Commit 2b58ea44 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream_Demux: destroy the demux from the thread

This is simpler and more consistent.
parent a838292c
...@@ -44,7 +44,6 @@ struct stream_sys_t ...@@ -44,7 +44,6 @@ struct stream_sys_t
/* Demuxer */ /* Demuxer */
char *psz_name; char *psz_name;
es_out_t *out; es_out_t *out;
demux_t *p_demux;
vlc_thread_t thread; vlc_thread_t thread;
}; };
...@@ -82,7 +81,6 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou ...@@ -82,7 +81,6 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
p_sys->i_pos = 0; p_sys->i_pos = 0;
p_sys->out = out; p_sys->out = out;
p_sys->p_demux = NULL;
p_sys->p_block = NULL; p_sys->p_block = NULL;
p_sys->psz_name = strdup( psz_demux ); p_sys->psz_name = strdup( psz_demux );
...@@ -122,8 +120,6 @@ static void DStreamDelete( stream_t *s ) ...@@ -122,8 +120,6 @@ static void DStreamDelete( stream_t *s )
block_FifoPut( p_sys->p_fifo, p_empty ); block_FifoPut( p_sys->p_fifo, p_empty );
vlc_join( p_sys->thread, NULL ); vlc_join( p_sys->thread, NULL );
if( p_sys->p_demux )
demux_Delete( p_sys->p_demux );
if( p_sys->p_block ) if( p_sys->p_block )
block_Release( p_sys->p_block ); block_Release( p_sys->p_block );
...@@ -278,16 +274,14 @@ static void* DStreamThread( void *obj ) ...@@ -278,16 +274,14 @@ static void* DStreamThread( void *obj )
int canc = vlc_savecancel(); int canc = vlc_savecancel();
/* Create the demuxer */ /* Create the demuxer */
if( !(p_demux = demux_New( s, s->p_input, "", p_sys->psz_name, "", s, p_sys->out, p_demux = demux_New( s, s->p_input, "", p_sys->psz_name, "", s, p_sys->out,
false )) ) false );
{ if( p_demux == NULL )
return NULL; return NULL;
}
/* stream_Demux cannot apply DVB filters. /* stream_Demux cannot apply DVB filters.
* Get all programs and let the E/S output sort them out. */ * Get all programs and let the E/S output sort them out. */
demux_Control( p_demux, DEMUX_SET_GROUP, -1, NULL ); demux_Control( p_demux, DEMUX_SET_GROUP, -1, NULL );
p_sys->p_demux = p_demux;
/* Main loop */ /* Main loop */
while( vlc_object_alive( s ) ) while( vlc_object_alive( s ) )
...@@ -295,6 +289,8 @@ static void* DStreamThread( void *obj ) ...@@ -295,6 +289,8 @@ static void* DStreamThread( void *obj )
if( demux_Demux( p_demux ) <= 0 ) break; if( demux_Demux( p_demux ) <= 0 ) break;
} }
demux_Delete( p_demux );
vlc_restorecancel( canc ); vlc_restorecancel( canc );
return NULL; return NULL;
} }
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