Tag Parser 12.3.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
mediaformat.cpp
Go to the documentation of this file.
1#include "./mediaformat.h"
2
3namespace TagParser {
4
5using namespace SubFormats;
6
17std::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 Scalable 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";
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";
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";
76 return "Advanced Video Coding Extended Profile";
77 case AvcHighProfile:
78 return "Advanced Video Coding High Profile";
80 return "Advanced Video Coding High 10 Profile";
82 return "Advanced Video Coding Multiview Profile";
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";
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) {
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 "Versatile Video Coding";
141 return "IMAADPCM ACM";
143 switch (sub) {
145 return "Bitmap subtitle";
146 default:
147 return "Image subtitle";
148 }
150 return "Interaction Stream";
152 return "JPEG";
154 return "Karaoke And Text Encapsulation";
156 return "Opus";
158 return "Microsoft Audio Codec Manager";
160 switch (sub) {
161 case 1:
162 return "Microsoft MPEG-4 version 1";
163 case 2:
164 return "Microsoft MPEG-4 version 2";
165 case 3:
166 return "Microsoft MPEG-4 version 3";
167 default:
168 return "Microsoft MPEG-4";
169 }
171 return "Microsoft Video Codec Manager";
173 return "Dolby TrueHD";
175 switch (sub) {
176 case Mpeg1Layer1:
177 return "MPEG-1 Layer 1";
178 case Mpeg1Layer2:
179 return "MPEG-1 Layer 2";
180 case Mpeg1Layer3:
181 return "MPEG-1 Layer 3";
182 default:
183 return "MPEG-1 Audio";
184 }
186 return "MPEG-1 Video";
188 switch (sub) {
189 case Mpeg1Layer1:
190 return "MPEG-2 Layer 1";
191 case Mpeg1Layer2:
192 return "MPEG-2 Layer 2";
193 case Mpeg1Layer3:
194 return "MPEG-2 Layer 3";
195 default:
196 return "MPEG-2 Audio";
197 }
199 switch (sub) {
201 return "MPEG-2 Video Simple Profile";
202 case Mpeg2MainProfile:
203 return "MPEG-2 Video Main Profile";
204 case Mpeg2SnrProfile:
205 return "MPEG-2 Video SNR Profile";
207 return "MPEG-2 Video Spatial Profile";
208 case Mpeg2HighProfile:
209 return "MPEG-2 Video High Profile";
210 case Mpeg2422Profile:
211 return "MPEG-2 Video 422 Profile";
212 default:
213 return "MPEG-2 Video";
214 }
216 switch (sub) {
218 return "MPEG-4 Simple Profile L1";
220 return "MPEG-4 Simple Profile L2";
222 return "MPEG-4 Simple Profile L2";
224 return "MPEG-4 Simple Profile";
226 return "MPEG-4 Simple Scalable Profile";
228 return "MPEG-4 Simple Scalable Profile L1";
230 return "MPEG-4 Simple Scalable Profile L2";
232 return "MPEG-4 Core Profile L1";
234 return "MPEG-4 Core Profile L2";
236 return "MPEG-4 Main Profile L2";
238 return "MPEG-4 Main Profile L3";
240 return "MPEG-4 Main Profile L4";
241 case Mpeg4NBitPrifle2:
242 return "MPEG-4 N-Bit Profile L2";
244 return "MPEG-4 Scalable Texture Profile L1";
246 return "MPEG-4 Simple Face Animation Profile L1";
248 return "MPEG-4 Simple Face Animation Profile L2";
250 return "MPEG-4 Simple FBA Profile L1";
252 return "MPEG-4 Simple FBA Profile L2";
254 return "MPEG-4 Basic Animated Texture Profile L1";
256 return "MPEG-4 Basic Animated Texture Profile L2";
257 case Mpeg4AvcProfile:
258 return "MPEG-4 Advanced Audio Coding Profile";
260 return "MPEG-4 Hybrid Profile L1";
262 return "MPEG-4 Hybrid Profile L2";
264 return "MPEG-4 Basic Animated Texture Profile L1";
266 return "MPEG-4 Basic Animated Texture Profile L2";
268 return "MPEG-4 Basic Animated Texture Profile L3";
270 return "MPEG-4 Basic Animated Texture Profile L4";
272 return "MPEG-4 Core Scalable Profile L1";
274 return "MPEG-4 Core Scalable Profile L2";
276 return "MPEG-4 Core Scalable Profile L3";
278 return "MPEG-4 Advanced Coding Efficiency Profile L1";
280 return "MPEG-4 Advanced Coding Efficiency Profile L2";
282 return "MPEG-4 Advanced Coding Efficiency Profile L3";
284 return "MPEG-4 Advanced Coding Efficiency Profile L4";
286 return "MPEG-4 Advanced Core Profile L1";
288 return "MPEG-4 Advanced Core Profile L2";
290 return "MPEG-4 Advanced Scalable Texture L1";
292 return "MPEG-4 Advanced Scalable Texture L2";
294 return "MPEG-4 Simple Studio Profile L1";
296 return "MPEG-4 Simple Studio Profile L2";
298 return "MPEG-4 Simple Studio Profile L3";
300 return "MPEG-4 Simple Studio Profile L4";
302 return "MPEG-4 Core Studio Profile L1";
304 return "MPEG-4 Core Studio Profile L2";
306 return "MPEG-4 Core Studio Profile L3";
308 return "MPEG-4 Core Studio Profile L4";
310 return "MPEG-4 Advanced Simple Profile";
312 return "MPEG-4 Advanced Simple Profile L1";
314 return "MPEG-4 Advanced Simple Profile L2";
316 return "MPEG-4 Advanced Simple Profile L3";
318 return "MPEG-4 Advanced Simple Profile L4";
320 return "MPEG-4 Advanced Simple Profile L5";
322 return "MPEG-4 Advanced Simple Profile L3b";
324 return "MPEG-4 Fine Granularity Scalable Profile";
326 return "MPEG-4 Fine Granularity Scalable Profile L1";
328 return "MPEG-4 Fine Granularity Scalable Profile L2";
330 return "MPEG-4 Fine Granularity Scalable Profile L3";
332 return "MPEG-4 Fine Granularity Scalable Profile L4";
334 return "MPEG-4 Fine Granularity Scalable Profile L5";
335 default:
336 return "MPEG-4 Visual";
337 }
339 return "MPEG-4 Timed Text";
341 return "Musepack SV8";
343 switch (sub) {
344 case PcmIntBe:
345 return "Pulse Code Modulation (integer, big endian)";
346 case PcmIntLe:
347 return "Pulse Code Modulation (integer, little endian)";
348 case PcmFloatIeee:
349 return "Pulse Code Modulation (float, IEEE)";
350 default:
351 return "Pulse Code Modulation";
352 }
354 return "Portable Network Graphics";
356 return "ProRes";
358 return "QCELP";
360 return "Quicktime Audio";
362 return "Quicktime Video";
364 return "Real Audio";
366 return "Real Video";
368 return "SAOC";
370 return "SMV";
372 return "Streaming Text Stream";
374 return "Synthesized Texture Stream";
376 switch (sub) {
377 case 2:
378 return "Systems v2";
379 default:
380 return "Systems";
381 }
383 switch (sub) {
385 return "plain UTF-8 subtitle";
387 return "SubStation Alpha";
389 return "Advanced SubStation Alpha";
391 return "Universal Subtitle Format";
393 return "Web Video Text Tracks Format";
394 default:
395 return "Text subtitle";
396 }
398 return "Theora";
400 return "Tagged Image File Format";
402 return "Timed Text";
404 return "The True Audio";
406 return "uncompressed video frames";
408 return "Windows Media Video";
410 return "VobBtn Buttons";
412 return "VobSub";
414 return "Vorbis";
416 return "VP8";
418 return "VP9";
420 return "WavPack";
422 return "Windows Media Audio";
424 switch (sub) {
425 case 1:
426 return "Windows Media Video v1/v7";
427 case 2:
428 return "Windows Media Video v2/v8";
429 default:
430 return "Windows Media Video";
431 }
433 return "DVB subtitles";
435 return "Speex";
437 return "Monkey's Audio";
438 default:
439 return "unknown";
440 }
441}
442
448std::string_view MediaFormat::abbreviation() const
449{
450 switch (general) {
452 switch (sub) {
454 return "MPEG-2 AAC Main";
456 return "MPEG-2 AAC-LC";
458 return "MPEG-2 AAC-SSR";
460 return "MPEG-4 AAC Main";
462 return "MPEG-4 AAC-LC";
464 return "MPEG-4 AAC-SSR";
466 return "MPEG-4 AAC-LTP";
468 return "MPEG-4 ER AAC-LC";
470 return "MPEG-4 ER AAC-LC";
472 return "MPEG-4 ER AAC-LTP";
474 return "MPEG-4 ER AAC-LD";
476 return "MPEG-4 ER AAC-ELD";
477 default:
478 return "AAC";
479 }
481 return "AC-3";
483 return "AC-4";
485 return "ADPCM ACM";
487 return "AFX";
489 return "ALAC";
491 return "ALS";
493 return "AMR";
495 switch (sub) {
497 return "H.264 CAVLC 4:4:4 Intra";
499 return "H.264 Basline";
500 case AvcMainProfile:
501 return "H.264 Main";
503 return "H.264 Scalable Basline";
505 return "H.264 Scalable High";
507 return "H.264 Extended";
508 case AvcHighProfile:
509 return "H.264 High";
510 case AvcHigh10Profile:
511 return "H.264 High 10";
513 return "H.264 Multiview";
515 return "H.264 High 4:2:2";
517 return "H.264 Stereo High";
519 return "H.264 Multiview Depth High";
521 return "H.264 High 4:4:4";
523 return "H.264 High 4:4:4 Predictive";
524 default:
525 return "H.264";
526 }
528 return "AV1";
530 return "BMP";
532 return "Daala";
534 return "Dirac";
536 switch (sub) {
537 case DtsLossless:
538 return "DTS Lossless";
539 case DtsExpress:
540 return "DTS LBR";
541 default:
542 return "DTS";
543 }
545 switch (sub) {
547 return "DTS-HD High Resolution";
548 case DtsHdMasterAudio:
549 return "DTS-HD Master Audio";
550 case DtsExpress:
551 return "DTS-HD Express";
552 default:
553 return "DTS-HD";
554 }
556 return "E-AC-3";
558 return "EVRC";
560 return "FLAC";
562 return "FDS";
564 return "GIF";
566 return "3GPP2 CMF";
568 return "H.265";
570 return "H.266";
572 return "IMAADPCM ACM";
574 switch (sub) {
576 return "BMP subtitle";
577 default:
578 return "Image subtitle";
579 }
581 return "Interaction Stream";
583 return "JPEG";
585 return "OggKate";
587 return "Opus";
589 return "MS ACM";
591 switch (sub) {
592 case 1:
593 return "MS MPEG-4 v1";
594 case 2:
595 return "MS MPEG-4 v2";
596 case 3:
597 return "MS MPEG-4 v3";
598 default:
599 return "MS MPEG-4";
600 }
602 return "MS VCM";
604 return "Dolby TrueHD";
606 switch (sub) {
607 case Mpeg1Layer1:
608 return "MP1";
609 case Mpeg1Layer2:
610 return "MP2";
611 case Mpeg1Layer3:
612 return "MP3";
613 default:
614 return "MPEG-1 Audio";
615 }
617 return "MP1";
619 switch (sub) {
620 case Mpeg1Layer1:
621 return "MP1";
622 case Mpeg1Layer2:
623 return "MP2";
624 case Mpeg1Layer3:
625 return "MP3";
626 default:
627 return "MPEG-2 Audio";
628 }
630 switch (sub) {
632 return "MPEG-2 SP";
633 case Mpeg2MainProfile:
634 return "MPEG-2 Main";
635 case Mpeg2SnrProfile:
636 return "MPEG-2 SNR";
638 return "MPEG-2 Spatial";
639 case Mpeg2HighProfile:
640 return "MPEG-2 High";
641 case Mpeg2422Profile:
642 return "MPEG-2 422";
643 default:
644 return "MPEG-2 Video";
645 }
647 switch (sub) {
652 return "MPEG-4 SP";
660 return "MPEG-4 ASP";
661 case Mpeg4AvcProfile:
662 return "H.264";
663 default:
664 return "MPEG-4 Visual";
665 }
667 return "MPC";
669 switch (sub) {
670 case PcmIntBe:
671 return "PCM (int, BE)";
672 case PcmIntLe:
673 return "PCM (int, LE)";
674 case PcmFloatIeee:
675 return "PCM IEEE";
676 default:
677 return "PCM";
678 }
680 return "PNG";
682 return "ProRes";
684 return "QCELP";
686 return "Quicktime Audio";
688 return "Quicktime Video";
690 return "Real Audio";
692 return "Real Video";
694 return "SAOC";
696 return "SMV";
698 return "Streaming Text Stream";
700 return "Synthesized Texture Stream";
702 switch (sub) {
703 case 2:
704 return "Systems v2";
705 default:
706 return "Systems";
707 }
709 switch (sub) {
711 return "";
713 return "SSA";
715 return "ASS";
717 return "USF";
719 return "WebVTT";
720 default:
721 return "";
722 }
724 return "Theora";
726 return "TIFF";
728 return "Timed Text";
730 return "TTA";
732 return "uncompressed video frames";
734 return "VC-1";
736 return "VobBtn";
738 return "VobSub";
740 return "Vorbis";
742 return "VP8";
744 return "VP9";
746 return "WavPack";
748 return "WMA";
750 return "WMV";
752 return "DVBSUB";
754 return "Speex";
755 default:
756 return "";
757 }
758}
759
765std::string_view MediaFormat::shortAbbreviation() const
766{
767 switch (general) {
769 switch (sub) {
772 return "AAC-Main";
776 switch (extension) {
777 using namespace ExtensionFormats;
778 case SpectralBandReplication:
779 case ParametricStereo:
780 case (SpectralBandReplication | ParametricStereo):
781 return "HE-AAC";
782 default:
783 return "AAC-LC";
784 }
786 return "AAC-LC";
789 return "AAC-SSR";
792 return "AAC-LTP";
794 return "AAC-LD";
796 return "AAC-ELD";
797 default:
798 return "AAC";
799 }
801 return "AC3";
803 return "AC4";
805 return "ADPCM-ACM";
807 return "AFX";
809 return "ALAC";
811 return "ALS";
813 return "AMR";
815 switch (sub) {
817 return "H.264-CAVLC";
819 return "H.264-Basline";
820 case AvcMainProfile:
821 return "H.264-Main";
823 return "H.264-Scalable-Basline";
825 return "H.264-Scalable-High";
827 return "H.264-Extended";
828 case AvcHighProfile:
829 return "H.264-High";
830 case AvcHigh10Profile:
831 return "H.264-High-10";
833 return "H.264-Multiview";
835 return "H.264-High-4:2:2";
837 return "H.264-Stereo-High";
839 return "H.264-Multiview-Depth-High";
841 return "H.264-High-4:4:4";
843 return "H.264-High-4:4:4-Predictive";
844 default:
845 return "H.264";
846 }
848 return "AV1";
850 return "BMP";
852 return "Daala";
854 return "Dirac";
856 switch (sub) {
857 case DtsLossless:
858 return "DTS-Lossless";
859 case DtsExpress:
860 return "DTS-LBR";
861 default:
862 return "DTS";
863 }
865 return "DTS-HD";
867 return "E-AC-3";
869 return "EVRC";
871 return "FLAC";
873 return "FDS";
875 return "GIF";
877 return "3GPP2-CMF";
879 return "H.265";
881 return "H.266";
883 return "IMAADPCM-ACM";
885 return "BMP";
887 return "JPEG";
889 return "OggKate";
891 return "Opus";
893 return "MS-ACM";
895 return "MS-MPEG-4";
897 return "MS-VCM";
899 return "TrueHD";
901 switch (sub) {
902 case Mpeg1Layer1:
903 return "MP1";
904 case Mpeg1Layer2:
905 return "MP2";
906 default:
907 // since MP3 is backward compatible, it is ok to use it also as fallback
908 return "MP3";
909 }
911 return "MP1";
913 switch (sub) {
914 case Mpeg1Layer1:
915 return "MP1";
916 case Mpeg1Layer2:
917 return "MP2";
918 default:
919 // since MP3 is backward compatible, it is ok to use it also as fallback
920 return "MP3";
921 }
923 switch (sub) {
925 return "MPEG-2-SP";
926 case Mpeg2MainProfile:
927 return "MPEG-2-Main";
928 case Mpeg2SnrProfile:
929 return "MPEG-2-SNR";
931 return "MPEG-2-Spatial";
932 case Mpeg2HighProfile:
933 return "MPEG-2-High";
934 case Mpeg2422Profile:
935 return "MPEG-2-422";
936 default:
937 return "MPEG-2";
938 }
940 switch (sub) {
945 return "MPEG-4-SP";
953 return "MPEG-4-ASP";
954 case Mpeg4AvcProfile:
955 return "H.264";
956 default:
957 return "MPEG-4-Visual";
958 }
960 return "MPC";
962 return "PCM";
964 return "PNG";
966 return "ProRes";
968 return "QCELP";
970 return "Qt-Audio";
972 return "Qt-Video";
974 return "Real-Audio";
976 return "Real-Video";
978 return "SAOC";
980 return "SMV";
982 return "Systems";
984 switch (sub) {
986 return "UTF-8";
988 return "SSA";
990 return "ASS";
992 return "USF";
994 return "WebVTT";
995 default:
996 return "";
997 }
999 return "Theora";
1001 return "TIFF";
1003 return "Timed-Text";
1005 return "TTA";
1007 return "RAW";
1009 return "VC-1";
1011 return "VobBtn";
1013 return "VobSub";
1015 return "Vorbis";
1017 return "VP8";
1019 return "VP9";
1021 return "WavPack";
1023 return "WMA";
1025 return "WMV";
1027 return "DVBSUB";
1029 return "Speex";
1031 return "APE";
1032 default:
1033 return "";
1034 }
1035}
1036
1042std::string_view MediaFormat::extensionName() const
1043{
1044 switch (general) {
1045 using namespace ExtensionFormats;
1047 switch (extension) {
1048 case SpectralBandReplication:
1049 return "Spectral Band Replication / HE-AAC";
1050 case ParametricStereo:
1051 return "Parametric Stereo / HE-AAC v2"; // PS always implies SBR?
1052 case (SpectralBandReplication | ParametricStereo):
1053 return "Spectral Band Replication and Parametric Stereo / HE-AAC v2";
1054 default:;
1055 }
1056 break;
1057 default:;
1058 }
1059 return "";
1060}
1061
1065std::string_view mediaTypeName(MediaType mediaType)
1066{
1067 switch (mediaType) {
1068 case MediaType::Unknown:
1069 return "Other";
1070 case MediaType::Audio:
1071 return "Audio";
1072 case MediaType::Video:
1073 return "Video";
1074 case MediaType::Text:
1075 return "Subititle";
1076 case MediaType::Buttons:
1077 return "Buttons";
1078 case MediaType::Control:
1079 return "Control";
1080 case MediaType::Hint:
1081 return "Hint";
1082 case MediaType::Meta:
1083 return "Meta-data";
1084 }
1085 return "";
1086}
1087
1088} // 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.
std::string_view extensionName() const
Returns the abbreviation of the media format as C-style string.
unsigned char extension
GeneralMediaFormat general
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
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.