Tag Parser 12.3.1
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 Vvc1:
65 case Avc1:
66 case Avc2:
67 case Avc3:
68 case Avc4:
69 case H264Decoder1:
70 case H264Decoder2:
71 case H264Decoder3:
72 case H264Decoder4:
73 case H264Decoder5:
74 case H264Decoder6:
76 case Av1_IVF:
77 case Av1_ISOBMFF:
79 case Divx4Decoder1:
80 case Divx4Decoder2:
81 case H263Quicktime:
82 case H2633GPP:
83 case XvidDecoder1:
84 case XvidDecoder2:
85 case XvidDecoder3:
86 case XvidDecoder4:
87 case XvidDecoder5:
88 case Divx5Decoder:
90 case Divx3Decoder1:
91 case Divx3Decoder2:
92 case Divx3Decoder3:
93 case Divx3Decoder4:
94 case Divx3Decoder5:
95 case Divx3Decoder6:
96 case Divx3Decoder7:
97 case Divx3Decoder8:
98 case Divx3Decoder9:
99 case Divx3Decoder10:
100 case Divx3Decoder11:
101 case Divx3Decoder12:
102 case Divx3Decoder13:
103 case Divx3Decoder14:
104 case Divx3Decoder15:
106 case Tiff:
110 case Raw:
112 case Jpeg:
114 case Gif:
116 case Png:
118 case AdpcmAcm:
120 case ImaadpcmAcm:
122 case Mp3CbrOnly:
123 case Mp3:
125 case Mpeg4Audio:
127 case Alac:
129 case Ac3:
131 case EAc3:
133 case DolbyMpl:
135 case Ac4:
137 case Rv20:
138 case Rv30:
139 case Rv40:
141 case Int24:
142 case Int32:
144 case Int16Be:
146 case Int16Le:
151 case Amr:
152 case AmrNarrowband:
154 case Dts:
155 case DtsH:
157 case DtsE:
179 case Vp8:
181 case Vp9:
182 case Vp9_2:
184 case WavPack:
191 case Flac:
193 case Opus:
195 // TODO: map more FOURCCs
196 default:
198 }
199}
200
201} // namespace FourccIds
202
207namespace Mp4FormatExtensionIds {
208}
209
213namespace Mpeg4ElementaryStreamObjectIds {
214
218MediaFormat streamObjectTypeFormat(std::uint8_t streamObjectTypeId)
219{
220 switch (streamObjectTypeId) {
221 case SystemsIso144961:
227 case AfxStream:
229 case FontDataStream:
235 case Mpeg4Visual:
237 case Avc:
241 case Als:
243 case Sa0c:
245 case Aac:
265 case Mpeg2Audio:
267 case Mpeg1Video:
269 case Mpeg1Audio:
271 case Jpeg:
273 case Png:
275 case Evrc:
276 case PrivateEvrc:
278 case Smv:
280 case Gpp2Cmf:
282 case Vc1:
284 case Dirac:
286 case Ac3:
287 case PrivateAc3:
289 case EAc3:
291 case Dts:
292 case PrivateDts:
296 case DtsHdMasterAudio:
298 case DtsHdExpress:
300 case PrivateOgg:
301 case PrivateOgg2:
303 case PrivateVobSub:
305 case PrivateQcelp:
307 default:
308 return MediaFormat();
309 }
310}
311
312} // namespace Mpeg4ElementaryStreamObjectIds
313
317namespace Mpeg4DescriptorIds {
318}
319
323namespace Mpeg4ElementaryStreamTypeIds {
324
328std::string_view streamTypeName(std::uint8_t streamTypeId)
329{
330 switch (streamTypeId) {
331 case ObjectDescriptor:
332 return "object descriptor";
333 case ClockReference:
334 return "clock reference";
335 case SceneDescriptor:
336 return "scene descriptor";
337 case Visual:
338 return "visual";
339 case Audio:
340 return "audio";
341 case Mpeg7:
342 return "MPEG-7";
343 case Ipmps:
344 return "IMPS";
346 return "object content info";
347 case MpegJava:
348 return "MPEG Java";
349 case Interaction:
350 return "interaction";
351 case Ipmp:
352 return "IPMP";
353 case FontData:
354 return "font data";
355 case StreamingText:
356 return "streaming text";
357 default:
358 return "";
359 }
360}
361
362} // namespace Mpeg4ElementaryStreamTypeIds
363
368namespace Mpeg4AudioObjectIds {
369
370TAG_PARSER_EXPORT MediaFormat idToMediaFormat(std::uint8_t mpeg4AudioObjectId, bool sbrPresent, bool psPresent)
371{
372 MediaFormat fmt;
373 switch (mpeg4AudioObjectId) {
374 case AacMain:
376 break;
377 case AacLc:
379 break;
380 case AacSsr:
382 break;
383 case AacLtp:
385 break;
386 case Sbr:
388 break;
389 case AacScalable:
391 break;
392 case ErAacLc:
394 break;
395 case ErAacLtp:
397 break;
398 case ErAacLd:
400 break;
401 case Ps:
403 break;
404 case Layer1:
406 break;
407 case Layer2:
409 break;
410 case Layer3:
412 break;
413 default:;
414 }
415 if (sbrPresent) {
417 }
418 if (psPresent) {
420 }
421 return fmt;
422}
423
424} // namespace Mpeg4AudioObjectIds
425
426std::uint32_t mpeg4SamplingFrequencyTable[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 };
427
431namespace Mpeg4ChannelConfigs {
432
436std::string_view channelConfigString(std::uint8_t config)
437{
438 switch (config) {
440 return "defined in AOT Specific Config";
441 case FrontCenter:
442 return "1 channel: front-center";
444 return "2 channels: front-left, front-right";
446 return "3 channels: front-center, front-left, front-right";
448 return "4 channels: front-center, front-left, front-right, back-center";
450 return "5 channels: front-center, front-left, front-right, back-left, back-right";
452 return "6 channels: front-center, front-left, front-right, back-left, back-right, LFE-channel";
454 return "8 channels: front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel";
455 default:
456 return std::string_view();
457 }
458}
459
463std::uint8_t channelCount(std::uint8_t config)
464{
465 switch (config) {
466 case FrontCenter:
467 return 1;
469 return 2;
471 return 3;
473 return 4;
475 return 5;
477 return 6;
479 return 8;
480 default:
481 return 0;
482 }
483}
484
485} // namespace Mpeg4ChannelConfigs
486
490namespace Mpeg4VideoCodes {
491}
492
496namespace Mpeg2VideoCodes {
497}
498
499} // 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:14
@ WindowsMediaAudio9Professional
Definition mp4ids.h:409
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:370
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:436
@ FrontCenterFrontLeftFrontRightBackLeftBackRightLFEChannel
Definition mp4ids.h:638
@ FrontCenterFrontLeftFrontRightSideLeftSideRightBackLeftBackRightLFEChannel
Definition mp4ids.h:639
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:463
TAG_PARSER_EXPORT MediaFormat streamObjectTypeFormat(std::uint8_t streamObjectTypeId)
Returns the TagParser::MediaFormat denoted by the specified MPEG-4 stream ID.
Definition mp4ids.cpp:218
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:328
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
std::uint32_t mpeg4SamplingFrequencyTable[13]
Definition mp4ids.cpp:426