/* ***** BEGIN LICENSE BLOCK ***** * * $Id: parseparams_byteio.cpp,v 1.2 2006/04/20 15:39:30 asuraparaju Exp $ $Name: Dirac_0_7_0 $ * * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License. * * The Original Code is BBC Research and Development code. * * The Initial Developer of the Original Code is the British Broadcasting * Corporation. * Portions created by the Initial Developer are Copyright (C) 2004. * All Rights Reserved. * * Contributor(s): Andrew Kennedy (Original Author) * Anuradha Suraparaju * * Alternatively, the contents of this file may be used under the terms of * the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser * Public License Version 2.1 (the "LGPL"), in which case the provisions of * the GPL or the LGPL are applicable instead of those above. If you wish to * allow use of your version of this file only under the terms of the either * the GPL or LGPL and not to allow others to use your version of this file * under the MPL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by the GPL * or LGPL. If you do not delete the provisions above, a recipient may use * your version of this file under the terms of any one of the MPL, the GPL * or the LGPL. * ***** END LICENSE BLOCK ***** */ #include //For std::ostringstream #include #include const unsigned int PP_AU_FRAME_NUM_SIZE = 4; using namespace dirac; ParseParamsByteIO::ParseParamsByteIO(const int& accessunit_fnum, const ByteIO& stream_data): ByteIO(stream_data), m_accessunit_fnum(accessunit_fnum) { } ParseParamsByteIO::ParseParamsByteIO(const int& accessunit_fnum, const ByteIO& stream_data, ParseParams &parse_params): ByteIO(stream_data), m_accessunit_fnum(accessunit_fnum), m_parse_params(parse_params) { } ParseParamsByteIO::~ParseParamsByteIO() { } //-------------public--------------------------------------------------------------- void ParseParamsByteIO::Input() { // input AU Frame number m_accessunit_fnum = InputFixedLengthUint(PP_AU_FRAME_NUM_SIZE); ParseParams def_parse_params(m_accessunit_fnum); //input version m_parse_params.SetMajorVersion(InputVarLengthUint()); m_parse_params.SetMinorVersion(InputVarLengthUint()); // input profile m_parse_params.SetProfile(InputVarLengthUint()); // input level m_parse_params.SetLevel(InputVarLengthUint()); std::ostringstream errstr; // FIXME: for the time being all should be a perfect match until // we add support for previous versions if (m_parse_params.MajorVersion() != def_parse_params.MajorVersion() || m_parse_params.MinorVersion() != def_parse_params.MinorVersion()) { errstr << "Cannot handle version "; errstr << m_parse_params.MajorVersion() << "."; errstr << m_parse_params.MinorVersion() << "."; errstr << " Supported version is "; errstr << def_parse_params.MajorVersion() << "."; errstr << def_parse_params.MinorVersion() << std::endl; } if (m_parse_params.Profile() > def_parse_params.Profile()) { errstr << "Cannot handle profile " << m_parse_params.Profile(); errstr << ". Supported profile is " << def_parse_params.Profile(); } if (m_parse_params.Level() > def_parse_params.Level()) { errstr << "Cannot handle level " << m_parse_params.Level(); errstr << ". Supported level is " << def_parse_params.Level(); } if (errstr.str().size()) { DIRAC_THROW_EXCEPTION( ERR_UNSUPPORTED_STREAM_DATA, errstr.str(), SEVERITY_FRAME_ERROR); } } void ParseParamsByteIO::Output() { // output AU Frame number OutputFixedLengthUint(m_accessunit_fnum, PP_AU_FRAME_NUM_SIZE); //:TODO implement // output version OutputVarLengthUint(0); OutputVarLengthUint(1); // output profile OutputVarLengthUint(0); // output level OutputVarLengthUint(0); } int ParseParamsByteIO::GetIdNumber() const { return m_accessunit_fnum; }