[FFmpeg-devel] [PATCH] fix pcm_read_seek with negative timestamp

Michael Niedermayer michaelni
Sat Mar 14 17:55:43 CET 2009

sOn Sat, Mar 14, 2009 at 05:15:49PM +0100, Reimar D?ffinger wrote:
> On Sat, Mar 14, 2009 at 03:41:54PM +0100, Michael Niedermayer wrote:
> > On Sat, Mar 14, 2009 at 12:04:44PM +0100, Reimar D?ffinger wrote:
> > > Hello,
> > > currently pcm_read seek for negative timestamps either seeks somewhere
> > > before data_offset (clearly broken) or fails (possibly broken).
> > 
> > > This patch treats negative time stamps as 0, which would be
> > 
> > which breaks the API
> > now, seek2() fixes all that by introducing an API that has no problem
> > with timestamps that are outside the first..last
> I can't find anything in the avformat.h description of av_seek_frame or
> read_seek which would explain why this should break API, could you be
> more specific?

yes, the flags select direction, if you ask for lets say ts=-123 and
backward and it succeeds with ts=0 (which is not backward) thats just
not strictly correct.
A user wanting this could explicitly do
if(av_seek_frame(ts, BACKWARD)<0)
    av_seek_frame(ts, 0);

> Also considering that _other_ existing code (e.g. generic index, but I
> have the suspicion that others, too) already handle timestamps outside
> first..last like my patch would do, calling it "breaks the API" is a bit
> of an exaggeration. 

it does not follow the API, and as we have a new and better API whats
the point in trying to workaround deficiencies of a API that will be removed?

> And seeking somewhere before data_offset breaks
> everything, not just the API.



Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090314/f8086184/attachment.pgp>

More information about the ffmpeg-devel mailing list