Commit 6a98da9f authored by Christophe Massiot's avatar Christophe Massiot

Fixed a major bug I introduced lately.

parent d8e44fce
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_system.c: TS, PS and PES management * mpeg_system.c: TS, PS and PES management
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: mpeg_system.c,v 1.72 2001/12/12 13:48:09 massiot Exp $ * $Id: mpeg_system.c,v 1.73 2001/12/13 17:33:47 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr> * Michel Lespinasse <walken@via.ecp.fr>
...@@ -799,7 +799,10 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data ) ...@@ -799,7 +799,10 @@ void input_DemuxPS( input_thread_t * p_input, data_packet_t * p_data )
boolean_t b_trash = 0; boolean_t b_trash = 0;
es_descriptor_t * p_es = NULL; es_descriptor_t * p_es = NULL;
i_code = U32_AT( p_data->p_payload_start ); i_code = ((u32)p_data->p_payload_start[0] << 24)
| ((u32)p_data->p_payload_start[1] << 16)
| ((u32)p_data->p_payload_start[2] << 8)
| p_data->p_payload_start[3];
if( i_code <= 0x1BC ) if( i_code <= 0x1BC )
{ {
switch( i_code ) switch( i_code )
...@@ -1342,9 +1345,9 @@ static void input_DecodePAT( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -1342,9 +1345,9 @@ static void input_DecodePAT( input_thread_t * p_input, es_descriptor_t * p_es )
for( i_loop = 0; i_loop < (i_section_length - 9) / 4 ; i_loop++ ) for( i_loop = 0; i_loop < (i_section_length - 9) / 4 ; i_loop++ )
{ {
i_program_id = ( *(u32 *)(p_current_data + i_loop * 4 + 8) << 8 ) | i_program_id = ( (u32)*(p_current_data + i_loop * 4 + 8) << 8 ) |
*(p_current_data + i_loop * 4 + 9); *(p_current_data + i_loop * 4 + 9);
i_pmt_pid = ( (*(u32 *)( p_current_data + i_loop * 4 + 10) & 0x1F) i_pmt_pid = ( ((u32)*( p_current_data + i_loop * 4 + 10) & 0x1F)
<< 8 ) | << 8 ) |
*( p_current_data + i_loop * 4 + 11); *( p_current_data + i_loop * 4 + 11);
...@@ -1418,7 +1421,7 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -1418,7 +1421,7 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
p_current_section = p_psi->buffer; p_current_section = p_psi->buffer;
p_current_data = p_psi->buffer; p_current_data = p_psi->buffer;
p_pgrm_data->i_pcr_pid = ( (*(u32 *)(p_current_section + 8) & 0x1F) << 8 ) | p_pgrm_data->i_pcr_pid = ( ((u32)*(p_current_section + 8) & 0x1F) << 8 ) |
*(p_current_section + 9); *(p_current_section + 9);
i_audio_es = 0; i_audio_es = 0;
...@@ -1471,10 +1474,10 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -1471,10 +1474,10 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
/* Then add what we received in this PMT */ /* Then add what we received in this PMT */
do do
{ {
i_section_length = ( (*(u32 *)(p_current_data + 1) & 0xF) << 8 ) | i_section_length = ( ((u32)*(p_current_data + 1) & 0xF) << 8 ) |
*(p_current_data + 2); *(p_current_data + 2);
i_current_section = (u8)p_current_data[6]; i_current_section = (u8)p_current_data[6];
i_prog_info_length = ( (*(u32 *)(p_current_data + 10) & 0xF) << 8 ) | i_prog_info_length = ( ((u32)*(p_current_data + 10) & 0xF) << 8 ) |
*(p_current_data + 11); *(p_current_data + 11);
/* For the moment we ignore program descriptors */ /* For the moment we ignore program descriptors */
...@@ -1485,9 +1488,9 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -1485,9 +1488,9 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
while( p_current_data < p_current_section + i_section_length -1 ) while( p_current_data < p_current_section + i_section_length -1 )
{ {
i_stream_type = (int)p_current_data[0]; i_stream_type = (int)p_current_data[0];
i_pid = ( (*(u32 *)(p_current_data + 1) & 0x1F) << 8 ) | i_pid = ( ((u32)*(p_current_data + 1) & 0x1F) << 8 ) |
*(p_current_data + 2); *(p_current_data + 2);
i_es_info_length = ( (*(u32 *)(p_current_data + 3) & 0xF) << 8 ) | i_es_info_length = ( ((u32)*(p_current_data + 3) & 0xF) << 8 ) |
*(p_current_data + 4); *(p_current_data + 4);
/* Add this ES to the program */ /* Add this ES to the program */
......
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