From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 988FF4D123 for ; Fri, 30 May 2025 19:47:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7C0DF68DE37; Fri, 30 May 2025 22:47:47 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id DD86A68DD19 for ; Fri, 30 May 2025 22:47:40 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2FD8B43B33 for ; Fri, 30 May 2025 19:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1748634460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5GeAMa0M/yl57k9BxOp3IAs1l6MjF+hEPnHx/xft/JU=; b=RbPmXi3oE2vs6xz9u9TrPo58emWvdzSwBJAdg5S0bRRGryWGmlzUowJDHl5AMHunErh9Fk JDNgQHFynUjSEkpPQoKQASYXBGLEgfg0Y8GAI8BS2NWGFNtav4LbufYpvK4uvRHdm69YkW 8NAl+Jg8CorYsrA74J544K8/aazrdZd/xhmQZ94ibrpPcwBxUfGOi3AnFNzqjjlnTJpa5/ afXWFTe6yq9wxz/wrtX5taiNcmJGdFTYnfyKBP0QC4Wlu3UE09v5MMGRLUJv1ch5wmM+zU FFm0hcQk4nYg9p60Oj6jKloYWcGaWllJM26Yu3K2N4/mu7rL8suvIvhD+JGeeg== Date: Fri, 30 May 2025 21:47:39 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250530194739.GL29660@pb2> References: <20250517035029.202-1-kasper93@gmail.com> MIME-Version: 1.0 In-Reply-To: X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgddvleekleculddtuddrgeefvddrtddtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepleekgefgffeiudefjeeuffejudehtddtudeltdehveevvedtieeulefhtdeutdeknecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/demux: use io_close2 when closing avfromat 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 Content-Type: multipart/mixed; boundary="===============7900382202838429586==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7900382202838429586== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="i13JRWZVmttpvc5M" Content-Disposition: inline --i13JRWZVmttpvc5M Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 17, 2025 at 03:03:19PM +0200, Andreas Rheinhardt wrote: > Andreas Rheinhardt: > > Kacper Michaj=C5=82ow: > >> It's not valid to call avio_close() on context that has not been open > >> with avio_open(). > >> > >> This fixes use of custom IO. (io_open / io_close2 callbacks) > >> > >> Note that by default io_close2 is set to io_close2_default() which cal= ls > >> avio_close(), so default case will work the same as before. > >> > >> Signed-off-by: Kacper Michaj=C5=82ow > >> --- > >> libavformat/demux.c | 3 +-- > >> 1 file changed, 1 insertion(+), 2 deletions(-) > >> > >> diff --git a/libavformat/demux.c b/libavformat/demux.c > >> index 2795863567..ecd4f40da9 100644 > >> --- a/libavformat/demux.c > >> +++ b/libavformat/demux.c > >> @@ -383,11 +383,10 @@ void avformat_close_input(AVFormatContext **ps) > >> if (ffifmt(s->iformat)->read_close) > >> ffifmt(s->iformat)->read_close(s); > >> =20 > >> + ff_format_io_close(s, &pb); > >> avformat_free_context(s); > >> =20 > >> *ps =3D NULL; > >> - > >> - avio_close(pb); > >> } > >> =20 > >> static void force_codec_ids(AVFormatContext *s, AVStream *st) > >=20 > > avformat_open_input() sets AVFMT_FLAG_CUSTOM_IO when using custom IO and > > avformat_close_input() checks for this and does not free the > > AVFormatContext's AVIOContext in this case (but does avio_close(NULL) in > > this case). > > Your patch furthermore presumes that the custom IO context is compatible > > with io_close2, which need not be true at all (one can use custom IO > > without ever touching io_open/io_close2 pointers; I expect users that > > use custom IO, but not formats that open new AVIOContexts to do so). >=20 > On reading a bit further, init_input() uses io_open to open the > AVIOContext in case no AVIOContext was supplied (and one is needed). > This means that the AVFMT_FLAG_CUSTOM_IO flag is misleading, as it is > possible to use custom IO even with this flag unset. > It also means that > your patch is likely correct. does any reason remain against applying it ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope --i13JRWZVmttpvc5M Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaDoLUwAKCRBhHseHBAsP q/IbAJ9wtFDYbdKNK324EHOVGb22Ar/VXQCeKhJmCQKWCD2s37qItD/8YdhqtlA= =4N1q -----END PGP SIGNATURE----- --i13JRWZVmttpvc5M-- --===============7900382202838429586== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============7900382202838429586==--