Commit 74e8f4f6 authored by Laurent Aimar's avatar Laurent Aimar

all: fix a bug in packet parsing and can now play unseekable stream.

parent 107a73f2
......@@ -2,7 +2,7 @@
* asf.c : ASFv01 file input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: asf.c,v 1.3 2002/10/28 11:49:57 fenrir Exp $
* $Id: asf.c,v 1.4 2002/11/10 16:31:20 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -432,7 +432,9 @@ static int Demux( input_thread_t *p_input )
i_packet_send_time = GetDWLE( p_peek + i_skip ); i_skip += 4;
i_packet_duration = GetWLE( p_peek + i_skip ); i_skip += 2;
i_packet_size_left = i_packet_length; // XXX donnes reellement lu
// i_packet_size_left = i_packet_length; // XXX donnes reellement lu
/* FIXME I have to do that for some file, I don't known why */
i_packet_size_left = i_data_packet_min;
if( b_packet_multiple_payload )
{
......@@ -495,6 +497,7 @@ static int Demux( input_thread_t *p_input )
i_media_object_offset = i_tmp;
}
i_pts = __MAX( i_pts - p_demux->p_fp->i_preroll * 1000, 0 );
if( b_packet_multiple_payload )
{
......@@ -632,7 +635,6 @@ loop_error_recovery:
ASF_SkipBytes( p_input, i_data_packet_min );
} // loop over packet
p_demux->i_time = 0;
for( i = 0; i < 128 ; i++ )
{
......
......@@ -2,7 +2,7 @@
* libasf.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libasf.c,v 1.4 2002/11/08 10:26:53 gbazin Exp $
* $Id: libasf.c,v 1.5 2002/11/10 16:31:20 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -110,18 +110,45 @@ int ASF_SeekAbsolute( input_thread_t *p_input,
{
off_t i_filepos;
if( i_pos >= p_input->stream.p_selected_area->i_size )
i_filepos = ASF_TellAbsolute( p_input );
if( i_pos == i_filepos )
{
return( 0 );
return( 1 );
}
i_filepos = ASF_TellAbsolute( p_input );
if( i_pos != i_filepos )
if( p_input->stream.b_seekable &&
p_input->stream.i_method != INPUT_METHOD_NETWORK )
{
p_input->pf_seek( p_input, i_pos );
input_AccessReinit( p_input );
return( 1 );
}
else if( i_pos > i_filepos )
{
u64 i_size = i_pos - i_filepos;
do
{
data_packet_t *p_data;
int i_read;
i_read =
input_SplitBuffer(p_input, &p_data, __MIN( i_size, 1024 ) );
if( i_read <= 0 )
{
return( 0 );
}
input_DeletePacket( p_input->p_method_data, p_data );
i_size -= i_read;
} while( i_size > 0 );
return( 1 );
}
else
{
msg_Err( p_input, "cannot seek" );
return( 0 );
}
}
/* return 1 if success, 0 if fail */
......@@ -203,7 +230,7 @@ int ASF_NextObject( input_thread_t *p_input,
{
return( 0 ); /* failed */
}
if( p_obj->common.p_father )
if( p_obj->common.p_father && p_obj->common.p_father->common.i_object_size != 0 )
{
if( p_obj->common.p_father->common.i_object_pos + p_obj->common.p_father->common.i_object_size <
p_obj->common.i_object_pos + p_obj->common.i_object_size + 24 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment