* [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
@ 2025-06-14 19:58 Pavel Koshevoy
2025-06-14 21:55 ` Michael Niedermayer
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Pavel Koshevoy @ 2025-06-14 19:58 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Pavel Koshevoy
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.
---
libavformat/mpegts.c | 8 +++++++-
tests/fate/demux.mak | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index deb69a0548..88b1754307 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -156,6 +156,8 @@ struct MpegTSContext {
/** to detect seek */
int64_t last_pos;
+ int reprobe_stream_if_pmt_es_stream_type_changes;
+
int skip_changes;
int skip_clear;
int skip_unknown_pmt;
@@ -199,6 +201,8 @@ static const AVOption options[] = {
MPEGTS_OPTIONS,
{"fix_teletext_pts", "try to fix pts values of dvb teletext streams", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_BOOL,
{.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+ {"reprobe_stream_if_pmt_es_stream_type_changes", "allow PMT updates to change codec_type and codec_id at runtime",
+ offsetof(MpegTSContext, reprobe_stream_if_pmt_es_stream_type_changes), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{"scan_all_pmts", "scan and combine all PMTs", offsetof(MpegTSContext, scan_all_pmts), AV_OPT_TYPE_BOOL,
{.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM },
{"skip_unknown_pmt", "skip PMTs for programs not advertised in the PAT", offsetof(MpegTSContext, skip_unknown_pmt), AV_OPT_TYPE_BOOL,
@@ -2510,7 +2514,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (!st)
goto out;
- if (pes && pes->stream_type != stream_type)
+ if (pes && (!pes->stream_type ||
+ (pes->stream_type != stream_type &&
+ ts->reprobe_stream_if_pmt_es_stream_type_changes)))
mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
add_pid_to_program(prg, pid);
diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index ead5ad4b10..6e5e2eb81a 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -158,7 +158,7 @@ FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a copy
FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
-fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
+fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts -reprobe_stream_if_pmt_es_stream_type_changes 1
FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-timed-id3-demux
fate-ts-timed-id3-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/mpegts/id3.ts
--
2.43.0
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-14 19:58 [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option Pavel Koshevoy
@ 2025-06-14 21:55 ` Michael Niedermayer
2025-06-15 1:36 ` Pavel Koshevoy
2025-06-15 3:24 ` Andreas Rheinhardt
2025-06-15 6:46 ` Marton Balint
2 siblings, 1 reply; 8+ messages in thread
From: Michael Niedermayer @ 2025-06-14 21:55 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 620 bytes --]
On Sat, Jun 14, 2025 at 01:58:28PM -0600, 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.
> ---
> libavformat/mpegts.c | 8 +++++++-
> tests/fate/demux.mak | 2 +-
> 2 files changed, 8 insertions(+), 2 deletions(-)
patch LGTM
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"I am not trying to be anyone's saviour, I'm trying to think about the
future and not be sad" - Elon Musk
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-14 21:55 ` Michael Niedermayer
@ 2025-06-15 1:36 ` Pavel Koshevoy
2025-06-15 13:16 ` Michael Niedermayer
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Koshevoy @ 2025-06-15 1:36 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Jun 14, 2025 at 3:56 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:
> On Sat, Jun 14, 2025 at 01:58:28PM -0600, 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.
> > ---
> > libavformat/mpegts.c | 8 +++++++-
> > tests/fate/demux.mak | 2 +-
> > 2 files changed, 8 insertions(+), 2 deletions(-)
>
> patch LGTM
>
>
So, should I still wait for you to revert
0021484d05f9b0f032fa319399de6e24eea0c04f and then submit a new patch
combining all three changes:
- the original 0021484d05f9b0f032fa319399de6e24eea0c04f changes
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-April/342631.html,
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-May/343004.html
- the segfault fix
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/344890.html
- the new reprobe_stream_if_pmt_es_stream_type_changes MpegTsContext
option, https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/345187.html
Since 0021484d05f9b0f032fa319399de6e24eea0c04f hasn't been reverted yet you
could just apply the other 2 patches instead.
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-14 19:58 [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option Pavel Koshevoy
2025-06-14 21:55 ` Michael Niedermayer
@ 2025-06-15 3:24 ` Andreas Rheinhardt
2025-06-15 13:17 ` Michael Niedermayer
2025-06-15 19:44 ` Pavel Koshevoy
2025-06-15 6:46 ` Marton Balint
2 siblings, 2 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2025-06-15 3:24 UTC (permalink / raw)
To: ffmpeg-devel
Pavel Koshevoy:
> 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.
> ---
> libavformat/mpegts.c | 8 +++++++-
> tests/fate/demux.mak | 2 +-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index deb69a0548..88b1754307 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -156,6 +156,8 @@ struct MpegTSContext {
> /** to detect seek */
> int64_t last_pos;
>
> + int reprobe_stream_if_pmt_es_stream_type_changes;
> +
> int skip_changes;
> int skip_clear;
> int skip_unknown_pmt;
> @@ -199,6 +201,8 @@ static const AVOption options[] = {
> MPEGTS_OPTIONS,
> {"fix_teletext_pts", "try to fix pts values of dvb teletext streams", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_BOOL,
> {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> + {"reprobe_stream_if_pmt_es_stream_type_changes", "allow PMT updates to change codec_type and codec_id at runtime",
> + offsetof(MpegTSContext, reprobe_stream_if_pmt_es_stream_type_changes), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> {"scan_all_pmts", "scan and combine all PMTs", offsetof(MpegTSContext, scan_all_pmts), AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM },
> {"skip_unknown_pmt", "skip PMTs for programs not advertised in the PAT", offsetof(MpegTSContext, skip_unknown_pmt), AV_OPT_TYPE_BOOL,
> @@ -2510,7 +2514,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
> if (!st)
> goto out;
>
> - if (pes && pes->stream_type != stream_type)
> + if (pes && (!pes->stream_type ||
> + (pes->stream_type != stream_type &&
> + ts->reprobe_stream_if_pmt_es_stream_type_changes)))
> mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
>
> add_pid_to_program(prg, pid);
> diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
> index ead5ad4b10..6e5e2eb81a 100644
> --- a/tests/fate/demux.mak
> +++ b/tests/fate/demux.mak
> @@ -158,7 +158,7 @@ FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
> fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a copy
>
> FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
> -fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
> +fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts -reprobe_stream_if_pmt_es_stream_type_changes 1
>
> FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-timed-id3-demux
> fate-ts-timed-id3-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/mpegts/id3.ts
IMO this should not be mpegts specific, but for all demuxers. Other
(header-less) formats may have the same issue.
- Andreas
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-14 19:58 [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option Pavel Koshevoy
2025-06-14 21:55 ` Michael Niedermayer
2025-06-15 3:24 ` Andreas Rheinhardt
@ 2025-06-15 6:46 ` Marton Balint
2 siblings, 0 replies; 8+ messages in thread
From: Marton Balint @ 2025-06-15 6:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, 14 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.
> ---
> libavformat/mpegts.c | 8 +++++++-
> tests/fate/demux.mak | 2 +-
Documentation is missing.
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index deb69a0548..88b1754307 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -156,6 +156,8 @@ struct MpegTSContext {
> /** to detect seek */
> int64_t last_pos;
>
> + int reprobe_stream_if_pmt_es_stream_type_changes;
> +
> int skip_changes;
> int skip_clear;
> int skip_unknown_pmt;
> @@ -199,6 +201,8 @@ static const AVOption options[] = {
> MPEGTS_OPTIONS,
> {"fix_teletext_pts", "try to fix pts values of dvb teletext streams", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_BOOL,
> {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> + {"reprobe_stream_if_pmt_es_stream_type_changes", "allow PMT updates to change codec_type and codec_id at runtime",
> + offsetof(MpegTSContext, reprobe_stream_if_pmt_es_stream_type_changes), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
The option name is a very long and way too specific. Maybe
-allow_codec_changes is shorter and more understandable?
Thanks,
Marton
> {"scan_all_pmts", "scan and combine all PMTs", offsetof(MpegTSContext, scan_all_pmts), AV_OPT_TYPE_BOOL,
> {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM },
> {"skip_unknown_pmt", "skip PMTs for programs not advertised in the PAT", offsetof(MpegTSContext, skip_unknown_pmt), AV_OPT_TYPE_BOOL,
> @@ -2510,7 +2514,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
> if (!st)
> goto out;
>
> - if (pes && pes->stream_type != stream_type)
> + if (pes && (!pes->stream_type ||
> + (pes->stream_type != stream_type &&
> + ts->reprobe_stream_if_pmt_es_stream_type_changes)))
> mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
>
> add_pid_to_program(prg, pid);
> diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
> index ead5ad4b10..6e5e2eb81a 100644
> --- a/tests/fate/demux.mak
> +++ b/tests/fate/demux.mak
> @@ -158,7 +158,7 @@ FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
> fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a copy
>
> FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
> -fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
> +fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts -reprobe_stream_if_pmt_es_stream_type_changes 1
>
> FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-timed-id3-demux
> fate-ts-timed-id3-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/mpegts/id3.ts
> --
> 2.43.0
>
> _______________________________________________
> 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".
>
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-15 1:36 ` Pavel Koshevoy
@ 2025-06-15 13:16 ` Michael Niedermayer
0 siblings, 0 replies; 8+ messages in thread
From: Michael Niedermayer @ 2025-06-15 13:16 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 997 bytes --]
On Sat, Jun 14, 2025 at 07:36:11PM -0600, Pavel Koshevoy wrote:
> On Sat, Jun 14, 2025 at 3:56 PM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
>
> > On Sat, Jun 14, 2025 at 01:58:28PM -0600, 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.
> > > ---
> > > libavformat/mpegts.c | 8 +++++++-
> > > tests/fate/demux.mak | 2 +-
> > > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > patch LGTM
> >
> >
> So, should I still wait for you to revert
if we can make it disabled by default then it doesnt need a revert
anyway, dont wait for me, delaying development is bad
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-15 3:24 ` Andreas Rheinhardt
@ 2025-06-15 13:17 ` Michael Niedermayer
2025-06-15 19:44 ` Pavel Koshevoy
1 sibling, 0 replies; 8+ messages in thread
From: Michael Niedermayer @ 2025-06-15 13:17 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 3432 bytes --]
Hi Andreas
On Sun, Jun 15, 2025 at 05:24:34AM +0200, Andreas Rheinhardt wrote:
> Pavel Koshevoy:
> > 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.
> > ---
> > libavformat/mpegts.c | 8 +++++++-
> > tests/fate/demux.mak | 2 +-
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index deb69a0548..88b1754307 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -156,6 +156,8 @@ struct MpegTSContext {
> > /** to detect seek */
> > int64_t last_pos;
> >
> > + int reprobe_stream_if_pmt_es_stream_type_changes;
> > +
> > int skip_changes;
> > int skip_clear;
> > int skip_unknown_pmt;
> > @@ -199,6 +201,8 @@ static const AVOption options[] = {
> > MPEGTS_OPTIONS,
> > {"fix_teletext_pts", "try to fix pts values of dvb teletext streams", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_BOOL,
> > {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> > + {"reprobe_stream_if_pmt_es_stream_type_changes", "allow PMT updates to change codec_type and codec_id at runtime",
> > + offsetof(MpegTSContext, reprobe_stream_if_pmt_es_stream_type_changes), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> > {"scan_all_pmts", "scan and combine all PMTs", offsetof(MpegTSContext, scan_all_pmts), AV_OPT_TYPE_BOOL,
> > {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM },
> > {"skip_unknown_pmt", "skip PMTs for programs not advertised in the PAT", offsetof(MpegTSContext, skip_unknown_pmt), AV_OPT_TYPE_BOOL,
> > @@ -2510,7 +2514,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
> > if (!st)
> > goto out;
> >
> > - if (pes && pes->stream_type != stream_type)
> > + if (pes && (!pes->stream_type ||
> > + (pes->stream_type != stream_type &&
> > + ts->reprobe_stream_if_pmt_es_stream_type_changes)))
> > mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
> >
> > add_pid_to_program(prg, pid);
> > diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
> > index ead5ad4b10..6e5e2eb81a 100644
> > --- a/tests/fate/demux.mak
> > +++ b/tests/fate/demux.mak
> > @@ -158,7 +158,7 @@ FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
> > fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a copy
> >
> > FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
> > -fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
> > +fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts -reprobe_stream_if_pmt_es_stream_type_changes 1
> >
> > FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-timed-id3-demux
> > fate-ts-timed-id3-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/mpegts/id3.ts
>
> IMO this should not be mpegts specific, but for all demuxers. Other
> (header-less) formats may have the same issue.
+1
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option
2025-06-15 3:24 ` Andreas Rheinhardt
2025-06-15 13:17 ` Michael Niedermayer
@ 2025-06-15 19:44 ` Pavel Koshevoy
1 sibling, 0 replies; 8+ messages in thread
From: Pavel Koshevoy @ 2025-06-15 19:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, Jun 14, 2025 at 9:24 PM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:
> Pavel Koshevoy:
> > 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.
> > ---
> > libavformat/mpegts.c | 8 +++++++-
> > tests/fate/demux.mak | 2 +-
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index deb69a0548..88b1754307 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -156,6 +156,8 @@ struct MpegTSContext {
> > /** to detect seek */
> > int64_t last_pos;
> >
> > + int reprobe_stream_if_pmt_es_stream_type_changes;
> > +
> > int skip_changes;
> > int skip_clear;
> > int skip_unknown_pmt;
> > @@ -199,6 +201,8 @@ static const AVOption options[] = {
> > MPEGTS_OPTIONS,
> > {"fix_teletext_pts", "try to fix pts values of dvb teletext
> streams", offsetof(MpegTSContext, fix_teletext_pts), AV_OPT_TYPE_BOOL,
> > {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> > + {"reprobe_stream_if_pmt_es_stream_type_changes", "allow PMT updates
> to change codec_type and codec_id at runtime",
> > + offsetof(MpegTSContext,
> reprobe_stream_if_pmt_es_stream_type_changes), AV_OPT_TYPE_BOOL, {.i64 =
> 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> > {"scan_all_pmts", "scan and combine all PMTs",
> offsetof(MpegTSContext, scan_all_pmts), AV_OPT_TYPE_BOOL,
> > {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM },
> > {"skip_unknown_pmt", "skip PMTs for programs not advertised in the
> PAT", offsetof(MpegTSContext, skip_unknown_pmt), AV_OPT_TYPE_BOOL,
> > @@ -2510,7 +2514,9 @@ static void pmt_cb(MpegTSFilter *filter, const
> uint8_t *section, int section_len
> > if (!st)
> > goto out;
> >
> > - if (pes && pes->stream_type != stream_type)
> > + if (pes && (!pes->stream_type ||
> > + (pes->stream_type != stream_type &&
> > + ts->reprobe_stream_if_pmt_es_stream_type_changes)))
> > mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
> >
> > add_pid_to_program(prg, pid);
> > diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
> > index ead5ad4b10..6e5e2eb81a 100644
> > --- a/tests/fate/demux.mak
> > +++ b/tests/fate/demux.mak
> > @@ -158,7 +158,7 @@ FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) +=
> fate-xwma-demux
> > fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a
> copy
> >
> > FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
> > -fate-ts-demux: CMD = ffprobe_demux
> $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
> > +fate-ts-demux: CMD = ffprobe_demux
> $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
> -reprobe_stream_if_pmt_es_stream_type_changes 1
> >
> > FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-timed-id3-demux
> > fate-ts-timed-id3-demux: CMD = ffprobe_demux
> $(TARGET_SAMPLES)/mpegts/id3.ts
>
> IMO this should not be mpegts specific, but for all demuxers. Other
> (header-less) formats may have the same issue.
>
Okay, but I only have mpeg-ts samples to test this with,
so I wanted to keep the scope of changes confined to mpegts.
Anyway, how would I go about doing it for all demuxers?
Would that be a new AVFormatContext option, like
`skip_estimate_duration_from_pts`?
I'll send a new patch.
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-15 19:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-14 19:58 [FFmpeg-devel] [PATCH] avformat/mpegts: Add -reprobe_stream_if_pmt_es_stream_type_changes option Pavel Koshevoy
2025-06-14 21:55 ` Michael Niedermayer
2025-06-15 1:36 ` Pavel Koshevoy
2025-06-15 13:16 ` Michael Niedermayer
2025-06-15 3:24 ` Andreas Rheinhardt
2025-06-15 13:17 ` Michael Niedermayer
2025-06-15 19:44 ` Pavel Koshevoy
2025-06-15 6:46 ` Marton Balint
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