[FFmpeg-cvslog] avformat/mpegtsenc: only allow one program in m2ts mode

Marton Balint git at videolan.org
Tue Apr 21 22:44:34 EEST 2020


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Tue Dec 10 23:24:27 2019 +0100| [bcc19933af903cda7a824ee654bb0aedfad758de] | committer: Marton Balint

avformat/mpegtsenc: only allow one program in m2ts mode

The standard does not allow more.

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bcc19933af903cda7a824ee654bb0aedfad758de
---

 libavformat/mpegtsenc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index bee996ad49..c3b9dd55d4 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -869,8 +869,13 @@ static int mpegts_init(AVFormatContext *s)
     ts->m2ts_pgssub_pid  = M2TS_PGSSUB_START_PID;
     ts->m2ts_textsub_pid = M2TS_TEXTSUB_PID;
 
-    if (ts->m2ts_mode)
+    if (ts->m2ts_mode) {
         ts->pmt_start_pid = M2TS_PMT_PID;
+        if (s->nb_programs > 1) {
+            av_log(s, AV_LOG_ERROR, "Only one program is allowed in m2ts mode!\n");
+            return AVERROR(EINVAL);
+        }
+    }
 
     if (s->max_delay < 0) /* Not set by the caller */
         s->max_delay = 0;



More information about the ffmpeg-cvslog mailing list