[MPlayer-cvslog] r37309 - trunk/stream/stream.h

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Dec 3 09:24:18 CET 2014


On 02.12.2014, at 22:22, Ivan Kalvachev <ikalvachev at gmail.com> wrote:
> On 10/25/14, reimar <subversion at mplayerhq.hu> wrote:
>> Author: reimar
>> Date: Sat Oct 25 17:27:08 2014
>> New Revision: 37309
>> 
>> Log:
>> stream: Avoid unnecessary seek when our buffer is empty.
>> 
>> Modified:
>>   trunk/stream/stream.h
>> 
>> Modified: trunk/stream/stream.h
>> ==============================================================================
>> --- trunk/stream/stream.h    Sat Oct 25 15:40:40 2014    (r37308)
>> +++ trunk/stream/stream.h    Sat Oct 25 17:27:08 2014    (r37309)
>> @@ -324,6 +324,8 @@ static inline int stream_seek(stream_t *
>>            "Invalid seek to negative position %"PRIx64"!\n", pos);
>>     pos = 0;
>>   }
>> +  if (s->buf_len == 0 && s->pos == pos)
>> +    return 1;
>>   if(pos<s->pos){
>>     int64_t x=pos-(s->pos-s->buf_len);
>>     if(x>=0){
> 
> This breaks sub/subreader.c::guess_cp() code.
> The code reads the file once and feeds it to enca, in order to guess
> the encoding/code_page. Then it calls:
>    stream_reset();
>    stream_seek();.
> 
> With the above change, data structures are changed, but actual file
> seek is not performed. So when subtitle parsing really starts there is
> nothing to parse.
> 
> The interesting part is that stream_reset() have a commented out call
> to stream_seek(), in order to ensure actual seek, but I guess it have
> been removed as it is unnecessary in the most common case (opening
> file).
> 
> Please revert.

Reverting it breaks auto-detection with non-seekable inputs, thus is not a real solution either.


More information about the MPlayer-cvslog mailing list