aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-15 08:14:40 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-15 08:14:40 +0200
commit2167a32f3730e569a636d9b041122558aceb89f1 (patch)
tree4a58e73c69b0fec6ee0548e545c31903f3da9055
parent539c688d28048afa089e3777e4af487e7cf6e9fa (diff)
matrix: mpeg video upload support
-rw-r--r--include/FileAnalyzer.hpp1
-rw-r--r--src/FileAnalyzer.cpp5
2 files changed, 5 insertions, 1 deletions
diff --git a/include/FileAnalyzer.hpp b/include/FileAnalyzer.hpp
index aedd520..b06ef91 100644
--- a/include/FileAnalyzer.hpp
+++ b/include/FileAnalyzer.hpp
@@ -14,6 +14,7 @@ namespace QuickMedia {
UNKNOWN,
VIDEO_AVI,
VIDEO_MP4,
+ VIDEO_MPEG,
VIDEO_WEBM,
VIDEO_FLV,
AUDIO_BASIC,
diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp
index 32fbbdb..0178789 100644
--- a/src/FileAnalyzer.cpp
+++ b/src/FileAnalyzer.cpp
@@ -20,7 +20,7 @@ namespace QuickMedia {
// https://mimesniff.spec.whatwg.org/
// TODO: Test all of these
- static const std::array<MagicNumber, 28> magic_numbers = {
+ static const std::array<MagicNumber, 30> 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 },
@@ -29,6 +29,8 @@ namespace QuickMedia {
MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', 'm', 'p', '4', '2'}, 11, ContentType::VIDEO_MP4 },
MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', '3', 'g', 'p', '5'}, 11, ContentType::VIDEO_MP4 },
MagicNumber{ {0x00, 0x00, 0x00, -1, 'f', 't', 'y', 'p', 'q', 't'}, 10, ContentType::VIDEO_MP4 },
+ MagicNumber{ {0x00, 0x00, 0x01, 0xBA}, 4, ContentType::VIDEO_MPEG },
+ MagicNumber{ {0x00, 0x00, 0x01, 0xB3}, 4, ContentType::VIDEO_MPEG },
MagicNumber{ {0x1A, 0x45, 0xDF, 0xA3}, 4, ContentType::VIDEO_WEBM },
MagicNumber{ {'F', 'L', 'V', 0x01}, 4, ContentType::VIDEO_FLV },
MagicNumber{ {'.', 's', 'n', 'd'}, 4, ContentType::AUDIO_BASIC },
@@ -69,6 +71,7 @@ namespace QuickMedia {
case ContentType::UNKNOWN: return "application/octet-stream";
case ContentType::VIDEO_AVI: return "video/avi";
case ContentType::VIDEO_MP4: return "video/mp4";
+ case ContentType::VIDEO_MPEG: return "video/mpeg";
case ContentType::VIDEO_WEBM: return "video/webm";
case ContentType::VIDEO_FLV: return "video/x-flv";
case ContentType::AUDIO_BASIC: return "audio/basic";