Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
 libavcodec/hevcdec.c | 18 ++++++++++++++++++
 libavformat/mov.c    | 12 +++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 4dacdd7..44b6108 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2776,6 +2776,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) {
@@ -2787,6 +2789,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 cc0b64f..f143aa1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1776,13 +1776,11 @@ static int mov_skip_multiple_stsd(MOVContext *c, 
AVIOContext *pb,
     int video_codec_id = ff_codec_get_id(ff_codec_movvideo_tags, format);
 
     if (codec_tag &&
-        (codec_tag == AV_RL32("hvc1") ||
-         codec_tag == AV_RL32("hev1") ||
-         (codec_tag != format &&
-          // prores is allowed to have differing data format and codec tag
-          codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") &&
-          (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id
-                                 : codec_tag != MKTAG('j','p','e','g'))))) {
+        (codec_tag != format &&
+         // prores is allowed to have differing data format and codec tag
+         codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") &&
+         (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id
+                                : codec_tag != MKTAG('j','p','e','g')))) {
         /* Multiple fourcc, we skip JPEG. This is not correct, we should
          * export it as a separate AVStream but this needs a few changes
          * in the MOV demuxer, patch welcome. */
-- 
2.10.0

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to