Tag Parser 12.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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
18namespace Mp4TagAtomIds {
19}
20
24namespace Mp4TagExtendedMeanIds {
25std::string_view iTunes = "com.apple.iTunes";
26}
27
31namespace Mp4TagExtendedNameIds {
32std::string_view cdec = "cdec";
33std::string_view label = "LABEL";
34} // namespace Mp4TagExtendedNameIds
35
39namespace Mp4MediaTypeIds {
40}
41
46namespace FourccIds {
47
48MediaFormat fourccToMediaFormat(std::uint32_t fourccId)
49{
50 switch (fourccId) {
51 case Mpeg:
53 case Mpeg2Imx30:
54 case Mpeg2Imx50:
56 case Mpeg4Video:
58 case Mpeg4TimedText:
60 case Hevc1:
61 case Hevc2:
63 case Avc1:
64 case Avc2:
65 case Avc3:
66 case Avc4:
67 case H264Decoder1:
68 case H264Decoder2:
69 case H264Decoder3:
70 case H264Decoder4:
71 case H264Decoder5:
72 case H264Decoder6:
74 case Av1_IVF:
75 case Av1_ISOBMFF:
77 case Divx4Decoder1:
78 case Divx4Decoder2:
79 case H263Quicktime:
80 case H2633GPP:
81 case XvidDecoder1:
82 case XvidDecoder2:
83 case XvidDecoder3:
84 case XvidDecoder4:
85 case XvidDecoder5:
86 case Divx5Decoder:
88 case Divx3Decoder1:
89 case Divx3Decoder2:
90 case Divx3Decoder3:
91 case Divx3Decoder4:
92 case Divx3Decoder5:
93 case Divx3Decoder6:
94 case Divx3Decoder7:
95 case Divx3Decoder8:
96 case Divx3Decoder9:
97 case Divx3Decoder10:
98 case Divx3Decoder11:
99 case Divx3Decoder12:
100 case Divx3Decoder13:
101 case Divx3Decoder14:
102 case Divx3Decoder15:
104 case Tiff:
108 case Raw:
110 case Jpeg:
112 case Gif:
114 case Png:
116 case AdpcmAcm:
118 case ImaadpcmAcm:
120 case Mp3CbrOnly:
121 case Mp3:
123 case Mpeg4Audio:
125 case Alac:
127 case Ac3:
129 case EAc3:
131 case DolbyMpl:
133 case Ac4:
135 case Rv20:
136 case Rv30:
137 case Rv40:
139 case Int24:
140 case Int32:
142 case Int16Be:
144 case Int16Le:
149 case Amr:
150 case AmrNarrowband:
152 case Dts:
153 case DtsH:
155 case DtsE:
177 case Vp8:
179 case Vp9:
180 case Vp9_2:
182 case WavPack:
189 case Flac:
191 case Opus:
193 // TODO: map more FOURCCs
194 default:
196 }
197}
198
199} // namespace FourccIds
200
205namespace Mp4FormatExtensionIds {
206}
207
211namespace Mpeg4ElementaryStreamObjectIds {
212
216MediaFormat streamObjectTypeFormat(std::uint8_t streamObjectTypeId)
217{
218 switch (streamObjectTypeId) {
219 case SystemsIso144961:
225 case AfxStream:
227 case FontDataStream:
233 case Mpeg4Visual:
235 case Avc:
239 case Als:
241 case Sa0c:
243 case Aac:
263 case Mpeg2Audio:
265 case Mpeg1Video:
267 case Mpeg1Audio:
269 case Jpeg:
271 case Png:
273 case Evrc:
274 case PrivateEvrc:
276 case Smv:
278 case Gpp2Cmf:
280 case Vc1:
282 case Dirac:
284 case Ac3:
285 case PrivateAc3:
287 case EAc3:
289 case Dts:
290 case PrivateDts:
294 case DtsHdMasterAudio:
296 case DtsHdExpress:
298 case PrivateOgg:
299 case PrivateOgg2:
301 case PrivateVobSub:
303 case PrivateQcelp:
305 default:
306 return MediaFormat();
307 }
308}
309
310} // namespace Mpeg4ElementaryStreamObjectIds
311
315namespace Mpeg4DescriptorIds {
316}
317
321namespace Mpeg4ElementaryStreamTypeIds {
322
326std::string_view streamTypeName(std::uint8_t streamTypeId)
327{
328 switch (streamTypeId) {
329 case ObjectDescriptor:
330 return "object descriptor";
331 case ClockReference:
332 return "clock reference";
333 case SceneDescriptor:
334 return "scene descriptor";
335 case Visual:
336 return "visual";
337 case Audio:
338 return "audio";
339 case Mpeg7:
340 return "MPEG-7";
341 case Ipmps:
342 return "IMPS";
344 return "object content info";
345 case MpegJava:
346 return "MPEG Java";
347 case Interaction:
348 return "interaction";
349 case Ipmp:
350 return "IPMP";
351 case FontData:
352 return "font data";
353 case StreamingText:
354 return "streaming text";
355 default:
356 return "";
357 }
358}
359
360} // namespace Mpeg4ElementaryStreamTypeIds
361
366namespace Mpeg4AudioObjectIds {
367
368TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
369{
370 MediaFormat fmt;
371 switch (mpeg4AudioObjectId) {
372 case AacMain:
374 break;
375 case AacLc:
377 break;
378 case AacSsr:
380 break;
381 case AacLtp:
383 break;
384 case Sbr:
386 break;
387 case AacScalable:
389 break;
390 case ErAacLc:
392 break;
393 case ErAacLtp:
395 break;
396 case ErAacLd:
398 break;
399 case Ps:
401 break;
402 case Layer1:
404 break;
405 case Layer2:
407 break;
408 case Layer3:
410 break;
411 default:;
412 }
413 if (sbrPresent) {
415 }
416 if (psPresent) {
418 }
419 return fmt;
420}
421
422} // namespace Mpeg4AudioObjectIds
423
424std::uint32_t mpeg4SamplingFrequencyTable[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 };
425
429namespace Mpeg4ChannelConfigs {
430
434std::string_view channelConfigString(std::uint8_t config)
435{
436 switch (config) {
438 return "defined in AOT Specific Config";
439 case FrontCenter:
440 return "1 channel: front-center";
442 return "2 channels: front-left, front-right";
444 return "3 channels: front-center, front-left, front-right";
446 return "4 channels: front-center, front-left, front-right, back-center";
448 return "5 channels: front-center, front-left, front-right, back-left, back-right";
450 return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
452 return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
453 default:
454 return std::string_view();
455 }
456}
457
461std::uint8_t channelCount(std::uint8_t config)
462{
463 switch (config) {
464 case FrontCenter:
465 return 1;
467 return 2;
469 return 3;
471 return 4;
473 return 5;
475 return 6;
477 return 8;
478 default:
479 return 0;
480 }
481}
482
483} // namespace Mpeg4ChannelConfigs
484
488namespace Mpeg4VideoCodes {
489}
490
494namespace Mpeg2VideoCodes {
495}
496
497} // namespace TagParser
The MediaFormat class specifies the format of media data.
unsigned char extension
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:13
@ WindowsMediaAudio9Professional
Definition mp4ids.h:406
TAG_PARSER_EXPORT MediaFormat fourccToMediaFormat(std::uint32_t fourccId)
Definition mp4ids.cpp:48
TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent=false, bool psPresent=false)
Definition mp4ids.cpp:368
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:434
@ FrontCenterFrontLeftFrontRightBackLeftBackRightLFEChannel
Definition mp4ids.h:635
@ FrontCenterFrontLeftFrontRightSideLeftSideRightBackLeftBackRightLFEChannel
Definition mp4ids.h:636
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:461
TAG_PARSER_EXPORT MediaFormat streamObjectTypeFormat(std::uint8_t streamObjectTypeId)
Returns the TagParser::MediaFormat denoted by the specified MPEG-4 stream ID.
Definition mp4ids.cpp:216
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:326
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
std::uint32_t mpeg4SamplingFrequencyTable[13]
Definition mp4ids.cpp:424