00001 /***************************************************************** 00002 | 00003 | AP4 - ES Descriptor 00004 | 00005 | Copyright 2002-2006 Gilles Boccon-Gibod & Julien Boeuf 00006 | 00007 | 00008 | This file is part of Bento4/AP4 (MP4 Atom Processing Library). 00009 | 00010 | Unless you have obtained Bento4 under a difference license, 00011 | this version of Bento4 is Bento4|GPL. 00012 | Bento4|GPL is free software; you can redistribute it and/or modify 00013 | it under the terms of the GNU General Public License as published by 00014 | the Free Software Foundation; either version 2, or (at your option) 00015 | any later version. 00016 | 00017 | Bento4|GPL is distributed in the hope that it will be useful, 00018 | but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 | GNU General Public License for more details. 00021 | 00022 | You should have received a copy of the GNU General Public License 00023 | along with Bento4|GPL; see the file COPYING. If not, write to the 00024 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 00025 | 02111-1307, USA. 00026 | 00027 ****************************************************************/ 00028 00029 #ifndef _AP4_ES_DESCRIPTOR_H_ 00030 #define _AP4_ES_DESCRIPTOR_H_ 00031 00032 /*---------------------------------------------------------------------- 00033 | includes 00034 +---------------------------------------------------------------------*/ 00035 #include "Ap4List.h" 00036 #include "Ap4String.h" 00037 #include "Ap4Descriptor.h" 00038 #include "Ap4DecoderConfigDescriptor.h" 00039 00040 /*---------------------------------------------------------------------- 00041 | class references 00042 +---------------------------------------------------------------------*/ 00043 class AP4_ByteStream; 00044 00045 /*---------------------------------------------------------------------- 00046 | constants 00047 +---------------------------------------------------------------------*/ 00048 const AP4_UI08 AP4_DESCRIPTOR_TAG_ES = 0x03; 00049 const AP4_UI08 AP4_DESCRIPTOR_TAG_ES_ID_INC = 0x0E; 00050 const AP4_UI08 AP4_DESCRIPTOR_TAG_ES_ID_REF = 0x0F; 00051 00052 const int AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY = 1; 00053 const int AP4_ES_DESCRIPTOR_FLAG_URL = 2; 00054 const int AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM = 4; 00055 00056 /*---------------------------------------------------------------------- 00057 | AP4_EsDescriptor 00058 +---------------------------------------------------------------------*/ 00059 class AP4_EsDescriptor : public AP4_Descriptor 00060 { 00061 public: 00062 // methods 00063 AP4_EsDescriptor(AP4_UI16 es_id); 00064 AP4_EsDescriptor(AP4_ByteStream& stream, 00065 AP4_Size header_size, 00066 AP4_Size payload_size); 00067 ~AP4_EsDescriptor(); 00068 virtual AP4_Result AddSubDescriptor(AP4_Descriptor* descriptor); 00069 virtual AP4_Result WriteFields(AP4_ByteStream& stream); 00070 virtual AP4_Result Inspect(AP4_AtomInspector& inspector); 00071 virtual const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor() const; 00072 00073 private: 00074 // members 00075 unsigned short m_EsId; 00076 unsigned short m_OcrEsId; 00077 AP4_Flags m_Flags; 00078 unsigned char m_StreamPriority; 00079 unsigned short m_DependsOn; 00080 AP4_String m_Url; 00081 mutable AP4_List<AP4_Descriptor> m_SubDescriptors; 00082 }; 00083 00084 /*---------------------------------------------------------------------- 00085 | AP4_EsIdIncDescriptor 00086 +---------------------------------------------------------------------*/ 00087 class AP4_EsIdIncDescriptor : public AP4_Descriptor 00088 { 00089 public: 00090 // methods 00091 AP4_EsIdIncDescriptor(AP4_UI32 track_id); 00092 AP4_EsIdIncDescriptor(AP4_ByteStream& stream, 00093 AP4_Size header_size, 00094 AP4_Size payload_size); 00095 virtual AP4_Result WriteFields(AP4_ByteStream& stream); 00096 virtual AP4_Result Inspect(AP4_AtomInspector& inspector); 00097 00098 // accessors 00099 AP4_UI32 GetTrackId() const { return m_TrackId; } 00100 00101 private: 00102 // members 00103 AP4_UI32 m_TrackId; 00104 }; 00105 00106 /*---------------------------------------------------------------------- 00107 | AP4_EsIdRefDescriptor 00108 +---------------------------------------------------------------------*/ 00109 class AP4_EsIdRefDescriptor : public AP4_Descriptor 00110 { 00111 public: 00112 // methods 00113 AP4_EsIdRefDescriptor(AP4_UI16 ref_index); 00114 AP4_EsIdRefDescriptor(AP4_ByteStream& stream, 00115 AP4_Size header_size, 00116 AP4_Size payload_size); 00117 virtual AP4_Result WriteFields(AP4_ByteStream& stream); 00118 virtual AP4_Result Inspect(AP4_AtomInspector& inspector); 00119 00120 // accessors 00121 AP4_UI16 GetRefIndex() const { return m_RefIndex; } 00122 00123 private: 00124 // members 00125 AP4_UI16 m_RefIndex; 00126 }; 00127 00128 #endif // _AP4_ES_DESCRIPTOR_H_