[FFmpeg-devel] [PATCH]lavf/riff: Support ambient wav files

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Sep 16 13:00:58 CEST 2015


On Wednesday 16 September 2015 12:54:58 pm Paul B Mahol wrote:
> On 9/16/15, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> > Hi!
> >
> > Attached patch allows to decode amb files as requested by Andy Furniss.
> >
> > Please comment, Carl Eugen
>
> lgtm

New, imo better patch attached: Also supports float and can never 
interfere when writing a wav file.

Sorry, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/riff.h b/libavformat/riff.h
index d6d91ef..e842940 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -107,6 +107,8 @@ extern const AVCodecGuid ff_codec_wav_guids[];
 
 #define FF_MEDIASUBTYPE_BASE_GUID \
     0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
+#define FF_AMBISONIC_BASE_GUID \
+    0x21, 0x07, 0xD3, 0x11, 0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 
 
 static av_always_inline int ff_guidcmp(const void *g1, const void *g2)
 {
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 7eecdb2..26779e1 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -69,6 +69,8 @@ static void parse_waveformatex(AVIOContext *pb, AVCodecContext *c)
 
     ff_get_guid(pb, &subformat);
     if (!memcmp(subformat + 4,
+                (const uint8_t[]){ FF_AMBISONIC_BASE_GUID }, 12) ||
+        !memcmp(subformat + 4,
                 (const uint8_t[]){ FF_MEDIASUBTYPE_BASE_GUID }, 12)) {
         c->codec_tag = AV_RL32(subformat);
         c->codec_id  = ff_wav_codec_get_id(c->codec_tag,


More information about the ffmpeg-devel mailing list