[FFmpeg-devel] [PATCH] avformat/demux: Add allow_codec_changes option to AVFormatContext (v2)

Michael Niedermayer michael at niedermayer.cc
Tue Jun 17 23:46:06 EEST 2025


On Tue, Jun 17, 2025 at 08:39:05PM +0200, Marton Balint wrote:
> 
> 
> On Tue, 17 Jun 2025, Pavel Koshevoy wrote:
> 
> > Make runtime AVStream.codecpar codec_id updates optional and disabled
> > by default, so that avformat API clients can enable this feature explicitly
> > when they add support for runtime codec changes.
> > 
> > Accordingly, codec_close should not assume that the codec_id cannot change.
> > This fixes 'ffprobe 1_poc.mp4' segfault introduced with
> > commit 0021484d05f9b0f032fa319399de6e24eea0c04f.
> > ---
> > doc/APIchanges              |  3 +++
> > doc/formats.texi            |  6 ++++++
> > libavformat/avformat.h      | 10 ++++++++++
> > libavformat/demux.c         |  8 +++++++-
> > libavformat/mpegts.c        |  4 +++-
> > libavformat/options_table.h |  1 +
> > libavformat/version.h       |  2 +-
> > tests/fate/demux.mak        |  2 +-
> > 8 files changed, 32 insertions(+), 4 deletions(-)
> > 
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 91710bb27d..29b3389094 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
> > 
> > API changes, most recent first:
> > 
> > +2025-06-17 - xxxxxxxxxx - lavf 62.2.100 - avformat.h
> > +  Add AVFormatContext.allow_codec_changes AVOption.
> 
> Considering that this is a simple boolean option, maybe you should use
> AVFormatContext->flags instead, so no new field need to be added, only a new
> flag.

as a seperate value it could be extended to somethig like

-allow_codec_changes ALL
-allow_codec_changes NONE
-allow_codec_changes WITHIN_TYPE        (no type change like video to audio)

but not sure this makes sense or is even reasonable implementation wise

anyway i have nothing against making this a flag if people prefer
just wanted to provide an example where a flag would be at a disadvantage

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250617/b29ef25c/attachment.sig>


More information about the ffmpeg-devel mailing list