[FFmpeg-devel] [PATCH] demux individual program out of MPEG-TS

Måns Rullgård mans
Sun Sep 9 15:44:56 CEST 2007


Nico Sabbi wrote:
> This patch permits to demux specified -programid from an
> MPEG-TS stream

Index: libavformat/mpegts.c
===================================================================
--- libavformat/mpegts.c        (revisione 10431)
+++ libavformat/mpegts.c        (copia locale)
@@ -598,6 +598,8 @@
         if (sid == 0x0000) {
             /* NIT info */
         } else {
+            if(ts->stream->programid && ts->stream->programid != sid)
+                continue;

Since sid != 0 here, checking ts->stream->programid is unnecessary.

             new_service(ts, sid, NULL, NULL);
             ts->stop_parse--;
             mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1);
@@ -676,6 +678,8 @@
                 name = getstr8(&p, p_end);
                 if (!name)
                     break;
+                if(ts->stream->programid && ts->stream->programid != sid)
+                    break;

I think (no code nearby) sid != 0 here too.

                 new_service(ts, sid, provider_name, name);
                 break;
             default:
Index: libavformat/avformat.h
===================================================================
--- libavformat/avformat.h        (revisione 10431)
+++ libavformat/avformat.h        (copia locale)
@@ -422,6 +422,8 @@
     int loop_input;
     /** decoding: size of data to probe; encoding unused */
     unsigned int probesize;
+    /* decoding: program id desired; encoding unused */
+    unsigned int programid;

Maybe calling the field "program" is just as good.  I'm inclined to
say it is, but could be convinced otherwise.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list