Tag Parser  8.2.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
mediaformat.cpp
Go to the documentation of this file.
1 #include "./mediaformat.h"
2 
3 namespace TagParser {
4 
5 using namespace SubFormats;
6 
17 const char *MediaFormat::name() const
18 {
19  switch (general) {
21  switch (sub) {
23  return "Advanced Audio Coding Main Profile";
25  return "Advanced Audio Coding Low Complexity Profile";
27  return "Advanced Audio Coding Scalable Sampling Rate Profile";
29  return "Advanced Audio Coding Main Profile";
31  return "Advanced Audio Coding Low Complexity Profile";
33  return "Advanced Audio Coding Scaleable Sampling Rate Profile";
35  return "Advanced Audio Coding Long Term Predicition";
37  return "Advanced Audio Coding Error Resilient Low Complexity Profile";
39  return "Advanced Audio Coding Error Resilient Scalable Sampling Rate Profile";
41  return "Advanced Audio Coding Error Resilient Long Term Predicition";
42  case AacMpeg4ERLowDelay:
43  return "Advanced Audio Coding Error Resilient Low Delay";
45  return "Advanced Audio Coding Error Resilient Enhanced Low Delay";
46  default:
47  return "Advanced Audio Coding";
48  }
50  return "Dolby Digital";
52  return "AC-4";
54  return "ADPCM ACM";
56  return "AFX Stream";
58  return "Apple Lossless Audio Codec";
60  return "ALS";
62  return "Adaptive Multi-Rate audio codec";
64  switch (sub) {
66  return "Advanced Video Coding CAVLC 4:4:4 Intra Profile";
67  case AvcBaselineProfile:
68  return "Advanced Video Coding Basline Profile";
69  case AvcMainProfile:
70  return "Advanced Video Coding Main Profile";
72  return "Advanced Video Coding Scalable Basline Profile";
74  return "Advanced Video Coding Scalable High Profile";
75  case AvcExtendedProfile:
76  return "Advanced Video Coding Extended Profile";
77  case AvcHighProfile:
78  return "Advanced Video Coding High Profile";
79  case AvcHigh10Profile:
80  return "Advanced Video Coding High 10 Profile";
82  return "Advanced Video Coding Multiview Profile";
83  case AvcHigh422Profile:
84  return "Advanced Video Coding High 4:2:2 Profile";
86  return "Advanced Video Coding Stereo High Profile";
88  return "Advanced Video Coding Multiview Depth High Profile";
89  case AvcHigh444Profile:
90  return "Advanced Video Coding High 4:4:4 Profile";
92  return "Advanced Video Coding High 4:4:4 Predictive Profile";
93  default:
94  return "Advanced Video Coding";
95  }
97  return "AOMedia Video 1";
99  return "Windows Bitmap";
101  return "Daala";
103  return "Dirac";
105  switch (sub) {
106  case DtsLossless:
107  return "DTS Lossless";
108  case DtsExpress:
109  return "DTS Express";
110  default:
111  return "DTS";
112  }
114  switch (sub) {
115  case DtsHdHighResolution:
116  return "DTS-HD High Resolution";
117  case DtsHdMasterAudio:
118  return "DTS-HD Master Audio";
119  case DtsExpress:
120  return "DTS-HD Express";
121  default:
122  return "DTS-HD";
123  }
125  return "Dolby Digital Plus";
127  return "EVRC";
129  return "Free Lossless Audio Codec";
131  return "Font Data Stream";
133  return "GIF";
135  return "3GPP2 Compact Multimedia Format (CMF)";
137  return "High Efficiency Video Coding";
139  return "IMAADPCM ACM";
141  switch (sub) {
143  return "Bitmap subtitle";
144  default:
145  return "Image subtitle";
146  }
148  return "Interaction Stream";
150  return "JPEG";
152  return "Karaoke And Text Encapsulation";
154  return "Opus";
156  return "Microsoft Audio Codec Manager";
158  switch (sub) {
159  case 1:
160  return "Microsoft MPEG-4 version 1";
161  case 2:
162  return "Microsoft MPEG-4 version 2";
163  case 3:
164  return "Microsoft MPEG-4 version 3";
165  default:
166  return "Microsoft MPEG-4";
167  }
169  return "Microsoft Video Codec Manager";
171  return "Dolby TrueHD";
173  switch (sub) {
174  case Mpeg1Layer1:
175  return "MPEG-1 Layer 1";
176  case Mpeg1Layer2:
177  return "MPEG-1 Layer 2";
178  case Mpeg1Layer3:
179  return "MPEG-1 Layer 3";
180  default:
181  return "MPEG-1 Audio";
182  }
184  return "MPEG-1 Video";
186  switch (sub) {
187  case Mpeg1Layer1:
188  return "MPEG-2 Layer 1";
189  case Mpeg1Layer2:
190  return "MPEG-2 Layer 2";
191  case Mpeg1Layer3:
192  return "MPEG-2 Layer 3";
193  default:
194  return "MPEG-2 Audio";
195  }
197  switch (sub) {
198  case Mpeg2SimpleProfile:
199  return "MPEG-2 Video Simple Profile";
200  case Mpeg2MainProfile:
201  return "MPEG-2 Video Main Profile";
202  case Mpeg2SnrProfile:
203  return "MPEG-2 Video SNR Profile";
204  case Mpeg2SpatialProfile:
205  return "MPEG-2 Video Spatial Profile";
206  case Mpeg2HighProfile:
207  return "MPEG-2 Video High Profile";
208  case Mpeg2422Profile:
209  return "MPEG-2 Video 422 Profile";
210  default:
211  return "MPEG-2 Video";
212  }
214  switch (sub) {
215  case Mpeg4SimpleProfile1:
216  return "MPEG-4 Simple Profile L1";
217  case Mpeg4SimpleProfile2:
218  return "MPEG-4 Simple Profile L2";
219  case Mpeg4SimpleProfile3:
220  return "MPEG-4 Simple Profile L2";
221  case Mpeg4SimpleProfile0:
222  return "MPEG-4 Simple Profile";
224  return "MPEG-4 Simple Scalable Profile";
226  return "MPEG-4 Simple Scalable Profile L1";
228  return "MPEG-4 Simple Scalable Profile L2";
229  case Mpeg4CoreProfile1:
230  return "MPEG-4 Core Profile L1";
231  case Mpeg4CoreProfiel2:
232  return "MPEG-4 Core Profile L2";
233  case Mpeg4MainProfile2:
234  return "MPEG-4 Main Profile L2";
235  case Mpeg4MainProfile3:
236  return "MPEG-4 Main Profile L3";
237  case Mpeg4MainProfile4:
238  return "MPEG-4 Main Profile L4";
239  case Mpeg4NBitPrifle2:
240  return "MPEG-4 N-Bit Profile L2";
242  return "MPEG-4 Scalable Texture Profile L1";
244  return "MPEG-4 Simple Face Animation Profile L1";
246  return "MPEG-4 Simple Face Animation Profile L2";
248  return "MPEG-4 Simple FBA Profile L1";
250  return "MPEG-4 Simple FBA Profile L2";
252  return "MPEG-4 Basic Animated Texture Profile L1";
254  return "MPEG-4 Basic Animated Texture Profile L2";
255  case Mpeg4AvcProfile:
256  return "MPEG-4 Advanced Audio Coding Profile";
257  case Mpeg4HybridProfile1:
258  return "MPEG-4 Hybrid Profile L1";
259  case Mpeg4HybridProfile2:
260  return "MPEG-4 Hybrid Profile L2";
262  return "MPEG-4 Basic Animated Texture Profile L1";
264  return "MPEG-4 Basic Animated Texture Profile L2";
266  return "MPEG-4 Basic Animated Texture Profile L3";
268  return "MPEG-4 Basic Animated Texture Profile L4";
270  return "MPEG-4 Core Scalable Profile L1";
272  return "MPEG-4 Core Scalable Profile L2";
274  return "MPEG-4 Core Scalable Profile L3";
276  return "MPEG-4 Advanced Coding Efficiency Profile L1";
278  return "MPEG-4 Advanced Coding Efficiency Profile L2";
280  return "MPEG-4 Advanced Coding Efficiency Profile L3";
282  return "MPEG-4 Advanced Coding Efficiency Profile L4";
284  return "MPEG-4 Advanced Core Profile L1";
286  return "MPEG-4 Advanced Core Profile L2";
288  return "MPEG-4 Advanced Scalable Texture L1";
290  return "MPEG-4 Advanced Scalable Texture L2";
292  return "MPEG-4 Simple Studio Profile L1";
294  return "MPEG-4 Simple Studio Profile L2";
296  return "MPEG-4 Simple Studio Profile L3";
298  return "MPEG-4 Simple Studio Profile L4";
300  return "MPEG-4 Core Studio Profile L1";
302  return "MPEG-4 Core Studio Profile L2";
304  return "MPEG-4 Core Studio Profile L3";
306  return "MPEG-4 Core Studio Profile L4";
308  return "MPEG-4 Advanced Simple Profile";
310  return "MPEG-4 Advanced Simple Profile L1";
312  return "MPEG-4 Advanced Simple Profile L2";
314  return "MPEG-4 Advanced Simple Profile L3";
316  return "MPEG-4 Advanced Simple Profile L4";
318  return "MPEG-4 Advanced Simple Profile L5";
320  return "MPEG-4 Advanced Simple Profile L3b";
322  return "MPEG-4 Fine Granularity Scalable Profile";
324  return "MPEG-4 Fine Granularity Scalable Profile L1";
326  return "MPEG-4 Fine Granularity Scalable Profile L2";
328  return "MPEG-4 Fine Granularity Scalable Profile L3";
330  return "MPEG-4 Fine Granularity Scalable Profile L4";
332  return "MPEG-4 Fine Granularity Scalable Profile L5";
333  default:
334  return "MPEG-4 Visual";
335  }
337  return "MPEG-4 Timed Text";
339  return "Musepack SV8";
341  switch (sub) {
342  case PcmIntBe:
343  return "Pulse Code Modulation (integer, big endian)";
344  case PcmIntLe:
345  return "Pulse Code Modulation (integer, little endian)";
346  case PcmFloatIeee:
347  return "Pulse Code Modulation (float, IEEE)";
348  default:
349  return "Pulse Code Modulation";
350  }
352  return "Portable Network Graphics";
354  return "ProRes";
356  return "QCELP";
358  return "Quicktime Audio";
360  return "Quicktime Video";
362  return "Real Audio";
364  return "Real Video";
366  return "SAOC";
368  return "SMV";
370  return "Streaming Text Stream";
372  return "Synthesized Texture Stream";
374  switch (sub) {
375  case 2:
376  return "Systems v2";
377  default:
378  return "Systems";
379  }
381  switch (sub) {
383  return "plain UTF-8 subtitle";
385  return "SubStation Alpha";
387  return "Advanced SubStation Alpha";
389  return "Universal Subtitle Format";
391  return "Web Video Text Tracks Format";
392  default:
393  return "Text subtitle";
394  }
396  return "Theora";
398  return "Tagged Image File Format";
400  return "Timed Text";
402  return "The True Audio";
404  return "uncompressed video frames";
406  return "Windows Media Video";
408  return "VobBtn Buttons";
410  return "VobSub";
412  return "Vorbis";
414  return "VP8";
416  return "VP9";
418  return "WavPack";
420  return "Windows Media Audio";
422  switch (sub) {
423  case 1:
424  return "Windows Media Video v1/v7";
425  case 2:
426  return "Windows Media Video v2/v8";
427  default:
428  return "Windows Media Video";
429  }
431  return "DVB subtitles";
433  return "Speex";
435  return "Monkey's Audio";
436  default:
437  return "unknown";
438  }
439 }
440 
446 const char *MediaFormat::abbreviation() const
447 {
448  switch (general) {
450  switch (sub) {
451  case AacMpeg2MainProfile:
452  return "MPEG-2 AAC Main";
454  return "MPEG-2 AAC-LC";
456  return "MPEG-2 AAC-SSR";
457  case AacMpeg4MainProfile:
458  return "MPEG-4 AAC Main";
460  return "MPEG-4 AAC-LC";
462  return "MPEG-4 AAC-SSR";
464  return "MPEG-4 AAC-LTP";
466  return "MPEG-4 ER AAC-LC";
468  return "MPEG-4 ER AAC-LC";
470  return "MPEG-4 ER AAC-LTP";
471  case AacMpeg4ERLowDelay:
472  return "MPEG-4 ER AAC-LD";
474  return "MPEG-4 ER AAC-ELD";
475  default:
476  return "AAC";
477  }
479  return "AC-3";
481  return "AC-4";
483  return "ADPCM ACM";
485  return "AFX";
487  return "ALAC";
489  return "ALS";
491  return "AMR";
493  return "H.264";
495  return "AV1";
497  return "BMP";
499  return "Daala";
501  return "Dirac";
503  switch (sub) {
504  case DtsLossless:
505  return "DTS Lossless";
506  case DtsExpress:
507  return "DTS LBR";
508  default:
509  return "DTS";
510  }
512  switch (sub) {
513  case DtsHdHighResolution:
514  return "DTS-HD High Resolution";
515  case DtsHdMasterAudio:
516  return "DTS-HD Master Audio";
517  case DtsExpress:
518  return "DTS-HD Express";
519  default:
520  return "DTS-HD";
521  }
523  return "E-AC-3";
525  return "EVRC";
527  return "FLAC";
529  return "FDS";
531  return "GIF";
533  return "3GPP2 CMF";
535  return "H.265";
537  return "IMAADPCM ACM";
539  switch (sub) {
541  return "BMP subtitle";
542  default:
543  return "Image subtitle";
544  }
546  return "Interaction Stream";
548  return "JPEG";
550  return "OggKate";
552  return "Opus";
554  return "MS ACM";
556  switch (sub) {
557  case 1:
558  return "MS MPEG-4 v1";
559  case 2:
560  return "MS MPEG-4 v2";
561  case 3:
562  return "MS MPEG-4 v3";
563  default:
564  return "MS MPEG-4";
565  }
567  return "MS VCM";
569  return "Dolby TrueHD";
571  switch (sub) {
572  case Mpeg1Layer1:
573  return "MP1";
574  case Mpeg1Layer2:
575  return "MP2";
576  case Mpeg1Layer3:
577  return "MP3";
578  default:
579  return "MPEG-1 Audio";
580  }
582  return "MP1";
584  switch (sub) {
585  case Mpeg1Layer1:
586  return "MP1";
587  case Mpeg1Layer2:
588  return "MP2";
589  case Mpeg1Layer3:
590  return "MP3";
591  default:
592  return "MPEG-2 Audio";
593  }
595  switch (sub) {
596  case Mpeg2SimpleProfile:
597  return "MPEG-2 SP";
598  case Mpeg2MainProfile:
599  return "MPEG-2 Main";
600  case Mpeg2SnrProfile:
601  return "MPEG-2 SNR";
602  case Mpeg2SpatialProfile:
603  return "MPEG-2 Spatial";
604  case Mpeg2HighProfile:
605  return "MPEG-2 High";
606  case Mpeg2422Profile:
607  return "MPEG-2 422";
608  default:
609  return "MPEG-2 Video";
610  }
612  switch (sub) {
613  case Mpeg4SimpleProfile1:
614  case Mpeg4SimpleProfile2:
615  case Mpeg4SimpleProfile3:
616  case Mpeg4SimpleProfile0:
617  return "MPEG-4 SP";
625  return "H.263";
626  case Mpeg4AvcProfile:
627  return "H.264";
628  default:
629  return "MPEG-4 Visual";
630  }
632  return "MPC";
634  switch (sub) {
635  case PcmIntBe:
636  return "PCM (int, BE)";
637  case PcmIntLe:
638  return "PCM (int, LE)";
639  case PcmFloatIeee:
640  return "PCM IEEE";
641  default:
642  return "PCM";
643  }
645  return "PNG";
647  return "ProRes";
649  return "QCELP";
651  return "Quicktime Audio";
653  return "Quicktime Video";
655  return "Real Audio";
657  return "Real Video";
659  return "SAOC";
661  return "SMV";
663  return "Streaming Text Stream";
665  return "Synthesized Texture Stream";
667  switch (sub) {
668  case 2:
669  return "Systems v2";
670  default:
671  return "Systems";
672  }
674  switch (sub) {
676  return "";
678  return "SSA";
680  return "ASS";
682  return "USF";
684  return "WebVTT";
685  default:
686  return "";
687  }
689  return "Theora";
691  return "TIFF";
693  return "Timed Text";
695  return "TTA";
697  return "uncompressed video frames";
699  return "VC-1";
701  return "VobBtn";
703  return "VobSub";
705  return "Vorbis";
707  return "VP8";
709  return "VP9";
711  return "WavPack";
713  return "WMA";
715  return "WMV";
717  return "DVBSUB";
719  return "Speex";
720  default:
721  return "";
722  }
723 }
724 
731 {
732  switch (general) {
734  switch (sub) {
735  case AacMpeg2MainProfile:
736  case AacMpeg4MainProfile:
737  return "AAC-Main";
741  switch (extension) {
742  using namespace ExtensionFormats;
744  case ParametricStereo:
746  return "HE-AAC";
747  default:
748  return "AAC-LC";
749  }
751  return "AAC-LC";
754  return "AAC-SSR";
757  return "AAC-LTP";
758  case AacMpeg4ERLowDelay:
759  return "AAC-LD";
761  return "AAC-ELD";
762  default:
763  return "AAC";
764  }
766  return "AC3";
768  return "AC4";
770  return "ADPCM-ACM";
772  return "AFX";
774  return "ALAC";
776  return "ALS";
778  return "AMR";
780  return "H.264";
782  return "AV1";
784  return "BMP";
786  return "Daala";
788  return "Dirac";
790  switch (sub) {
791  case DtsLossless:
792  return "DTS-Lossless";
793  case DtsExpress:
794  return "DTS-LBR";
795  default:
796  return "DTS";
797  }
799  return "DTS-HD";
801  return "E-AC-3";
803  return "EVRC";
805  return "FLAC";
807  return "FDS";
809  return "GIF";
811  return "3GPP2-CMF";
813  return "H.265";
815  return "IMAADPCM-ACM";
817  return "BMP";
819  return "JPEG";
821  return "OggKate";
823  return "Opus";
825  return "MS-ACM";
827  return "MS-MPEG-4";
829  return "MS-VCM";
831  return "TrueHD";
833  switch (sub) {
834  case Mpeg1Layer1:
835  return "MP1";
836  case Mpeg1Layer2:
837  return "MP2";
838  default:
839  // since MP3 is backward compatible, it is ok to use it also as fallback
840  return "MP3";
841  }
843  return "MP1";
845  switch (sub) {
846  case Mpeg1Layer1:
847  return "MP1";
848  case Mpeg1Layer2:
849  return "MP2";
850  default:
851  // since MP3 is backward compatible, it is ok to use it also as fallback
852  return "MP3";
853  }
855  switch (sub) {
856  case Mpeg2SimpleProfile:
857  return "MPEG-2-SP";
858  case Mpeg2MainProfile:
859  return "MPEG-2-Main";
860  case Mpeg2SnrProfile:
861  return "MPEG-2-SNR";
862  case Mpeg2SpatialProfile:
863  return "MPEG-2-Spatial";
864  case Mpeg2HighProfile:
865  return "MPEG-2-High";
866  case Mpeg2422Profile:
867  return "MPEG-2-422";
868  default:
869  return "MPEG-2";
870  }
872  switch (sub) {
873  case Mpeg4SimpleProfile1:
874  case Mpeg4SimpleProfile2:
875  case Mpeg4SimpleProfile3:
876  case Mpeg4SimpleProfile0:
877  return "MPEG-4-SP";
885  return "H.263";
886  case Mpeg4AvcProfile:
887  return "H.264";
888  default:
889  return "MPEG-4-Visual";
890  }
892  return "MPC";
894  return "PCM";
896  return "PNG";
898  return "ProRes";
900  return "QCELP";
902  return "Qt-Audio";
904  return "Qt-Video";
906  return "Real-Audio";
908  return "Real-Video";
910  return "SAOC";
912  return "SMV";
914  return "Systems";
916  switch (sub) {
918  return "UTF-8";
920  return "SSA";
922  return "ASS";
924  return "USF";
926  return "WebVTT";
927  default:
928  return "";
929  }
931  return "Theora";
933  return "TIFF";
935  return "Timed-Text";
937  return "TTA";
939  return "RAW";
941  return "VC-1";
943  return "VobBtn";
945  return "VobSub";
947  return "Vorbis";
949  return "VP8";
951  return "VP9";
953  return "WavPack";
955  return "WMA";
957  return "WMV";
959  return "DVBSUB";
961  return "Speex";
963  return "APE";
964  default:
965  return "";
966  }
967 }
968 
974 const char *MediaFormat::extensionName() const
975 {
976  switch (general) {
977  using namespace ExtensionFormats;
979  switch (extension) {
981  return "Spectral Band Replication / HE-AAC";
982  case ParametricStereo:
983  return "Parametric Stereo / HE-AAC v2"; // PS always implies SBR?
985  return "Spectral Band Replication and Parametric Stereo / HE-AAC v2";
986  default:;
987  }
988  break;
989  default:;
990  }
991  return "";
992 }
993 
997 const char *mediaTypeName(MediaType mediaType)
998 {
999  switch (mediaType) {
1000  case MediaType::Audio:
1001  return "Audio";
1002  case MediaType::Video:
1003  return "Video";
1004  case MediaType::Text:
1005  return "Subititle";
1006  case MediaType::Hint:
1007  return "Hint";
1008  case MediaType::Buttons:
1009  return "Buttons";
1010  case MediaType::Control:
1011  return "Control";
1012  case MediaType::Unknown:
1013  return "Other";
1014  }
1015  return "";
1016 }
1017 
1018 } // namespace TagParser
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Definition: mediaformat.h:13
const char * extensionName() const
Returns the abbreviation of the media format as C-style string.
TAG_PARSER_EXPORT const char * mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.
const char * shortAbbreviation() const
Returns a short abbreviation of the media format as C-style string.
const char * name() const
Returns the name of the media format as C-style string.
Definition: mediaformat.cpp:17
const char * abbreviation() const
Returns the abbreviation of the media format as C-style string.
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9