summaryrefslogtreecommitdiff
path: root/libavformat/mpegtsenc.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-12-10 23:24:27 +0100
committerMarton Balint <cus@passwd.hu>2020-04-21 21:28:29 +0200
commitbcc19933af903cda7a824ee654bb0aedfad758de (patch)
tree858df8056abbe1dc003b8789dc3f74ca652bb246 /libavformat/mpegtsenc.c
parent422f0a61367f068fb8b1b9ab8cc2eee1808c803c (diff)
avformat/mpegtsenc: only allow one program in m2ts mode
The standard does not allow more. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r--libavformat/mpegtsenc.c7
1 files changed, 6 insertions, 1 deletions
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;