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

Ivan Schreter schreter
Thu Sep 17 19:26:46 CEST 2009


Hi,

Michael Niedermayer wrote:
> 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
>   

I'm afraid, that won't work at all. INT64_MIN is a different point in 
time for various timebases, so biased timestamps would not be comparable 
(as they are in different timebases).

Regards,

Ivan




More information about the ffmpeg-cvslog mailing list