From e21f1b0c1c9db466305d8d8e6703aa721c77c26c Mon Sep 17 00:00:00 2001 From: Pedro Date: Tue, 2 Nov 2021 20:57:48 +0100 Subject: [PATCH] Detect WAV file format from content - detection is made by matching against specific RIFF WAVE header --- README.md | 2 +- src/Detector.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c044898..c53d929 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Formats support status. | Txt | txt | - | text/plain | | | Vhd | vhd | - | - | | | Vob | vob | + | video/x-ms-vob | at [0]: (0x001ba) & at [-4]: (0x001b9) | -| Wav | wav | - | audio/x-wav | | +| Wav | wav | + | audio/x-wav | at [0]: (0x52494646) & at [8]: (0x57415645) | | Webm | webm | + | video/webm | at [0]: (0x1a45dfa3) | | Wma | wma | - | audio/x-ms-wma | | | Wmv | wmv | - | video/x-ms-wmv | | diff --git a/src/Detector.php b/src/Detector.php index eee6b39..7356f48 100644 --- a/src/Detector.php +++ b/src/Detector.php @@ -652,6 +652,13 @@ class Detector { // and -4 => [0x00, 0x00, 0x01, 0xB9] ]], + self::WAV => [ + [ + 0 => [0x52, 0x49, 0x46, 0x46], + // and + 8 => [0x57, 0x41, 0x56, 0x45] + ] + ], self::WEBM => [[0 => [0x1A, 0x45, 0xDF, 0xA3]]], // zip is a container for a lot of formats