Tag Parser  8.0.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 PrivateQcelp:
296  default:
297  return MediaFormat();
298  }
299 }
300 
301 } // namespace Mpeg4ElementaryStreamObjectIds
302 
306 namespace Mpeg4DescriptorIds {
307 }
308 
312 namespace Mpeg4ElementaryStreamTypeIds {
313 
317 const char *streamTypeName(byte streamTypeId)
318 {
319  switch (streamTypeId) {
320  case ObjectDescriptor:
321  return "object descriptor";
322  case ClockReference:
323  return "clock reference";
324  case SceneDescriptor:
325  return "scene descriptor";
326  case Visual:
327  return "visual";
328  case Audio:
329  return "audio";
330  case Mpeg7:
331  return "MPEG-7";
332  case Ipmps:
333  return "IMPS";
334  case ObjectContentInfo:
335  return "object content info";
336  case MpegJava:
337  return "MPEG Java";
338  case Interaction:
339  return "interaction";
340  case Ipmp:
341  return "IPMP";
342  case FontData:
343  return "font data";
344  case StreamingText:
345  return "streaming text";
346  default:
347  return "";
348  }
349 }
350 
351 } // namespace Mpeg4ElementaryStreamTypeIds
352 
357 namespace Mpeg4AudioObjectIds {
358 
359 TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
360 {
361  MediaFormat fmt;
362  switch (mpeg4AudioObjectId) {
363  case AacMain:
365  break;
366  case AacLc:
368  break;
369  case AacSsr:
371  break;
372  case AacLtp:
374  break;
375  case Sbr:
377  break;
378  case AacScalable:
380  break;
381  case ErAacLc:
383  break;
384  case ErAacLtp:
386  break;
387  case ErAacLd:
389  break;
390  case Ps:
392  break;
393  case Layer1:
395  break;
396  case Layer2:
398  break;
399  case Layer3:
401  break;
402  default:;
403  }
404  if (sbrPresent) {
406  }
407  if (psPresent) {
409  }
410  return fmt;
411 }
412 
413 } // namespace Mpeg4AudioObjectIds
414 
415 uint32 mpeg4SamplingFrequencyTable[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 };
416 
420 namespace Mpeg4ChannelConfigs {
421 
425 const char *channelConfigString(byte config)
426 {
427  switch (config) {
428  case AotSpecificConfig:
429  return "defined in AOT Specific Config";
430  case FrontCenter:
431  return "1 channel: front-center";
432  case FrontLeftFrontRight:
433  return "2 channels: front-left, front-right";
435  return "3 channels: front-center, front-left, front-right";
437  return "4 channels: front-center, front-left, front-right, back-center";
439  return "5 channels: front-center, front-left, front-right, back-left, back-right";
441  return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
443  return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
444  default:
445  return nullptr;
446  }
447 }
448 
452 byte channelCount(byte config)
453 {
454  switch (config) {
455  case FrontCenter:
456  return 1;
457  case FrontLeftFrontRight:
458  return 2;
460  return 3;
462  return 4;
464  return 5;
466  return 6;
468  return 8;
469  default:
470  return 0;
471  }
472 }
473 
474 } // namespace Mpeg4ChannelConfigs
475 
479 namespace Mpeg4VideoCodes {
480 }
481 
485 namespace Mpeg2VideoCodes {
486 }
487 
488 } // namespace TagParser
TAG_PARSER_EXPORT byte channelCount(byte config)
Returns the channel count for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:452
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:244
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition: mp4ids.cpp:359
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:317
TAG_PARSER_EXPORT const char * channelConfigString(byte config)
Returns the string representation for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:425
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:259
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:415