diff mbox

[FFmpeg-devel,2/2] avformat/wavdec: add support for decoding 24.0 and 16.8 floating point pcm formats

Message ID 1474319840-13896-2-git-send-email-onemda@gmail.com
State Accepted
Commit 314269118161ed7735a905332ccf847d1ec696a2
Headers show

Commit Message

Paul B Mahol Sept. 19, 2016, 9:17 p.m. UTC
Fixes #5602 and #5603.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavformat/wavdec.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Michael Niedermayer Nov. 13, 2016, 8:18 p.m. UTC | #1
On Mon, Sep 19, 2016 at 11:17:20PM +0200, Paul B Mahol wrote:
> Fixes #5602 and #5603.
> 
> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavformat/wavdec.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

LGTM

please add a fate test if possible

thx

[...]
diff mbox

Patch

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 7176cd6..9f760c1 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -560,6 +560,19 @@  break_loop:
     if (sample_count)
         st->duration = sample_count;
 
+    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S32LE &&
+        st->codecpar->block_align == st->codecpar->channels * 4 &&
+        st->codecpar->bits_per_coded_sample == 32 &&
+        st->codecpar->extradata_size == 2 &&
+        AV_RL16(st->codecpar->extradata) == 1) {
+        st->codecpar->codec_id = AV_CODEC_ID_PCM_F16LE;
+        st->codecpar->bits_per_coded_sample = 16;
+    } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE &&
+               st->codecpar->block_align == st->codecpar->channels * 4 &&
+               st->codecpar->bits_per_coded_sample == 24) {
+        st->codecpar->codec_id = AV_CODEC_ID_PCM_F24LE;
+    }
+
     ff_metadata_conv_ctx(s, NULL, wav_metadata_conv);
     ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv);