avformat: deprecate AVFormatContext io_close callback

io_close2 should be used instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2023-02-13 01:50:12 +01:00
parent eee6492df7
commit 927042b409
11 changed files with 46 additions and 0 deletions

View File

@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09
API changes, most recent first:
2023-02-16 - xxxxxxxxxx - lavf 60.2.100 - avformat.h
Deprecate AVFormatContext io_close callback.
The superior io_close2 callback should be used instead.
2023-02-13 - xxxxxxxxxx - lavu 58.1.100 - frame.h
Deprecate AVFrame.coded_picture_number and display_picture_number.
Their usefulness is questionable and very few decoders set them.

View File

@ -854,10 +854,16 @@ int ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
{
int ret = 0;
if (*pb) {
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
if (s->io_close == ff_format_io_close_default || s->io_close == NULL)
#endif
ret = s->io_close2(s, *pb);
#if FF_API_AVFORMAT_IO_CLOSE
else
s->io_close(s, *pb);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
*pb = NULL;
return ret;

View File

@ -1663,10 +1663,15 @@ typedef struct AVFormatContext {
int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url,
int flags, AVDictionary **options);
#if FF_API_AVFORMAT_IO_CLOSE
/**
* A callback for closing the streams opened with AVFormatContext.io_open().
*
* @deprecated use io_close2
*/
attribute_deprecated
void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
#endif
/**
* ',' separated list of disallowed protocols.

View File

@ -1551,7 +1551,11 @@ static int dash_init(AVFormatContext *s)
return AVERROR_MUXER_NOT_FOUND;
ctx->interrupt_callback = s->interrupt_callback;
ctx->opaque = s->opaque;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
ctx->io_close = s->io_close;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ctx->io_close2 = s->io_close2;
ctx->io_open = s->io_open;
ctx->strict_std_compliance = s->strict_std_compliance;

View File

@ -501,7 +501,11 @@ static int fifo_mux_init(AVFormatContext *avf, const AVOutputFormat *oformat,
if (ret < 0)
return ret;
avf2->opaque = avf->opaque;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
avf2->io_close = avf->io_close;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
avf2->io_close2 = avf->io_close2;
avf2->io_open = avf->io_open;
avf2->flags = avf->flags;

View File

@ -869,7 +869,11 @@ static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
oc->max_delay = s->max_delay;
oc->opaque = s->opaque;
oc->io_open = s->io_open;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
oc->io_close = s->io_close;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
oc->io_close2 = s->io_close2;
oc->strict_std_compliance = s->strict_std_compliance;
av_dict_copy(&oc->metadata, s->metadata, 0);

View File

@ -379,7 +379,11 @@ static int open_track_resource_context(AVFormatContext *s,
return AVERROR(ENOMEM);
track_resource->ctx->io_open = s->io_open;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
track_resource->ctx->io_close = s->io_close;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
track_resource->ctx->io_close2 = s->io_close2;
track_resource->ctx->flags |= s->flags & ~AVFMT_FLAG_CUSTOM_IO;

View File

@ -151,10 +151,12 @@ static int io_open_default(AVFormatContext *s, AVIOContext **pb,
return ffio_open_whitelist(pb, url, flags, &s->interrupt_callback, options, s->protocol_whitelist, s->protocol_blacklist);
}
#if FF_API_AVFORMAT_IO_CLOSE
void ff_format_io_close_default(AVFormatContext *s, AVIOContext *pb)
{
avio_close(pb);
}
#endif
static int io_close2_default(AVFormatContext *s, AVIOContext *pb)
{
@ -172,7 +174,11 @@ AVFormatContext *avformat_alloc_context(void)
s = &si->pub;
s->av_class = &av_format_context_class;
s->io_open = io_open_default;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
s->io_close = ff_format_io_close_default;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->io_close2= io_close2_default;
av_opt_set_defaults(s);

View File

@ -160,7 +160,11 @@ static int segment_mux_init(AVFormatContext *s)
oc->max_delay = s->max_delay;
av_dict_copy(&oc->metadata, s->metadata, 0);
oc->opaque = s->opaque;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
oc->io_close = s->io_close;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
oc->io_close2 = s->io_close2;
oc->io_open = s->io_open;
oc->flags = s->flags;

View File

@ -236,7 +236,11 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
av_dict_copy(&avf2->metadata, avf->metadata, 0);
avf2->opaque = avf->opaque;
avf2->io_open = avf->io_open;
#if FF_API_AVFORMAT_IO_CLOSE
FF_DISABLE_DEPRECATION_WARNINGS
avf2->io_close = avf->io_close;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
avf2->io_close2 = avf->io_close2;
avf2->interrupt_callback = avf->interrupt_callback;
avf2->flags = avf->flags;

View File

@ -44,6 +44,7 @@
#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_AVIODIRCONTEXT (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_AVFORMAT_IO_CLOSE (LIBAVFORMAT_VERSION_MAJOR < 61)
#define FF_API_R_FRAME_RATE 1