Tag Parser  6.5.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:
127  case WavPack:
133  // TODO: map more FOURCCs
134  default:
136  }
137 }
138 
139 }
140 
145 namespace Mp4FormatExtensionIds {
146 }
147 
151 namespace Mpeg4ElementaryStreamObjectIds {
152 
156 MediaFormat streamObjectTypeFormat(byte streamObjectTypeId)
157 {
158  switch(streamObjectTypeId) {
167  case Avc: return GeneralMediaFormat::Avc;
169  case Als: return GeneralMediaFormat::Als;
170  case Sa0c: return GeneralMediaFormat::Sa0c;
184  case Jpeg: return GeneralMediaFormat::Jpeg;
185  case Png: return GeneralMediaFormat::Png;
186  case Evrc: case PrivateEvrc: return GeneralMediaFormat::Evrc;
187  case Smv: return GeneralMediaFormat::Smv;
189  case Vc1: return GeneralMediaFormat::Vc1;
190  case Dirac: return GeneralMediaFormat::Dirac;
191  case Ac3: case PrivateAc3: return GeneralMediaFormat::Ac3;
192  case EAc3: return GeneralMediaFormat::EAc3;
193  case Dts: case PrivateDts: return GeneralMediaFormat::Dts;
199  default: return MediaFormat();
200  }
201 }
202 
203 }
204 
208 namespace Mpeg4DescriptorIds {
209 }
210 
214 namespace Mpeg4ElementaryStreamTypeIds {
215 
219 const char *streamTypeName(byte streamTypeId)
220 {
221  switch(streamTypeId) {
222  case ObjectDescriptor: return "object descriptor";
223  case ClockReference: return "clock reference";
224  case SceneDescriptor: return "scene descriptor";
225  case Visual: return "visual";
226  case Audio: return "audio";
227  case Mpeg7: return "MPEG-7";
228  case Ipmps: return "IMPS";
229  case ObjectContentInfo: return "object content info";
230  case MpegJava: return "MPEG Java";
231  case Interaction: return "interaction";
232  case Ipmp: return "IPMP";
233  case FontData: return "font data";
234  case StreamingText: return "streaming text";
235  default: return "";
236  }
237 }
238 
239 }
240 
245 namespace Mpeg4AudioObjectIds {
246 
247 TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
248 {
249  MediaFormat fmt;
250  switch(mpeg4AudioObjectId) {
251  case AacMain:
253  break;
254  case AacLc:
256  break;
257  case AacSsr:
259  break;
260  case AacLtp:
262  break;
263  case Sbr:
265  break;
266  case AacScalable:
268  break;
269  case ErAacLc:
271  break;
272  case ErAacLtp:
274  break;
275  case ErAacLd:
277  break;
278  case Ps:
280  break;
281  case Layer1:
283  break;
284  case Layer2:
286  break;
287  case Layer3:
289  break;
290  default:
291  ;
292  }
293  if(sbrPresent) {
295  }
296  if(psPresent) {
298  }
299  return fmt;
300 }
301 
302 }
303 
305  96000, 88200, 64000, 48000, 44100, 32000,
306  24000, 22050, 16000, 12000, 11025, 8000, 7350
307 };
308 
312 namespace Mpeg4ChannelConfigs {
313 
317 const char *channelConfigString(byte config)
318 {
319  switch(config) {
320  case AotSpecificConfig:
321  return "defined in AOT Specific Config";
322  case FrontCenter:
323  return "1 channel: front-center";
324  case FrontLeftFrontRight:
325  return "2 channels: front-left, front-right";
327  return "3 channels: front-center, front-left, front-right";
329  return "4 channels: front-center, front-left, front-right, back-center";
331  return "5 channels: front-center, front-left, front-right, back-left, back-right";
333  return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
335  return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
336  default:
337  return nullptr;
338  }
339 }
340 
344 byte channelCount(byte config)
345 {
346  switch(config) {
347  case FrontCenter:
348  return 1;
349  case FrontLeftFrontRight:
350  return 2;
352  return 3;
354  return 4;
356  return 5;
358  return 6;
360  return 8;
361  default:
362  return 0;
363  }
364 }
365 
366 }
367 
371 namespace Mpeg4VideoCodes {
372 }
373 
377 namespace Mpeg2VideoCodes {
378 }
379 
380 }
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:219
uint32 mpeg4SamplingFrequencyTable[13]
Definition: mp4ids.cpp:304
unsigned char extension
Definition: mediaformat.h:276
TAG_PARSER_EXPORT const char * channelConfigString(byte config)
Returns the string representation for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:317
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:156
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(byte mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition: mp4ids.cpp:247
TAG_PARSER_EXPORT byte channelCount(byte config)
Returns the channel count for the specified MPEG-4 channel config.
Definition: mp4ids.cpp:344
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:260