6 #include "../avi/bitmapinfoheader.h" 8 #include "../wav/waveaudiostream.h" 10 #include "../avc/avcconfiguration.h" 12 #include "../mp4/mp4ids.h" 13 #include "../mp4/mp4track.h" 15 #include "../mediaformat.h" 16 #include "../exceptions.h" 18 #include <c++utilities/conversion/stringconversion.h> 37 AbstractTrack(trackElement.stream(), trackElement.startOffset()),
38 m_trackElement(&trackElement)
59 const auto &part1 = parts[0], &part2 = parts[1], &part3 = parts[2];
61 if(part1 ==
"V_MS" && part2 ==
"VFW" && part3 ==
"FOURCC") {
63 }
else if(part1 ==
"V_UNCOMPRESSED") {
65 }
else if(part1 ==
"V_MPEG4") {
70 }
else if(part3 ==
"ASP") {
72 }
else if(part3 ==
"AVC") {
75 }
else if(part2 ==
"MS" && part3 ==
"V3") {
78 }
else if(part1 ==
"V_MPEG1") {
80 }
else if(part1 ==
"V_MPEG2") {
82 }
else if(part1 ==
"V_REAL") {
84 }
else if(part1 ==
"V_QUICKTIME") {
86 }
else if(part1 ==
"V_THEORA") {
88 }
else if(part1 ==
"V_PRORES") {
90 }
else if(part1 ==
"V_VP8") {
92 }
else if(part1 ==
"V_VP9") {
94 }
else if(part1 ==
"A_MPEG") {
98 }
else if(part2 ==
"L2") {
100 }
else if(part2 ==
"L3") {
103 }
else if(part1 ==
"A_PCM") {
108 }
else if(part3 ==
"LIT") {
111 }
else if (part2 ==
"FLOAT" && part3 ==
"IEEE") {
114 }
else if(part1 ==
"A_MPC") {
116 }
else if(part1 ==
"A_AC3") {
118 }
else if(part1 ==
"A_ALAC") {
120 }
else if(part1 ==
"A_DTS") {
122 if(part2 ==
"EXPRESS") {
124 }
else if(part2 ==
"LOSSLESS") {
127 }
else if(part1 ==
"A_VORBIS") {
129 }
else if(part1 ==
"A_FLAC") {
131 }
else if(part1 ==
"A_OPUS") {
133 }
else if(part1 ==
"A_REAL") {
135 }
else if(part1 ==
"A_MS" && part2 ==
"ACM") {
137 }
else if(part1 ==
"A_AAC") {
139 if(part2 ==
"MPEG2") {
140 if(part3 ==
"MAIN") {
142 }
else if(part3 ==
"LC") {
144 }
else if(part3 ==
"SBR") {
147 }
else if(part3 ==
"SSR") {
150 }
else if(part2 ==
"MPEG4") {
151 if(part3 ==
"MAIN") {
153 }
else if(part3 ==
"LC") {
155 }
else if(part3 ==
"SBR") {
158 }
else if(part3 ==
"SSR") {
160 }
else if(part3 ==
"LTP") {
164 }
else if(part1 ==
"A_QUICKTIME") {
166 }
else if(part1 ==
"A_TTA1") {
168 }
else if(part1 ==
"A_WAVPACK4") {
170 }
else if(part1 ==
"S_TEXT") {
172 if(part2 ==
"UTF8") {
174 }
else if(part2 ==
"SSA") {
176 }
else if(part2 ==
"ASS") {
178 }
else if(part2 ==
"USF") {
180 }
else if(part2 ==
"WEBVTT") {
183 }
else if(part1 ==
"S_IMAGE") {
188 }
else if(part1 ==
"S_VOBSUB") {
190 }
else if(part1 ==
"S_KATE") {
192 }
else if(part1 ==
"B_VOBBTN") {
194 }
else if(part1 ==
"V_MSWMV") {
202 static const string context(
"parsing header of Matroska track");
204 m_trackElement->
parse();
210 for(
EbmlElement *trackInfoElement = m_trackElement->
firstChild(), *subElement =
nullptr; trackInfoElement; trackInfoElement = trackInfoElement->nextSibling()) {
212 trackInfoElement->parse();
217 uint32 defaultDuration = 0;
218 switch(trackInfoElement->id()) {
220 switch(trackInfoElement->readUInteger()) {
241 for(subElement = trackInfoElement->firstChild(); subElement; subElement = subElement->nextSibling()) {
248 switch(subElement->id()) {
274 m_fps = subElement->readFloat();
288 for(subElement = trackInfoElement->firstChild(); subElement; subElement = subElement->nextSibling()) {
295 switch(subElement->id()) {
321 m_id = trackInfoElement->readUInteger();
324 m_name = trackInfoElement->readString();
338 m_enabled = trackInfoElement->readUInteger();
341 m_default = trackInfoElement->readUInteger();
344 m_forced = trackInfoElement->readUInteger();
347 m_lacing = trackInfoElement->readUInteger();
350 defaultDuration = trackInfoElement->readUInteger();
357 if(!
m_fps && defaultDuration) {
358 m_fps = 1000000000.0 /
static_cast<double>(defaultDuration);
372 if(codecPrivateElement->
dataSize() >= 0x28) {
389 if(codecPrivateElement->
dataSize() >= 16) {
403 if(audioSpecificConfig->sampleFrequencyIndex == 0xF) {
410 if(audioSpecificConfig->extensionSampleFrequencyIndex == 0xF) {
423 auto avcConfig = make_unique<Media::AvcConfiguration>();
440 if(startsWith<string>(
m_formatId,
"V_") || startsWith<string>(
m_formatId,
"A_") || startsWith<string>(m_formatId,
"S_")) {