[FFmpeg-devel] [PATCH] When PMT is found, we have found mpegts header information

Baptiste Coudurier baptiste.coudurier
Mon Apr 19 00:50:02 CEST 2010

On 4/18/10 9:04 AM, elupus wrote:
> On Sat, 17 Apr 2010 14:32:32 -0700, Baptiste Coudurier wrote:
>> On 4/17/10 5:49 AM, elupus wrote:
>>> They will however totaly be missed if we reduce probesize and pmt shows up
>>> later. But i'll keep it local to xbmc for now, until ffmpeg get's a new
>>> mpegts demuxer :)
>> Absolutely not, you seem to be confused. Demuxer will keep parsing PMT
>> and add new encountered streams. You will notice it when the AVPacket
>> stream_id is new.
>> That's why AVFMT_NOHEADER is set, here is the doxygen about it:
>>       /** Read one packet and put it in 'pkt'. pts and flags are also
>>          set. 'av_new_stream' can be called only if the flag
>>          AVFMTCTX_NOHEADER is used.
> Well what i meant was, for us to speed up starting, we'd have to reduce
> probesize. Whatever size we set will be a guess with no guarantee there
> will be a pmt there. So we get in the situation that we'd have to try
> av_find_stream_info multiple times with successivly larger probesize if we
> want to be able to keep startup delay down, and find streams.
>> However with your patch, indeed streams will totally be missed and break
>> the behaviour of the demuxer.
> My patch only changes what happens during probesize, where it makes
> av_find_stream_info stop after first pmt is found. It does not stop the
> demuxer from adding more streams later (even as the doxy above would
> suggest that is against api), so further stream will still be found.

Technically by not setting AVFMT_NOHEADER it will make it stop after all 
detected in the first PMT have parameters information.

Breaking API is certainly not wanted.
However I think API could be extended to allow this usage. This could be 
done that makes av_find_stream_info ignore AVFMT_NO_HEADER.
Would that work for you ?


Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org

More information about the ffmpeg-devel mailing list