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 71EBE4CF15 for ; Sat, 14 Jun 2025 19:58:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 43AE268CCFD; Sat, 14 Jun 2025 22:58:39 +0300 (EEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 340C868C68E for ; Sat, 14 Jun 2025 22:58:32 +0300 (EEST) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7489addd403so790753b3a.1 for ; Sat, 14 Jun 2025 12:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749931110; x=1750535910; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZuFkeP83nxSQFJRYb+UDIUF7NWAfFH2+nqELgyYwhgM=; b=kgpvhk4VXSo5higvwNd3pZN9wga9D95Fdo/HdKkvxZ1InF62UznrRfuMHNgnI2+SnI TLTeh8xqEJ8onuv6qpRwTDfp4gf9oMtZ2dhKPmDdSOme5kEnXzAhU0yN/5IYXl1MSYr4 SZBvcwJiW/QheGCd512+t1Tt0aTZvAQabynojI208JSjONaDAa247EzHlvQsZNcla157 AsRH5ibPZf5GN8e2xuOwKNRshKRGp03XMJ/nfJO1/CkOpF2yA4qVBJykreQqtxyQol9V tRiC4b5eiDWTosYyxqBSpDfrumCRctm0IBQ2WSZKt/ssIyh1nuWNglFkFE42uncbM+ke t76A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749931110; x=1750535910; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZuFkeP83nxSQFJRYb+UDIUF7NWAfFH2+nqELgyYwhgM=; b=jiFydq4CB1Gc8C+kcTRWvCDMP+gWwFacwpF+eHtCNwkz5SXIXHVaibLdjbuZgx7HhI 60dV80VvpIod2Malnk3hNHYOscRpjRVcUTdqq7hta8bpxlArnr0woicWM5tvEj5sxcou 94h6u6ckWlMrzEmWoinBg3TvBoM3eeBQEFw3Jw25irtz9Qcyl9NnEq33MYfCEht+3PDP FuHurQ9Mo3v/Sy+g0pcdx4TTUXBVuONZLHKtCf9RBPbSXbmvehcGtDuaRsElP2tKbSg5 p/rWFix3RKjYDS8kqQPmULdRf815acfb2vk0xovPSgoV5s6Uw9tYivMhRbCypQy+5VNn bCKQ== X-Gm-Message-State: AOJu0YzMXY9nqwqQEsQ86kI5nN7LMfjFzpBnZyVKTQ1u+Hms6xgLHRxO frHDauRDj940ItKPvhqUSm/nM7ggxjsztXlbvEh/mJB2QVpVy0/yMExXqEfCEJcQ X-Gm-Gg: ASbGncuYZIBC0pFco3zmYVIJtKYauau152JGOjOabp2+kt0tj+ijx7NBWJpmPNCiNJY Q6mf68ANPTAONsQMvpsOxBcHOcwnaT264hc76TFkCHRZBrRcC9wNhb80E7VYFjUFa9Fj0sG/nsQ HQT/2EE1TxI+KTJTxCN6SLEKGwp9wGJIm2KPyFz/F/rHKZPI7106xewxbANH0G3Xumpdf1Vh0VH v1skgWj8YDuQPUDdUx15vruMExh+3+B50TPxGZ1UxPUFTj4Bb8l4jVpxojfTf6aKoTmNyPU71hJ 0TzbZ24UKcONbZ2kb1XJ/9YxdbEyus4Bv/oAHEx1kCsI1a2VoA65bSUmwecuDM/efQ52/WapaF+ N X-Google-Smtp-Source: AGHT+IHpGu+tUdKAwHKmGFhGddoOTEcvexMfeyChDdp7Nl391o7gi7x0wHSTdSLs28nrvMH4AI7fxA== X-Received: by 2002:a05:6a00:2e02:b0:740:a52f:a126 with SMTP id d2e1a72fcca58-7489cf72a4fmr4374835b3a.9.1749931110087; Sat, 14 Jun 2025 12:58:30 -0700 (PDT) Received: from homestead.aragog.com ([2605:a601:a9a2:a100:67c:16ff:fe02:37f0]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7489000602fsm3708374b3a.48.2025.06.14.12.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Jun 2025 12:58:29 -0700 (PDT) From: Pavel Koshevoy To: ffmpeg-devel@ffmpeg.org Date: Sat, 14 Jun 2025 13:58:28 -0600 Message-ID: <20250614195828.20357-1-pkoshevoy@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Pavel Koshevoy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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".