[Ffmpeg-devel] [PATCH] MPTS support in mpegts.c

Andy Brown abrown
Tue Mar 14 15:22:52 CET 2006


This patch allows selection of which service to use if the mpegts file contains
more than one.  The original file searched for all the services but then only
configured the streams for the first one.  Now it allows chosing which service
to configure streams for based on the channel member of the AVFormatParameters
structure (if not specified or set to 0 it behaves as it originally did).

In order to obtain a list of services (ids and names) that the
mpegts_read_header() function discovers, I had to add another function
(get_channels) to the AVInputFormat structure as well as a new AVChannel
structure (both in avformat.h).

While the ideal solution would provide a way to determine services without
having to call functions twice, this was a good compromise with minimal
changes.  I'm successfully using this change with the following series of calls
in my application:

    av_open_input_file(frmt, NULL);
    if(frmt->iformat->get_channels) {
        count = frmt->iformat->get_channels(frmt, chan);
        if (count > 1 && chan) {
            av_close_input_file(frmt);
            /* add code here to select desired service -> sid */
            param.channel = sid;
            av_open_input_file(frmt, &param);
        }
        if (chan) av_free(chan);
    }

Andy


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpegts-mpts.patch
Type: text/x-patch
Size: 3064 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060314/1894c7f3/attachment.bin>



More information about the ffmpeg-devel mailing list