Tag Parser  6.4.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 
5 namespace Media {
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 }
33 
37 namespace Mp4MediaTypeIds {
38 }
39 
44 namespace FourccIds {
45 
47 {
48  switch(fourccId) {
49  case Mpeg:
51  case Mpeg2Imx30: case Mpeg2Imx50:
53  case Mpeg4Video:
55  case Mpeg4TimedText:
57  case Hevc1: case Hevc2:
59  case Avc1: case Avc2: case Avc3: case Avc4: case H264Decoder1: case H264Decoder2:
60  case H264Decoder3: case H264Decoder4: case H264Decoder5: case H264Decoder6:
62  case Divx4Decoder1: case Divx4Decoder2:
63  case H263Quicktime: case H2633GPP: case XvidDecoder1: case XvidDecoder2:
64  case XvidDecoder3: case XvidDecoder4: case XvidDecoder5: case Divx5Decoder:
70  case Tiff:
74  case Raw:
76  case Jpeg:
78  case Gif:
80  case Png:
82  case AdpcmAcm:
84  case ImaadpcmAcm:
86  case Mp3CbrOnly: case Mp3:
88  case Mpeg4Audio:
90  case Alac:
92  case Ac3:
94  case EAc3:
96  case DolbyMpl:
98  case Ac4:
100  case Rv20: case Rv30: case Rv40:
102  case Int24: case Int32:
104  case Int16Be:
106  case Int16Le:
110  case Amr: case AmrNarrowband:
112  case Dts: case DtsH:
114  case DtsE:
123  case MsMpeg4V2Decoder4:
131  // TODO: map more FOURCCs
132  default:
134  }
135 }
136 
137 }
138 
143 namespace Mp4FormatExtensionIds {
144 }
145 
149 namespace Mpeg4ElementaryStreamObjectIds {
150 
154 MediaFormat streamObjectTypeFormat(byte streamObjectTypeId)
155 {
156  switch(streamObjectTypeId) {
165  case Avc: return GeneralMediaFormat::Avc;
167  case Als: return GeneralMediaFormat::Als;
168  case Sa0c: return GeneralMediaFormat::Sa0c;
182  case Jpeg: return GeneralMediaFormat::Jpeg;
183  case Png: return GeneralMediaFormat::Png;
184  case Evrc: case PrivateEvrc: return GeneralMediaFormat::Evrc;
185  case Smv: return GeneralMediaFormat::Smv;
187  case Vc1: return GeneralMediaFormat::Vc1;
188  case Dirac: return GeneralMediaFormat::Dirac;
189  case Ac3: case PrivateAc3: return GeneralMediaFormat::Ac3;
190  case EAc3: return GeneralMediaFormat::EAc3;
191  case Dts: case PrivateDts: return GeneralMediaFormat::Dts;
197  default: return MediaFormat();
198  }
199 }
200 
201 }
202 
206 namespace Mpeg4DescriptorIds {
207 }
208 
212 namespace Mpeg4ElementaryStreamTypeIds {
213 
217 const char *streamTypeName(byte streamTypeId)
218 {
219  switch(streamTypeId) {
220  case ObjectDescriptor: return "object descriptor";
221  case ClockReference: return "clock reference";
222  case SceneDescriptor: return "scene descriptor";
223  case Visual: return "visual";
224  case Audio: return "audio";
225  case Mpeg7: return "MPEG-7";
226  case Ipmps: return "IMPS";
227  case ObjectContentInfo: return "object content info";
228  case MpegJava: return "MPEG Java";
229  case Interaction: return "interaction";
230  case Ipmp: return "IPMP";
231  case FontData: return "font data";
232  case StreamingText: return "streaming text";
233  default: return "";
234  }
235 }
236 
237 }
238 
243 namespace Mpeg4AudioObjectIds {
244 
245 TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
246 {
247  MediaFormat fmt;
248  switch(mpeg4AudioObjectId) {
249  case AacMain:
251  break;
252  case AacLc:
254  break;
255  case AacSsr:
257  break;
258  case AacLtp:
260  break;
261  case Sbr:
263  break;
264  case AacScalable:
266  break;
267  case ErAacLc:
269  break;
270  case ErAacLtp:
272  break;
273  case ErAacLd:
275  break;
276  case Ps:
278  break;
279  case Layer1:
281  break;
282  case Layer2:
284  break;
285  case Layer3:
287  break;
288  default:
289  ;
290  }
291  if(sbrPresent) {
293  }
294  if(psPresent) {
296  }
297  return fmt;
298 }
299 
300 }
301 
303  96000, 88200, 64000, 48000, 44100, 32000,
304  24000, 22050, 16000, 12000, 11025, 8000, 7350
305 };
306 
310 namespace Mpeg4ChannelConfigs {
311 
315 const char *channelConfigString(byte config)
316 {
317  switch(config) {
318  case AotSpecificConfig:
319  return "defined in AOT Specific Config";
320  case FrontCenter:
321  return "1 channel: front-center";
322  case FrontLeftFrontRight:
323  return "2 channels: front-left, front-right";
325  return "3 channels: front-center, front-left, front-right";
327  return "4 channels: front-center, front-left, front-right, back-center";
329  return "5 channels: front-center, front-left, front-right, back-left, back-right";
331  return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
333  return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
334  default:
335  return nullptr;
336  }
337 }
338 
342 byte channelCount(byte config)
343 {
344  switch(config) {
345  case FrontCenter:
346  return 1;
347  case FrontLeftFrontRight:
348  return 2;
350  return 3;
352  return 4;
354  return 5;
356  return 6;
358  return 8;
359  default:
360  return 0;
361  }
362 }
363 
364 }
365 
369 namespace Mpeg4VideoCodes {
370 }
371 
375 namespace Mpeg2VideoCodes {
376 }
377 
378 }
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:217
uint32 mpeg4SamplingFrequencyTable[13]
Definition: mp4ids.cpp:302
unsigned char extension
Definition: mediaformat.h:273
TAG_PARSER_EXPORT const char * channelConfigString(byte config)
Returns the string representation for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:315
TAG_PARSER_EXPORT MediaFormat fourccToMediaFormat(uint32 fourccId)
Definition: mp4ids.cpp:46
TAG_PARSER_EXPORT MediaFormat streamObjectTypeFormat(byte streamObjectTypeId)
Returns the Media::MediaFormat denoted by the specified MPEG-4 stream ID.
Definition: mp4ids.cpp:154
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition: mp4ids.cpp:245
TAG_PARSER_EXPORT byte channelCount(byte config)
Returns the channel count for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:342
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
The MediaFormat class specifies the format of media data.
Definition: mediaformat.h:257