[FFmpeg-devel] [PATCH] estimate stream durations using read_timestamp

elupus elupus
Sat May 24 14:28:09 CEST 2008


On Sat, 24 May 2008 14:15:23 +0200, Michael Niedermayer wrote:

> On Sat, May 24, 2008 at 01:04:24PM +0200, elupus wrote:
>> On Sat, 24 May 2008 13:00:53 +0200, elupus wrote:
>> 
>>> Hi,
>>> 
>>> Here is a patch for libavformat to estimate stream durations using the
>>> read_timestamp interface. This could most likely replace the special casing
>>> for mpeg using read_packet. Thou i've not yet checked that.
> 
> your code is a duplicate of av_estimate_timings_from_pts().
> One of the 2 has to be removed or you will have to explain why both are
> usefull.
> 
> [...]

Agreed, the new function doesn't use as you put it "undefined behavior" (in
the nuv thread) of seeking the input stream somewhere and expecting
read_packet to work. Thus it is more general.

Then again, it does have to read each stream since read_timestamp is stream
specific. Current code would read whole file if a stream doesn't contain
one of the stream. Should be fixable with a check for
DURATION_MAX_READ_SIZE in it too.

Will fix that, remove the old function and test it with some mpegs and see
that it doesn't seem to break anything. 

Joakim





More information about the ffmpeg-devel mailing list