SyncLayer.cpp

00001 /*********************************************************************** 00002 * * 00003 * ViTooKi * 00004 * * 00005 * title: SyncLayer.cpp * 00006 * * 00007 * * 00008 * * 00009 * ITEC institute of the University of Klagenfurt (Austria) * 00010 * http://www.itec.uni-klu.ac.at * 00011 * * 00012 * * 00013 * For more information visit the ViTooKi homepage: * 00014 * http://ViTooKi.sourceforge.net * 00015 * vitooki-user@lists.sourceforge.net * 00016 * vitooki-devel@lists.sourceforge.net * 00017 * * 00018 * This file is part of ViTooKi, a free video toolkit. * 00019 * ViTooKi is free software; you can redistribute it and/or * 00020 * modify it under the terms of the GNU General Public License * 00021 * as published by the Free Software Foundation; either version 2 * 00022 * of the License, or (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the Free Software * 00031 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 00032 * MA 02111-1307, USA. * 00033 * * 00034 ***********************************************************************/ 00035 00036 /*********************************************************************** 00037 * * 00038 * REVISION HISTORY: * 00039 * * 00040 * * 00041 * * 00042 ***********************************************************************/ 00043 00044 /**************************************************************** 00045 Project: MPEG-4 Environment 00046 Purpose: Define SL Stream interface to higher layers 00047 Author: M. Ohlenroth 00048 Date: $Id: SyncLayer.cpp,v 1.5 2006/01/20 15:37:54 mkropfbe Exp $ 00049 ****************************************************************/ 00050 00051 00052 //#include <stdint.h> 00053 #ifndef WINCE 00054 #include <sys/types.h> 00055 #endif 00056 #include "SyncLayer.hpp" 00057 00058 // predefined SLConfigDescriptor for RFC 3016 mode: 00059 const SLConfigDescriptor slcd_rfc_3016 = { 00060 0, false, true, false, false, 00061 false, false, false, false, 00062 0, 0, 0, 0, 0, 00063 0, 0, 0, 0, 0x3, 00064 0, 0, 0, // three unused values 00065 0, 0 00066 }; 00067 00068 00069 bool operator == (SLPacketHeader const &first, 00070 SLPacketHeader const &second) { 00071 return first.accessUnitStartFlag == second.accessUnitStartFlag 00072 && first.accessUnitEndFlag == second.accessUnitEndFlag 00073 && first.OCRFlag == second.OCRFlag 00074 && first.idleFlag == second.idleFlag 00075 && first.paddingFlag == second.paddingFlag 00076 && first.packetSequenceNumber == second.packetSequenceNumber 00077 && first.DegPrioFlag == second.DegPrioFlag 00078 && first.degradationPriority == second.degradationPriority 00079 && first.objectClockReference == second.objectClockReference 00080 && first.randomAccessPointFlag == second.randomAccessPointFlag 00081 && first.AU_sequenceNumber == second.AU_sequenceNumber 00082 && first.decodingTimeStampFlag == second.decodingTimeStampFlag 00083 && first.compositionTimeStampFlag == second.compositionTimeStampFlag 00084 && first.instantBitrateFlag == second.instantBitrateFlag 00085 && first.decodingTimeStamp == second.decodingTimeStamp 00086 && first.compositionTimeStamp == second.compositionTimeStamp 00087 && first.accessUnitLength == second.accessUnitLength 00088 && first.instantBitrate == second.instantBitrate; 00089 }; 00090 00091 00092 SLPacket::SLPacket(SLPacketHeader Aslph, u8 * Apayload, size_t Apl_size, 00093 void * extra_data, u32 extra_data_size) { 00094 00095 // dprintf_full("SLPacket construct size %i extra_data_size %i\n",Apl_size, extra_data_size); 00096 slph=Aslph; 00097 payload=Apayload; 00098 pl_size=Apl_size; 00099 payload = new u8[pl_size + extra_data_size]; 00100 if(extra_data) 00101 memcpy(payload, extra_data, extra_data_size); 00102 if (payload) 00103 memcpy(payload + extra_data_size, Apayload, pl_size); 00104 pl_size += extra_data_size; 00105 }