[FFmpeg-devel] [PATCH] libavformat/riff.c: Adding support of PCM_S24LE in WAVEFORMATEXTENSIBLE

Thierry Foucu tfoucu at gmail.com
Fri Oct 23 00:27:58 CEST 2015


On Thu, Oct 22, 2015 at 2:29 PM, Hendrik Leppkes <h.leppkes at gmail.com>
wrote:

> On Thu, Oct 22, 2015 at 11:15 PM, Thierry Foucu <tfoucu at gmail.com> wrote:
> > On Thu, Oct 22, 2015 at 2:08 PM, Hendrik Leppkes <h.leppkes at gmail.com>
> > wrote:
> >
> >> On Thu, Oct 22, 2015 at 9:19 PM, Thierry Foucu <tfoucu at gmail.com>
> wrote:
> >> > ---
> >> >  libavformat/riff.c | 1 +
> >> >  1 file changed, 1 insertion(+)
> >> >
> >> > diff --git a/libavformat/riff.c b/libavformat/riff.c
> >> > index a9197e7..7de8936 100644
> >> > --- a/libavformat/riff.c
> >> > +++ b/libavformat/riff.c
> >> > @@ -487,5 +487,6 @@ const AVCodecGuid ff_codec_wav_guids[] = {
> >> >      { AV_CODEC_ID_ATRAC3P,  { 0xBF, 0xAA, 0x23, 0xE9, 0x58, 0xCB,
> 0x71,
> >> 0x44, 0xA1, 0x19, 0xFF, 0xFA, 0x01, 0xE4, 0xCE, 0x62 } },
> >> >      { AV_CODEC_ID_EAC3,     { 0xAF, 0x87, 0xFB, 0xA7, 0x02, 0x2D,
> 0xFB,
> >> 0x42, 0xA4, 0xD4, 0x05, 0xCD, 0x93, 0x84, 0x3B, 0xDD } },
> >> >      { AV_CODEC_ID_MP2,      { 0x2B, 0x80, 0x6D, 0xE0, 0x46, 0xDB,
> 0xCF,
> >> 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } },
> >> > +    { AV_CODEC_ID_PCM_S24LE,{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
> 0x00,
> >> 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA } },
> >> >      { AV_CODEC_ID_NONE }
> >> >  };
> >> > --
> >>
> >> This is the generic PCM GUID, isn't it? It could be any PCM bitdepth,
> >> so the patch does not appear correct to me.
> >>
> >
> > Should i then look for the generic PCM GUID (to decide this is a PCM
> codec)
> > and base on the bits_per_coded_sample, selects the PCM codec?
> >
> >
>
> From what I can tell such files should already be handled by the
> generic WAVEFORMATEXTENSIBLE handler.
>

here is another version to fix the file.


diff --git a/libavformat/riff.h b/libavformat/riff.h
index 3b57bb45..cfc5ce8 100644
--- a/libavformat/riff.h
+++ b/libavformat/riff.h
@@ -109,6 +109,8 @@ extern const AVCodecGuid ff_codec_wav_guids[];
     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
+#define PCM_BASE_GUID \
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA

 static av_always_inline int ff_guidcmp(const void *g1, const void *g2)
 {
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 26779e1..ced19fb 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -71,7 +71,9 @@ static void parse_waveformatex(AVIOContext *pb,
AVCodecContext *c)
     if (!memcmp(subformat + 4,
                 (const uint8_t[]){ FF_AMBISONIC_BASE_GUID }, 12) ||
         !memcmp(subformat + 4,
-                (const uint8_t[]){ FF_MEDIASUBTYPE_BASE_GUID }, 12)) {
+                (const uint8_t[]){ FF_MEDIASUBTYPE_BASE_GUID }, 12) ||
+        !memcmp(subformat + 4,
+                (const uint8_t[]){ PCM_BASE_GUID }, 12)) {
         c->codec_tag = AV_RL32(subformat);
         c->codec_id  = ff_wav_codec_get_id(c->codec_tag,
                                            c->bits_per_coded_sample);




> Can you share a file which doesn't work as expected?
>
> - Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list