Browse code

avformat/mpegtsenc: Fix used service

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2016/03/23 10:58:52
Showing 2 changed files
... ...
@@ -806,6 +806,7 @@ static int mpegts_init(AVFormatContext *s)
806 806
 
807 807
     /* assign pids to each stream */
808 808
     for (i = 0; i < s->nb_streams; i++) {
809
+        AVProgram *program;
809 810
         st = s->streams[i];
810 811
 
811 812
         ts_st = av_mallocz(sizeof(MpegTSWriteStream));
... ...
@@ -823,6 +824,17 @@ static int mpegts_init(AVFormatContext *s)
823 823
             ret = AVERROR(ENOMEM);
824 824
             goto fail;
825 825
         }
826
+
827
+        program = av_find_program_from_stream(s, NULL, i);
828
+        if (program) {
829
+            for (j = 0; j < ts->nb_services; j++) {
830
+                if (ts->services[j]->program == program) {
831
+                    service = ts->services[j];
832
+                    break;
833
+                }
834
+            }
835
+        }
836
+
826 837
         ts_st->service = service;
827 838
         /* MPEG pid values < 16 are reserved. Applications which set st->id in
828 839
          * this range are assigned a calculated pid. */
... ...
@@ -31,7 +31,7 @@
31 31
 
32 32
 #define LIBAVFORMAT_VERSION_MAJOR  57
33 33
 #define LIBAVFORMAT_VERSION_MINOR  29
34
-#define LIBAVFORMAT_VERSION_MICRO 100
34
+#define LIBAVFORMAT_VERSION_MICRO 101
35 35
 
36 36
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
37 37
                                                LIBAVFORMAT_VERSION_MINOR, \