Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 17/30] avformat: remove deprecated FF_API_AVSTREAM_SIDE_DATA
Date: Sun, 23 Feb 2025 19:06:17 -0300
Message-ID: <20250223220630.18756-18-jamrial@gmail.com> (raw)
In-Reply-To: <20250223220630.18756-1-jamrial@gmail.com>

Deprecated since 2023-10-06.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/avformat.c      |  80 ----------------------------
 libavformat/avformat.h      | 103 ------------------------------------
 libavformat/demux.c         |  46 ----------------
 libavformat/demux_utils.c   |  12 -----
 libavformat/internal.h      |  11 ----
 libavformat/mux.c           |  22 --------
 libavformat/options.c       |   5 --
 libavformat/seek.c          |   7 ---
 libavformat/version_major.h |   1 -
 9 files changed, 287 deletions(-)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index f53299cc40..18ca4643ee 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -50,14 +50,6 @@ void ff_free_stream(AVStream **pst)
     if (!st)
         return;
 
-#if FF_API_AVSTREAM_SIDE_DATA
-FF_DISABLE_DEPRECATION_WARNINGS
-    for (int i = 0; i < st->nb_side_data; i++)
-        av_freep(&st->side_data[i].data);
-    av_freep(&st->side_data);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     if (st->attached_pic.data)
         av_packet_unref(&st->attached_pic);
 
@@ -199,78 +191,6 @@ void avformat_free_context(AVFormatContext *s)
     av_free(s);
 }
 
-#if FF_API_AVSTREAM_SIDE_DATA
-FF_DISABLE_DEPRECATION_WARNINGS
-uint8_t *av_stream_get_side_data(const AVStream *st,
-                                 enum AVPacketSideDataType type, size_t *size)
-{
-    for (int i = 0; i < st->nb_side_data; i++) {
-        if (st->side_data[i].type == type) {
-            if (size)
-                *size = st->side_data[i].size;
-            return st->side_data[i].data;
-        }
-    }
-    if (size)
-        *size = 0;
-    return NULL;
-}
-
-int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
-                            uint8_t *data, size_t size)
-{
-    AVPacketSideData *sd, *tmp;
-
-    for (int i = 0; i < st->nb_side_data; i++) {
-        sd = &st->side_data[i];
-
-        if (sd->type == type) {
-            av_freep(&sd->data);
-            sd->data = data;
-            sd->size = size;
-            return 0;
-        }
-    }
-
-    if (st->nb_side_data + 1U > FFMIN(INT_MAX, SIZE_MAX / sizeof(*tmp)))
-        return AVERROR(ERANGE);
-
-    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
-    if (!tmp) {
-        return AVERROR(ENOMEM);
-    }
-
-    st->side_data = tmp;
-    st->nb_side_data++;
-
-    sd = &st->side_data[st->nb_side_data - 1];
-    sd->type = type;
-    sd->data = data;
-    sd->size = size;
-
-    return 0;
-}
-
-uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
-                                 size_t size)
-{
-    int ret;
-    uint8_t *data = av_malloc(size);
-
-    if (!data)
-        return NULL;
-
-    ret = av_stream_add_side_data(st, type, data, size);
-    if (ret < 0) {
-        av_freep(&data);
-        return NULL;
-    }
-
-    return data;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 /**
  * Copy all stream parameters from source to destination stream, with the
  * exception of the index field, which is usually set by avformat_new_stream().
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 08e3206290..fabe1d305c 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -844,38 +844,6 @@ typedef struct AVStream {
      */
     AVPacket attached_pic;
 
-#if FF_API_AVSTREAM_SIDE_DATA
-    /**
-     * An array of side data that applies to the whole stream (i.e. the
-     * container does not allow it to change between packets).
-     *
-     * There may be no overlap between the side data in this array and side data
-     * in the packets. I.e. a given side data is either exported by the muxer
-     * (demuxing) / set by the caller (muxing) in this array, then it never
-     * appears in the packets, or the side data is exported / sent through
-     * the packets (always in the first packet where the value becomes known or
-     * changes), then it does not appear in this array.
-     *
-     * - demuxing: Set by libavformat when the stream is created.
-     * - muxing: May be set by the caller before avformat_write_header().
-     *
-     * Freed by libavformat in avformat_free_context().
-     *
-     * @deprecated use AVStream's @ref AVCodecParameters.coded_side_data
-     *             "codecpar side data".
-     */
-    attribute_deprecated
-    AVPacketSideData *side_data;
-    /**
-     * The number of elements in the AVStream.side_data array.
-     *
-     * @deprecated use AVStream's @ref AVCodecParameters.nb_coded_side_data
-     *             "codecpar side data".
-     */
-    attribute_deprecated
-    int            nb_side_data;
-#endif
-
     /**
      * Flags indicating events happening on the stream, a combination of
      * AVSTREAM_EVENT_FLAG_*.
@@ -1923,26 +1891,6 @@ typedef struct AVFormatContext {
     int64_t duration_probesize;
 } AVFormatContext;
 
-#if FF_API_AVSTREAM_SIDE_DATA
-/**
- * This function will cause global side data to be injected in the next packet
- * of each stream as well as after any subsequent seek.
- *
- * @note global side data is always available in every AVStream's
- *       @ref AVCodecParameters.coded_side_data "codecpar side data" array, and
- *       in a @ref AVCodecContext.coded_side_data "decoder's side data" array if
- *       initialized with said stream's codecpar.
- * @see av_packet_side_data_get()
- *
- * @deprecated this function should never be needed, as global side data is now
- *             exported in AVCodecParameters and should
- *             be propagated from demuxers to decoders via
- *             ::avcodec_parameters_to_context()
- */
-attribute_deprecated
-void av_format_inject_global_side_data(AVFormatContext *s);
-#endif
-
 #if FF_API_GET_DUR_ESTIMATE_METHOD
 /**
  * Returns the method used to set ctx->duration.
@@ -2131,57 +2079,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const struct AVCodec *c);
  */
 int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st);
 
-#if FF_API_AVSTREAM_SIDE_DATA
-/**
- * Wrap an existing array as stream side data.
- *
- * @param st   stream
- * @param type side information type
- * @param data the side data array. It must be allocated with the av_malloc()
- *             family of functions. The ownership of the data is transferred to
- *             st.
- * @param size side information size
- *
- * @return zero on success, a negative AVERROR code on failure. On failure,
- *         the stream is unchanged and the data remains owned by the caller.
- * @deprecated use av_packet_side_data_add() with the stream's
- *             @ref AVCodecParameters.coded_side_data "codecpar side data"
- */
-attribute_deprecated
-int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
-                            uint8_t *data, size_t size);
-
-/**
- * Allocate new information from stream.
- *
- * @param stream stream
- * @param type   desired side information type
- * @param size   side information size
- *
- * @return pointer to fresh allocated data or NULL otherwise
- * @deprecated use av_packet_side_data_new() with the stream's
- *             @ref AVCodecParameters.coded_side_data "codecpar side data"
- */
-attribute_deprecated
-uint8_t *av_stream_new_side_data(AVStream *stream,
-                                 enum AVPacketSideDataType type, size_t size);
-/**
- * Get side information from stream.
- *
- * @param stream stream
- * @param type   desired side information type
- * @param size   If supplied, *size will be set to the size of the side data
- *               or to zero if the desired side data is not present.
- *
- * @return pointer to data if present or NULL otherwise
- * @deprecated use av_packet_side_data_get() with the stream's
- *             @ref AVCodecParameters.coded_side_data "codecpar side data"
- */
-attribute_deprecated
-uint8_t *av_stream_get_side_data(const AVStream *stream,
-                                 enum AVPacketSideDataType type, size_t *size);
-#endif
-
 AVProgram *av_new_program(AVFormatContext *s, int id);
 
 /**
diff --git a/libavformat/demux.c b/libavformat/demux.c
index c0bfb9cb67..71af8acad9 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1495,27 +1495,6 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
             }
             sti->skip_samples = 0;
         }
-
-#if FF_API_AVSTREAM_SIDE_DATA
-        if (sti->inject_global_side_data) {
-            for (int i = 0; i < st->codecpar->nb_coded_side_data; i++) {
-                const AVPacketSideData *const src_sd = &st->codecpar->coded_side_data[i];
-                uint8_t *dst_data;
-
-                if (av_packet_get_side_data(pkt, src_sd->type, NULL))
-                    continue;
-
-                dst_data = av_packet_new_side_data(pkt, src_sd->type, src_sd->size);
-                if (!dst_data) {
-                    av_log(s, AV_LOG_WARNING, "Could not inject global side data\n");
-                    continue;
-                }
-
-                memcpy(dst_data, src_sd->data, src_sd->size);
-            }
-            sti->inject_global_side_data = 0;
-        }
-#endif
     }
 
     if (!fci->metafree) {
@@ -3074,31 +3053,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
         }
 
         sti->avctx_inited = 0;
-#if FF_API_AVSTREAM_SIDE_DATA
-FF_DISABLE_DEPRECATION_WARNINGS
-        if (st->codecpar->nb_coded_side_data > 0) {
-            av_assert0(!st->side_data && !st->nb_side_data);
-            st->side_data = av_calloc(st->codecpar->nb_coded_side_data, sizeof(*st->side_data));
-            if (!st->side_data) {
-                ret = AVERROR(ENOMEM);
-                goto find_stream_info_err;
-            }
-
-            for (int j = 0; j < st->codecpar->nb_coded_side_data; j++) {
-                uint8_t *data = av_memdup(st->codecpar->coded_side_data[j].data,
-                                          st->codecpar->coded_side_data[j].size);
-                if (!data) {
-                    ret = AVERROR(ENOMEM);
-                    goto find_stream_info_err;
-                }
-                st->side_data[j].type = st->codecpar->coded_side_data[j].type;
-                st->side_data[j].size = st->codecpar->coded_side_data[j].size;
-                st->side_data[j].data = data;
-                st->nb_side_data++;
-            }
-        }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
     }
 
 find_stream_info_err:
diff --git a/libavformat/demux_utils.c b/libavformat/demux_utils.c
index 9aae521c6c..b632277460 100644
--- a/libavformat/demux_utils.c
+++ b/libavformat/demux_utils.c
@@ -81,18 +81,6 @@ AVChapter *avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_ba
     return chapter;
 }
 
-#if FF_API_AVSTREAM_SIDE_DATA
-void av_format_inject_global_side_data(AVFormatContext *s)
-{
-    FFFormatContext *const si = ffformatcontext(s);
-    si->inject_global_side_data = 1;
-    for (unsigned i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        ffstream(st)->inject_global_side_data = 1;
-    }
-}
-#endif
-
 int avformat_queue_attached_pictures(AVFormatContext *s)
 {
     FormatContextInternal *const fci = ff_fc_internal(s);
diff --git a/libavformat/internal.h b/libavformat/internal.h
index b909adf209..500c310b88 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -110,10 +110,6 @@ typedef struct FFFormatContext {
      */
     AVPacket *pkt;
 
-#if FF_API_AVSTREAM_SIDE_DATA
-    int inject_global_side_data;
-#endif
-
     int avoid_negative_ts_use_pts;
 
     /**
@@ -292,13 +288,6 @@ typedef struct FFStream {
     uint8_t dts_ordered;
     uint8_t dts_misordered;
 
-#if FF_API_AVSTREAM_SIDE_DATA
-    /**
-     * Internal data to inject global side data
-     */
-    int inject_global_side_data;
-#endif
-
     /**
      * display aspect ratio (0 if unknown)
      * - encoding: unused
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 60204f6266..db3b6c2bfe 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -295,27 +295,6 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
             }
         }
 
-#if FF_API_AVSTREAM_SIDE_DATA
-FF_DISABLE_DEPRECATION_WARNINGS
-        /* if the caller is using the deprecated AVStream side_data API,
-         * copy its contents to AVStream.codecpar, giving it priority
-           over existing side data in the latter */
-        for (int i = 0; i < st->nb_side_data; i++) {
-            const AVPacketSideData *sd_src = &st->side_data[i];
-            AVPacketSideData *sd_dst;
-
-            sd_dst = av_packet_side_data_new(&st->codecpar->coded_side_data,
-                                             &st->codecpar->nb_coded_side_data,
-                                             sd_src->type, sd_src->size, 0);
-            if (!sd_dst) {
-                ret = AVERROR(ENOMEM);
-                goto fail;
-            }
-            memcpy(sd_dst->data, sd_src->data, sd_src->size);
-        }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
         desc = avcodec_descriptor_get(par->codec_id);
         if (desc && desc->props & AV_CODEC_PROP_REORDER)
             sti->reorder = 1;
@@ -965,7 +944,6 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
     int stream_count = 0;
     int noninterleaved_count = 0;
     int ret;
-    int eof = flush;
 
     if (has_packet) {
         if ((ret = ff_interleave_add_packet(s, pkt, interleave_compare_dts)) < 0)
diff --git a/libavformat/options.c b/libavformat/options.c
index b314cd4a35..76b91169a5 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -250,7 +250,6 @@ const AVClass *av_stream_get_class(void)
 
 AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
 {
-    FFFormatContext *const si = ffformatcontext(s);
     FFStream *sti;
     AVStream *st;
     AVStream **streams;
@@ -322,10 +321,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
     sti->transferred_mux_tb = (AVRational) { 0, 1 };;
 #endif
 
-#if FF_API_AVSTREAM_SIDE_DATA
-    sti->inject_global_side_data = si->inject_global_side_data;
-#endif
-
     sti->need_context_update = 1;
 
     s->streams[s->nb_streams++] = st;
diff --git a/libavformat/seek.c b/libavformat/seek.c
index a096d5e5b3..c0d94371e6 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -715,8 +715,6 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
 /** Flush the frame reader. */
 void ff_read_frame_flush(AVFormatContext *s)
 {
-    FFFormatContext *const si = ffformatcontext(s);
-
     ff_flush_packet_queue(s);
 
     /* Reset read state for each stream. */
@@ -741,11 +739,6 @@ void ff_read_frame_flush(AVFormatContext *s)
         for (int j = 0; j < MAX_REORDER_DELAY + 1; j++)
             sti->pts_buffer[j] = AV_NOPTS_VALUE;
 
-#if FF_API_AVSTREAM_SIDE_DATA
-        if (si->inject_global_side_data)
-            sti->inject_global_side_data = 1;
-#endif
-
         sti->skip_samples = 0;
     }
 }
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index f76d811889..aec4ee6e74 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -42,7 +42,6 @@
  *
  */
 #define FF_API_COMPUTE_PKT_FIELDS2      (LIBAVFORMAT_VERSION_MAJOR < 62)
-#define FF_API_AVSTREAM_SIDE_DATA       (LIBAVFORMAT_VERSION_MAJOR < 62)
 
 #define FF_API_GET_DUR_ESTIMATE_METHOD  (LIBAVFORMAT_VERSION_MAJOR < 62)
 #define FF_API_INTERNAL_TIMING          (LIBAVFORMAT_VERSION_MAJOR < 62)
-- 
2.48.1

_______________________________________________
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".

  parent reply	other threads:[~2025-02-23 22:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-23 22:06 [FFmpeg-devel] [PATCH 00/31] Major library soname bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 01/30] avcodec: remove deprecated FF_API_SUBFRAMES James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 02/30] avcodec: remove deprecated FF_API_TICKS_PER_FRAME James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 03/30] avcodec: remove deprecated FF_API_DROPCHANGED James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 04/30] avcodec: remove deprecated FF_API_AVFFT James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 05/30] avcodec: remove deprecated FF_API_FF_PROFILE_LEVEL James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 06/30] avcodec: remove deprecated FF_API_AVCODEC_CLOSE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 07/30] avcodec: remove deprecated FF_API_BUFFER_MIN_SIZE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 08/30] avcodec: remove deprecated FF_API_VDPAU_ALLOC_GET_SET James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 09/30] avcodec: remove deprecated FF_API_QUALITY_FACTOR James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 10/30] avcodec/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 11/30] avdevice: remove deprecated FF_API_BKTR_DEVICE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 12/30] avdevice: remove deprecated FF_API_OPENGL_DEVICE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 13/30] avdevice: remove deprecated FF_API_SDL2_DEVICE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 14/30] avdevice/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 15/30] avformat: remove deprecated FF_API_LAVF_SHORTEST James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 16/30] avformat: remove deprecated FF_API_ALLOW_FLUSH James Almer
2025-02-23 22:06 ` James Almer [this message]
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 18/30] avformat: remove deprecated FF_API_GET_DUR_ESTIMATE_METHOD James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 19/30] avformat/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 20/30] avfilter: remove deprecated FF_API_LINK_PUBLIC James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 21/30] avfilter/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 22/30] avutil: remove deprecated FF_API_HDR_VIVID_THREE_SPLINE James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 23/30] avutil: remove deprecated FF_API_FRAME_PKT James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 24/30] avutil: remove deprecated FF_API_INTERLACED_FRAME James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 25/30] avutil: remove deprecated FF_API_FRAME_KEY James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 26/30] avutil: remove deprecated FF_API_PALETTE_HAS_CHANGED James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 27/30] avutil: remove deprecated FF_API_VULKAN_CONTIGUOUS_MEMORY James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 28/30] avutil: remove deprecated FF_API_H274_FILM_GRAIN_VCS James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 29/30] avutil/version_major: postpone some deprecations until the next bump James Almer
2025-02-23 22:06 ` [FFmpeg-devel] [PATCH 30/30] libs: bump major version for all libraries James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250223220630.18756-18-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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