4 #include <c++utilities/conversion/binaryconversion.h>
16 Ar = 0x213C617263683E0A,
17 Asf1 = 0x3026B2758E66CF11ul,
18 Asf2 = 0xA6D900AA0062CE6Cul,
19 Png = 0x89504E470D0A1A0Aul,
28 Rar = 0x526172211A0700ul,
38 Xz = 0xFD377A585A00ul,
107 std::uint64_t sig = 0;
108 if (buffer.size() >= 8) {
109 sig = BE::toUInt64(buffer.data());
110 }
else if (buffer.size() >= 4) {
111 sig = BE::toUInt32(buffer.data());
113 }
else if (buffer.size() >= 2) {
114 sig = BE::toUInt16(buffer.data());
117 return ContainerFormat::Unknown;
124 return ContainerFormat::Asf;
126 return ContainerFormat::Asf;
130 if (buffer.size() >= 10 && buffer[8] == 0x32 && buffer[9] == 0x20) {
136 switch (sig & 0x00000000FFFFFFFF) {
181 if (buffer.size() >= 16 && BE::toUInt64(buffer.data() + 8) ==
Sig64::RiffAvi) {
183 }
else if (buffer.size() >= 12 && BE::toUInt32(buffer.data() + 8) ==
RiffWave) {
203 return ContainerFormat::Zip;
210 return ContainerFormat::FlashVideo;
214 return ContainerFormat::Id2v2Tag;
220 return ContainerFormat::Ac3Frames;
242 return ContainerFormat::Unknown;
253 switch (containerFormat) {
254 case ContainerFormat::Ac3Frames:
258 case ContainerFormat::Asf:
266 case ContainerFormat::FlashVideo:
296 case static_cast<unsigned int>(GeneralMediaFormat::Speex):
310 case ContainerFormat::Matroska:
332 case ContainerFormat::Tar:
349 case ContainerFormat::Zip:
375 switch (containerFormat) {
376 case ContainerFormat::Ac3Frames:
377 return "raw Dolby Digital";
379 return "Audio Data Transport Stream";
381 return "Archive (GNU ar)";
382 case ContainerFormat::Asf:
383 return "Advanced Systems Format";
387 return "Executable and Linkable Format";
389 return "raw Free Lossless Audio Codec frames";
390 case ContainerFormat::FlashVideo:
391 return "Flash Video";
394 return "Graphics Interchange Format";
398 return "Java class file";
400 return "JPEG File Interchange Format";
402 return "LHA compressed file";
404 return "LZW compressed file";
406 return "MPEG-4 Part 14";
408 return "Ogg transport bitstream";
410 return "Photoshop document";
412 return "Portable Network Graphics";
414 return "Portable Executable";
416 return "RAR Archive";
419 case ContainerFormat::Matroska:
421 case ContainerFormat::Webm:
424 return "MPEG-1 Layer 1/2/3 frames";
426 return "Resource Interchange File Format";
430 return "RIFF/Audio Video Interleave";
431 case ContainerFormat::Tar:
432 return "TAR archive";
435 return "Tagged Image File Format";
437 return "UTF-16 text";
439 return "UTF-32 text";
445 return "Microsoft Windows Bitmap";
447 return "Microsoft Windows Icon";
449 return "bzip2 compressed file";
451 return "gzip compressed file";
453 return "lzip compressed file";
459 return "xz compressed file";
462 case ContainerFormat::Zip:
463 return "ZIP archive";
465 return "Monkey's Audio";
480 switch (containerFormat) {
488 return "little endian";
501 switch (containerFormat) {
502 case ContainerFormat::Ac3Frames:
504 case ContainerFormat::Asf:
505 return "video/x-ms-asf";
508 case ContainerFormat::FlashVideo:
509 return "video/x-flv";
533 case ContainerFormat::Matroska:
536 return "audio/x-matroska";
538 return "video/x-matroska";
543 return "application/x-bzip";
545 return "application/gzip";
547 return "application/x-lzh-compressed";
549 return "application/x-rar-compressed";
551 return "application/x-lzip";
553 return "video/quicktime";
554 case ContainerFormat::Zip:
555 return "application/zip";
557 return "application/x-7z-compressed";
559 return "application/x-xz";
563 return "image/vnd.microsoft.icon";
574 switch (containerFormat) {
575 case ContainerFormat::Matroska:
576 case ContainerFormat::Webm:
579 return TagTargetLevel::Unspecified;
588 switch (containerFormat) {
589 case ContainerFormat::Matroska:
590 case ContainerFormat::Webm:
Contains all classes and functions of the TagInfo library.
TAG_PARSER_EXPORT std::string_view containerFormatSubversion(ContainerFormat containerFormat)
Returns the subversion of the container format as C-style string.
Sig16
Holds 16-bit signatures.
TagTargetLevel
The TagTargetLevel enum specifies tag target levels.
TAG_PARSER_EXPORT std::string_view containerFormatAbbreviation(ContainerFormat containerFormat, MediaType mediaType=MediaType::Unknown, unsigned int version=0)
Returns the abbreviation of the container format as C-style string considering the specified media ty...
Sig24
Holds 24-bit signatures.
Sig48
Holds 48-bit signatures.
constexpr TAG_PARSER_EXPORT std::uint64_t matroskaTagTargetLevelValue(TagTargetLevel targetLevel)
Returns the Matroska specific target level value for the specified general targetLevel.
TAG_PARSER_EXPORT std::string_view containerFormatName(ContainerFormat containerFormat)
Returns the name of the specified container format as C-style string.
TAG_PARSER_EXPORT ContainerFormat parseSignature(const char *buffer, std::size_t bufferSize)
TAG_PARSER_EXPORT std::string_view containerMimeType(ContainerFormat containerFormat, MediaType mediaType=MediaType::Unknown)
Returns the MIME-type of the container format as C-style string.
constexpr TAG_PARSER_EXPORT TagTargetLevel matroskaTagTargetLevel(std::uint64_t targetLevelValue)
Returns the general TagTargetLevel for the Matroska specific targetLevelValue.
Sig56
Holds 52-bit signatures.
TAG_PARSER_EXPORT TagTargetLevel containerTargetLevel(ContainerFormat containerFormat, std::uint64_t targetLevelValue)
Returns the general TagTargetLevel for the specified container format and raw targetLevelValue.
Sig32
Holds 32-bit signatures.
MediaType
The MediaType enum specifies the type of media data (audio, video, text, ...).
Sig64
Holds 64-bit signatures.
TAG_PARSER_EXPORT std::uint64_t containerTargetLevelValue(ContainerFormat containerFormat, TagTargetLevel targetLevel)
Returns the raw target level value for the specified containerFormat and general targetLevel.
ContainerFormat
Specifies the container format.