tagparser/signature.h

91 lines
3.6 KiB
C
Raw Normal View History

#ifndef TAG_PARSER_SIGNATURE_H
#define TAG_PARSER_SIGNATURE_H
2015-04-22 19:22:01 +02:00
2015-09-06 19:57:33 +02:00
#include "./mediaformat.h"
2015-04-22 19:22:01 +02:00
2019-03-13 19:06:42 +01:00
#include <cstdint>
#include <string_view>
2015-04-22 19:22:01 +02:00
namespace TagParser {
2015-04-22 19:22:01 +02:00
2019-06-10 22:49:11 +02:00
enum class TagTargetLevel : std::uint8_t;
2016-05-26 01:59:22 +02:00
2015-04-22 19:22:01 +02:00
/*!
* \brief Specifies the container format.
2016-05-16 20:56:53 +02:00
*
* Raw streams like ADTS or raw FLAC count as container format in this context.
2015-04-22 19:22:01 +02:00
*/
enum class ContainerFormat : unsigned int {
2015-04-22 19:22:01 +02:00
Unknown, /**< unknown container format */
2016-08-07 20:48:23 +02:00
Ac3Frames, /**< raw AC-3/Dolby Digital frames */
2016-06-10 23:08:01 +02:00
Adts, /**< Audio Data Transport Stream */
Ar, /**< "GNU ar" archive */
2015-04-22 19:22:01 +02:00
Asf, /**< Advanced Systems Format */
2016-06-10 23:08:01 +02:00
Bzip2, /**< bzip2 compressed file */
2016-08-07 20:48:23 +02:00
Dirac, /**< raw Dirac */
Ebml, /**< EBML */
2015-04-22 19:22:01 +02:00
Elf, /**< Executable and Linkable Format */
2016-08-07 20:48:23 +02:00
Flac, /**< raw Free Lossless Audio Codec */
2016-05-05 23:11:48 +02:00
FlashVideo, /**< Flash (FLV) */
2015-04-22 19:22:01 +02:00
Gif87a, /**< Graphics Interchange Format (1987) */
Gif89a, /**< Graphics Interchange Format (1989) */
Gzip, /**< gzip compressed file */
2023-05-16 23:00:32 +02:00
Id3v2Tag, /**< file holding an ID3v2 tag only */
2018-07-28 14:56:00 +02:00
Ivf, /**< IVF (simple file format that transports raw VP8/VP9/AV1 data) */
2015-04-22 19:22:01 +02:00
JavaClassFile, /**< Java class file */
Jpeg, /**< JPEG File Interchange Format */
Lha, /**< LHA */
2016-08-07 20:48:23 +02:00
Lzip, /**< lz compressed file */
2015-04-22 19:22:01 +02:00
Lzw, /**< LZW */
2016-08-07 20:48:23 +02:00
Matroska, /**< Matroska (subset of EBML) */
2018-08-29 22:32:11 +02:00
Midi, /**< Musical Instrument Digital Interface (MIDI) */
2018-03-21 20:31:29 +01:00
MonkeysAudio, /**< Monkey's Audio */
2015-04-22 19:22:01 +02:00
Mp4, /**< MPEG-4 Part 14 (subset of QuickTime container) */
2016-08-07 20:48:23 +02:00
MpegAudioFrames, /**< MPEG-1 Layer 1/2/3 frames */
2015-04-22 19:22:01 +02:00
Ogg, /**< Ogg */
PhotoshopDocument, /**< Photoshop document */
Png, /**< Portable Network Graphics */
PortableExecutable, /**< Portable Executable */
2016-08-07 20:48:23 +02:00
QuickTime, /**< QuickTime container */
2015-04-22 19:22:01 +02:00
Rar, /**< RAR Archive */
Riff, /**< Resource Interchange File Format */
RiffAvi, /**< Audio Video Interleave (subset of RIFF) */
2016-08-07 20:48:23 +02:00
RiffWave, /**< WAVE (subset of RIFF) */
SevenZ, /**< 7z archive */
2016-06-10 23:08:01 +02:00
Tar, /**< Tar archive */
2015-04-22 19:22:01 +02:00
TiffBigEndian, /**< Tagged Image File Format (big endian) */
TiffLittleEndian, /**< Tagged Image File Format (little endian) */
Utf16Text, /**< UTF-16 text */
Utf32Text, /**< UTF-32 text */
Utf8Text, /**< UTF-8 text */
2018-03-21 20:31:29 +01:00
WavPack, /**< WavPack */
2016-08-07 20:48:23 +02:00
Webm, /**< WebM (subset of Matroska) */
2015-04-22 19:22:01 +02:00
WindowsBitmap, /**< Microsoft Windows Bitmap */
WindowsIcon, /**< Microsoft Windows Icon */
2017-09-03 18:26:32 +02:00
Xz, /**< xz compressed file */
YUV4Mpeg2, /**< YUV4MPEG2 */
2018-03-21 20:31:29 +01:00
Zip, /**< ZIP archive */
2022-08-17 23:06:09 +02:00
Aiff, /**< Audio Interchange File Format */
2023-03-05 22:37:14 +01:00
Zstd, /**< Zstandard-compressed data */
ApeTag, /**< APE tag */
2015-04-22 19:22:01 +02:00
};
TAG_PARSER_EXPORT ContainerFormat parseSignature(const char *buffer, std::size_t bufferSize);
TAG_PARSER_EXPORT ContainerFormat parseSignature(std::string_view buffer);
TAG_PARSER_EXPORT std::string_view containerFormatName(ContainerFormat containerFormat);
TAG_PARSER_EXPORT std::string_view containerFormatAbbreviation(
2018-03-07 01:17:50 +01:00
ContainerFormat containerFormat, MediaType mediaType = MediaType::Unknown, unsigned int version = 0);
TAG_PARSER_EXPORT std::string_view containerFormatSubversion(ContainerFormat containerFormat);
TAG_PARSER_EXPORT std::string_view containerMimeType(ContainerFormat containerFormat, MediaType mediaType = MediaType::Unknown);
2019-03-13 19:06:42 +01:00
TAG_PARSER_EXPORT TagTargetLevel containerTargetLevel(ContainerFormat containerFormat, std::uint64_t targetLevelValue);
TAG_PARSER_EXPORT std::uint64_t containerTargetLevelValue(ContainerFormat containerFormat, TagTargetLevel targetLevel);
2015-04-22 19:22:01 +02:00
inline ContainerFormat parseSignature(const char *buffer, std::size_t bufferSize)
{
return parseSignature(std::string_view(buffer, bufferSize));
}
2018-03-07 01:17:50 +01:00
} // namespace TagParser
2015-04-22 19:22:01 +02:00
#endif // TAG_PARSER_SIGNATURE_H