From patchwork Tue Nov 30 00:49:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 31826 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp6968864iob; Mon, 29 Nov 2021 16:50:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJypjzqzEXUtl2CR2AjOqh/Job3A/g9DNKSM0PzGf8jXjgWcV1n/hVNdNoUHaSZsHIuaTniB X-Received: by 2002:a05:6402:5cb:: with SMTP id n11mr80382268edx.279.1638233441903; Mon, 29 Nov 2021 16:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638233441; cv=none; d=google.com; s=arc-20160816; b=lu84FI4B+M58PpCOG5t2hbyK7PjMrpltkrLbeVg8DX2NXmHqAuWZ98ofF1YM2Af7/1 DaVx1Pokyc5Y4fBSCdKXytJe/UEWpotfO0zFiSJSIwJiUFpl6eOx35pLQuYa0Xf6wDAf SwU0qpyWLAYWHeaYvu4A+5FH51oSLC5N5RhXLWUm5mHtavUazeUFdY+UReF3PSN0iCcP i5RUW/ixKMF27HTSd+0jRTCL7+rtWA3dZvDQB7OFIeAuT74FpWfWtgWIKj9NqamJ9cpy 3cbEwd/vE3UIbMJP8itDXDWA0H8MGvyMzI0pmdoUS9d+m30RIOOY6L3ytgTDzDIKrDVj GEvg== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=jyZOk6ipB8XHKh5yrI55Z66t3EUwbiKOnqHQsCpoCmM=; b=U3YCmf05VlyWnJ1Vi/9Z6RrO0FAFw4k6JJPPkvShbNoMqtaYHQ39eGO+xIGLa1vTl4 TwdBjL0SdtBq65gbP1A3Wf6NymJirV2B+LALuFlT1mYS4sd+FLLFXAe+RnS+06kzEd9U NrILpq67q6Hs9wO1qxx7Qy2jAPse/FZ4bRWKg+46kVhT68EgUcqse5zsN3wFkCAsd767 UOoILiqqzthfO8TwLy4/9u9Q0S2r6919nBo8M2uBlEHGS/H4AoRRGXm83L3K5bqAcrm3 8c4d1PVgr+3NAgfw8XGa1U3D9Jy1KaOpTHuFqqT7+FNqPhnqtiD5m4BPyTv/oLjomrDu IeGg== 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 dt15si24094185ejc.564.2021.11.29.16.50.41; Mon, 29 Nov 2021 16:50:41 -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 3EACD68AE7C; Tue, 30 Nov 2021 02:50:10 +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 CD92C68AE46 for ; Tue, 30 Nov 2021 02:50:01 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4997BE6377; Tue, 30 Nov 2021 01:50:01 +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 AERzc41cQMBw; Tue, 30 Nov 2021 01:49:59 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id EA42AE6441; Tue, 30 Nov 2021 01:49:58 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Tue, 30 Nov 2021 01:49:49 +0100 Message-Id: <20211130004950.30697-4-cus@passwd.hu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211130004950.30697-1-cus@passwd.hu> References: <20211130004950.30697-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] avformat: make AVFormatContext io_close return an int 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: Igr1tnHFc3Fg Otherwise there is no way to detect any error during avio_close(). Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ libavformat/avformat.h | 6 +++++- libavformat/internal.h | 6 +++++- libavformat/options.c | 4 ++-- libavformat/utils.c | 6 ++++-- libavformat/version.h | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index bc9f4e38da..090263aedf 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-12-xx - xxxxxxxxxx - lavf 59.10.100 - avformat.h + AVFormatContext io_open now returns an int. + 2021-11-22 - xxxxxxxxxx - lavu 57.9.100 - pixfmt.h Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 75699f3a32..eec1f6b20c 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1756,8 +1756,12 @@ typedef struct AVFormatContext { /** * A callback for closing the streams opened with AVFormatContext.io_open(). + * + * @param s the format context + * @param pb IO context to be closed and freed + * @return 0 on success, a negative AVERROR code on failure */ - void (*io_close)(struct AVFormatContext *s, AVIOContext *pb); + int (*io_close)(struct AVFormatContext *s, AVIOContext *pb); /** * ',' separated list of disallowed protocols. diff --git a/libavformat/internal.h b/libavformat/internal.h index 20e93d9267..4f28885f3c 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -905,8 +905,12 @@ int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **op /* * A wrapper around AVFormatContext.io_close that should be used * instead of calling the pointer directly. + * + * @param s AVFormatContext + * @param *pb the AVIOContext to be closed and freed. Can be NULL. + * @return >=0 on success, negative AVERROR in case of failure */ -void ff_format_io_close(AVFormatContext *s, AVIOContext **pb); +int ff_format_io_close(AVFormatContext *s, AVIOContext **pb); /** * Utility function to check if the file uses http or https protocol diff --git a/libavformat/options.c b/libavformat/options.c index 72c9bdcefe..15f0c9e90c 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -146,9 +146,9 @@ 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); } -static void io_close_default(AVFormatContext *s, AVIOContext *pb) +static int io_close_default(AVFormatContext *s, AVIOContext *pb) { - avio_close(pb); + return avio_close(pb); } AVFormatContext *avformat_alloc_context(void) diff --git a/libavformat/utils.c b/libavformat/utils.c index 7840e8717c..db5ef46dc2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1829,11 +1829,13 @@ int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **op return 0; } -void ff_format_io_close(AVFormatContext *s, AVIOContext **pb) +int ff_format_io_close(AVFormatContext *s, AVIOContext **pb) { + int ret = 0; if (*pb) - s->io_close(s, *pb); + ret = s->io_close(s, *pb); *pb = NULL; + return ret; } int ff_is_http_proto(const char *filename) { diff --git a/libavformat/version.h b/libavformat/version.h index 0705ee4112..1623835a78 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,8 +32,8 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 59 -#define LIBAVFORMAT_VERSION_MINOR 9 -#define LIBAVFORMAT_VERSION_MICRO 102 +#define LIBAVFORMAT_VERSION_MINOR 10 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \