Tag Parser 10.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
mp4ids.cpp
Go to the documentation of this file.
1#include "./mp4ids.h"
2
3#include "../mediaformat.h"
4
5namespace TagParser {
6
10namespace Mp4AtomIds {
11}
12
17namespace Mp4TagAtomIds {
18}
19
23namespace Mp4TagExtendedMeanIds {
24std::string_view iTunes = "com.apple.iTunes";
25}
26
30namespace Mp4TagExtendedNameIds {
31std::string_view cdec = "cdec";
32std::string_view label = "LABEL";
33} // namespace Mp4TagExtendedNameIds
34
38namespace Mp4MediaTypeIds {
39}
40
45namespace FourccIds {
46
47MediaFormat fourccToMediaFormat(std::uint32_t fourccId)
48{
49 switch (fourccId) {
50 case Mpeg:
52 case Mpeg2Imx30:
53 case Mpeg2Imx50:
55 case Mpeg4Video:
57 case Mpeg4TimedText:
59 case Hevc1:
60 case Hevc2:
62 case Avc1:
63 case Avc2:
64 case Avc3:
65 case Avc4:
66 case H264Decoder1:
67 case H264Decoder2:
68 case H264Decoder3:
69 case H264Decoder4:
70 case H264Decoder5:
71 case H264Decoder6:
73 case Av1_IVF:
74 case Av1_ISOBMFF:
76 case Divx4Decoder1:
77 case Divx4Decoder2:
78 case H263Quicktime:
79 case H2633GPP:
80 case XvidDecoder1:
81 case XvidDecoder2:
82 case XvidDecoder3:
83 case XvidDecoder4:
84 case XvidDecoder5:
85 case Divx5Decoder:
87 case Divx3Decoder1:
88 case Divx3Decoder2:
89 case Divx3Decoder3:
90 case Divx3Decoder4:
91 case Divx3Decoder5:
92 case Divx3Decoder6:
93 case Divx3Decoder7:
94 case Divx3Decoder8:
95 case Divx3Decoder9:
96 case Divx3Decoder10:
97 case Divx3Decoder11:
98 case Divx3Decoder12:
99 case Divx3Decoder13:
100 case Divx3Decoder14:
101 case Divx3Decoder15:
103 case Tiff:
107 case Raw:
109 case Jpeg:
111 case Gif:
113 case Png:
115 case AdpcmAcm:
117 case ImaadpcmAcm:
119 case Mp3CbrOnly:
120 case Mp3:
122 case Mpeg4Audio:
124 case Alac:
126 case Ac3:
128 case EAc3:
130 case DolbyMpl:
132 case Ac4:
134 case Rv20:
135 case Rv30:
136 case Rv40:
138 case Int24:
139 case Int32:
141 case Int16Be:
143 case Int16Le:
148 case Amr:
149 case AmrNarrowband:
151 case Dts:
152 case DtsH:
154 case DtsE:
176 case Vp8:
178 case Vp9:
179 case Vp9_2:
181 case WavPack:
188 case Flac:
190 case Opus:
192 // TODO: map more FOURCCs
193 default:
195 }
196}
197
198} // namespace FourccIds
199
204namespace Mp4FormatExtensionIds {
205}
206
210namespace Mpeg4ElementaryStreamObjectIds {
211
215MediaFormat streamObjectTypeFormat(std::uint8_t streamObjectTypeId)
216{
217 switch (streamObjectTypeId) {
218 case SystemsIso144961:
224 case AfxStream:
226 case FontDataStream:
232 case Mpeg4Visual:
234 case Avc:
238 case Als:
240 case Sa0c:
242 case Aac:
262 case Mpeg2Audio:
264 case Mpeg1Video:
266 case Mpeg1Audio:
268 case Jpeg:
270 case Png:
272 case Evrc:
273 case PrivateEvrc:
275 case Smv:
277 case Gpp2Cmf:
279 case Vc1:
281 case Dirac:
283 case Ac3:
284 case PrivateAc3:
286 case EAc3:
288 case Dts:
289 case PrivateDts:
293 case DtsHdMasterAudio:
295 case DtsHdExpress:
297 case PrivateOgg:
298 case PrivateOgg2:
300 case PrivateVobSub:
302 case PrivateQcelp:
304 default:
305 return MediaFormat();
306 }
307}
308
309} // namespace Mpeg4ElementaryStreamObjectIds
310
314namespace Mpeg4DescriptorIds {
315}
316
320namespace Mpeg4ElementaryStreamTypeIds {
321
325std::string_view streamTypeName(std::uint8_t streamTypeId)
326{
327 switch (streamTypeId) {
328 case ObjectDescriptor:
329 return "object descriptor";
330 case ClockReference:
331 return "clock reference";
332 case SceneDescriptor:
333 return "scene descriptor";
334 case Visual:
335 return "visual";
336 case Audio:
337 return "audio";
338 case Mpeg7:
339 return "MPEG-7";
340 case Ipmps:
341 return "IMPS";
343 return "object content info";
344 case MpegJava:
345 return "MPEG Java";
346 case Interaction:
347 return "interaction";
348 case Ipmp:
349 return "IPMP";
350 case FontData:
351 return "font data";
352 case StreamingText:
353 return "streaming text";
354 default:
355 return "";
356 }
357}
358
359} // namespace Mpeg4ElementaryStreamTypeIds
360
365namespace Mpeg4AudioObjectIds {
366
367TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
368{
369 MediaFormat fmt;
370 switch (mpeg4AudioObjectId) {
371 case AacMain:
373 break;
374 case AacLc:
376 break;
377 case AacSsr:
379 break;
380 case AacLtp:
382 break;
383 case Sbr:
385 break;
386 case AacScalable:
388 break;
389 case ErAacLc:
391 break;
392 case ErAacLtp:
394 break;
395 case ErAacLd:
397 break;
398 case Ps:
400 break;
401 case Layer1:
403 break;
404 case Layer2:
406 break;
407 case Layer3:
409 break;
410 default:;
411 }
412 if (sbrPresent) {
414 }
415 if (psPresent) {
417 }
418 return fmt;
419}
420
421} // namespace Mpeg4AudioObjectIds
422
423std::uint32_t mpeg4SamplingFrequencyTable[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 };
424
428namespace Mpeg4ChannelConfigs {
429
433std::string_view channelConfigString(std::uint8_t config)
434{
435 switch (config) {
437 return "defined in AOT Specific Config";
438 case FrontCenter:
439 return "1 channel: front-center";
441 return "2 channels: front-left, front-right";
443 return "3 channels: front-center, front-left, front-right";
445 return "4 channels: front-center, front-left, front-right, back-center";
447 return "5 channels: front-center, front-left, front-right, back-left, back-right";
449 return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
451 return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
452 default:
453 return std::string_view();
454 }
455}
456
460std::uint8_t channelCount(std::uint8_t config)
461{
462 switch (config) {
463 case FrontCenter:
464 return 1;
466 return 2;
468 return 3;
470 return 4;
472 return 5;
474 return 6;
476 return 8;
477 default:
478 return 0;
479 }
480}
481
482} // namespace Mpeg4ChannelConfigs
483
487namespace Mpeg4VideoCodes {
488}
489
493namespace Mpeg2VideoCodes {
494}
495
496} // namespace TagParser
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:246
unsigned char extension
Definition: mediaformat.h:261
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
@ WindowsMediaAudio9Professional
Definition: mp4ids.h:393
@ WindowsMediaAudio9Standard
Definition: mp4ids.h:394
TAG_PARSER_EXPORT MediaFormat fourccToMediaFormat(std::uint32_t fourccId)
Definition: mp4ids.cpp:47
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition: mp4ids.cpp:367
TAG_PARSER_EXPORT std::string_view channelConfigString(std::uint8_t config)
Returns the string representation for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:433
@ FrontCenterFrontLeftFrontRightBackLeftBackRightLFEChannel
Definition: mp4ids.h:622
@ FrontCenterFrontLeftFrontRightSideLeftSideRightBackLeftBackRightLFEChannel
Definition: mp4ids.h:623
@ FrontCenterFrontLeftFrontRightBackLeftBackRight
Definition: mp4ids.h:621
TAG_PARSER_EXPORT std::uint8_t channelCount(std::uint8_t config)
Returns the channel count for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:460
TAG_PARSER_EXPORT MediaFormat streamObjectTypeFormat(std::uint8_t streamObjectTypeId)
Returns the TagParser::MediaFormat denoted by the specified MPEG-4 stream ID.
Definition: mp4ids.cpp:215
TAG_PARSER_EXPORT std::string_view streamTypeName(std::uint8_t streamTypeId)
Returns the name of the stream type denoted by the specified MPEG-4 stream type ID.
Definition: mp4ids.cpp:325
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
std::uint32_t mpeg4SamplingFrequencyTable[13]
Definition: mp4ids.cpp:423