Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size"
@ 2023-09-05 17:43 James Almer
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 2/4] avformat/demux: propagate the internal decoder's bitrate properties James Almer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: James Almer @ 2023-09-05 17:43 UTC (permalink / raw)
  To: ffmpeg-devel

This reverts commit eb88ccb92e05018b1060cf8126b30eeeff551d3b.

AVCodecContext fields are the proper place for a decoder to export such values.
This change is in preparation for the following commits.
---
 libavcodec/avcodec.h   |  2 +-
 libavcodec/mpeg12dec.c | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 649411ac79..714a3c78da 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1260,7 +1260,7 @@ typedef struct AVCodecContext {
     /**
      * decoder bitstream buffer size
      * - encoding: Set by user.
-     * - decoding: unused
+     * - decoding: May be set by libavcodec.
      */
     int rc_buffer_size;
 
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 36461a9ae6..2290a90778 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -76,7 +76,6 @@ typedef struct Mpeg1Context {
     unsigned aspect_ratio_info;
     AVRational save_aspect;
     int save_width, save_height, save_progressive_seq;
-    int rc_buffer_size;
     AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
     unsigned frame_rate_index;
     int sync;                   /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */
@@ -1392,7 +1391,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
     bit_rate_ext = get_bits(&s->gb, 12);  /* XXX: handle it */
     s->bit_rate += (bit_rate_ext << 18) * 400LL;
     check_marker(s->avctx, &s->gb, "after bit rate extension");
-    s1->rc_buffer_size += get_bits(&s->gb, 8) * 1024 * 16 << 10;
+    s->avctx->rc_buffer_size += get_bits(&s->gb, 8) * 1024 * 16 << 10;
 
     s->low_delay = get_bits1(&s->gb);
     if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
@@ -1405,7 +1404,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
     s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
 
     if (cpb_props = ff_add_cpb_side_data(s->avctx)) {
-        cpb_props->buffer_size = s1->rc_buffer_size;
+        cpb_props->buffer_size = s->avctx->rc_buffer_size;
         if (s->bit_rate != 0x3FFFF*400)
             cpb_props->max_bitrate = s->bit_rate;
     }
@@ -1414,7 +1413,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
         av_log(s->avctx, AV_LOG_DEBUG,
                "profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, bitrate:%"PRId64"\n",
                s->avctx->profile, s->avctx->level, s->progressive_sequence, s->chroma_format,
-               s1->rc_buffer_size, s->bit_rate);
+               s->avctx->rc_buffer_size, s->bit_rate);
 }
 
 static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
@@ -2104,7 +2103,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
         return AVERROR_INVALIDDATA;
     }
 
-    s1->rc_buffer_size = get_bits(&s->gb, 10) * 1024 * 16;
+    s->avctx->rc_buffer_size = get_bits(&s->gb, 10) * 1024 * 16;
     skip_bits(&s->gb, 1);
 
     /* get matrix */
@@ -2152,7 +2151,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
 
     if (s->avctx->debug & FF_DEBUG_PICT_INFO)
         av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%"PRId64", aspect_ratio_info: %d \n",
-               s1->rc_buffer_size, s->bit_rate, s1->aspect_ratio_info);
+               s->avctx->rc_buffer_size, s->bit_rate, s1->aspect_ratio_info);
 
     return 0;
 }
-- 
2.42.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 2/4] avformat/demux: propagate the internal decoder's bitrate properties
  2023-09-05 17:43 [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
@ 2023-09-05 17:43 ` James Almer
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpeg12dec: stop propagating AVCPBProperties side data James Almer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: James Almer @ 2023-09-05 17:43 UTC (permalink / raw)
  To: ffmpeg-devel

Muxers may access this information through cpb properties within the stream's
side data.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/demux.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index b218f64574..fcd5daf699 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -2974,6 +2974,23 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             ret = add_coded_side_data(st, sti->avctx);
             if (ret < 0)
                 goto find_stream_info_err;
+
+            if (sti->avctx->rc_buffer_size > 0 || sti->avctx->rc_max_rate > 0 ||
+                sti->avctx->rc_min_rate) {
+                size_t cpb_size;
+                AVCPBProperties *props = av_cpb_properties_alloc(&cpb_size);
+                if (props) {
+                    if (sti->avctx->rc_buffer_size > 0)
+                        props->buffer_size = sti->avctx->rc_buffer_size;
+                    if (sti->avctx->rc_min_rate > 0)
+                        props->min_bitrate = sti->avctx->rc_min_rate;
+                    if (sti->avctx->rc_max_rate > 0)
+                        props->max_bitrate = sti->avctx->rc_max_rate;
+                    if (av_stream_add_side_data(st, AV_PKT_DATA_CPB_PROPERTIES,
+                                                (uint8_t *)props, cpb_size))
+                        av_free(props);
+                }
+            }
         }
 
         sti->avctx_inited = 0;
-- 
2.42.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 3/4] avcodec/mpeg12dec: stop propagating AVCPBProperties side data
  2023-09-05 17:43 [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 2/4] avformat/demux: propagate the internal decoder's bitrate properties James Almer
@ 2023-09-05 17:43 ` James Almer
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 4/4] avcodec/utils: move ff_add_cpb_side_data() to encoder code James Almer
  2023-09-06 12:13 ` [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
  3 siblings, 0 replies; 5+ messages in thread
From: James Almer @ 2023-09-05 17:43 UTC (permalink / raw)
  To: ffmpeg-devel

It's already exported using the relevant AVCodecContext fields.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/mpeg12dec.c        | 10 ++--------
 libavcodec/mpegvideo_parser.c |  2 +-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 2290a90778..1accd07e9e 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1248,7 +1248,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
         if (ret < 0)
             return ret;
 
-        if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) {
+        if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate &&
+            (s->bit_rate != 0x3FFFF*400)) {
             avctx->rc_max_rate = s->bit_rate;
         } else if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate &&
                    (s->bit_rate != 0x3FFFF*400 || s->vbv_delay != 0xFFFF)) {
@@ -1371,7 +1372,6 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
     MpegEncContext *s = &s1->mpeg_enc_ctx;
     int horiz_size_ext, vert_size_ext;
     int bit_rate_ext;
-    AVCPBProperties *cpb_props;
 
     skip_bits(&s->gb, 1); /* profile and level esc*/
     s->avctx->profile       = get_bits(&s->gb, 3);
@@ -1403,12 +1403,6 @@ static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
     ff_dlog(s->avctx, "sequence extension\n");
     s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
 
-    if (cpb_props = ff_add_cpb_side_data(s->avctx)) {
-        cpb_props->buffer_size = s->avctx->rc_buffer_size;
-        if (s->bit_rate != 0x3FFFF*400)
-            cpb_props->max_bitrate = s->bit_rate;
-    }
-
     if (s->avctx->debug & FF_DEBUG_PICT_INFO)
         av_log(s->avctx, AV_LOG_DEBUG,
                "profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, bitrate:%"PRId64"\n",
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index 1204789c67..d0b22634bb 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -233,7 +233,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     if (set_dim_ret < 0)
         av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions\n");
 
-    if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && bit_rate) {
+    if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && bit_rate && bit_rate != 0x3FFFF) {
         avctx->rc_max_rate = 400LL*bit_rate;
     }
     if (bit_rate &&
-- 
2.42.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 4/4] avcodec/utils: move ff_add_cpb_side_data() to encoder code
  2023-09-05 17:43 [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 2/4] avformat/demux: propagate the internal decoder's bitrate properties James Almer
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpeg12dec: stop propagating AVCPBProperties side data James Almer
@ 2023-09-05 17:43 ` James Almer
  2023-09-06 12:13 ` [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
  3 siblings, 0 replies; 5+ messages in thread
From: James Almer @ 2023-09-05 17:43 UTC (permalink / raw)
  To: ffmpeg-devel

It's only used by encoders, so move it to prevent wrong usage.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/encode.c         | 31 +++++++++++++++++++++++++++++++
 libavcodec/encode.h         |  5 +++++
 libavcodec/internal.h       |  5 -----
 libavcodec/libaomenc.c      |  2 +-
 libavcodec/libopenh264enc.c |  2 +-
 libavcodec/libsvtav1.c      |  2 +-
 libavcodec/libvpxenc.c      |  2 +-
 libavcodec/libx264.c        |  2 +-
 libavcodec/libx265.c        |  2 +-
 libavcodec/mpegvideo_enc.c  |  2 +-
 libavcodec/nvenc.c          |  2 +-
 libavcodec/qsvenc.c         |  2 +-
 libavcodec/utils.c          | 31 -------------------------------
 13 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index b92593770c..7cd3213b73 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -865,3 +865,34 @@ AVCodecInternal *ff_encode_internal_alloc(void)
 {
     return av_mallocz(sizeof(EncodeContext));
 }
+
+AVCPBProperties *ff_encode_add_cpb_side_data(AVCodecContext *avctx)
+{
+    AVPacketSideData *tmp;
+    AVCPBProperties  *props;
+    size_t size;
+    int i;
+
+    for (i = 0; i < avctx->nb_coded_side_data; i++)
+        if (avctx->coded_side_data[i].type == AV_PKT_DATA_CPB_PROPERTIES)
+            return (AVCPBProperties *)avctx->coded_side_data[i].data;
+
+    props = av_cpb_properties_alloc(&size);
+    if (!props)
+        return NULL;
+
+    tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
+    if (!tmp) {
+        av_freep(&props);
+        return NULL;
+    }
+
+    avctx->coded_side_data = tmp;
+    avctx->nb_coded_side_data++;
+
+    avctx->coded_side_data[avctx->nb_coded_side_data - 1].type = AV_PKT_DATA_CPB_PROPERTIES;
+    avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
+    avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
+
+    return props;
+}
diff --git a/libavcodec/encode.h b/libavcodec/encode.h
index dfaab7c976..e019cd7702 100644
--- a/libavcodec/encode.h
+++ b/libavcodec/encode.h
@@ -73,6 +73,11 @@ int ff_encode_reordered_opaque(AVCodecContext *avctx,
 int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
                         AVFrame *frame, int *got_packet);
 
+/**
+ * Add a CPB properties side data to an encoding context.
+ */
+AVCPBProperties *ff_encode_add_cpb_side_data(AVCodecContext *avctx);
+
 /**
  * Rescale from sample rate to AVCodecContext.time_base.
  */
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index a67cf713ca..83e0bc3fb2 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -180,11 +180,6 @@ int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx);
 
 int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec);
 
-/**
- * Add a CPB properties side data to an encoding context.
- */
-AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx);
-
 /**
  * Check AVFrame for S12M timecode side data and allocate and fill TC SEI message with timecode info
  *
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index f29cb0784a..53a1159b75 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -1018,7 +1018,7 @@ static av_cold int aom_init(AVCodecContext *avctx,
     if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH)
         ctx->rawimg.bit_depth = enccfg.g_bit_depth;
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
 
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 5b59af6f94..433accba22 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -353,7 +353,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         memcpy(avctx->extradata, fbi.sLayerInfo[0].pBsBuf, size);
     }
 
-    props = ff_add_cpb_side_data(avctx);
+    props = ff_encode_add_cpb_side_data(avctx);
     if (!props)
         return AVERROR(ENOMEM);
     props->max_bitrate = param.iMaxBitrate;
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index f2b73361d8..a8b3b62b96 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -325,7 +325,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
                             FFMAX(avctx->bit_rate, avctx->rc_max_rate) / 1000LL;
 
     if (avctx->bit_rate || avctx->rc_max_rate || avctx->rc_buffer_size) {
-        AVCPBProperties *cpb_props = ff_add_cpb_side_data(avctx);
+        AVCPBProperties *cpb_props = ff_encode_add_cpb_side_data(avctx);
         if (!cpb_props)
             return AVERROR(ENOMEM);
 
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 7a545527a9..0f6f4e785c 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -1273,7 +1273,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
         ctx->rawimg.bit_depth = enccfg.g_bit_depth;
 #endif
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
 
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index ce849d6c9a..131d1c7fc9 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1231,7 +1231,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         avctx->extradata_size = p - avctx->extradata;
     }
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
     cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000;
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 873b3021ee..447e6da25f 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -395,7 +395,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     ctx->params->rc.vbvBufferSize = avctx->rc_buffer_size / 1000;
     ctx->params->rc.vbvMaxBitrate = avctx->rc_max_rate    / 1000;
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
     cpb_props->buffer_size = ctx->params->rc.vbvBufferSize * 1000;
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 69e3152c82..5bf4b06a11 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -973,7 +973,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
         }
     }
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
     cpb_props->max_bitrate = avctx->rc_max_rate;
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 1e83ea9734..4249ff7188 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1666,7 +1666,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     if (ctx->encode_config.rcParams.averageBitRate > 0)
         avctx->bit_rate = ctx->encode_config.rcParams.averageBitRate;
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
     cpb_props->max_bitrate = ctx->encode_config.rcParams.maxBitRate;
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index b3b7475b0f..ac7364f61f 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1504,7 +1504,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
     }
     memset(avctx->extradata + avctx->extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 
-    cpb_props = ff_add_cpb_side_data(avctx);
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
     if (!cpb_props)
         return AVERROR(ENOMEM);
     cpb_props->max_bitrate = avctx->rc_max_rate;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bd4131db62..d54e050848 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1018,37 +1018,6 @@ AVCPBProperties *av_cpb_properties_alloc(size_t *size)
     return props;
 }
 
-AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx)
-{
-    AVPacketSideData *tmp;
-    AVCPBProperties  *props;
-    size_t size;
-    int i;
-
-    for (i = 0; i < avctx->nb_coded_side_data; i++)
-        if (avctx->coded_side_data[i].type == AV_PKT_DATA_CPB_PROPERTIES)
-            return (AVCPBProperties *)avctx->coded_side_data[i].data;
-
-    props = av_cpb_properties_alloc(&size);
-    if (!props)
-        return NULL;
-
-    tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
-    if (!tmp) {
-        av_freep(&props);
-        return NULL;
-    }
-
-    avctx->coded_side_data = tmp;
-    avctx->nb_coded_side_data++;
-
-    avctx->coded_side_data[avctx->nb_coded_side_data - 1].type = AV_PKT_DATA_CPB_PROPERTIES;
-    avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
-    avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
-
-    return props;
-}
-
 static unsigned bcd2uint(uint8_t bcd)
 {
     unsigned low  = bcd & 0xf;
-- 
2.42.0

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

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size"
  2023-09-05 17:43 [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
                   ` (2 preceding siblings ...)
  2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 4/4] avcodec/utils: move ff_add_cpb_side_data() to encoder code James Almer
@ 2023-09-06 12:13 ` James Almer
  3 siblings, 0 replies; 5+ messages in thread
From: James Almer @ 2023-09-06 12:13 UTC (permalink / raw)
  To: ffmpeg-devel

On 9/5/2023 2:43 PM, James Almer wrote:
> This reverts commit eb88ccb92e05018b1060cf8126b30eeeff551d3b.
> 
> AVCodecContext fields are the proper place for a decoder to export such values.
> This change is in preparation for the following commits.
> ---
>   libavcodec/avcodec.h   |  2 +-
>   libavcodec/mpeg12dec.c | 11 +++++------
>   2 files changed, 6 insertions(+), 7 deletions(-)

Will apply set.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-06 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 17:43 [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer
2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 2/4] avformat/demux: propagate the internal decoder's bitrate properties James Almer
2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpeg12dec: stop propagating AVCPBProperties side data James Almer
2023-09-05 17:43 ` [FFmpeg-devel] [PATCH 4/4] avcodec/utils: move ff_add_cpb_side_data() to encoder code James Almer
2023-09-06 12:13 ` [FFmpeg-devel] [PATCH 1/4] Revert "avcodec/mpeg12dec: Do not alter avctx->rc_buffer_size" James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git