Tag Parser  8.3.0
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 
5 namespace TagParser {
6 
10 namespace Mp4AtomIds {
11 }
12 
16 namespace Mp4TagAtomIds {
17 }
18 
22 namespace Mp4TagExtendedMeanIds {
23 const char *iTunes = "com.apple.iTunes";
24 }
25 
29 namespace Mp4TagExtendedNameIds {
30 const char *cdec = "cdec";
31 const char *label = "LABEL";
32 } // namespace Mp4TagExtendedNameIds
33 
37 namespace Mp4MediaTypeIds {
38 }
39 
44 namespace FourccIds {
45 
47 {
48  switch (fourccId) {
49  case Mpeg:
51  case Mpeg2Imx30:
52  case Mpeg2Imx50:
54  case Mpeg4Video:
56  case Mpeg4TimedText:
58  case Hevc1:
59  case Hevc2:
61  case Avc1:
62  case Avc2:
63  case Avc3:
64  case Avc4:
65  case H264Decoder1:
66  case H264Decoder2:
67  case H264Decoder3:
68  case H264Decoder4:
69  case H264Decoder5:
70  case H264Decoder6:
72  case Av1_IVF:
73  case Av1_ISOBMFF:
75  case Divx4Decoder1:
76  case Divx4Decoder2:
77  case H263Quicktime:
78  case H2633GPP:
79  case XvidDecoder1:
80  case XvidDecoder2:
81  case XvidDecoder3:
82  case XvidDecoder4:
83  case XvidDecoder5:
84  case Divx5Decoder:
86  case Divx3Decoder1:
87  case Divx3Decoder2:
88  case Divx3Decoder3:
89  case Divx3Decoder4:
90  case Divx3Decoder5:
91  case Divx3Decoder6:
92  case Divx3Decoder7:
93  case Divx3Decoder8:
94  case Divx3Decoder9:
95  case Divx3Decoder10:
96  case Divx3Decoder11:
97  case Divx3Decoder12:
98  case Divx3Decoder13:
99  case Divx3Decoder14:
100  case Divx3Decoder15:
102  case Tiff:
104  case AppleTextAtsuiCodec:
106  case Raw:
108  case Jpeg:
110  case Gif:
112  case Png:
114  case AdpcmAcm:
116  case ImaadpcmAcm:
118  case Mp3CbrOnly:
119  case Mp3:
121  case Mpeg4Audio:
123  case Alac:
125  case Ac3:
127  case EAc3:
129  case DolbyMpl:
131  case Ac4:
133  case Rv20:
134  case Rv30:
135  case Rv40:
137  case Int24:
138  case Int32:
140  case Int16Be:
142  case Int16Le:
144  case FloatingPoint32Bit:
145  case FloatingPoint64Bit:
147  case Amr:
148  case AmrNarrowband:
150  case Dts:
151  case DtsH:
153  case DtsE:
155  case WindowsMediaAudio:
156  case WindowsMediaAudio7:
160  case MsMpeg4V1Decoder1:
161  case MsMpeg4V1Decoder2:
162  case MsMpeg4V1Decoder3:
163  case MsMpeg4V1Decoder4:
164  case MsMpeg4V1Decoder5:
165  case MsMpeg4V1Decoder6:
167  case MsMpeg4V2Decoder1:
168  case MsMpeg4V2Decoder2:
169  case MsMpeg4V2Decoder3:
170  case MsMpeg4V2Decoder4:
172  case MsMpeg4V3Decoder1:
173  case MsMpeg4V3Decoder2:
175  case Vp8:
177  case Vp9:
179  case WavPack:
183  case WindowsMediaVideoV2:
184  case WindowsMediaVideoV8:
186  // TODO: map more FOURCCs
187  default:
189  }
190 }
191 
192 } // namespace FourccIds
193 
198 namespace Mp4FormatExtensionIds {
199 }
200 
204 namespace Mpeg4ElementaryStreamObjectIds {
205 
209 MediaFormat streamObjectTypeFormat(byte streamObjectTypeId)
210 {
211  switch (streamObjectTypeId) {
212  case SystemsIso144961:
214  case SystemsIso144961v2:
216  case InteractionStream:
218  case AfxStream:
220  case FontDataStream:
224  case StreamingTextStream:
226  case Mpeg4Visual:
228  case Avc:
230  case ParameterSetsForAvc:
232  case Als:
234  case Sa0c:
236  case Aac:
250  case Mpeg2AacMainProfile:
256  case Mpeg2Audio:
258  case Mpeg1Video:
260  case Mpeg1Audio:
262  case Jpeg:
264  case Png:
266  case Evrc:
267  case PrivateEvrc:
269  case Smv:
271  case Gpp2Cmf:
273  case Vc1:
275  case Dirac:
277  case Ac3:
278  case PrivateAc3:
280  case EAc3:
282  case Dts:
283  case PrivateDts:
285  case DtsHdHighResolution:
287  case DtsHdMasterAudio:
289  case DtsHdExpress:
291  case PrivateOgg:
292  case PrivateOgg2:
294  case PrivateVobSub:
296  case PrivateQcelp:
298  default:
299  return MediaFormat();
300  }
301 }
302 
303 } // namespace Mpeg4ElementaryStreamObjectIds
304 
308 namespace Mpeg4DescriptorIds {
309 }
310 
314 namespace Mpeg4ElementaryStreamTypeIds {
315 
319 const char *streamTypeName(byte streamTypeId)
320 {
321  switch (streamTypeId) {
322  case ObjectDescriptor:
323  return "object descriptor";
324  case ClockReference:
325  return "clock reference";
326  case SceneDescriptor:
327  return "scene descriptor";
328  case Visual:
329  return "visual";
330  case Audio:
331  return "audio";
332  case Mpeg7:
333  return "MPEG-7";
334  case Ipmps:
335  return "IMPS";
336  case ObjectContentInfo:
337  return "object content info";
338  case MpegJava:
339  return "MPEG Java";
340  case Interaction:
341  return "interaction";
342  case Ipmp:
343  return "IPMP";
344  case FontData:
345  return "font data";
346  case StreamingText:
347  return "streaming text";
348  default:
349  return "";
350  }
351 }
352 
353 } // namespace Mpeg4ElementaryStreamTypeIds
354 
359 namespace Mpeg4AudioObjectIds {
360 
361 TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
362 {
363  MediaFormat fmt;
364  switch (mpeg4AudioObjectId) {
365  case AacMain:
367  break;
368  case AacLc:
370  break;
371  case AacSsr:
373  break;
374  case AacLtp:
376  break;
377  case Sbr:
379  break;
380  case AacScalable:
382  break;
383  case ErAacLc:
385  break;
386  case ErAacLtp:
388  break;
389  case ErAacLd:
391  break;
392  case Ps:
394  break;
395  case Layer1:
397  break;
398  case Layer2:
400  break;
401  case Layer3:
403  break;
404  default:;
405  }
406  if (sbrPresent) {
408  }
409  if (psPresent) {
411  }
412  return fmt;
413 }
414 
415 } // namespace Mpeg4AudioObjectIds
416 
417 uint32 mpeg4SamplingFrequencyTable[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 };
418 
422 namespace Mpeg4ChannelConfigs {
423 
427 const char *channelConfigString(byte config)
428 {
429  switch (config) {
430  case AotSpecificConfig:
431  return "defined in AOT Specific Config";
432  case FrontCenter:
433  return "1 channel: front-center";
434  case FrontLeftFrontRight:
435  return "2 channels: front-left, front-right";
437  return "3 channels: front-center, front-left, front-right";
439  return "4 channels: front-center, front-left, front-right, back-center";
441  return "5 channels: front-center, front-left, front-right, back-left, back-right";
443  return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
445  return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
446  default:
447  return nullptr;
448  }
449 }
450 
454 byte channelCount(byte config)
455 {
456  switch (config) {
457  case FrontCenter:
458  return 1;
459  case FrontLeftFrontRight:
460  return 2;
462  return 3;
464  return 4;
466  return 5;
468  return 6;
470  return 8;
471  default:
472  return 0;
473  }
474 }
475 
476 } // namespace Mpeg4ChannelConfigs
477 
481 namespace Mpeg4VideoCodes {
482 }
483 
487 namespace Mpeg2VideoCodes {
488 }
489 
490 } // namespace TagParser
TAG_PARSER_EXPORT byte channelCount(byte config)
Returns the channel count for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:454
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:245
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition: mp4ids.cpp:361
TAG_PARSER_EXPORT const char * streamTypeName(byte streamTypeId)
Returns the name of the stream type denoted by the specified MPEG-4 stream type ID.
Definition: mp4ids.cpp:319
TAG_PARSER_EXPORT const char * channelConfigString(byte config)
Returns the string representation for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:427
TAG_PARSER_EXPORT MediaFormat fourccToMediaFormat(uint32 fourccId)
Definition: mp4ids.cpp:46
TAG_PARSER_EXPORT MediaFormat streamObjectTypeFormat(byte streamObjectTypeId)
Returns the TagParser::MediaFormat denoted by the specified MPEG-4 stream ID.
Definition: mp4ids.cpp:209
unsigned char extension
Definition: mediaformat.h:260
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
uint32 mpeg4SamplingFrequencyTable[13]
Definition: mp4ids.cpp:417