From: Pavel Koshevoy <pkoshevoy-at-gmail.com@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avformat/demux: Add allow_codec_changes option to AVFormatContext
Date: Tue, 17 Jun 2025 08:39:51 -0600
Message-ID: <CAJgjuoxtbh5zjKO2X4SdqUrepQ5KAA-2GiVzac4eN_==yvsu1Q@mail.gmail.com> (raw)
In-Reply-To: <CAJgjuow3j1pVvBZ4Ur9nd0EF1y_BgVHyH6vk-iK40s3nteE9HQ@mail.gmail.com>
On Tue, Jun 17, 2025 at 8:00 AM Pavel Koshevoy <pkoshevoy@gmail.com> wrote:
>
>
> On Tue, Jun 17, 2025, 07:55 Pavel Koshevoy <pkoshevoy@gmail.com> wrote:
>
>> Ping. I think I've addressed the concerns raised with the previous
>> patch.
>> Please let me know if I may commit this... it is a segfault fix, so it
>> probably should get some review priority.
>>
>> Thank you,
>> Pavel
>>
>>
>> On Sun, Jun 15, 2025, 14:50 Pavel Koshevoy <pkoshevoy@gmail.com> 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/formats.texi | 6 ++++++
>>> libavformat/avformat.h | 10 ++++++++++
>>> libavformat/demux.c | 8 +++++++-
>>> libavformat/mpegts.c | 4 +++-
>>> libavformat/options_table.h | 1 +
>>> tests/fate/demux.mak | 2 +-
>>> 6 files changed, 28 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/doc/formats.texi b/doc/formats.texi
>>> index 876a9e92b3..d18613f8bd 100644
>>> --- a/doc/formats.texi
>>> +++ b/doc/formats.texi
>>> @@ -228,6 +228,12 @@ would require too many resources due to a large
>>> number of streams.
>>> Skip estimation of input duration if it requires an additional probing
>>> for PTS at end of file.
>>> At present, applicable for MPEG-PS and MPEG-TS.
>>>
>>> +@item allow_codec_changes @var{bool} (@emph{input})
>>> +Allow AVStream.codecpar codec_type and codec_id to change at runtime
>>> +(for example when MPEG-TS PMT ES stream_type changes at runtime).
>>> +This is disabled by default, because most clients of avformat API
>>> +do not support random mid-stream codec changes.
>>> +
>>> @item duration_probesize @var{integer} (@emph{input})
>>> Set probing size, in bytes, for input duration estimation when it
>>> actually requires
>>> an additional probing for PTS at end of file (at present: MPEG-PS and
>>> MPEG-TS).
>>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>>> index b6c63e2237..c6956626b5 100644
>>> --- a/libavformat/avformat.h
>>> +++ b/libavformat/avformat.h
>>> @@ -1884,6 +1884,16 @@ typedef struct AVFormatContext {
>>> * @see skip_estimate_duration_from_pts
>>> */
>>> int64_t duration_probesize;
>>> +
>>> + /**
>>> + * Allow AVStream.codecpar codec_type and codec_id to change at
>>> runtime
>>> + * (for example when MPEG-TS PMT ES stream_type changes at runtime).
>>> + * This is disabled by default, because most clients of avformat API
>>> + * do not support random mid-stream codec changes.
>>> + * - muxing: unused
>>> + * - demuxing: set by user
>>> + */
>>> + int allow_codec_changes;
>>> } AVFormatContext;
>>>
>>
> Oops, I forgot to bump up the minor version.
>
>
I've sent a v2 of the patch, with LIBAVFORMAT_VERSION_MINOR bumped to 2 and
APIchanges note added.
Thank you,
Pavel.
_______________________________________________
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".
prev parent reply other threads:[~2025-06-17 14:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-15 20:50 Pavel Koshevoy
2025-06-17 13:55 ` Pavel Koshevoy
2025-06-17 14:00 ` Pavel Koshevoy
2025-06-17 14:39 ` Pavel Koshevoy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJgjuoxtbh5zjKO2X4SdqUrepQ5KAA-2GiVzac4eN_==yvsu1Q@mail.gmail.com' \
--to=pkoshevoy-at-gmail.com@ffmpeg.org \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git