1 /* Copyright (c) MediaArea.net SARL. All Rights Reserved. 2 * 3 * Use of this source code is governed by a BSD-style license that can 4 * be found in the License.html file in the root of the source tree. 5 */ 6 7 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 // 9 // Information about GXF files 10 // SMPTE 360M - General Exchange Format 11 // SMPTE RDD 14-2007 - General Exchange Format-2 12 // 13 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 14 15 //--------------------------------------------------------------------------- 16 #ifndef MediaInfo_File_GxfH 17 #define MediaInfo_File_GxfH 18 //--------------------------------------------------------------------------- 19 20 //--------------------------------------------------------------------------- 21 #include "MediaInfo/File__Analyze.h" 22 #if defined(MEDIAINFO_ANCILLARY_YES) 23 #include <MediaInfo/Multiple/File_Ancillary.h> 24 #endif //defined(MEDIAINFO_ANCILLARY_YES) 25 //--------------------------------------------------------------------------- 26 27 namespace MediaInfoLib 28 { 29 30 //*************************************************************************** 31 // Class File_Gxf 32 //*************************************************************************** 33 34 class File_Gxf : public File__Analyze 35 { 36 public : 37 //Constructor/Destructor 38 File_Gxf(); 39 ~File_Gxf(); 40 41 private : 42 //Streams management 43 void Streams_Finish(); 44 45 //Buffer - Synchro 46 bool Synchronize(); 47 bool Synched_Test(); 48 49 //Buffer - Global 50 void Read_Buffer_Unsynched(); 51 #if MEDIAINFO_SEEK 52 size_t Read_Buffer_Seek (size_t Method, int64u Value, int64u ID); 53 #endif //MEDIAINFO_SEEK 54 void Read_Buffer_AfterParsing(); 55 56 //Buffer - Per element 57 bool Header_Begin(); 58 void Header_Parse(); 59 void Data_Parse(); 60 61 //Packets 62 void map(); 63 void media(); 64 void end_of_stream(); 65 void field_locator_table(); 66 void UMF_file(); 67 68 //Temp - Global 69 #if defined(MEDIAINFO_ANCILLARY_YES) 70 File_Ancillary* Ancillary; 71 #endif //defined(MEDIAINFO_ANCILLARY_YES) 72 int32u Material_Fields_First; 73 int32u Material_Fields_Last; 74 int32u Material_File_Size; 75 int32u Material_Fields_FieldsPerFrame; 76 int8u Parsers_Count; 77 int8u AncillaryData_StreamID; 78 struct tc 79 { 80 int64u Milliseconds; 81 string String; 82 tctc83 tc() 84 { 85 Milliseconds=(int64u)-1; 86 } 87 }; 88 std::map<int8u, tc> TimeCodes; //Key is StreamID 89 bool Material_Fields_First_IsValid; 90 bool Material_Fields_Last_IsValid; 91 bool Material_File_Size_IsValid; 92 93 //Temp - Stream 94 struct stream : public stream_time 95 { 96 std::vector<File__Analyze*> Parsers; 97 int64u FirstFrameDuration; //In case of audio, indicates the duration of the first frame 98 stream_t StreamKind; 99 size_t StreamPos; 100 int32u TimeStamp_Start; 101 int32u TimeStamp_End; 102 int32u FrameRate_Code; 103 int32u LinesPerFrame_Code; 104 int32u FieldsPerFrame_Code; 105 int8u MediaType; 106 int8u TrackID; 107 bool IsChannelGrouping; 108 bool DisplayInfo; //In case of channel grouping, info is about the complete (2*half) stream, so second stream info must not be used 109 Ztring MediaName; 110 std::map<std::string, Ztring> Infos; 111 #if MEDIAINFO_DEMUX 112 bool Demux_EventWasSent; 113 #endif //MEDIAINFO_DEMUX 114 streamstream115 stream() 116 { 117 FirstFrameDuration=0; 118 StreamKind=Stream_Max; 119 StreamPos=(size_t)-1; 120 TimeStamp_Start = (int32u)-1; 121 TimeStamp_End = (int32u)-1; 122 Init_Stream(false); 123 FrameRate_Code=(int32u)-1; 124 LinesPerFrame_Code=(int32u)-1; 125 FieldsPerFrame_Code=(int32u)-1; 126 MediaType=(int8u)-1; 127 TrackID=(int8u)-1; 128 IsChannelGrouping=false; 129 DisplayInfo=true; 130 #if MEDIAINFO_DEMUX 131 Demux_EventWasSent=false; 132 #endif //MEDIAINFO_DEMUX 133 } ~streamstream134 ~stream() 135 { 136 for (size_t Pos=0; Pos<Parsers.size(); Pos++) 137 delete Parsers[Pos]; 138 } 139 }; 140 std::vector<stream> Streams; 141 File__Analyze* UMF_File; 142 int64u SizeToAnalyze; //Total size of a chunk to analyse, it may be changed by the parser 143 int64u IsParsingMiddle_MaxOffset; 144 int8u Audio_Count; 145 int8u TrackNumber; 146 147 //File__Analyze helpers 148 void Streams_Finish_PerStream(size_t StreamID, stream &Temp); 149 void Detect_EOF(); 150 File__Analyze* ChooseParser_ChannelGrouping(int8u TrackID); 151 void TryToFinish(); 152 153 #if MEDIAINFO_DEMUX 154 bool Demux_HeaderParsed; 155 #endif //MEDIAINFO_DEMUX 156 157 #if MEDIAINFO_SEEK 158 int32u Flt_FieldPerEntry; 159 std::vector<int32u> Flt_Offsets; //In 1024-byte 160 struct seek 161 { 162 int64u FrameNumber; 163 int32u StreamOffset; //In 1024-byte 164 }; 165 std::vector<seek> Seeks; 166 bool IFrame_IsParsed; 167 #endif //MEDIAINFO_SEEK 168 }; 169 170 } //NameSpace 171 172 #endif 173