Commit f0156a28 authored by Laurent Aimar's avatar Laurent Aimar

* mmsh: more fixes.

parent d9043cc6
......@@ -412,7 +412,15 @@ static ssize_t Read ( input_thread_t * p_input, byte_t * p_buffer,
while( i_data < i_len )
{
if( p_sys->i_packet_used < p_sys->i_packet_length )
if( p_sys->i_pos < p_sys->i_header )
{
i_copy = __MIN( p_sys->i_header - p_sys->i_pos, i_len - i_data );
memcpy( &p_buffer[i_data], p_sys->p_header, i_copy );
i_data += i_copy;
p_sys->i_pos += i_copy;
}
else if( p_sys->i_packet_used < p_sys->i_packet_length )
{
i_copy = __MIN( p_sys->i_packet_length - p_sys->i_packet_used,
i_len - i_data );
......@@ -423,6 +431,7 @@ static ssize_t Read ( input_thread_t * p_input, byte_t * p_buffer,
i_data += i_copy;
p_sys->i_packet_used += i_copy;
p_sys->i_pos += i_copy;
}
else if( p_sys->i_pos + i_data > p_sys->i_header &&
(int)p_sys->i_packet_used < p_sys->asfh.i_min_data_packet_size )
......@@ -434,6 +443,7 @@ static ssize_t Read ( input_thread_t * p_input, byte_t * p_buffer,
i_data += i_copy;
p_sys->i_packet_used += i_copy;
p_sys->i_pos += i_copy;
}
else
{
......@@ -442,11 +452,14 @@ static ssize_t Read ( input_thread_t * p_input, byte_t * p_buffer,
{
return -1;
}
if( ck.i_type == 0x4824 )
{
p_sys->i_packet_used = 0;
p_sys->i_packet_length = 0;
}
}
}
p_sys->i_pos += i_data;
return( i_data );
}
......@@ -567,6 +580,9 @@ static int Start( input_thread_t *p_input, off_t i_pos )
free( psz );
}
p_sys->i_packet_used = 0;
p_sys->i_packet_length = 0;
return VLC_SUCCESS;
}
......
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