summaryrefslogtreecommitdiff
path: root/libavformat/avformat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/avformat.c')
-rw-r--r--libavformat/avformat.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 7ff0cf3429..5b8bb7879e 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -48,9 +48,13 @@ 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);
@@ -140,6 +144,8 @@ 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)
{
@@ -207,36 +213,8 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
return data;
}
-
-int ff_stream_side_data_copy(AVStream *dst, const AVStream *src)
-{
- /* Free existing side data*/
- for (int i = 0; i < dst->nb_side_data; i++)
- av_free(dst->side_data[i].data);
- av_freep(&dst->side_data);
- dst->nb_side_data = 0;
-
- /* Copy side data if present */
- if (src->nb_side_data) {
- dst->side_data = av_calloc(src->nb_side_data,
- sizeof(*dst->side_data));
- if (!dst->side_data)
- return AVERROR(ENOMEM);
- dst->nb_side_data = src->nb_side_data;
-
- for (int i = 0; i < src->nb_side_data; i++) {
- uint8_t *data = av_memdup(src->side_data[i].data,
- src->side_data[i].size);
- if (!data)
- return AVERROR(ENOMEM);
- dst->side_data[i].type = src->side_data[i].type;
- dst->side_data[i].size = src->side_data[i].size;
- dst->side_data[i].data = data;
- }
- }
-
- return 0;
-}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
/**
* Copy all stream parameters from source to destination stream, with the
@@ -272,10 +250,6 @@ static int stream_params_copy(AVStream *dst, const AVStream *src)
if (ret < 0)
return ret;
- ret = ff_stream_side_data_copy(dst, src);
- if (ret < 0)
- return ret;
-
av_packet_unref(&dst->attached_pic);
if (src->attached_pic.data) {
ret = av_packet_ref(&dst->attached_pic, &src->attached_pic);