[FFmpeg-devel] [PATCH 2/2] hevc: Support extradata changes

Vittorio Giovara vittorio.giovara at gmail.com
Wed Nov 2 17:48:58 EET 2016


Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
---
Please CC.
Vittorio

 libavcodec/hevc.c | 18 ++++++++++++++++++
 libavformat/mov.c |  4 ----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 29e0d49..b50120e 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -3051,6 +3051,8 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
                              AVPacket *avpkt)
 {
     int ret;
+    int new_extradata_size;
+    uint8_t *new_extradata;
     HEVCContext *s = avctx->priv_data;
 
     if (!avpkt->size) {
@@ -3062,6 +3064,22 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
         return 0;
     }
 
+    new_extradata_size = 0;
+    new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
+                                            &new_extradata_size);
+    if (new_extradata_size > 0 && new_extradata) {
+        if (new_extradata_size > avctx->extradata_size) {
+            avctx->extradata = av_realloc(avctx->extradata, new_extradata_size);
+            if (!avctx->extradata)
+                return AVERROR(ENOMEM);
+        }
+        avctx->extradata_size = new_extradata_size;
+        memcpy(avctx->extradata, new_extradata, new_extradata_size);
+        ret = hevc_decode_extradata(s);
+        if (ret < 0)
+            return ret;
+    }
+
     s->ref = NULL;
     ret    = decode_nal_units(s, avpkt->data, avpkt->size);
     if (ret < 0)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4222088..24c75ab 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2212,10 +2212,6 @@ static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb,
         avio_skip(pb, size);
         return 1;
     }
-    if ( codec_tag == AV_RL32("hvc1") ||
-         codec_tag == AV_RL32("hev1")
-    )
-        av_log(c->fc, AV_LOG_WARNING, "Concatenated H.264 or H.265 might not play correctly.\n");
 
     return 0;
 }
-- 
2.10.0



More information about the ffmpeg-devel mailing list