From patchwork Mon Feb 13 21:37:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 40388 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3808366pzk; Mon, 13 Feb 2023 13:38:10 -0800 (PST) X-Google-Smtp-Source: AK7set+j35KUATrUnz1MHt2a71bcnTNjpXIiPzeLUsZeT+aUa3cHGQvZ9VX4PIxVjwUenkw1PmpH X-Received: by 2002:a17:907:a582:b0:8af:6c2:1e83 with SMTP id vs2-20020a170907a58200b008af06c21e83mr18617752ejc.35.1676324290373; Mon, 13 Feb 2023 13:38:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676324290; cv=none; d=google.com; s=arc-20160816; b=w3fwzzQCwWZHFzq1bkMo8nY4HL0gOQ20U15cGAtlPHE1FDRFmQM8qTcinK8maVehxt bNbvOPN9BruwamXy07TwfoImfQ44YAMQb2KL8kzJVmH8Dt8nftdVs6O7LCV0OOa3Su3m N7bT+LTnIbb31PUlI9hIx84qiDXINGN4t0XgKgddiKXyIyLLHlZj4v8gIyPFJEHFx39A uNtit47xBNTPe01pkqariuen/PVcHjElN0DQMiUEjZglpnIauW+j+u3v915vTG2yUE35 k3j0EbNd8QVKk/eL1XQTDT4TIeHhWErGOm+Kq5o0Bpmb8wNPcaGzfUkY+Fveh82iclvD 6glw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=fcUOn8P5DDSne0huEd16imlX2VrUurfu2prXst19/yM=; b=zUV2Z4dxgeh2LRkJK580yszaTXgXLTvPmu6nwUE+XunnpxqRLefbyNlwqB8S9i/VkU /Hka737GXczJFedB/BUeWH6tjF/2PsG7XhlrD5Uat9jw0U9kOP+okAE4E9GJmTnn039f hqrCr9VSFy9iFwFCVtqfa2MT8VPHaG51NEURnaJ0e7jjH/MCOq9yZattjM2dwqaksdtv EgPN+NUeDAMwOTgV0F3RHvdnGe3h2KktmyB6x1cdo2SGu1qkmx88alvUlIndZOiFh1g6 SsaweabLBuk9Q42ghmoV3L4Qe4v6//4huylAW30UFaeg4XTMwF5UK+gESYBAh0n3M5BV Yteg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ft31-20020a170907801f00b0088db807b22csi14312488ejc.117.2023.02.13.13.38.10; Mon, 13 Feb 2023 13:38:10 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 09B0268BE85; Mon, 13 Feb 2023 23:38:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BBFE868BDA6 for ; Mon, 13 Feb 2023 23:38:01 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B9F8FE8703; Mon, 13 Feb 2023 22:38:00 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Za38MN9wzdsE; Mon, 13 Feb 2023 22:37:59 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id DD37CE859E; Mon, 13 Feb 2023 22:37:58 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Feb 2023 22:37:54 +0100 Message-Id: <20230213213754.15081-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat: deprecate AVFormatContext io_close callback X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HLjBBszHyg/T io_close2 should be used instead. Signed-off-by: Marton Balint --- 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