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 8B5D84FC65 for ; Sat, 28 Jun 2025 23:03:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 88B6068E5F2; Sun, 29 Jun 2025 02:03:23 +0300 (EEST) Received: from relay16.mail.gandi.net (relay16.mail.gandi.net [217.70.178.236]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 67B3768E17F for ; Sun, 29 Jun 2025 02:03:16 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 902F14386A for ; Sat, 28 Jun 2025 23:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751151795; 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=VpL4g7Tf2SZnCYx8u+LaG4WeVdwwGYloVgpIsP3WELc=; b=XAYJd96MkmSPOHhLIlti6x9ciOeVLhw1wN/D7fkajckX3VEIpL1GijXAzDBscECNtyjyiD zL2z9RwN73qHNiVWiKxTwY6hjDneL+5zJDw4zeuNtYCWVuuvN4BFV7E7qZ9o80wVJLc6il 9WcT6LAFIZ0h1l+92kUYvl6LkNLuAoldq6/U0o3Qks0QfLF5xy4FZp6patANFdGA3AFxJp h+z9uySeSSBuLYNwpFYHgmRFuCIvDaZh0HdoAdaBXscoTGywjAi0mwMJBPPwamrpBlpHNy vRacQ8CMj6Ec31P9JfETX+mKMumevkYQth/We7GP512lLH2zMB5TG/VZauzzAQ== Date: Sun, 29 Jun 2025 01:03:14 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250628230314.GU29660@pb2> References: <20250622181030.11106-1-pkoshevoy@gmail.com> MIME-Version: 1.0 In-Reply-To: <20250622181030.11106-1-pkoshevoy@gmail.com> X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdejvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg Subject: Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES 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="===============0085281396740547198==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0085281396740547198== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ToNIJMqTEhxyY9PB" Content-Disposition: inline --ToNIJMqTEhxyY9PB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi On Sun, Jun 22, 2025 at 12:10:30PM -0600, Pavel Koshevoy wrote: > Make midstream AVStream.codecpar updates optional and disabled > by default, so that avformat API clients can enable this feature > explicitly when they add support for midstream codec changes. > --- > doc/APIchanges | 3 +++ > doc/formats.texi | 5 +++++ > libavformat/avformat.h | 2 ++ > libavformat/mpegts.c | 4 +++- > libavformat/options_table.h | 1 + > libavformat/version.h | 2 +- > tests/fate/demux.mak | 2 +- > 7 files changed, 16 insertions(+), 3 deletions(-) >=20 > diff --git a/doc/APIchanges b/doc/APIchanges > index 91710bb27d..43172fbcdd 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-= 03-28 > =20 > API changes, most recent first: > =20 > +2025-06-17 - xxxxxxxxxx - lavf 62.2.100 - avformat.h > + Add AVFMT_FLAG_ALLOW_CODEC_CHANGES flag. > + > 2025-05-21 - xxxxxxxxxx - lavu 60.3.100 - avassert.h > Add av_unreachable() and av_assume() macros. > =20 > diff --git a/doc/formats.texi b/doc/formats.texi > index 876a9e92b3..5a0d070247 100644 > --- a/doc/formats.texi > +++ b/doc/formats.texi > @@ -39,6 +39,11 @@ Set format flags. Some are implemented for a limited n= umber of formats. > =20 > Possible values for input files: > @table @samp > +@item allow_codec_changes > +Allow AVStream.codecpar to change midstream if input changes > +(for example when MPEG-TS ES stream_type changes). > +This is disabled by default, because most clients of avformat API > +do not support random midstream codec changes. > @item discardcorrupt > Discard corrupted packets. > @item fastseek should this document the relation to resolution & pixfmt changes ? > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index b6c63e2237..2e5232c96d 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -1436,6 +1436,8 @@ typedef struct AVFormatContext { > #define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate = seeks for some formats > #define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as req= uested by the muxer > =20 > +#define AVFMT_FLAG_ALLOW_CODEC_CHANGES 0x400000 ///< Allow AVStream.code= cpar to be updated midstream if input changes (e.g. MPEG-TS ES stream_type = changes) > + > /** > * Maximum number of bytes read from input in order to determine str= eam > * properties. Used when reading the global header and in > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index deb69a0548..ed4ff580e5 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -2510,7 +2510,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint= 8_t *section, int section_len > if (!st) > goto out; > =20 > - if (pes && pes->stream_type !=3D stream_type) > + if (pes && (!pes->stream_type || > + (pes->stream_type !=3D stream_type && > + !!(ts->stream->flags & AVFMT_FLAG_ALLOW_CODEC_CHANG= ES)))) > mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc); > =20 > add_pid_to_program(prg, pid); > diff --git a/libavformat/options_table.h b/libavformat/options_table.h > index e2e690fd2a..811dd342cc 100644 > --- a/libavformat/options_table.h > +++ b/libavformat/options_table.h > @@ -50,6 +50,7 @@ static const AVOption avformat_options[] =3D { > {"sortdts", "try to interleave outputted packets by dts", 0, AV_OPT_TYPE= _CONST, {.i64 =3D AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, .unit =3D "ff= lags"}, > {"fastseek", "fast but inaccurate seeks", 0, AV_OPT_TYPE_CONST, {.i64 = =3D AVFMT_FLAG_FAST_SEEK }, INT_MIN, INT_MAX, D, .unit =3D "fflags"}, > {"nobuffer", "reduce the latency introduced by optional buffering", 0, A= V_OPT_TYPE_CONST, {.i64 =3D AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, .unit =3D= "fflags"}, > +{"allow_codec_changes", "allow AVStream.codecpar to change at runtime if= input changes", 0, AV_OPT_TYPE_CONST, { .i64 =3D AVFMT_FLAG_ALLOW_CODEC_CH= ANGES }, 0, 0, D, .unit =3D "fflags" }, If the option is user settable then ffmpeg/ffplay should possibly print a warning, that they do not support this if the user forces the flag thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle=20 --ToNIJMqTEhxyY9PB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaGB0rgAKCRBhHseHBAsP q1KKAJ9RdrzsjpkWu8c/ftqYexJT5HNSfgCeKbUq2zK37t2F0TEKu+o/YF9BBfM= =wFRC -----END PGP SIGNATURE----- --ToNIJMqTEhxyY9PB-- --===============0085281396740547198== 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". --===============0085281396740547198==--