From: Marton Balint <cus@passwd.hu> To: ffmpeg-devel@ffmpeg.org Cc: Marton Balint <cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH] avformat: deprecate AVFormatContext io_close callback Date: Mon, 13 Feb 2023 22:37:54 +0100 Message-ID: <20230213213754.15081-1-cus@passwd.hu> (raw) io_close2 should be used instead. Signed-off-by: Marton Balint <cus@passwd.hu> --- doc/APIchanges | 4 ++++ libavformat/avformat.c | 6 ++++++ libavformat/avformat.h | 5 +++++ libavformat/dashenc.c | 4 ++++ libavformat/fifo.c | 4 ++++ libavformat/hlsenc.c | 4 ++++ libavformat/imfdec.c | 4 ++++ libavformat/options.c | 6 ++++++ libavformat/segment.c | 4 ++++ libavformat/tee.c | 4 ++++ libavformat/version.h | 2 +- libavformat/version_major.h | 1 + 12 files changed, 47 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 3ca724724b..69116e296a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-02-xx - xxxxxxxxxx - lavf 60.3.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. diff --git a/libavformat/avformat.c b/libavformat/avformat.c index fe7b068f4a..708d90b38c 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -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; diff --git a/libavformat/avformat.h b/libavformat/avformat.h index b986aacc78..1916aa2dc5 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -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. diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 52865eacb5..17fe5f430c 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -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; diff --git a/libavformat/fifo.c b/libavformat/fifo.c index ebadeef645..9a3a23729c 100644 --- a/libavformat/fifo.c +++ b/libavformat/fifo.c @@ -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; diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index dcc363b42e..e1f96feda3 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -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); diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index 03de9ce151..4932b7ff1f 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -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; diff --git a/libavformat/options.c b/libavformat/options.c index c7681122cd..22ad523b2d 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -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); diff --git a/libavformat/segment.c b/libavformat/segment.c index eb629b342c..2a82f39f31 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -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; diff --git a/libavformat/tee.c b/libavformat/tee.c index 960b2ea574..cb555f52fd 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -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; diff --git a/libavformat/version.h b/libavformat/version.h index 904e7f06aa..7ff1483912 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFORMAT_VERSION_MINOR 2 +#define LIBAVFORMAT_VERSION_MINOR 3 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/libavformat/version_major.h b/libavformat/version_major.h index 9ccf40bdc1..293fbd3397 100644 --- a/libavformat/version_major.h +++ b/libavformat/version_major.h @@ -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 -- 2.35.3 _______________________________________________ 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".
next reply other threads:[~2023-02-13 21:38 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-13 21:37 Marton Balint [this message] 2023-02-14 13:22 ` Anton Khirnov 2023-02-14 20:30 ` Marton Balint 2023-02-15 7:21 ` Anton Khirnov 2023-02-16 0:31 ` Marton Balint
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=20230213213754.15081-1-cus@passwd.hu \ --to=cus@passwd.hu \ --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