- fix a bug in UnalignedShowBits that makes some _heavy_ unaligned streams

    not wotk correctly (for instance VLS' generated TS streams)
parent 84a86ed7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-dec.c: services to the decoders * input_ext-dec.c: services to the decoders
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ext-dec.c,v 1.14 2001/04/28 03:36:25 sam Exp $ * $Id: input_ext-dec.c,v 1.15 2001/05/07 13:52:39 bozo Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -181,13 +181,20 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits ) ...@@ -181,13 +181,20 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
* of the packet in a temporary buffer, and we'll see * of the packet in a temporary buffer, and we'll see
* later. */ * later. */
int i; int i;
/* number of bytes to trash from the last payload */
int j;
p_bit_stream->i_showbits_buffer = 0; p_bit_stream->i_showbits_buffer = 0;
/* is this initialization really usefull ? -- bozo */
j = sizeof(WORD_TYPE);
for( i = 0; i < sizeof(WORD_TYPE) ; i++ ) for( i = 0; i < sizeof(WORD_TYPE) ; i++ )
{ {
if( p_bit_stream->p_byte >= p_bit_stream->p_end ) if( p_bit_stream->p_byte >= p_bit_stream->p_end )
{ {
p_bit_stream->pf_next_data_packet( p_bit_stream ); p_bit_stream->pf_next_data_packet( p_bit_stream );
j = sizeof(WORD_TYPE) - i;
} }
((byte_t *)&p_bit_stream->i_showbits_buffer)[i] = ((byte_t *)&p_bit_stream->i_showbits_buffer)[i] =
* p_bit_stream->p_byte; * p_bit_stream->p_byte;
...@@ -195,7 +202,7 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits ) ...@@ -195,7 +202,7 @@ u32 UnalignedShowBits( bit_stream_t * p_bit_stream, unsigned int i_bits )
} }
/* This is kind of kludgy. */ /* This is kind of kludgy. */
p_bit_stream->p_data->p_payload_start += sizeof(WORD_TYPE); p_bit_stream->p_data->p_payload_start += j;
p_bit_stream->p_byte = p_bit_stream->p_byte =
(byte_t *)&p_bit_stream->i_showbits_buffer; (byte_t *)&p_bit_stream->i_showbits_buffer;
p_bit_stream->p_end = p_bit_stream->p_end =
......
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