aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-06 23:24:28 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-06 23:30:37 +0200
commit967f2549af522dc7bbca7208035119677ac9e6d0 (patch)
tree1a80693f7e6a3b4a40fd9141592440bb2a17e20f
parent5f1814a92ef45a7bfc33d48c75ac1db7f566cda0 (diff)
matrix: detect ogg vorbis files as audio files for upload
-rw-r--r--include/FileAnalyzer.hpp1
-rw-r--r--src/FileAnalyzer.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/include/FileAnalyzer.hpp b/include/FileAnalyzer.hpp
index 51a7aa8..aedd520 100644
--- a/include/FileAnalyzer.hpp
+++ b/include/FileAnalyzer.hpp
@@ -22,6 +22,7 @@ namespace QuickMedia {
AUDIO_MIDI,
AUDIO_WAVE,
AUDIO_FLAC,
+ AUDIO_VORBIS,
AUDIO_OPUS,
IMAGE_JPEG,
IMAGE_PNG,
diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp
index f44ecbf..bd44da7 100644
--- a/src/FileAnalyzer.cpp
+++ b/src/FileAnalyzer.cpp
@@ -21,7 +21,7 @@ namespace QuickMedia {
// What about audio ogg files that are not opus?
// TODO: Test all of these
- static const std::array<MagicNumber, 27> magic_numbers = {
+ static const std::array<MagicNumber, 28> magic_numbers = {
MagicNumber{ {'R', 'I', 'F', 'F', -1, -1, -1, -1, 'A', 'V', 'I', ' '}, 12, ContentType::VIDEO_AVI },
MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', 'p', 'i', 's', 'o', 'm'}, 12, ContentType::VIDEO_MP4 },
MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', 'p', 'm', 'p', '4', '2'}, 12, ContentType::VIDEO_MP4 },
@@ -42,6 +42,7 @@ namespace QuickMedia {
MagicNumber{ {'M', 'T', 'h', 'd', -1, -1, -1, -1}, 8, ContentType::AUDIO_MIDI },
MagicNumber{ {'R', 'I', 'F', 'F', -1, -1, -1, -1, 'W', 'A', 'V', 'E'}, 12, ContentType::AUDIO_WAVE },
MagicNumber{ {'f', 'L', 'a', 'C'}, 4, ContentType::AUDIO_FLAC },
+ MagicNumber{ {'O', 'g', 'g', 'S', 0x00, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1, -1, -1, -1, -1, 'v', 'o', 'r', 'b', 'i', 's'}, 30, ContentType::AUDIO_VORBIS },
MagicNumber{ {'O', 'g', 'g', 'S', 0x00, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ,-1, -1, -1, -1, -1, -1, -1, 'O', 'p', 'u', 's', 'H', 'e', 'a', 'd'}, 36, ContentType::AUDIO_OPUS },
MagicNumber{ {0xFF, 0xD8, 0xFF}, 3, ContentType::IMAGE_JPEG },
MagicNumber{ {0x89, 'P', 'N', 'G', 0x0D, 0x0A, 0x1A, 0x0A}, 8, ContentType::IMAGE_PNG },
@@ -77,6 +78,7 @@ namespace QuickMedia {
case ContentType::AUDIO_MIDI: return "audio/midi";
case ContentType::AUDIO_WAVE: return "audio/wave";
case ContentType::AUDIO_FLAC: return "audio/wave";
+ case ContentType::AUDIO_VORBIS: return "audio/ogg";
case ContentType::AUDIO_OPUS: return "audio/ogg";
case ContentType::IMAGE_JPEG: return "image/jpeg";
case ContentType::IMAGE_PNG: return "image/png";