Tag Parser 12.5.3
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
11
16std::string_view MediaFormat::name() const
17{
18 switch (general) {
20 switch (sub) {
22 return "Advanced Audio Coding Main Profile";
24 return "Advanced Audio Coding Low Complexity Profile";
26 return "Advanced Audio Coding Scalable Sampling Rate Profile";
28 return "Advanced Audio Coding Main Profile";
30 return "Advanced Audio Coding Low Complexity Profile";
32 return "Advanced Audio Coding Scalable Sampling Rate Profile";
34 return "Advanced Audio Coding Long Term Predicition";
36 return "Advanced Audio Coding Error Resilient Low Complexity Profile";
38 return "Advanced Audio Coding Error Resilient Scalable Sampling Rate Profile";
40 return "Advanced Audio Coding Error Resilient Long Term Predicition";
42 return "Advanced Audio Coding Error Resilient Low Delay";
44 return "Advanced Audio Coding Error Resilient Enhanced Low Delay";
45 default:
46 return "Advanced Audio Coding";
47 }
49 return "Dolby Digital";
51 return "AC-4";
53 return "ADPCM ACM";
55 return "AFX Stream";
57 return "Apple Lossless Audio Codec";
59 return "ALS";
61 return "Adaptive Multi-Rate audio codec";
63 switch (sub) {
65 return "Advanced Video Coding CAVLC 4:4:4 Intra Profile";
67 return "Advanced Video Coding Basline Profile";
68 case AvcMainProfile:
69 return "Advanced Video Coding Main Profile";
71 return "Advanced Video Coding Scalable Basline Profile";
73 return "Advanced Video Coding Scalable High Profile";
75 return "Advanced Video Coding Extended Profile";
76 case AvcHighProfile:
77 return "Advanced Video Coding High Profile";
79 return "Advanced Video Coding High 10 Profile";
81 return "Advanced Video Coding Multiview Profile";
83 return "Advanced Video Coding High 4:2:2 Profile";
85 return "Advanced Video Coding Stereo High Profile";
87 return "Advanced Video Coding Multiview Depth High Profile";
89 return "Advanced Video Coding High 4:4:4 Profile";
91 return "Advanced Video Coding High 4:4:4 Predictive Profile";
92 default:
93 return "Advanced Video Coding";
94 }
96 return "AOMedia Video 1";
98 return "Windows Bitmap";
100 return "Daala";
102 return "Dirac";
104 switch (sub) {
105 case DtsLossless:
106 return "DTS Lossless";
107 case DtsExpress:
108 return "DTS Express";
109 default:
110 return "DTS";
111 }
113 switch (sub) {
115 return "DTS-HD High Resolution";
116 case DtsHdMasterAudio:
117 return "DTS-HD Master Audio";
118 case DtsExpress:
119 return "DTS-HD Express";
120 default:
121 return "DTS-HD";
122 }
124 return "Dolby Digital Plus";
126 return "EVRC";
128 return "Free Lossless Audio Codec";
130 return "Font Data Stream";
132 return "GIF";
134 return "3GPP2 Compact Multimedia Format (CMF)";
136 return "High Efficiency Video Coding";
138 return "Versatile Video Coding";
140 return "IMAADPCM ACM";
142 switch (sub) {
144 return "Bitmap subtitle";
145 default:
146 return "Image subtitle";
147 }
149 return "Interaction Stream";
151 return "JPEG";
153 return "Karaoke And Text Encapsulation";
155 return "Opus";
157 return "Microsoft Audio Codec Manager";
159 switch (sub) {
160 case 1:
161 return "Microsoft MPEG-4 version 1";
162 case 2:
163 return "Microsoft MPEG-4 version 2";
164 case 3:
165 return "Microsoft MPEG-4 version 3";
166 default:
167 return "Microsoft MPEG-4";
168 }
170 return "Microsoft Video Codec Manager";
172 return "Dolby TrueHD";
174 switch (sub) {
175 case Mpeg1Layer1:
176 return "MPEG-1 Layer 1";
177 case Mpeg1Layer2:
178 return "MPEG-1 Layer 2";
179 case Mpeg1Layer3:
180 return "MPEG-1 Layer 3";
181 default:
182 return "MPEG-1 Audio";
183 }
185 return "MPEG-1 Video";
187 switch (sub) {
188 case Mpeg1Layer1:
189 return "MPEG-2 Layer 1";
190 case Mpeg1Layer2:
191 return "MPEG-2 Layer 2";
192 case Mpeg1Layer3:
193 return "MPEG-2 Layer 3";
194 default:
195 return "MPEG-2 Audio";
196 }
198 switch (sub) {
200 return "MPEG-2 Video Simple Profile";
201 case Mpeg2MainProfile:
202 return "MPEG-2 Video Main Profile";
203 case Mpeg2SnrProfile:
204 return "MPEG-2 Video SNR Profile";
206 return "MPEG-2 Video Spatial Profile";
207 case Mpeg2HighProfile:
208 return "MPEG-2 Video High Profile";
209 case Mpeg2422Profile:
210 return "MPEG-2 Video 422 Profile";
211 default:
212 return "MPEG-2 Video";
213 }
215 switch (sub) {
217 return "MPEG-4 Simple Profile L1";
219 return "MPEG-4 Simple Profile L2";
221 return "MPEG-4 Simple Profile L2";
223 return "MPEG-4 Simple Profile";
225 return "MPEG-4 Simple Scalable Profile";
227 return "MPEG-4 Simple Scalable Profile L1";
229 return "MPEG-4 Simple Scalable Profile L2";
231 return "MPEG-4 Core Profile L1";
233 return "MPEG-4 Core Profile L2";
235 return "MPEG-4 Main Profile L2";
237 return "MPEG-4 Main Profile L3";
239 return "MPEG-4 Main Profile L4";
240 case Mpeg4NBitPrifle2:
241 return "MPEG-4 N-Bit Profile L2";
243 return "MPEG-4 Scalable Texture Profile L1";
245 return "MPEG-4 Simple Face Animation Profile L1";
247 return "MPEG-4 Simple Face Animation Profile L2";
249 return "MPEG-4 Simple FBA Profile L1";
251 return "MPEG-4 Simple FBA Profile L2";
253 return "MPEG-4 Basic Animated Texture Profile L1";
255 return "MPEG-4 Basic Animated Texture Profile L2";
256 case Mpeg4AvcProfile:
257 return "MPEG-4 Advanced Audio Coding Profile";
259 return "MPEG-4 Hybrid Profile L1";
261 return "MPEG-4 Hybrid Profile L2";
263 return "MPEG-4 Basic Animated Texture Profile L1";
265 return "MPEG-4 Basic Animated Texture Profile L2";
267 return "MPEG-4 Basic Animated Texture Profile L3";
269 return "MPEG-4 Basic Animated Texture Profile L4";
271 return "MPEG-4 Core Scalable Profile L1";
273 return "MPEG-4 Core Scalable Profile L2";
275 return "MPEG-4 Core Scalable Profile L3";
277 return "MPEG-4 Advanced Coding Efficiency Profile L1";
279 return "MPEG-4 Advanced Coding Efficiency Profile L2";
281 return "MPEG-4 Advanced Coding Efficiency Profile L3";
283 return "MPEG-4 Advanced Coding Efficiency Profile L4";
285 return "MPEG-4 Advanced Core Profile L1";
287 return "MPEG-4 Advanced Core Profile L2";
289 return "MPEG-4 Advanced Scalable Texture L1";
291 return "MPEG-4 Advanced Scalable Texture L2";
293 return "MPEG-4 Simple Studio Profile L1";
295 return "MPEG-4 Simple Studio Profile L2";
297 return "MPEG-4 Simple Studio Profile L3";
299 return "MPEG-4 Simple Studio Profile L4";
301 return "MPEG-4 Core Studio Profile L1";
303 return "MPEG-4 Core Studio Profile L2";
305 return "MPEG-4 Core Studio Profile L3";
307 return "MPEG-4 Core Studio Profile L4";
309 return "MPEG-4 Advanced Simple Profile";
311 return "MPEG-4 Advanced Simple Profile L1";
313 return "MPEG-4 Advanced Simple Profile L2";
315 return "MPEG-4 Advanced Simple Profile L3";
317 return "MPEG-4 Advanced Simple Profile L4";
319 return "MPEG-4 Advanced Simple Profile L5";
321 return "MPEG-4 Advanced Simple Profile L3b";
323 return "MPEG-4 Fine Granularity Scalable Profile";
325 return "MPEG-4 Fine Granularity Scalable Profile L1";
327 return "MPEG-4 Fine Granularity Scalable Profile L2";
329 return "MPEG-4 Fine Granularity Scalable Profile L3";
331 return "MPEG-4 Fine Granularity Scalable Profile L4";
333 return "MPEG-4 Fine Granularity Scalable Profile L5";
334 default:
335 return "MPEG-4 Visual";
336 }
338 return "MPEG-4 Timed Text";
340 return "Musepack SV8";
342 switch (sub) {
343 case PcmIntBe:
344 return "Pulse Code Modulation (integer, big endian)";
345 case PcmIntLe:
346 return "Pulse Code Modulation (integer, little endian)";
347 case PcmFloatIeee:
348 return "Pulse Code Modulation (float, IEEE)";
349 default:
350 return "Pulse Code Modulation";
351 }
353 return "Portable Network Graphics";
355 return "ProRes";
357 return "QCELP";
359 return "Quicktime Audio";
361 return "Quicktime Video";
363 return "Real Audio";
365 return "Real Video";
367 return "SAOC";
369 return "SMV";
371 return "Streaming Text Stream";
373 return "Synthesized Texture Stream";
375 switch (sub) {
376 case 2:
377 return "Systems v2";
378 default:
379 return "Systems";
380 }
382 switch (sub) {
384 return "plain UTF-8 subtitle";
386 return "SubStation Alpha";
388 return "Advanced SubStation Alpha";
390 return "Universal Subtitle Format";
392 return "Web Video Text Tracks Format";
393 default:
394 return "Text subtitle";
395 }
397 return "Theora";
399 return "Tagged Image File Format";
401 return "Timed Text";
403 return "The True Audio";
405 return "uncompressed video frames";
407 return "Windows Media Video";
409 return "VobBtn Buttons";
411 return "VobSub";
413 return "Vorbis";
415 return "VP8";
417 return "VP9";
419 return "WavPack";
421 return "Windows Media Audio";
423 switch (sub) {
424 case 1:
425 return "Windows Media Video v1/v7";
426 case 2:
427 return "Windows Media Video v2/v8";
428 default:
429 return "Windows Media Video";
430 }
432 return "DVB subtitles";
434 return "Speex";
436 return "Monkey's Audio";
437 default:
438 return "unknown";
439 }
440}
441
446std::string_view MediaFormat::abbreviation() const
447{
448 switch (general) {
450 switch (sub) {
452 return "MPEG-2 AAC Main";
454 return "MPEG-2 AAC-LC";
456 return "MPEG-2 AAC-SSR";
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";
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";
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";
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";
513 return "H.264 High 4:2:2";
515 return "H.264 Stereo High";
517 return "H.264 Multiview Depth High";
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) {
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 "H.266";
570 return "IMAADPCM ACM";
572 switch (sub) {
574 return "BMP subtitle";
575 default:
576 return "Image subtitle";
577 }
579 return "Interaction Stream";
581 return "JPEG";
583 return "OggKate";
585 return "Opus";
587 return "MS ACM";
589 switch (sub) {
590 case 1:
591 return "MS MPEG-4 v1";
592 case 2:
593 return "MS MPEG-4 v2";
594 case 3:
595 return "MS MPEG-4 v3";
596 default:
597 return "MS MPEG-4";
598 }
600 return "MS VCM";
602 return "Dolby TrueHD";
604 switch (sub) {
605 case Mpeg1Layer1:
606 return "MP1";
607 case Mpeg1Layer2:
608 return "MP2";
609 case Mpeg1Layer3:
610 return "MP3";
611 default:
612 return "MPEG-1 Audio";
613 }
615 return "MP1";
617 switch (sub) {
618 case Mpeg1Layer1:
619 return "MP1";
620 case Mpeg1Layer2:
621 return "MP2";
622 case Mpeg1Layer3:
623 return "MP3";
624 default:
625 return "MPEG-2 Audio";
626 }
628 switch (sub) {
630 return "MPEG-2 SP";
631 case Mpeg2MainProfile:
632 return "MPEG-2 Main";
633 case Mpeg2SnrProfile:
634 return "MPEG-2 SNR";
636 return "MPEG-2 Spatial";
637 case Mpeg2HighProfile:
638 return "MPEG-2 High";
639 case Mpeg2422Profile:
640 return "MPEG-2 422";
641 default:
642 return "MPEG-2 Video";
643 }
645 switch (sub) {
650 return "MPEG-4 SP";
658 return "MPEG-4 ASP";
659 case Mpeg4AvcProfile:
660 return "H.264";
661 default:
662 return "MPEG-4 Visual";
663 }
665 return "MPC";
667 switch (sub) {
668 case PcmIntBe:
669 return "PCM (int, BE)";
670 case PcmIntLe:
671 return "PCM (int, LE)";
672 case PcmFloatIeee:
673 return "PCM IEEE";
674 default:
675 return "PCM";
676 }
678 return "PNG";
680 return "ProRes";
682 return "QCELP";
684 return "Quicktime Audio";
686 return "Quicktime Video";
688 return "Real Audio";
690 return "Real Video";
692 return "SAOC";
694 return "SMV";
696 return "Streaming Text Stream";
698 return "Synthesized Texture Stream";
700 switch (sub) {
701 case 2:
702 return "Systems v2";
703 default:
704 return "Systems";
705 }
707 switch (sub) {
709 return "";
711 return "SSA";
713 return "ASS";
715 return "USF";
717 return "WebVTT";
718 default:
719 return "";
720 }
722 return "Theora";
724 return "TIFF";
726 return "Timed Text";
728 return "TTA";
730 return "uncompressed video frames";
732 return "VC-1";
734 return "VobBtn";
736 return "VobSub";
738 return "Vorbis";
740 return "VP8";
742 return "VP9";
744 return "WavPack";
746 return "WMA";
748 return "WMV";
750 return "DVBSUB";
752 return "Speex";
753 default:
754 return "";
755 }
756}
757
762std::string_view MediaFormat::shortAbbreviation() const
763{
764 switch (general) {
766 switch (sub) {
769 return "AAC-Main";
773 switch (extension) {
774 using namespace ExtensionFormats;
775 case SpectralBandReplication:
776 case ParametricStereo:
777 case (SpectralBandReplication | ParametricStereo):
778 return "HE-AAC";
779 default:
780 return "AAC-LC";
781 }
783 return "AAC-LC";
786 return "AAC-SSR";
789 return "AAC-LTP";
791 return "AAC-LD";
793 return "AAC-ELD";
794 default:
795 return "AAC";
796 }
798 return "AC3";
800 return "AC4";
802 return "ADPCM-ACM";
804 return "AFX";
806 return "ALAC";
808 return "ALS";
810 return "AMR";
812 switch (sub) {
814 return "H.264-CAVLC";
816 return "H.264-Basline";
817 case AvcMainProfile:
818 return "H.264-Main";
820 return "H.264-Scalable-Basline";
822 return "H.264-Scalable-High";
824 return "H.264-Extended";
825 case AvcHighProfile:
826 return "H.264-High";
827 case AvcHigh10Profile:
828 return "H.264-High-10";
830 return "H.264-Multiview";
832 return "H.264-High-4:2:2";
834 return "H.264-Stereo-High";
836 return "H.264-Multiview-Depth-High";
838 return "H.264-High-4:4:4";
840 return "H.264-High-4:4:4-Predictive";
841 default:
842 return "H.264";
843 }
845 return "AV1";
847 return "BMP";
849 return "Daala";
851 return "Dirac";
853 switch (sub) {
854 case DtsLossless:
855 return "DTS-Lossless";
856 case DtsExpress:
857 return "DTS-LBR";
858 default:
859 return "DTS";
860 }
862 return "DTS-HD";
864 return "E-AC-3";
866 return "EVRC";
868 return "FLAC";
870 return "FDS";
872 return "GIF";
874 return "3GPP2-CMF";
876 return "H.265";
878 return "H.266";
880 return "IMAADPCM-ACM";
882 return "BMP";
884 return "JPEG";
886 return "OggKate";
888 return "Opus";
890 return "MS-ACM";
892 return "MS-MPEG-4";
894 return "MS-VCM";
896 return "TrueHD";
898 switch (sub) {
899 case Mpeg1Layer1:
900 return "MP1";
901 case Mpeg1Layer2:
902 return "MP2";
903 default:
904 // since MP3 is backward compatible, it is ok to use it also as fallback
905 return "MP3";
906 }
908 return "MP1";
910 switch (sub) {
911 case Mpeg1Layer1:
912 return "MP1";
913 case Mpeg1Layer2:
914 return "MP2";
915 default:
916 // since MP3 is backward compatible, it is ok to use it also as fallback
917 return "MP3";
918 }
920 switch (sub) {
922 return "MPEG-2-SP";
923 case Mpeg2MainProfile:
924 return "MPEG-2-Main";
925 case Mpeg2SnrProfile:
926 return "MPEG-2-SNR";
928 return "MPEG-2-Spatial";
929 case Mpeg2HighProfile:
930 return "MPEG-2-High";
931 case Mpeg2422Profile:
932 return "MPEG-2-422";
933 default:
934 return "MPEG-2";
935 }
937 switch (sub) {
942 return "MPEG-4-SP";
950 return "MPEG-4-ASP";
951 case Mpeg4AvcProfile:
952 return "H.264";
953 default:
954 return "MPEG-4-Visual";
955 }
957 return "MPC";
959 return "PCM";
961 return "PNG";
963 return "ProRes";
965 return "QCELP";
967 return "Qt-Audio";
969 return "Qt-Video";
971 return "Real-Audio";
973 return "Real-Video";
975 return "SAOC";
977 return "SMV";
979 return "Systems";
981 switch (sub) {
983 return "UTF-8";
985 return "SSA";
987 return "ASS";
989 return "USF";
991 return "WebVTT";
992 default:
993 return "";
994 }
996 return "Theora";
998 return "TIFF";
1000 return "Timed-Text";
1002 return "TTA";
1004 return "RAW";
1006 return "VC-1";
1008 return "VobBtn";
1010 return "VobSub";
1012 return "Vorbis";
1014 return "VP8";
1016 return "VP9";
1018 return "WavPack";
1020 return "WMA";
1022 return "WMV";
1024 return "DVBSUB";
1026 return "Speex";
1028 return "APE";
1029 default:
1030 return "";
1031 }
1032}
1033
1038std::string_view MediaFormat::extensionName() const
1039{
1040 switch (general) {
1041 using namespace ExtensionFormats;
1043 switch (extension) {
1044 case SpectralBandReplication:
1045 return "Spectral Band Replication / HE-AAC";
1046 case ParametricStereo:
1047 return "Parametric Stereo / HE-AAC v2"; // PS always implies SBR?
1048 case (SpectralBandReplication | ParametricStereo):
1049 return "Spectral Band Replication and Parametric Stereo / HE-AAC v2";
1050 default:;
1051 }
1052 break;
1053 default:;
1054 }
1055 return "";
1056}
1057
1061std::string_view mediaTypeName(MediaType mediaType)
1062{
1063 switch (mediaType) {
1064 case MediaType::Unknown:
1065 return "Other";
1066 case MediaType::Audio:
1067 return "Audio";
1068 case MediaType::Video:
1069 return "Video";
1070 case MediaType::Text:
1071 return "Subititle";
1072 case MediaType::Buttons:
1073 return "Buttons";
1074 case MediaType::Control:
1075 return "Control";
1076 case MediaType::Hint:
1077 return "Hint";
1078 case MediaType::Meta:
1079 return "Meta-data";
1080 }
1081 return "";
1082}
1083
1084} // namespace TagParser
std::string_view abbreviation() const
Returns the abbreviation of the media format.
std::string_view shortAbbreviation() const
Returns a short abbreviation of the media format.
std::string_view name() const
Returns the name of the media format.
std::string_view extensionName() const
Returns the abbreviation of the media format.
unsigned char extension
GeneralMediaFormat general
Encapsulates extension formats.
Encapsulates sub formats.
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.