From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id C446D4D051
	for <ffmpegdev@gitmailbox.com>; Sun, 15 Jun 2025 06:49:38 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 84E9A68D17C;
	Sun, 15 Jun 2025 09:49:34 +0300 (EEST)
Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140])
 by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 722CF68C83F
 for <ffmpeg-devel@ffmpeg.org>; Sun, 15 Jun 2025 09:49:28 +0300 (EEST)
Received: from localhost (localhost [127.0.0.1])
 by iq.passwd.hu (Postfix) with ESMTP id 39967EC7A3
 for <ffmpeg-devel@ffmpeg.org>; Sun, 15 Jun 2025 08:46:33 +0200 (CEST)
X-Virus-Scanned: amavisd-new at passwd.hu
Received: from iq.passwd.hu ([127.0.0.1])
 by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id f1Dv6QQX5_ih for <ffmpeg-devel@ffmpeg.org>;
 Sun, 15 Jun 2025 08:46:30 +0200 (CEST)
Received: from iq (iq [217.27.212.140])
 by iq.passwd.hu (Postfix) with ESMTPS id 83B1DEC79F
 for <ffmpeg-devel@ffmpeg.org>; Sun, 15 Jun 2025 08:46:30 +0200 (CEST)
Date: Sun, 15 Jun 2025 08:46:30 +0200 (CEST)
From: Marton Balint <cus@passwd.hu>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
In-Reply-To: <20250614195828.20357-1-pkoshevoy@gmail.com>
Message-ID: <180def82-86e0-a969-a83e-d427ccf9ab2c@passwd.hu>
References: <20250614195828.20357-1-pkoshevoy@gmail.com>
MIME-Version: 1.0
Subject: Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add
 -reprobe_stream_if_pmt_es_stream_type_changes option
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/180def82-86e0-a969-a83e-d427ccf9ab2c@passwd.hu/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>



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".