From patchwork Mon Dec 28 22:49:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 24671 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 72CE444866D for ; Tue, 29 Dec 2020 00:49:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 610C968A5D7; Tue, 29 Dec 2020 00:49:55 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6E68368A708 for ; Tue, 29 Dec 2020 00:49:47 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5C67BE4BDB; Mon, 28 Dec 2020 23:49:47 +0100 (CET) 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 A5YvDS2t9ibH; Mon, 28 Dec 2020 23:49:45 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7A6B3E4E26; Mon, 28 Dec 2020 23:49:45 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 28 Dec 2020 23:49:29 +0100 Message-Id: <20201228224929.21299-6-cus@passwd.hu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201228224929.21299-1-cus@passwd.hu> References: <20201228224929.21299-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] avformat: deprecate some mpegts details from AVStream X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" These fields were added to support -merge_pmt_versions, but the mpegts demuxer is also keeping track its programs internally, so that should be a better place to handle it. Also it is not a very good API to provide fields like program_num or pmt_stream_idx in an AVStream, because a single stream can be part of multiple programs, multiple PMTs, so the stream attributes can refer to any program the stream is part of. Considering that these were added only 2 years ago, and their usefulness was limited in the first place, I think the best approach is to deprecate them. If users should come forward wanting such functionality, then adding it to AVProgram seems the better place to be able to better support having the same stream in multiple programs. Signed-off-by: Marton Balint --- doc/APIchanges | 3 +++ libavformat/avformat.h | 5 +++++ libavformat/mpegts.c | 12 ++++++++++++ libavformat/version.h | 5 ++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 3fb9e12525..b901133f63 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2021-01-xx - xxxxxxxxxx - lavf 58.66.100 - avformat.h + Deprecate AVStream program_num, pmt_version, pmt_stream_idx. + 2020-12-03 - xxxxxxxxxx - lavu 56.62.100 - timecode.h Add av_timecode_init_from_components. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4865c56cc3..89a53056f2 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1096,12 +1096,17 @@ typedef struct AVStream { */ int stream_identifier; +#if FF_API_MPEGTS_AVSTREAM /** * Details of the MPEG-TS program which created this stream. */ + attribute_deprecated int program_num; + attribute_deprecated int pmt_version; + attribute_deprecated int pmt_stream_idx; +#endif /** * An opaque field for libavformat internal usage. diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 9a3fd56ece..6d9bdbc485 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2406,9 +2406,13 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (!pes->st) goto out; pes->st->id = pes->pid; +#if FF_API_MPEGTS_AVSTREAM +FF_DISABLE_DEPRECATION_WARNINGS pes->st->program_num = h->id; pes->st->pmt_version = h->version; pes->st->pmt_stream_idx = i; +FF_ENABLE_DEPRECATION_WARNINGS +#endif } st = pes->st; } else if (is_pes_stream(stream_type, prog_reg_desc)) { @@ -2428,9 +2432,13 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (!st) goto out; st->id = pes->pid; +#if FF_API_MPEGTS_AVSTREAM +FF_DISABLE_DEPRECATION_WARNINGS st->program_num = h->id; st->pmt_version = h->version; st->pmt_stream_idx = i; +FF_ENABLE_DEPRECATION_WARNINGS +#endif } } else { int idx = ff_find_stream_index(ts->stream, pid); @@ -2445,9 +2453,13 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (!st) goto out; st->id = pid; +#if FF_API_MPEGTS_AVSTREAM +FF_DISABLE_DEPRECATION_WARNINGS st->program_num = h->id; st->pmt_version = h->version; st->pmt_stream_idx = i; +FF_ENABLE_DEPRECATION_WARNINGS +#endif st->codecpar->codec_type = AVMEDIA_TYPE_DATA; if (stream_type == 0x86 && prog_reg_desc == AV_RL32("CUEI")) { mpegts_find_stream_type(st, stream_type, SCTE_types); diff --git a/libavformat/version.h b/libavformat/version.h index b43193bcb1..c211c13477 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 -#define LIBAVFORMAT_VERSION_MINOR 65 +#define LIBAVFORMAT_VERSION_MINOR 66 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ @@ -106,6 +106,9 @@ #ifndef FF_API_AVIOFORMAT #define FF_API_AVIOFORMAT (LIBAVFORMAT_VERSION_MAJOR < 59) #endif +#ifndef FF_API_MPEGTS_AVSTREAM +#define FF_API_MPEGTS_AVSTREAM (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif #ifndef FF_API_R_FRAME_RATE