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>
This commit is contained in:
Vittorio Gambaletta (VittGam) 2016-01-24 06:06:36 +01:00 committed by Michael Niedermayer
parent 191ec55c9f
commit 8b02af1e6f
1 changed files with 13 additions and 2 deletions

View File

@ -275,8 +275,19 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
if (s->nb_programs) { if (s->nb_programs) {
AVProgram *program = av_find_program_from_stream(s, NULL, i); int j, k, found = 0;
if (program->id != service->sid)
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; continue;
} }