]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cbs_h2645.c
fftools/ffmpeg: make specifying thread_queue_size turn on threaded input
[ffmpeg] / libavcodec / cbs_h2645.c
index 095e449ddceef7e054a7d1276bdc2507fe8d1057..e5c8012d39efee166e354208371d200116096f40 100644 (file)
@@ -408,10 +408,11 @@ static int cbs_h2645_read_more_rbsp_data(GetBitContext *gbc)
 
 #define infer(name, value) do { \
         if (current->name != (value)) { \
-            av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
+            av_log(ctx->log_ctx, AV_LOG_ERROR, \
                    "%s does not match inferred value: " \
                    "%"PRId64", but should be %"PRId64".\n", \
                    #name, (int64_t)current->name, (int64_t)(value)); \
+            return AVERROR_INVALIDDATA; \
         } \
     } while (0)
 
@@ -553,6 +554,7 @@ static void cbs_h265_free_sei_payload(H265RawSEIPayload *payload)
         av_buffer_unref(&payload->payload.other.data_ref);
         break;
     }
+    av_buffer_unref(&payload->extension_data.data_ref);
 }
 
 static void cbs_h265_free_sei(void *opaque, uint8_t *content)
@@ -589,7 +591,7 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
         ref = (nal->data == nal->raw_data) ? frag->data_ref
                                            : packet->rbsp.rbsp_buffer_ref;
 
-        err = ff_cbs_insert_unit_data(ctx, frag, -1, nal->type,
+        err = ff_cbs_insert_unit_data(frag, -1, nal->type,
                             (uint8_t*)nal->data, size, ref);
         if (err < 0)
             return err;
@@ -805,7 +807,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
         {
             H264RawSPS *sps;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*sps), NULL);
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*sps), NULL);
             if (err < 0)
                 return err;
             sps = unit->content;
@@ -822,7 +824,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
 
     case H264_NAL_SPS_EXT:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit,
+            err = ff_cbs_alloc_unit_content(unit,
                                             sizeof(H264RawSPSExtension),
                                             NULL);
             if (err < 0)
@@ -838,7 +840,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
         {
             H264RawPPS *pps;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*pps),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*pps),
                                             &cbs_h264_free_pps);
             if (err < 0)
                 return err;
@@ -861,7 +863,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
             H264RawSlice *slice;
             int pos, len;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*slice),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*slice),
                                             &cbs_h264_free_slice);
             if (err < 0)
                 return err;
@@ -888,7 +890,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
 
     case H264_NAL_AUD:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit,
+            err = ff_cbs_alloc_unit_content(unit,
                                             sizeof(H264RawAUD), NULL);
             if (err < 0)
                 return err;
@@ -901,7 +903,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
 
     case H264_NAL_SEI:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(H264RawSEI),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(H264RawSEI),
                                             &cbs_h264_free_sei);
             if (err < 0)
                 return err;
@@ -914,7 +916,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
 
     case H264_NAL_FILLER_DATA:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit,
+            err = ff_cbs_alloc_unit_content(unit,
                                             sizeof(H264RawFiller), NULL);
             if (err < 0)
                 return err;
@@ -928,7 +930,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
     case H264_NAL_END_SEQUENCE:
     case H264_NAL_END_STREAM:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit,
+            err = ff_cbs_alloc_unit_content(unit,
                                             sizeof(H264RawNALUnitHeader),
                                             NULL);
             if (err < 0)
@@ -964,7 +966,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
         {
             H265RawVPS *vps;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*vps),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*vps),
                                             &cbs_h265_free_vps);
             if (err < 0)
                 return err;
@@ -983,7 +985,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
         {
             H265RawSPS *sps;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*sps),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*sps),
                                             &cbs_h265_free_sps);
             if (err < 0)
                 return err;
@@ -1003,7 +1005,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
         {
             H265RawPPS *pps;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*pps),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*pps),
                                             &cbs_h265_free_pps);
             if (err < 0)
                 return err;
@@ -1039,7 +1041,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
             H265RawSlice *slice;
             int pos, len;
 
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*slice),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(*slice),
                                             &cbs_h265_free_slice);
             if (err < 0)
                 return err;
@@ -1066,7 +1068,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
 
     case HEVC_NAL_AUD:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit,
+            err = ff_cbs_alloc_unit_content(unit,
                                             sizeof(H265RawAUD), NULL);
             if (err < 0)
                 return err;
@@ -1080,7 +1082,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
     case HEVC_NAL_SEI_PREFIX:
     case HEVC_NAL_SEI_SUFFIX:
         {
-            err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(H265RawSEI),
+            err = ff_cbs_alloc_unit_content(unit, sizeof(H265RawSEI),
                                             &cbs_h265_free_sei);
 
             if (err < 0)
@@ -1529,8 +1531,7 @@ const CodedBitstreamType ff_cbs_type_h265 = {
     .close             = &cbs_h265_close,
 };
 
-int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx,
-                                CodedBitstreamFragment *au,
+int ff_cbs_h264_add_sei_message(CodedBitstreamFragment *au,
                                 H264RawSEIPayload *payload)
 {
     H264RawSEI *sei = NULL;
@@ -1575,7 +1576,7 @@ int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx,
                 break;
         }
 
-        err = ff_cbs_insert_unit_content(ctx, au, i, H264_NAL_SEI,
+        err = ff_cbs_insert_unit_content(au, i, H264_NAL_SEI,
                                          sei, sei_ref);
         av_buffer_unref(&sei_ref);
         if (err < 0)
@@ -1591,8 +1592,7 @@ fail:
     return err;
 }
 
-void ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx,
-                                    CodedBitstreamFragment *au,
+void ff_cbs_h264_delete_sei_message(CodedBitstreamFragment *au,
                                     CodedBitstreamUnit *nal,
                                     int position)
 {
@@ -1610,7 +1610,7 @@ void ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx,
                 break;
         }
 
-        ff_cbs_delete_unit(ctx, au, i);
+        ff_cbs_delete_unit(au, i);
     } else {
         cbs_h264_free_sei_payload(&sei->payload[position]);