Ticket #1532: vlc-0.9.0-git.diff

File vlc-0.9.0-git.diff, 1.9 kB (added by docbill, 6 months ago)

patch for vlc-snapshot-20080602

  • vlc-0.9.0-git/modules/access/http.c

    old new  
    829829    msg_Dbg( p_access, "trying to seek to %"PRId64, i_pos ); 
    830830 
    831831    Disconnect( p_access ); 
     832    if( p_access->info.i_pos < 0 ) 
     833    { 
     834        msg_Err( p_access, "seeking too early" ); 
     835        return Seek( p_access, 0); 
     836    } 
     837    else 
     838    { 
     839        int64_t i_size = p_access->info.i_size; 
     840        if(i_size > 0) 
     841        { 
     842            if( i_size < i_pos ) 
     843            { 
     844                msg_Err( p_access, "seeking too far" ); 
     845                // Fix me: This replicates the file.c behavior of returning 
     846                // success even when seeking too far. 
     847                return Seek( p_access, i_size ); 
     848            } 
     849            else if ( i_size == i_pos ) 
     850            { 
     851                // This is the only way I have found to seek to the end, and 
     852                // still leave the file handle open. 
     853                int retval = Seek( p_access, i_pos - 1); 
     854                if ( retval == VLC_SUCCESS ) { 
     855                  int8_t p_buffer[2]; 
     856                  Read( p_access, p_buffer, (size_t)1 ); 
     857                  // Reset EOF 
     858                  p_access->info.b_eof = false; 
     859                } 
     860                return retval; 
     861            } 
     862        } 
     863    } 
    832864 
     865    p_access->info.i_pos = i_pos; 
    833866    if( Connect( p_access, i_pos ) ) 
    834867    { 
    835868        msg_Err( p_access, "seek failed" ); 
     
    859892            break; 
    860893        case ACCESS_CAN_FASTSEEK: 
    861894            pb_bool = (bool*)va_arg( args, bool* ); 
    862             *pb_bool = false; 
     895            // http 1.1 should be just as fast as nfs... 
     896            *pb_bool = p_sys->b_seekable; 
    863897            break; 
    864898        case ACCESS_CAN_PAUSE: 
    865899        case ACCESS_CAN_CONTROL_PACE: