[FFmpeg-cvslog] r19773 - in trunk/libavformat: seek.c seek.h

Michael Niedermayer michaelni
Tue Sep 15 12:57:42 CEST 2009


On Tue, Sep 15, 2009 at 08:41:54AM +0200, Ivan Schreter wrote:
> Michael Niedermayer wrote:
>> On Sun, Sep 13, 2009 at 09:30:31PM +0200, Ivan Schreter wrote:
>>   
>>> Hi Michael,
>>>
>>> Michael Niedermayer wrote:
>>>     
>>>> On Sun, Sep 06, 2009 at 04:49:51PM +0200, Ivan Schreter wrote:
>>>>         
>>>>> Michael Niedermayer wrote:
[...]
>> [...]
>>   
>>> @@ -69,14 +88,31 @@
>>>      if (ts_b == INT64_MAX)
>>>          return ts_a < ts_b ? -1 : 0;
>>>  -    a = ts_a * tb_a.num * tb_b.den;
>>> -    b = ts_b * tb_b.num * tb_a.den;
>>> +    // convert_ts only works for positive numbers, handle special cases 
>>> correctly
>>>  -    res = a - b;
>>> -    if (!res)
>>> -        return 0;
>>> -    else
>>> -        return (res >> 63) | 1;
>>> +    // Note: Just converting the sign in convert_ts back and forth for 
>>> negative
>>> +    // numbers wouldn't work, as rounding would go in different 
>>> direction for negative
>>> +    // numbers, thus the result of the comparison of converted 
>>> timestamps would not be
>>> +    // exact anymore. Therefore, two branches below.
>>>     
>>
>> use unsigned numbers then, that should avoid the if/else
>>   
>
> Yes, but is it guaranteed that we will have only positive timestamps in 
> files?
>
> At least, the user may specify seeking to negative timestamp and/or specify 
> negative timestamps for limits. I could, of course, clamp those to 0, if we 
> say we never have negative timestamps returned in packets from 
> av_read_frame.
>
> What do you think?

subtract INT64_MIN, cast to uint64_t

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- 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-cvslog/attachments/20090915/a03738b4/attachment.pgp>



More information about the ffmpeg-cvslog mailing list