Commit 50d017a2 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/mpegtsenc: Keep track of the program for each service

Simplifies code
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 68e59765
...@@ -56,6 +56,7 @@ typedef struct MpegTSService { ...@@ -56,6 +56,7 @@ typedef struct MpegTSService {
int pcr_pid; int pcr_pid;
int pcr_packet_count; int pcr_packet_count;
int pcr_packet_period; int pcr_packet_period;
AVProgram *program;
} MpegTSService; } MpegTSService;
// service_type values as defined in ETSI 300 468 // service_type values as defined in ETSI 300 468
...@@ -275,15 +276,12 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) ...@@ -275,15 +276,12 @@ 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) {
int j, k, found = 0; int k, found = 0;
AVProgram *program = service->program;
for (j = 0; j < s->nb_programs; j++)
if (s->programs[j]->id == service->sid) { for (k = 0; k < program->nb_stream_indexes; k++)
for (k = 0; k < s->programs[j]->nb_stream_indexes; k++) if (program->stream_index[k] == i) {
if (s->programs[j]->stream_index[k] == i) { found = 1;
found = 1;
break;
}
break; break;
} }
...@@ -784,6 +782,7 @@ static int mpegts_init(AVFormatContext *s) ...@@ -784,6 +782,7 @@ static int mpegts_init(AVFormatContext *s)
service->pmt.write_packet = section_write_packet; service->pmt.write_packet = section_write_packet;
service->pmt.opaque = s; service->pmt.opaque = s;
service->pmt.cc = 15; service->pmt.cc = 15;
service->program = program;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment