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 // Pre-compilation
9 #include "MediaInfo/PreComp.h"
10 #ifdef __BORLANDC__
11 #pragma hdrstop
12 #endif
13 //---------------------------------------------------------------------------
14
15 //---------------------------------------------------------------------------
16 #include "MediaInfo/Setup.h"
17 //---------------------------------------------------------------------------
18
19 //---------------------------------------------------------------------------
20 #if defined(MEDIAINFO_GXF_YES)
21 //---------------------------------------------------------------------------
22
23 //---------------------------------------------------------------------------
24 #include "MediaInfo/Multiple/File_Umf.h"
25 //---------------------------------------------------------------------------
26
27 namespace MediaInfoLib
28 {
29
30 //***************************************************************************
31 // Constructor/Destructor
32 //***************************************************************************
33
34 //---------------------------------------------------------------------------
File_Umf()35 File_Umf::File_Umf()
36 :File__Analyze()
37 {
38 //In
39 #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX
40 GopSize=(int64u)-1;
41 #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX
42 }
43
44 //***************************************************************************
45 // Buffer - File header
46 //***************************************************************************
47
48 //---------------------------------------------------------------------------
FileHeader_Begin()49 bool File_Umf::FileHeader_Begin()
50 {
51 //Element_Size
52 if (Buffer_Size<2)
53 return false; //Must wait for more data
54
55 int16u Length=LittleEndian2int16u(Buffer);
56 if (Buffer_Size<Length)
57 return false; //Must wait for more data
58
59 //All should be OK...
60 Accept("UMF");
61 return true;
62 }
63
64 //***************************************************************************
65 // Buffer - Global
66 //***************************************************************************
67
68 //---------------------------------------------------------------------------
Read_Buffer_Continue()69 void File_Umf::Read_Buffer_Continue()
70 {
71 //Parsing
72 int32u Tracks, Segments;
73 Element_Begin1("Payload description");
74 Skip_L4( "Total length of the UMF data");
75 Skip_L4( "Version of this file");
76 Get_L4 (Tracks, "Number of tracks in the material");
77 Skip_L4( "Offset to track description section");
78 Skip_L4( "Size of the track description section");
79 Get_L4 (Segments, "Number of segments");
80 Skip_L4( "Offset to media description section");
81 Skip_L4( "Size of the media description section");
82 Skip_L4( "Offset to the user data section");
83 Skip_L4( "Size of the user data section");
84 Skip_L4( "Reserved");
85 Skip_L4( "Reserved");
86 Element_End0();
87
88 Element_Begin1("Material description");
89 Skip_L4( "Attributes");
90 Skip_L4( "Maximum length of the material in fields");
91 Skip_L4( "Minimum length of the material in fields");
92 Skip_L4( "Material mark in value in fields");
93 Skip_L4( "Material mark out value in fields");
94 Skip_L4( "Time code at mark in value");
95 Skip_L4( "Time code at mark out value");
96 Skip_L4( "last modified time (Most)");
97 Skip_L4( "last modified time (Least)");
98 Skip_L4( "creation time (Most)");
99 Skip_L4( "creation time (Least)");
100 Skip_L2( "Reserved");
101 Skip_L2( "Reserved");
102 Skip_L2( "Number of audio tracks");
103 Skip_L2( "Number of time code tracks");
104 Skip_L2( "Reserved");
105 Skip_L2( "Number of MPEG-1, MPEG-2, and MPEG-2 HD video tracks");
106 Element_End0();
107
108 for (int32u Pos=0; Pos<Tracks; Pos++)
109 {
110 Element_Begin1("Track description");
111 Skip_C1( "Track information - Track type");
112 Skip_C1( "Track information - Track logical number");
113 Skip_L2( "Number of segments on this track");
114 Element_End0();
115
116 if (Element_Offset>=Element_Size)
117 break;
118 }
119
120 for (int32u Pos=0; Pos<Segments; Pos++)
121 {
122 Element_Begin1("Media description");
123 int32u Type;
124 int16u Length;
125 Get_L2 (Length, "Length of this media description");
126 int64u End=Element_Offset+Length-2;
127 Skip_C1( "Track information - Track type");
128 Skip_C1( "Track information - Track logical number");
129 Skip_L2( "Media Sequence number");
130 Skip_L2( "Reserved");
131 Skip_L4( "Number of fields in segment");
132 Skip_L4( "Reserved");
133 Skip_L4( "Mark in value for the media file in fields");
134 Skip_L4( "Mark out value for the media file in fields");
135 Skip_Local(88, "Source device media file name");
136 Get_L4 (Type, "Type of media track");
137 Skip_L4( "Sampling rates for this track");
138 Skip_L4( "Size of sample for audio and time codes");
139 Skip_L4( "Reserved");
140 switch (Type)
141 {
142 case 0x00000004 :
143 case 0x00000007 :
144 case 0x00000009 : //MPEG-Video
145 {
146 #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX
147 int32u P, B;
148 #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX
149 Skip_L4( "Color difference format");
150 Skip_L4( "GoP structure");
151 Skip_L4( "Frame/field structure");
152 Skip_L4( "Target I-pictures per GoP");
153 #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX
154 Get_L4 (P, "Target P-pictures per I-picture");
155 Get_L4 (B, "Target B-pictures per P-picture or I-picture");
156 #else //MEDIAINFO_SEEK || MEDIAINFO_DEMUX
157 Skip_L4( "Target P-pictures per I-picture");
158 Skip_L4( "Target B-pictures per P-picture or I-picture");
159 #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX
160 Skip_L4( "MPEG video attributes");
161 Skip_L4( "Reserved");
162 #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX
163 GopSize=(1+P)*(1+B);
164 #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX
165 }
166 break;
167 case 0x00000003 : //TimeCode
168 Skip_L4( "Time code attributes");
169 Skip_L4( "Reserved");
170 Skip_L4( "Reserved");
171 Skip_L4( "Reserved");
172 Skip_L4( "Reserved");
173 Skip_L4( "Reserved");
174 Skip_L4( "Reserved");
175 Skip_L4( "Reserved");
176 break;
177 case 0x00000002 : //Audio
178 //Skip_LF8( "Level at which to play this segment");
179 //Skip_LF8( "Level at which to terminate this segment");
180 Skip_L8( "Level at which to play this segment");
181 Skip_L8( "Level at which to terminate this segment");
182 Skip_L4( "Number of fields over which to ramp up");
183 Skip_L4( "Number of fields over which to ramp down");
184 Skip_L4( "Reserved");
185 Skip_L4( "Reserved");
186 break;
187 case 0x00000005 : //DV25
188 case 0x00000006 : //DV50
189 Skip_L4( "Attributes"); //With Aspect ratio
190 Skip_L4( "Reserved");
191 Skip_L4( "Reserved");
192 Skip_L4( "Reserved");
193 Skip_L4( "Reserved");
194 Skip_L4( "Reserved");
195 Skip_L4( "Reserved");
196 Skip_L4( "Reserved");
197 #if MEDIAINFO_SEEK || MEDIAINFO_DEMUX
198 GopSize=1;
199 #endif //MEDIAINFO_SEEK || MEDIAINFO_DEMUX
200 break;
201 default :
202 Skip_L4( "Reserved");
203 Skip_L4( "Reserved");
204 Skip_L4( "Reserved");
205 Skip_L4( "Reserved");
206 Skip_L4( "Reserved");
207 Skip_L4( "Reserved");
208 Skip_L4( "Reserved");
209 Skip_L4( "Reserved");
210 }
211 if (Element_Offset<End)
212 Skip_XX(End-Element_Offset, "Unknown");
213 Element_End0();
214
215 if (Element_Offset>=Element_Size)
216 break;
217 }
218
219 while (Element_Offset<Element_Size)
220 {
221 Element_Begin1("User data");
222 int32u Length;
223 Get_L4 (Length, "The length of this user data record");
224 Skip_L4( "Position on the material time line");
225 Skip_L2( "Track associated with the user data record");
226 Skip_L2( "Media Sequence Numbe");
227 Skip_L4( "User-defined key");
228 if (Length>18)
229 Skip_XX(Length-18, "User data");
230 else
231 Skip_XX(Element_Size-Element_Offset-2, "User data");
232 Skip_L1( "NULL byte");
233 Skip_L1( "Reserved byte");
234 Element_End0();
235 }
236 }
237
238 } //NameSpace
239
240 #endif //MEDIAINFO_UMF_YES
241