Commit 19ff195c authored by Gildas Bazin's avatar Gildas Bazin

* src/input/input_programs.c: p_input->stream.p_selected_program needs to be reset in input_DelProgram().
* modules/demux/mpeg/ts.c: use dvbpsi_DetachPMT() when a program is deselected.
parent becae536
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mpeg_ts.c : Transport Stream input module for vlc * mpeg_ts.c : Transport Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: ts.c,v 1.36 2003/09/10 11:51:00 fenrir Exp $ * $Id: ts.c,v 1.37 2003/09/20 17:35:38 gbazin Exp $
* *
* Authors: Henri Fallon <henri@via.ecp.fr> * Authors: Henri Fallon <henri@via.ecp.fr>
* Johan Bilien <jobi@via.ecp.fr> * Johan Bilien <jobi@via.ecp.fr>
...@@ -1175,9 +1175,12 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input, ...@@ -1175,9 +1175,12 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input,
p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data; p_stream_data = (stream_ts_data_t *)p_input->stream.p_demux_data;
if ( ( p_new_pat->b_current_next && ( p_new_pat->i_version != p_stream_data->i_pat_version ) ) || if( ( p_new_pat->b_current_next &&
p_stream_data->i_pat_version == PAT_UNINITIALIZED ) ( p_new_pat->i_version != p_stream_data->i_pat_version ) ) ||
p_stream_data->i_pat_version == PAT_UNINITIALIZED )
{ {
msg_Dbg( p_input, "Processing PAT version %d", p_new_pat->i_version );
/* Delete all programs */ /* Delete all programs */
while( p_input->stream.i_pgrm_number ) while( p_input->stream.i_pgrm_number )
{ {
...@@ -1189,6 +1192,10 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input, ...@@ -1189,6 +1192,10 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input,
MP4_IODClean( &p_pgrm_demux_old->iod ); MP4_IODClean( &p_pgrm_demux_old->iod );
} }
/* Delete old PMT decoder */
if( p_pgrm_demux_old->p_pmt_handle )
dvbpsi_DetachPMT( p_pgrm_demux_old->p_pmt_handle );
input_DelProgram( p_input, p_input->stream.pp_programs[0] ); input_DelProgram( p_input, p_input->stream.pp_programs[0] );
} }
...@@ -1197,6 +1204,8 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input, ...@@ -1197,6 +1204,8 @@ static void TS_DVBPSI_HandlePAT( input_thread_t * p_input,
while( p_pgrm ) while( p_pgrm )
{ {
msg_Dbg( p_input, "New program: %d", p_pgrm->i_number );
/* If program = 0, we're having info about NIT not PMT */ /* If program = 0, we're having info about NIT not PMT */
if( p_pgrm->i_number ) if( p_pgrm->i_number )
{ {
...@@ -1690,7 +1699,7 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input, ...@@ -1690,7 +1699,7 @@ static void TS_DVBPSI_HandlePMT( input_thread_t * p_input,
p_input->pf_set_program( p_input, p_pgrm_to_select ); p_input->pf_set_program( p_input, p_pgrm_to_select );
} }
else else
p_input->pf_set_program( p_input, p_pgrm ); p_input->pf_set_program( p_input, p_pgrm );
} }
/* if the pmt belongs to the currently selected program, we /* if the pmt belongs to the currently selected program, we
* reselect it to update its ES */ * reselect it to update its ES */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.118 2003/08/17 20:39:08 fenrir Exp $ * $Id: input_programs.c,v 1.119 2003/09/20 17:35:38 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -291,6 +291,9 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm ) ...@@ -291,6 +291,9 @@ void input_DelProgram( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm )
p_input->stream.i_pgrm_number, p_input->stream.i_pgrm_number,
i_pgrm_index ); i_pgrm_index );
if( p_pgrm == p_input->stream.p_selected_program )
p_input->stream.p_selected_program = NULL;
/* Free the description of this program */ /* Free the description of this program */
free( p_pgrm ); free( p_pgrm );
} }
...@@ -498,7 +501,6 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg ) ...@@ -498,7 +501,6 @@ int input_SetProgram( input_thread_t * p_input, pgrm_descriptor_t * p_new_prg )
} }
p_input->stream.p_selected_program = p_new_prg; p_input->stream.p_selected_program = p_new_prg;
/* Update the navigation variables without triggering a callback */ /* Update the navigation variables without triggering a callback */
......
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