aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorVittorio Gambaletta (VittGam) <ffmpeg-dev@vittgam.net>2016-01-24 06:06:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-25 19:47:16 +0100
commit8b02af1e6fbb0d782f3561afd82f66edc7fa8ae0 (patch)
treecbf55aea3f9f91c36e2b5c019f55fe32a49da59e /libavformat
parent191ec55c9fc1ab0147b1e952d0700fde3ce9fbcb (diff)
downloadffmpeg-8b02af1e6fbb0d782f3561afd82f66edc7fa8ae0.tar.gz
avformat/mpegtsenc: Fix multi program so that it supports adding the same stream to multiple programs.
Signed-off-by: Vittorio Gambaletta <ffmpeg-dev@vittgam.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegtsenc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 2c120430dc..a20e229578 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -275,8 +275,19 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
if (s->nb_programs) {
- AVProgram *program = av_find_program_from_stream(s, NULL, i);
- if (program->id != service->sid)
+ int j, k, found = 0;
+
+ for (j = 0; j < s->nb_programs; j++)
+ if (s->programs[j]->id == service->sid) {
+ for (k = 0; k < s->programs[j]->nb_stream_indexes; k++)
+ if (s->programs[j]->stream_index[k] == i) {
+ found = 1;
+ break;
+ }
+ break;
+ }
+
+ if (!found)
continue;
}