Detect raw AC3 and Dirac
This commit is contained in:
parent
549028c0cf
commit
4335ba724b
|
@ -42,6 +42,7 @@ enum Sig48 : uint64
|
||||||
*/
|
*/
|
||||||
enum Sig32 : uint32
|
enum Sig32 : uint32
|
||||||
{
|
{
|
||||||
|
Dirac = 0x42424344u,
|
||||||
Elf = 0x7F454C46u,
|
Elf = 0x7F454C46u,
|
||||||
Flac = 0x664C6143u,
|
Flac = 0x664C6143u,
|
||||||
JavaClassFile = 0xCAFEBABEu,
|
JavaClassFile = 0xCAFEBABEu,
|
||||||
|
@ -79,6 +80,7 @@ enum Sig24 : uint32
|
||||||
*/
|
*/
|
||||||
enum Sig16 : uint16
|
enum Sig16 : uint16
|
||||||
{
|
{
|
||||||
|
Ac3 = 0x0B77u,
|
||||||
Adts = 0xFFF0u,
|
Adts = 0xFFF0u,
|
||||||
AdtsMask = 0xFFF6u,
|
AdtsMask = 0xFFF6u,
|
||||||
Jpeg = 0xffd8u,
|
Jpeg = 0xffd8u,
|
||||||
|
@ -150,6 +152,8 @@ ContainerFormat parseSignature(const char *buffer, int bufferSize)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
switch(sig >> 32) { // check 32-bit signatures
|
switch(sig >> 32) { // check 32-bit signatures
|
||||||
|
case Dirac:
|
||||||
|
return ContainerFormat::Dirac;
|
||||||
case Elf:
|
case Elf:
|
||||||
return ContainerFormat::Elf;
|
return ContainerFormat::Elf;
|
||||||
case Flac:
|
case Flac:
|
||||||
|
@ -200,6 +204,8 @@ ContainerFormat parseSignature(const char *buffer, int bufferSize)
|
||||||
return ContainerFormat::Utf8Text;
|
return ContainerFormat::Utf8Text;
|
||||||
}
|
}
|
||||||
switch(sig >> 48) { // check 16-bit signatures
|
switch(sig >> 48) { // check 16-bit signatures
|
||||||
|
case Ac3:
|
||||||
|
return ContainerFormat::Ac3Frames;
|
||||||
case Jpeg:
|
case Jpeg:
|
||||||
return ContainerFormat::Jpeg;
|
return ContainerFormat::Jpeg;
|
||||||
case Lha:
|
case Lha:
|
||||||
|
@ -227,17 +233,17 @@ ContainerFormat parseSignature(const char *buffer, int bufferSize)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the abbreviation of the container format as C-style string considering
|
* \brief Returns the abbreviation of the container format as C-style string considering
|
||||||
* the specified media type and version.
|
* the specified media type and version.
|
||||||
*
|
* \remarks The abbreviation might be used as file extension.
|
||||||
* This abbreviation might be used as file extension.
|
* \returns Returns an empty string if no abbreviation is available.
|
||||||
*
|
|
||||||
* Returns an empty string if no abbreviation is available.
|
|
||||||
*/
|
*/
|
||||||
const char *containerFormatAbbreviation(ContainerFormat containerFormat, MediaType mediaType, unsigned int version)
|
const char *containerFormatAbbreviation(ContainerFormat containerFormat, MediaType mediaType, unsigned int version)
|
||||||
{
|
{
|
||||||
switch(containerFormat) {
|
switch(containerFormat) {
|
||||||
|
case ContainerFormat::Ac3Frames: return "ac3";
|
||||||
case ContainerFormat::Ar: return "a";
|
case ContainerFormat::Ar: return "a";
|
||||||
case ContainerFormat::Asf: return "asf";
|
case ContainerFormat::Asf: return "asf";
|
||||||
|
case ContainerFormat::Dirac: return "drc";
|
||||||
case ContainerFormat::Elf: return "elf";
|
case ContainerFormat::Elf: return "elf";
|
||||||
case ContainerFormat::Flac: return "flac";
|
case ContainerFormat::Flac: return "flac";
|
||||||
case ContainerFormat::FlashVideo: return "flv";
|
case ContainerFormat::FlashVideo: return "flv";
|
||||||
|
@ -312,12 +318,16 @@ const char *containerFormatAbbreviation(ContainerFormat containerFormat, MediaTy
|
||||||
const char *containerFormatName(ContainerFormat containerFormat)
|
const char *containerFormatName(ContainerFormat containerFormat)
|
||||||
{
|
{
|
||||||
switch(containerFormat) {
|
switch(containerFormat) {
|
||||||
|
case ContainerFormat::Ac3Frames:
|
||||||
|
return "raw Dolby Digital";
|
||||||
case ContainerFormat::Adts:
|
case ContainerFormat::Adts:
|
||||||
return "Audio Data Transport Stream";
|
return "Audio Data Transport Stream";
|
||||||
case ContainerFormat::Ar:
|
case ContainerFormat::Ar:
|
||||||
return "Archive (GNU ar)";
|
return "Archive (GNU ar)";
|
||||||
case ContainerFormat::Asf:
|
case ContainerFormat::Asf:
|
||||||
return "Advanced Systems Format";
|
return "Advanced Systems Format";
|
||||||
|
case ContainerFormat::Dirac:
|
||||||
|
return "raw Dirac";
|
||||||
case ContainerFormat::Elf:
|
case ContainerFormat::Elf:
|
||||||
return "Executable and Linkable Format";
|
return "Executable and Linkable Format";
|
||||||
case ContainerFormat::Flac:
|
case ContainerFormat::Flac:
|
||||||
|
@ -422,6 +432,8 @@ const char *containerFormatSubversion(ContainerFormat containerFormat)
|
||||||
const char *containerMimeType(ContainerFormat containerFormat, MediaType mediaType)
|
const char *containerMimeType(ContainerFormat containerFormat, MediaType mediaType)
|
||||||
{
|
{
|
||||||
switch(containerFormat) {
|
switch(containerFormat) {
|
||||||
|
case ContainerFormat::Ac3Frames:
|
||||||
|
return "audio/ac3";
|
||||||
case ContainerFormat::Asf:
|
case ContainerFormat::Asf:
|
||||||
return "video/x-ms-asf";
|
return "video/x-ms-asf";
|
||||||
case ContainerFormat::Flac:
|
case ContainerFormat::Flac:
|
||||||
|
|
20
signature.h
20
signature.h
|
@ -18,12 +18,15 @@ DECLARE_ENUM_CLASS(TagTargetLevel, byte);
|
||||||
enum class ContainerFormat
|
enum class ContainerFormat
|
||||||
{
|
{
|
||||||
Unknown, /**< unknown container format */
|
Unknown, /**< unknown container format */
|
||||||
|
Ac3Frames, /**< raw AC-3/Dolby Digital frames */
|
||||||
Adts, /**< Audio Data Transport Stream */
|
Adts, /**< Audio Data Transport Stream */
|
||||||
Ar, /**< "GNU ar" archive */
|
Ar, /**< "GNU ar" archive */
|
||||||
Asf, /**< Advanced Systems Format */
|
Asf, /**< Advanced Systems Format */
|
||||||
Bzip2, /**< bzip2 compressed file */
|
Bzip2, /**< bzip2 compressed file */
|
||||||
|
Dirac, /**< raw Dirac */
|
||||||
|
Ebml, /**< EBML */
|
||||||
Elf, /**< Executable and Linkable Format */
|
Elf, /**< Executable and Linkable Format */
|
||||||
Flac, /**< Free Lossless Audio Codec (raw stream) */
|
Flac, /**< raw Free Lossless Audio Codec */
|
||||||
FlashVideo, /**< Flash (FLV) */
|
FlashVideo, /**< Flash (FLV) */
|
||||||
Gif87a, /**< Graphics Interchange Format (1987) */
|
Gif87a, /**< Graphics Interchange Format (1987) */
|
||||||
Gif89a, /**< Graphics Interchange Format (1989) */
|
Gif89a, /**< Graphics Interchange Format (1989) */
|
||||||
|
@ -32,31 +35,30 @@ enum class ContainerFormat
|
||||||
JavaClassFile, /**< Java class file */
|
JavaClassFile, /**< Java class file */
|
||||||
Jpeg, /**< JPEG File Interchange Format */
|
Jpeg, /**< JPEG File Interchange Format */
|
||||||
Lha, /**< LHA */
|
Lha, /**< LHA */
|
||||||
|
Lzip, /**< lz compressed file */
|
||||||
Lzw, /**< LZW */
|
Lzw, /**< LZW */
|
||||||
|
Matroska, /**< Matroska (subset of EBML) */
|
||||||
Mp4, /**< MPEG-4 Part 14 (subset of QuickTime container) */
|
Mp4, /**< MPEG-4 Part 14 (subset of QuickTime container) */
|
||||||
|
MpegAudioFrames, /**< MPEG-1 Layer 1/2/3 frames */
|
||||||
Ogg, /**< Ogg */
|
Ogg, /**< Ogg */
|
||||||
PhotoshopDocument, /**< Photoshop document */
|
PhotoshopDocument, /**< Photoshop document */
|
||||||
Png, /**< Portable Network Graphics */
|
Png, /**< Portable Network Graphics */
|
||||||
PortableExecutable, /**< Portable Executable */
|
PortableExecutable, /**< Portable Executable */
|
||||||
|
QuickTime, /**< QuickTime container */
|
||||||
Rar, /**< RAR Archive */
|
Rar, /**< RAR Archive */
|
||||||
Ebml, /**< EBML */
|
|
||||||
Matroska, /**< Matroska (subset of EBML) */
|
|
||||||
Webm, /**< WebM (subset of Matroska) */
|
|
||||||
MpegAudioFrames, /**< MPEG-1 Layer 1/2/3 frames */
|
|
||||||
Riff, /**< Resource Interchange File Format */
|
Riff, /**< Resource Interchange File Format */
|
||||||
RiffWave, /**< WAVE (subset of RIFF) */
|
|
||||||
RiffAvi, /**< Audio Video Interleave (subset of RIFF) */
|
RiffAvi, /**< Audio Video Interleave (subset of RIFF) */
|
||||||
|
RiffWave, /**< WAVE (subset of RIFF) */
|
||||||
|
SevenZ, /**< 7z archive */
|
||||||
Tar, /**< Tar archive */
|
Tar, /**< Tar archive */
|
||||||
TiffBigEndian, /**< Tagged Image File Format (big endian) */
|
TiffBigEndian, /**< Tagged Image File Format (big endian) */
|
||||||
TiffLittleEndian, /**< Tagged Image File Format (little endian) */
|
TiffLittleEndian, /**< Tagged Image File Format (little endian) */
|
||||||
Utf16Text, /**< UTF-16 text */
|
Utf16Text, /**< UTF-16 text */
|
||||||
Utf32Text, /**< UTF-32 text */
|
Utf32Text, /**< UTF-32 text */
|
||||||
Utf8Text, /**< UTF-8 text */
|
Utf8Text, /**< UTF-8 text */
|
||||||
|
Webm, /**< WebM (subset of Matroska) */
|
||||||
WindowsBitmap, /**< Microsoft Windows Bitmap */
|
WindowsBitmap, /**< Microsoft Windows Bitmap */
|
||||||
WindowsIcon, /**< Microsoft Windows Icon */
|
WindowsIcon, /**< Microsoft Windows Icon */
|
||||||
SevenZ, /**< 7z archive */
|
|
||||||
Lzip, /**< lz compressed file */
|
|
||||||
QuickTime, /**< QuickTime container */
|
|
||||||
Zip /**< ZIP archive */
|
Zip /**< ZIP archive */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue