[FFmpeg-devel] [PATCH] avformat/mpegtsenc: private_stream_1 is not asynchronous KLV

Mao Hata xt4ubq at gmail.com
Sat Apr 17 15:38:50 EEST 2021


According to ISO/IEC 13818-1, private_stream_1 is a synchronous
(has PTS/DTS) stream. Asynchronous one is private_stream_2.

-------------- next part --------------
From c1663cbdbbd2178cb199e079ec9bb712d1d757d8 Mon Sep 17 00:00:00 2001
From: Mao Hata <xt4ubq at gmail.com>
Date: Sat, 17 Apr 2021 19:55:22 +0900
Subject: [PATCH] avformat/mpegtsenc: private_stream_1 is not asynchronous KLV

This fixes inappropriately removing PTS/DTS from "bin_data" output.

Signed-off-by: Mao Hata <xt4ubq at gmail.com>
---
 libavformat/mpegts.h    | 1 +
 libavformat/mpegtsenc.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index 04874e0f42..ed640733e3 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -139,6 +139,7 @@
 
 /* ISO/IEC 13818-1 Table 2-22 */
 #define STREAM_ID_PRIVATE_STREAM_1   0xbd
+#define STREAM_ID_PRIVATE_STREAM_2   0xbf
 #define STREAM_ID_AUDIO_STREAM_0     0xc0
 #define STREAM_ID_VIDEO_STREAM_0     0xe0
 #define STREAM_ID_METADATA_STREAM    0xfc
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a357f3a6aa..9982089d0f 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1434,7 +1434,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
             } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
                 *q++ = stream_id != -1 ? stream_id : STREAM_ID_METADATA_STREAM;
 
-                if (stream_id == STREAM_ID_PRIVATE_STREAM_1) /* asynchronous KLV */
+                if (stream_id == STREAM_ID_PRIVATE_STREAM_2) /* asynchronous KLV */
                     pts = dts = AV_NOPTS_VALUE;
             } else {
                 *q++ = STREAM_ID_PRIVATE_STREAM_1;
-- 
2.31.1



More information about the ffmpeg-devel mailing list