aboutsummaryrefslogtreecommitdiff
path: root/libavformat/mpegtsenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer2016-03-23 02:52:03 +0100
committerMichael Niedermayer2016-03-24 12:27:23 +0100
commit50d017a28171177b89c367194ec8d02f963e7e9e (patch)
treeb2141ca938334d578a2a16e4ae788853b9faa6e3 /libavformat/mpegtsenc.c
parent68e5976543e90a9875bedc8417f12f0f9a68413d (diff)
avformat/mpegtsenc: Keep track of the program for each service
Simplifies code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r--libavformat/mpegtsenc.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 68f98673da..3e4e418cff 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -56,6 +56,7 @@ typedef struct MpegTSService {
int pcr_pid;
int pcr_packet_count;
int pcr_packet_period;
+ AVProgram *program;
} MpegTSService;
// service_type values as defined in ETSI 300 468
@@ -275,15 +276,12 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
if (s->nb_programs) {
- 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;
- }
+ int k, found = 0;
+ AVProgram *program = service->program;
+
+ for (k = 0; k < program->nb_stream_indexes; k++)
+ if (program->stream_index[k] == i) {
+ found = 1;
break;
}
@@ -784,6 +782,7 @@ static int mpegts_init(AVFormatContext *s)
service->pmt.write_packet = section_write_packet;
service->pmt.opaque = s;
service->pmt.cc = 15;
+ service->program = program;
}
}