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 ==
"V_MPEGH" && part2 ==
"ISO" && part3 ==
"HEVC") {
105 }
else if(part1 ==
"A_PCM") {
110 }
else if(part3 ==
"LIT") {
113 }
else if (part2 ==
"FLOAT" && part3 ==
"IEEE") {
116 }
else if(part1 ==
"A_MPC") {
118 }
else if(part1 ==
"A_AC3") {
120 }
else if(part1 ==
"A_ALAC") {
122 }
else if(part1 ==
"A_DTS") {
124 if(part2 ==
"EXPRESS") {
126 }
else if(part2 ==
"LOSSLESS") {
129 }
else if(part1 ==
"A_VORBIS") {
131 }
else if(part1 ==
"A_FLAC") {
133 }
else if(part1 ==
"A_OPUS") {
135 }
else if(part1 ==
"A_REAL") {
137 }
else if(part1 ==
"A_MS" && part2 ==
"ACM") {
139 }
else if(part1 ==
"A_AAC") {
141 if(part2 ==
"MPEG2") {
142 if(part3 ==
"MAIN") {
144 }
else if(part3 ==
"LC") {
146 }
else if(part3 ==
"SBR") {
149 }
else if(part3 ==
"SSR") {
152 }
else if(part2 ==
"MPEG4") {
153 if(part3 ==
"MAIN") {
155 }
else if(part3 ==
"LC") {
157 }
else if(part3 ==
"SBR") {
160 }
else if(part3 ==
"SSR") {
162 }
else if(part3 ==
"LTP") {
166 }
else if(part1 ==
"A_QUICKTIME") {
168 }
else if(part1 ==
"A_TTA1") {
170 }
else if(part1 ==
"A_WAVPACK4") {
172 }
else if(part1 ==
"S_TEXT") {
174 if(part2 ==
"UTF8") {
176 }
else if(part2 ==
"SSA") {
178 }
else if(part2 ==
"ASS") {
180 }
else if(part2 ==
"USF") {
182 }
else if(part2 ==
"WEBVTT") {
185 }
else if(part1 ==
"S_IMAGE") {
190 }
else if(part1 ==
"S_VOBSUB") {
192 }
else if(part1 ==
"S_KATE") {
194 }
else if(part1 ==
"B_VOBBTN") {
196 }
else if(part1 ==
"S_DVBSUB") {
198 }
else if(part1 ==
"V_MSWMV") {
206 static const string context(
"parsing header of Matroska track");
208 m_trackElement->
parse();
214 for(
EbmlElement *trackInfoElement = m_trackElement->
firstChild(), *subElement =
nullptr; trackInfoElement; trackInfoElement = trackInfoElement->nextSibling()) {
216 trackInfoElement->parse();
221 uint32 defaultDuration = 0;
222 switch(trackInfoElement->id()) {
224 switch(trackInfoElement->readUInteger()) {
245 for(subElement = trackInfoElement->firstChild(); subElement; subElement = subElement->nextSibling()) {
252 switch(subElement->id()) {
278 m_fps = subElement->readFloat();
292 for(subElement = trackInfoElement->firstChild(); subElement; subElement = subElement->nextSibling()) {
299 switch(subElement->id()) {
325 m_id = trackInfoElement->readUInteger();
328 m_name = trackInfoElement->readString();
342 m_enabled = trackInfoElement->readUInteger();
345 m_default = trackInfoElement->readUInteger();
348 m_forced = trackInfoElement->readUInteger();
351 m_lacing = trackInfoElement->readUInteger();
354 defaultDuration = trackInfoElement->readUInteger();
361 if(!
m_fps && defaultDuration) {
362 m_fps = 1000000000.0 /
static_cast<double>(defaultDuration);
376 if(codecPrivateElement->
dataSize() >= 0x28) {
393 if(codecPrivateElement->
dataSize() >= 16) {
407 if(audioSpecificConfig->sampleFrequencyIndex == 0xF) {
414 if(audioSpecificConfig->extensionSampleFrequencyIndex == 0xF) {
427 auto avcConfig = make_unique<Media::AvcConfiguration>();
444 if(startsWith<string>(
m_formatId,
"V_") || startsWith<string>(
m_formatId,
"A_") || startsWith<string>(m_formatId,
"S_")) {