Tag Parser  10.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 std::string_view 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 std::string_view 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  switch (sub) {
495  return "H.264 CAVLC 4:4:4 Intra";
496  case AvcBaselineProfile:
497  return "H.264 Basline";
498  case AvcMainProfile:
499  return "H.264 Main";
501  return "H.264 Scalable Basline";
503  return "H.264 Scalable High";
504  case AvcExtendedProfile:
505  return "H.264 Extended";
506  case AvcHighProfile:
507  return "H.264 High";
508  case AvcHigh10Profile:
509  return "H.264 High 10";
511  return "H.264 Multiview";
512  case AvcHigh422Profile:
513  return "H.264 High 4:2:2";
515  return "H.264 Stereo High";
517  return "H.264 Multiview Depth High";
518  case AvcHigh444Profile:
519  return "H.264 High 4:4:4";
521  return "H.264 High 4:4:4 Predictive";
522  default:
523  return "H.264";
524  }
526  return "AV1";
528  return "BMP";
530  return "Daala";
532  return "Dirac";
534  switch (sub) {
535  case DtsLossless:
536  return "DTS Lossless";
537  case DtsExpress:
538  return "DTS LBR";
539  default:
540  return "DTS";
541  }
543  switch (sub) {
544  case DtsHdHighResolution:
545  return "DTS-HD High Resolution";
546  case DtsHdMasterAudio:
547  return "DTS-HD Master Audio";
548  case DtsExpress:
549  return "DTS-HD Express";
550  default:
551  return "DTS-HD";
552  }
554  return "E-AC-3";
556  return "EVRC";
558  return "FLAC";
560  return "FDS";
562  return "GIF";
564  return "3GPP2 CMF";
566  return "H.265";
568  return "IMAADPCM ACM";
570  switch (sub) {
572  return "BMP subtitle";
573  default:
574  return "Image subtitle";
575  }
577  return "Interaction Stream";
579  return "JPEG";
581  return "OggKate";
583  return "Opus";
585  return "MS ACM";
587  switch (sub) {
588  case 1:
589  return "MS MPEG-4 v1";
590  case 2:
591  return "MS MPEG-4 v2";
592  case 3:
593  return "MS MPEG-4 v3";
594  default:
595  return "MS MPEG-4";
596  }
598  return "MS VCM";
600  return "Dolby TrueHD";
602  switch (sub) {
603  case Mpeg1Layer1:
604  return "MP1";
605  case Mpeg1Layer2:
606  return "MP2";
607  case Mpeg1Layer3:
608  return "MP3";
609  default:
610  return "MPEG-1 Audio";
611  }
613  return "MP1";
615  switch (sub) {
616  case Mpeg1Layer1:
617  return "MP1";
618  case Mpeg1Layer2:
619  return "MP2";
620  case Mpeg1Layer3:
621  return "MP3";
622  default:
623  return "MPEG-2 Audio";
624  }
626  switch (sub) {
627  case Mpeg2SimpleProfile:
628  return "MPEG-2 SP";
629  case Mpeg2MainProfile:
630  return "MPEG-2 Main";
631  case Mpeg2SnrProfile:
632  return "MPEG-2 SNR";
633  case Mpeg2SpatialProfile:
634  return "MPEG-2 Spatial";
635  case Mpeg2HighProfile:
636  return "MPEG-2 High";
637  case Mpeg2422Profile:
638  return "MPEG-2 422";
639  default:
640  return "MPEG-2 Video";
641  }
643  switch (sub) {
644  case Mpeg4SimpleProfile1:
645  case Mpeg4SimpleProfile2:
646  case Mpeg4SimpleProfile3:
647  case Mpeg4SimpleProfile0:
648  return "MPEG-4 SP";
656  return "MPEG-4 ASP";
657  case Mpeg4AvcProfile:
658  return "H.264";
659  default:
660  return "MPEG-4 Visual";
661  }
663  return "MPC";
665  switch (sub) {
666  case PcmIntBe:
667  return "PCM (int, BE)";
668  case PcmIntLe:
669  return "PCM (int, LE)";
670  case PcmFloatIeee:
671  return "PCM IEEE";
672  default:
673  return "PCM";
674  }
676  return "PNG";
678  return "ProRes";
680  return "QCELP";
682  return "Quicktime Audio";
684  return "Quicktime Video";
686  return "Real Audio";
688  return "Real Video";
690  return "SAOC";
692  return "SMV";
694  return "Streaming Text Stream";
696  return "Synthesized Texture Stream";
698  switch (sub) {
699  case 2:
700  return "Systems v2";
701  default:
702  return "Systems";
703  }
705  switch (sub) {
707  return "";
709  return "SSA";
711  return "ASS";
713  return "USF";
715  return "WebVTT";
716  default:
717  return "";
718  }
720  return "Theora";
722  return "TIFF";
724  return "Timed Text";
726  return "TTA";
728  return "uncompressed video frames";
730  return "VC-1";
732  return "VobBtn";
734  return "VobSub";
736  return "Vorbis";
738  return "VP8";
740  return "VP9";
742  return "WavPack";
744  return "WMA";
746  return "WMV";
748  return "DVBSUB";
750  return "Speex";
751  default:
752  return "";
753  }
754 }
755 
761 std::string_view MediaFormat::shortAbbreviation() const
762 {
763  switch (general) {
765  switch (sub) {
766  case AacMpeg2MainProfile:
767  case AacMpeg4MainProfile:
768  return "AAC-Main";
772  switch (extension) {
773  using namespace ExtensionFormats;
775  case ParametricStereo:
777  return "HE-AAC";
778  default:
779  return "AAC-LC";
780  }
782  return "AAC-LC";
785  return "AAC-SSR";
788  return "AAC-LTP";
789  case AacMpeg4ERLowDelay:
790  return "AAC-LD";
792  return "AAC-ELD";
793  default:
794  return "AAC";
795  }
797  return "AC3";
799  return "AC4";
801  return "ADPCM-ACM";
803  return "AFX";
805  return "ALAC";
807  return "ALS";
809  return "AMR";
811  switch (sub) {
813  return "H.264-CAVLC";
814  case AvcBaselineProfile:
815  return "H.264-Basline";
816  case AvcMainProfile:
817  return "H.264-Main";
819  return "H.264-Scalable-Basline";
821  return "H.264-Scalable-High";
822  case AvcExtendedProfile:
823  return "H.264-Extended";
824  case AvcHighProfile:
825  return "H.264-High";
826  case AvcHigh10Profile:
827  return "H.264-High-10";
829  return "H.264-Multiview";
830  case AvcHigh422Profile:
831  return "H.264-High-4:2:2";
833  return "H.264-Stereo-High";
835  return "H.264-Multiview-Depth-High";
836  case AvcHigh444Profile:
837  return "H.264-High-4:4:4";
839  return "H.264-High-4:4:4-Predictive";
840  default:
841  return "H.264";
842  }
844  return "AV1";
846  return "BMP";
848  return "Daala";
850  return "Dirac";
852  switch (sub) {
853  case DtsLossless:
854  return "DTS-Lossless";
855  case DtsExpress:
856  return "DTS-LBR";
857  default:
858  return "DTS";
859  }
861  return "DTS-HD";
863  return "E-AC-3";
865  return "EVRC";
867  return "FLAC";
869  return "FDS";
871  return "GIF";
873  return "3GPP2-CMF";
875  return "H.265";
877  return "IMAADPCM-ACM";
879  return "BMP";
881  return "JPEG";
883  return "OggKate";
885  return "Opus";
887  return "MS-ACM";
889  return "MS-MPEG-4";
891  return "MS-VCM";
893  return "TrueHD";
895  switch (sub) {
896  case Mpeg1Layer1:
897  return "MP1";
898  case Mpeg1Layer2:
899  return "MP2";
900  default:
901  // since MP3 is backward compatible, it is ok to use it also as fallback
902  return "MP3";
903  }
905  return "MP1";
907  switch (sub) {
908  case Mpeg1Layer1:
909  return "MP1";
910  case Mpeg1Layer2:
911  return "MP2";
912  default:
913  // since MP3 is backward compatible, it is ok to use it also as fallback
914  return "MP3";
915  }
917  switch (sub) {
918  case Mpeg2SimpleProfile:
919  return "MPEG-2-SP";
920  case Mpeg2MainProfile:
921  return "MPEG-2-Main";
922  case Mpeg2SnrProfile:
923  return "MPEG-2-SNR";
924  case Mpeg2SpatialProfile:
925  return "MPEG-2-Spatial";
926  case Mpeg2HighProfile:
927  return "MPEG-2-High";
928  case Mpeg2422Profile:
929  return "MPEG-2-422";
930  default:
931  return "MPEG-2";
932  }
934  switch (sub) {
935  case Mpeg4SimpleProfile1:
936  case Mpeg4SimpleProfile2:
937  case Mpeg4SimpleProfile3:
938  case Mpeg4SimpleProfile0:
939  return "MPEG-4-SP";
947  return "MPEG-4-ASP";
948  case Mpeg4AvcProfile:
949  return "H.264";
950  default:
951  return "MPEG-4-Visual";
952  }
954  return "MPC";
956  return "PCM";
958  return "PNG";
960  return "ProRes";
962  return "QCELP";
964  return "Qt-Audio";
966  return "Qt-Video";
968  return "Real-Audio";
970  return "Real-Video";
972  return "SAOC";
974  return "SMV";
976  return "Systems";
978  switch (sub) {
980  return "UTF-8";
982  return "SSA";
984  return "ASS";
986  return "USF";
988  return "WebVTT";
989  default:
990  return "";
991  }
993  return "Theora";
995  return "TIFF";
997  return "Timed-Text";
999  return "TTA";
1001  return "RAW";
1003  return "VC-1";
1005  return "VobBtn";
1007  return "VobSub";
1009  return "Vorbis";
1011  return "VP8";
1013  return "VP9";
1015  return "WavPack";
1017  return "WMA";
1019  return "WMV";
1021  return "DVBSUB";
1023  return "Speex";
1025  return "APE";
1026  default:
1027  return "";
1028  }
1029 }
1030 
1036 std::string_view MediaFormat::extensionName() const
1037 {
1038  switch (general) {
1039  using namespace ExtensionFormats;
1041  switch (extension) {
1043  return "Spectral Band Replication / HE-AAC";
1044  case ParametricStereo:
1045  return "Parametric Stereo / HE-AAC v2"; // PS always implies SBR?
1047  return "Spectral Band Replication and Parametric Stereo / HE-AAC v2";
1048  default:;
1049  }
1050  break;
1051  default:;
1052  }
1053  return "";
1054 }
1055 
1059 std::string_view mediaTypeName(MediaType mediaType)
1060 {
1061  switch (mediaType) {
1062  case MediaType::Unknown:
1063  return "Other";
1064  case MediaType::Audio:
1065  return "Audio";
1066  case MediaType::Video:
1067  return "Video";
1068  case MediaType::Text:
1069  return "Subititle";
1070  case MediaType::Buttons:
1071  return "Buttons";
1072  case MediaType::Control:
1073  return "Control";
1074  case MediaType::Hint:
1075  return "Hint";
1076  case MediaType::Meta:
1077  return "Meta-data";
1078  }
1079  return "";
1080 }
1081 
1082 } // namespace TagParser
std::string_view abbreviation() const
Returns the abbreviation of the media format as C-style string.
std::string_view shortAbbreviation() const
Returns a short abbreviation of the media format as C-style string.
std::string_view name() const
Returns the name of the media format as C-style string.
Definition: mediaformat.cpp:17
std::string_view extensionName() const
Returns the abbreviation of the media format as C-style string.
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
@ MonkeysAudio
Definition: signature.cpp:52
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Definition: mediaformat.h:14
TAG_PARSER_EXPORT std::string_view mediaTypeName(MediaType mediaType)
Returns the string representation for the specified mediaType.