diff mbox series

[FFmpeg-devel,2/2] avcodec/adxdec: add support for new extradata in packet sidedata

Message ID 20200912223321.21856-2-onemda@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avformat: add CRI AAX demuxer
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Paul B Mahol Sept. 12, 2020, 10:33 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/adxdec.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index 40ed8e5ba7..81ffc8b296 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -103,6 +103,22 @@  static int adx_decode_frame(AVCodecContext *avctx, void *data,
     const uint8_t *buf  = avpkt->data;
     const uint8_t *buf_end = buf + avpkt->size;
     int num_blocks, ch, ret;
+    int new_extradata_size;
+    uint8_t *new_extradata;
+
+    new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
+                                            &new_extradata_size);
+    if (new_extradata && new_extradata_size > 0) {
+        int header_size;
+        if ((ret = ff_adx_decode_header(avctx, new_extradata,
+                                        new_extradata_size, &header_size,
+                                        c->coeff)) < 0) {
+            av_log(avctx, AV_LOG_ERROR, "error parsing new ADX extradata\n");
+            return AVERROR_INVALIDDATA;
+        }
+
+        c->eof = 0;
+    }
 
     if (c->eof) {
         *got_frame_ptr = 0;