Tag Parser  7.0.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 "Windows Bitmap";
99  return "Daala";
101  return "Dirac";
103  switch (sub) {
104  case DtsLossless:
105  return "DTS Lossless";
106  case DtsExpress:
107  return "DTS Express";
108  default:
109  return "DTS";
110  }
112  switch (sub) {
113  case DtsHdHighResolution:
114  return "DTS-HD High Resolution";
115  case DtsHdMasterAudio:
116  return "DTS-HD Master Audio";
117  case DtsExpress:
118  return "DTS-HD Express";
119  default:
120  return "DTS-HD";
121  }
123  return "Dolby Digital Plus";
125  return "EVRC";
127  return "Free Lossless Audio Codec";
129  return "Font Data Stream";
131  return "GIF";
133  return "3GPP2 Compact Multimedia Format (CMF)";
135  return "High Efficiency Video Coding";
137  return "IMAADPCM ACM";
139  switch (sub) {
141  return "Bitmap subtitle";
142  default:
143  return "Image subtitle";
144  }
146  return "Interaction Stream";
148  return "JPEG";
150  return "Karaoke And Text Encapsulation";
152  return "Opus";
154  return "Microsoft Audio Codec Manager";
156  switch (sub) {
157  case 1:
158  return "Microsoft MPEG-4 version 1";
159  case 2:
160  return "Microsoft MPEG-4 version 2";
161  case 3:
162  return "Microsoft MPEG-4 version 3";
163  default:
164  return "Microsoft MPEG-4";
165  }
167  return "Microsoft Video Codec Manager";
169  return "Dolby TrueHD";
171  switch (sub) {
172  case Mpeg1Layer1:
173  return "MPEG-1 Layer 1";
174  case Mpeg1Layer2:
175  return "MPEG-1 Layer 2";
176  case Mpeg1Layer3:
177  return "MPEG-1 Layer 3";
178  default:
179  return "MPEG-1 Audio";
180  }
182  return "MPEG-1 Video";
184  switch (sub) {
185  case Mpeg1Layer1:
186  return "MPEG-2 Layer 1";
187  case Mpeg1Layer2:
188  return "MPEG-2 Layer 2";
189  case Mpeg1Layer3:
190  return "MPEG-2 Layer 3";
191  default:
192  return "MPEG-2 Audio";
193  }
195  switch (sub) {
196  case Mpeg2SimpleProfile:
197  return "MPEG-2 Video Simple Profile";
198  case Mpeg2MainProfile:
199  return "MPEG-2 Video Main Profile";
200  case Mpeg2SnrProfile:
201  return "MPEG-2 Video SNR Profile";
202  case Mpeg2SpatialProfile:
203  return "MPEG-2 Video Spatial Profile";
204  case Mpeg2HighProfile:
205  return "MPEG-2 Video High Profile";
206  case Mpeg2422Profile:
207  return "MPEG-2 Video 422 Profile";
208  default:
209  return "MPEG-2 Video";
210  }
212  switch (sub) {
213  case Mpeg4SimpleProfile1:
214  return "MPEG-4 Simple Profile L1";
215  case Mpeg4SimpleProfile2:
216  return "MPEG-4 Simple Profile L2";
217  case Mpeg4SimpleProfile3:
218  return "MPEG-4 Simple Profile L2";
219  case Mpeg4SimpleProfile0:
220  return "MPEG-4 Simple Profile";
222  return "MPEG-4 Simple Scalable Profile";
224  return "MPEG-4 Simple Scalable Profile L1";
226  return "MPEG-4 Simple Scalable Profile L2";
227  case Mpeg4CoreProfile1:
228  return "MPEG-4 Core Profile L1";
229  case Mpeg4CoreProfiel2:
230  return "MPEG-4 Core Profile L2";
231  case Mpeg4MainProfile2:
232  return "MPEG-4 Main Profile L2";
233  case Mpeg4MainProfile3:
234  return "MPEG-4 Main Profile L3";
235  case Mpeg4MainProfile4:
236  return "MPEG-4 Main Profile L4";
237  case Mpeg4NBitPrifle2:
238  return "MPEG-4 N-Bit Profile L2";
240  return "MPEG-4 Scalable Texture Profile L1";
242  return "MPEG-4 Simple Face Animation Profile L1";
244  return "MPEG-4 Simple Face Animation Profile L2";
246  return "MPEG-4 Simple FBA Profile L1";
248  return "MPEG-4 Simple FBA Profile L2";
250  return "MPEG-4 Basic Animated Texture Profile L1";
252  return "MPEG-4 Basic Animated Texture Profile L2";
253  case Mpeg4AvcProfile:
254  return "MPEG-4 Advanced Audio Coding Profile";
255  case Mpeg4HybridProfile1:
256  return "MPEG-4 Hybrid Profile L1";
257  case Mpeg4HybridProfile2:
258  return "MPEG-4 Hybrid Profile L2";
260  return "MPEG-4 Basic Animated Texture Profile L1";
262  return "MPEG-4 Basic Animated Texture Profile L2";
264  return "MPEG-4 Basic Animated Texture Profile L3";
266  return "MPEG-4 Basic Animated Texture Profile L4";
268  return "MPEG-4 Core Scalable Profile L1";
270  return "MPEG-4 Core Scalable Profile L2";
272  return "MPEG-4 Core Scalable Profile L3";
274  return "MPEG-4 Advanced Coding Efficiency Profile L1";
276  return "MPEG-4 Advanced Coding Efficiency Profile L2";
278  return "MPEG-4 Advanced Coding Efficiency Profile L3";
280  return "MPEG-4 Advanced Coding Efficiency Profile L4";
282  return "MPEG-4 Advanced Core Profile L1";
284  return "MPEG-4 Advanced Core Profile L2";
286  return "MPEG-4 Advanced Scalable Texture L1";
288  return "MPEG-4 Advanced Scalable Texture L2";
290  return "MPEG-4 Simple Studio Profile L1";
292  return "MPEG-4 Simple Studio Profile L2";
294  return "MPEG-4 Simple Studio Profile L3";
296  return "MPEG-4 Simple Studio Profile L4";
298  return "MPEG-4 Core Studio Profile L1";
300  return "MPEG-4 Core Studio Profile L2";
302  return "MPEG-4 Core Studio Profile L3";
304  return "MPEG-4 Core Studio Profile L4";
306  return "MPEG-4 Advanced Simple Profile";
308  return "MPEG-4 Advanced Simple Profile L1";
310  return "MPEG-4 Advanced Simple Profile L2";
312  return "MPEG-4 Advanced Simple Profile L3";
314  return "MPEG-4 Advanced Simple Profile L4";
316  return "MPEG-4 Advanced Simple Profile L5";
318  return "MPEG-4 Advanced Simple Profile L3b";
320  return "MPEG-4 Fine Granularity Scalable Profile";
322  return "MPEG-4 Fine Granularity Scalable Profile L1";
324  return "MPEG-4 Fine Granularity Scalable Profile L2";
326  return "MPEG-4 Fine Granularity Scalable Profile L3";
328  return "MPEG-4 Fine Granularity Scalable Profile L4";
330  return "MPEG-4 Fine Granularity Scalable Profile L5";
331  default:
332  return "MPEG-4 Visual";
333  }
335  return "MPEG-4 Timed Text";
337  return "Musepack SV8";
339  switch (sub) {
340  case PcmIntBe:
341  return "Pulse Code Modulation (integer, big endian)";
342  case PcmIntLe:
343  return "Pulse Code Modulation (integer, little endian)";
344  case PcmFloatIeee:
345  return "Pulse Code Modulation (float, IEEE)";
346  default:
347  return "Pulse Code Modulation";
348  }
350  return "Portable Network Graphics";
352  return "ProRes";
354  return "QCELP";
356  return "Quicktime Audio";
358  return "Quicktime Video";
360  return "Real Audio";
362  return "Real Video";
364  return "SAOC";
366  return "SMV";
368  return "Streaming Text Stream";
370  return "Synthesized Texture Stream";
372  switch (sub) {
373  case 2:
374  return "Systems v2";
375  default:
376  return "Systems";
377  }
379  switch (sub) {
381  return "plain UTF-8 subtitle";
383  return "SubStation Alpha";
385  return "Advanced SubStation Alpha";
387  return "Universal Subtitle Format";
389  return "Web Video Text Tracks Format";
390  default:
391  return "Text subtitle";
392  }
394  return "Theora";
396  return "Tagged Image File Format";
398  return "Timed Text";
400  return "The True Audio";
402  return "uncompressed video frames";
404  return "Windows Media Video";
406  return "VobBtn Buttons";
408  return "VobSub";
410  return "Vorbis";
412  return "VP8";
414  return "VP9";
416  return "WavPack";
418  return "Windows Media Audio";
420  switch (sub) {
421  case 1:
422  return "Windows Media Video v1/v7";
423  case 2:
424  return "Windows Media Video v2/v8";
425  default:
426  return "Windows Media Video";
427  }
429  return "DVB subtitles";
431  return "Speex";
433  return "Monkey's Audio";
434  default:
435  return "unknown";
436  }
437 }
438 
444 const char *MediaFormat::abbreviation() const
445 {
446  switch (general) {
448  switch (sub) {
449  case AacMpeg2MainProfile:
450  return "MPEG-2 AAC Main";
452  return "MPEG-2 AAC-LC";
454  return "MPEG-2 AAC-SSR";
455  case AacMpeg4MainProfile:
456  return "MPEG-4 AAC Main";
458  return "MPEG-4 AAC-LC";
460  return "MPEG-4 AAC-SSR";
462  return "MPEG-4 AAC-LTP";
464  return "MPEG-4 ER AAC-LC";
466  return "MPEG-4 ER AAC-LC";
468  return "MPEG-4 ER AAC-LTP";
469  case AacMpeg4ERLowDelay:
470  return "MPEG-4 ER AAC-LD";
472  return "MPEG-4 ER AAC-ELD";
473  default:
474  return "AAC";
475  }
477  return "AC-3";
479  return "AC-4";
481  return "ADPCM ACM";
483  return "AFX";
485  return "ALAC";
487  return "ALS";
489  return "AMR";
491  return "H.264";
493  return "BMP";
495  return "Daala";
497  return "Dirac";
499  switch (sub) {
500  case DtsLossless:
501  return "DTS Lossless";
502  case DtsExpress:
503  return "DTS LBR";
504  default:
505  return "DTS";
506  }
508  switch (sub) {
509  case DtsHdHighResolution:
510  return "DTS-HD High Resolution";
511  case DtsHdMasterAudio:
512  return "DTS-HD Master Audio";
513  case DtsExpress:
514  return "DTS-HD Express";
515  default:
516  return "DTS-HD";
517  }
519  return "E-AC-3";
521  return "EVRC";
523  return "FLAC";
525  return "FDS";
527  return "GIF";
529  return "3GPP2 CMF";
531  return "H.265";
533  return "IMAADPCM ACM";
535  switch (sub) {
537  return "BMP subtitle";
538  default:
539  return "Image subtitle";
540  }
542  return "Interaction Stream";
544  return "JPEG";
546  return "OggKate";
548  return "Opus";
550  return "MS ACM";
552  switch (sub) {
553  case 1:
554  return "MS MPEG-4 v1";
555  case 2:
556  return "MS MPEG-4 v2";
557  case 3:
558  return "MS MPEG-4 v3";
559  default:
560  return "MS MPEG-4";
561  }
563  return "MS VCM";
565  return "Dolby TrueHD";
567  switch (sub) {
568  case Mpeg1Layer1:
569  return "MP1";
570  case Mpeg1Layer2:
571  return "MP2";
572  case Mpeg1Layer3:
573  return "MP3";
574  default:
575  return "MPEG-1 Audio";
576  }
578  return "MP1";
580  switch (sub) {
581  case Mpeg1Layer1:
582  return "MP1";
583  case Mpeg1Layer2:
584  return "MP2";
585  case Mpeg1Layer3:
586  return "MP3";
587  default:
588  return "MPEG-2 Audio";
589  }
591  switch (sub) {
592  case Mpeg2SimpleProfile:
593  return "MPEG-2 SP";
594  case Mpeg2MainProfile:
595  return "MPEG-2 Main";
596  case Mpeg2SnrProfile:
597  return "MPEG-2 SNR";
598  case Mpeg2SpatialProfile:
599  return "MPEG-2 Spatial";
600  case Mpeg2HighProfile:
601  return "MPEG-2 High";
602  case Mpeg2422Profile:
603  return "MPEG-2 422";
604  default:
605  return "MPEG-2 Video";
606  }
608  switch (sub) {
609  case Mpeg4SimpleProfile1:
610  case Mpeg4SimpleProfile2:
611  case Mpeg4SimpleProfile3:
612  case Mpeg4SimpleProfile0:
613  return "MPEG-4 SP";
621  return "H.263";
622  case Mpeg4AvcProfile:
623  return "H.264";
624  default:
625  return "MPEG-4 Visual";
626  }
628  return "MPC";
630  switch (sub) {
631  case PcmIntBe:
632  return "PCM (int, BE)";
633  case PcmIntLe:
634  return "PCM (int, LE)";
635  case PcmFloatIeee:
636  return "PCM IEEE";
637  default:
638  return "PCM";
639  }
641  return "PNG";
643  return "ProRes";
645  return "QCELP";
647  return "Quicktime Audio";
649  return "Quicktime Video";
651  return "Real Audio";
653  return "Real Video";
655  return "SAOC";
657  return "SMV";
659  return "Streaming Text Stream";
661  return "Synthesized Texture Stream";
663  switch (sub) {
664  case 2:
665  return "Systems v2";
666  default:
667  return "Systems";
668  }
670  switch (sub) {
672  return "";
674  return "SSA";
676  return "ASS";
678  return "USF";
680  return "WebVTT";
681  default:
682  return "";
683  }
685  return "Theora";
687  return "TIFF";
689  return "Timed Text";
691  return "TTA";
693  return "uncompressed video frames";
695  return "VC-1";
697  return "VobBtn";
699  return "VobSub";
701  return "Vorbis";
703  return "VP8";
705  return "VP9";
707  return "WavPack";
709  return "WMA";
711  return "WMV";
713  return "DVBSUB";
715  return "Speex";
716  default:
717  return "";
718  }
719 }
720 
727 {
728  switch (general) {
730  switch (sub) {
731  case AacMpeg2MainProfile:
732  case AacMpeg4MainProfile:
733  return "AAC-Main";
737  switch (extension) {
738  using namespace ExtensionFormats;
740  case ParametricStereo:
742  return "HE-AAC";
743  default:
744  return "AAC-LC";
745  }
747  return "AAC-LC";
750  return "AAC-SSR";
753  return "AAC-LTP";
754  case AacMpeg4ERLowDelay:
755  return "AAC-LD";
757  return "AAC-ELD";
758  default:
759  return "AAC";
760  }
762  return "AC3";
764  return "AC4";
766  return "ADPCM-ACM";
768  return "AFX";
770  return "ALAC";
772  return "ALS";
774  return "AMR";
776  return "H.264";
778  return "BMP";
780  return "Daala";
782  return "Dirac";
784  switch (sub) {
785  case DtsLossless:
786  return "DTS-Lossless";
787  case DtsExpress:
788  return "DTS-LBR";
789  default:
790  return "DTS";
791  }
793  return "DTS-HD";
795  return "E-AC-3";
797  return "EVRC";
799  return "FLAC";
801  return "FDS";
803  return "GIF";
805  return "3GPP2-CMF";
807  return "H.265";
809  return "IMAADPCM-ACM";
811  return "BMP";
813  return "JPEG";
815  return "OggKate";
817  return "Opus";
819  return "MS-ACM";
821  return "MS-MPEG-4";
823  return "MS-VCM";
825  return "TrueHD";
827  switch (sub) {
828  case Mpeg1Layer1:
829  return "MP1";
830  case Mpeg1Layer2:
831  return "MP2";
832  default:
833  // since MP3 is backward compatible, it is ok to use it also as fallback
834  return "MP3";
835  }
837  return "MP1";
839  switch (sub) {
840  case Mpeg1Layer1:
841  return "MP1";
842  case Mpeg1Layer2:
843  return "MP2";
844  default:
845  // since MP3 is backward compatible, it is ok to use it also as fallback
846  return "MP3";
847  }
849  switch (sub) {
850  case Mpeg2SimpleProfile:
851  return "MPEG-2-SP";
852  case Mpeg2MainProfile:
853  return "MPEG-2-Main";
854  case Mpeg2SnrProfile:
855  return "MPEG-2-SNR";
856  case Mpeg2SpatialProfile:
857  return "MPEG-2-Spatial";
858  case Mpeg2HighProfile:
859  return "MPEG-2-High";
860  case Mpeg2422Profile:
861  return "MPEG-2-422";
862  default:
863  return "MPEG-2";
864  }
866  switch (sub) {
867  case Mpeg4SimpleProfile1:
868  case Mpeg4SimpleProfile2:
869  case Mpeg4SimpleProfile3:
870  case Mpeg4SimpleProfile0:
871  return "MPEG-4-SP";
879  return "H.263";
880  case Mpeg4AvcProfile:
881  return "H.264";
882  default:
883  return "MPEG-4-Visual";
884  }
886  return "MPC";
888  return "PCM";
890  return "PNG";
892  return "ProRes";
894  return "QCELP";
896  return "Qt-Audio";
898  return "Qt-Video";
900  return "Real-Audio";
902  return "Real-Video";
904  return "SAOC";
906  return "SMV";
908  return "Systems";
910  switch (sub) {
912  return "UTF-8";
914  return "SSA";
916  return "ASS";
918  return "USF";
920  return "WebVTT";
921  default:
922  return "";
923  }
925  return "Theora";
927  return "TIFF";
929  return "Timed-Text";
931  return "TTA";
933  return "RAW";
935  return "VC-1";
937  return "VobBtn";
939  return "VobSub";
941  return "Vorbis";
943  return "VP8";
945  return "VP9";
947  return "WavPack";
949  return "WMA";
951  return "WMV";
953  return "DVBSUB";
955  return "Speex";
957  return "APE";
958  default:
959  return "";
960  }
961 }
962 
968 const char *MediaFormat::extensionName() const
969 {
970  switch (general) {
971  using namespace ExtensionFormats;
973  switch (extension) {
975  return "Spectral Band Replication / HE-AAC";
976  case ParametricStereo:
977  return "Parametric Stereo / HE-AAC v2"; // PS always implies SBR?
979  return "Spectral Band Replication and Parametric Stereo / HE-AAC v2";
980  default:;
981  }
982  break;
983  default:;
984  }
985  return "";
986 }
987 
991 const char *mediaTypeName(MediaType mediaType)
992 {
993  switch (mediaType) {
994  case MediaType::Audio:
995  return "Audio";
996  case MediaType::Video:
997  return "Video";
998  case MediaType::Text:
999  return "Subititle";
1000  case MediaType::Hint:
1001  return "Hint";
1002  case MediaType::Buttons:
1003  return "Buttons";
1004  case MediaType::Control:
1005  return "Control";
1006  case MediaType::Unknown:
1007  return "Other";
1008  default:
1009  return "";
1010  }
1011 }
1012 
1013 } // 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.
const char *TAG_PARSER_EXPORT 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.