avcodec/hevc_parse: allow setting apply_defdispwin when decoding SPS NAL units
authorJames Almer <jamrial@gmail.com>
Sun, 2 Apr 2017 03:16:02 +0000 (00:16 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 9 Apr 2017 16:46:35 +0000 (13:46 -0300)
Reviewed-by: nevcairiel
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/hevc_parse.c
libavcodec/hevc_parse.h
libavcodec/mediacodecdec.c

index 25c44fd..ee4cd54 100644 (file)
@@ -23,7 +23,7 @@
 
 static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCParamSets *ps,
                                  int is_nalff, int nal_length_size, int err_recognition,
-                                 void *logctx)
+                                 int apply_defdispwin, void *logctx)
 {
     int i;
     int ret = 0;
@@ -45,7 +45,7 @@ static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCParamSets
                 goto done;
             break;
         case HEVC_NAL_SPS:
-            ret = ff_hevc_decode_nal_sps(&nal->gb, logctx, ps, 1);
+            ret = ff_hevc_decode_nal_sps(&nal->gb, logctx, ps, apply_defdispwin);
             if (ret < 0)
                 goto done;
             break;
@@ -69,8 +69,8 @@ done:
 }
 
 int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps,
-                             int *is_nalff, int *nal_length_size,
-                             int err_recognition, void *logctx)
+                             int *is_nalff, int *nal_length_size, int err_recognition,
+                             int apply_defdispwin, void *logctx)
 {
     int ret = 0;
     GetByteContext gb;
@@ -109,7 +109,7 @@ int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps,
                 }
 
                 ret = hevc_decode_nal_units(gb.buffer, nalsize, ps, *is_nalff, *nal_length_size,
-                                            err_recognition, logctx);
+                                            err_recognition, apply_defdispwin, logctx);
                 if (ret < 0) {
                     av_log(logctx, AV_LOG_ERROR,
                            "Decoding nal unit %d %d from hvcC failed\n",
@@ -126,7 +126,7 @@ int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps,
     } else {
         *is_nalff = 0;
         ret = hevc_decode_nal_units(data, size, ps, *is_nalff, *nal_length_size,
-                                    err_recognition, logctx);
+                                    err_recognition, apply_defdispwin, logctx);
         if (ret < 0)
             return ret;
     }
index 39bd23e..8aa46a2 100644 (file)
@@ -27,7 +27,7 @@
 #include "hevcdec.h"
 
 int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps,
-                             int *is_nalff, int *nal_length_size,
-                             int err_recognition, void *logctx);
+                             int *is_nalff, int *nal_length_size, int err_recognition,
+                             int apply_defdispwin, void *logctx);
 
 #endif /* AVCODEC_HEVC_PARSE_H */
index 857e7a5..6fd0db2 100644 (file)
@@ -202,7 +202,7 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
     memset(&ps, 0, sizeof(ps));
 
     ret = ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size,
-                                &ps, &is_nalff, &nal_length_size, 0, avctx);
+                                   &ps, &is_nalff, &nal_length_size, 0, 1, avctx);
     if (ret < 0) {
         goto done;
     }