[FFmpeg-devel,v3,13/25] avcodec/utils: do_decode now supports AVMEDIA_TYPE_DATA

Submitted by erkki.seppala.ext@nokia.com on Sept. 19, 2016, 1:25 p.m.

Details

Message ID 1474291548-17810-14-git-send-email-erkki.seppala.ext@nokia.com
State New
Headers show

Commit Message

erkki.seppala.ext@nokia.com Sept. 19, 2016, 1:25 p.m.
This allows using avcodec_send_packet with data frames (ie. timed
metadata)

Signed-off-by: Erkki Seppälä <erkki.seppala.ext@nokia.com>
Signed-off-by: OZOPlayer <OZOPL@nokia.com>
---
 libavcodec/utils.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 138125a..8b55464 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2737,6 +2737,10 @@  static int do_decode(AVCodecContext *avctx, AVPacket *pkt)
     } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
         ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame,
                                     &got_frame, pkt);
+    } else if (avctx->codec_type == AVMEDIA_TYPE_DATA) {
+        ret = avctx->codec->decode(avctx, avctx->internal->buffer_frame, &got_frame, pkt);
+        if (ret == 0 && got_frame)
+            ret = pkt->size;
     } else {
         ret = AVERROR(EINVAL);
     }