[FFmpeg-cvslog] avformat/mpegtsenc: Fix used service

Michael Niedermayer git at videolan.org
Sat Mar 26 22:36:08 CET 2016


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Wed Mar 23 02:58:52 2016 +0100| [6e5648ad42b7fd5f13d90648a8fc49fbbcdb9187] | committer: Michael Niedermayer

avformat/mpegtsenc: Fix used service

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 26811fd9468dc484402faca3ca33cacb2e58c53e)

Conflicts:

	libavformat/version.h

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e5648ad42b7fd5f13d90648a8fc49fbbcdb9187
---

 libavformat/mpegtsenc.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 360c137..6bf5461 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -806,6 +806,7 @@ static int mpegts_init(AVFormatContext *s)
 
     /* assign pids to each stream */
     for (i = 0; i < s->nb_streams; i++) {
+        AVProgram *program;
         st = s->streams[i];
 
         ts_st = av_mallocz(sizeof(MpegTSWriteStream));
@@ -823,6 +824,17 @@ static int mpegts_init(AVFormatContext *s)
             ret = AVERROR(ENOMEM);
             goto fail;
         }
+
+        program = av_find_program_from_stream(s, NULL, i);
+        if (program) {
+            for (j = 0; j < ts->nb_services; j++) {
+                if (ts->services[j]->program == program) {
+                    service = ts->services[j];
+                    break;
+                }
+            }
+        }
+
         ts_st->service = service;
         /* MPEG pid values < 16 are reserved. Applications which set st->id in
          * this range are assigned a calculated pid. */



More information about the ffmpeg-cvslog mailing list