Commit 5d0cd088 authored by Laurent Aimar's avatar Laurent Aimar

* include/input_ext-plugins.h: exported input_RunDecoder/input_EndDecoder.

 * modules/stream_out/display.c: use input_RunDecoder/input_EndDecoder
 (fixed dead lock and no more duplicated stream in audio/video menu).
parent 4c29602d
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* but exported to plug-ins * but exported to plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * Copyright (C) 1999-2002 VideoLAN
* $Id: input_ext-plugins.h,v 1.47 2004/01/26 20:48:09 fenrir Exp $ * $Id$
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -55,8 +55,8 @@ VLC_EXPORT( int, input_UnselectES,( input_thread_t *, es_descriptor_t * ) ); ...@@ -55,8 +55,8 @@ VLC_EXPORT( int, input_UnselectES,( input_thread_t *, es_descriptor_t * ) );
/***************************************************************************** /*****************************************************************************
* Prototypes from input_dec.c * Prototypes from input_dec.c
*****************************************************************************/ *****************************************************************************/
decoder_t * input_RunDecoder( input_thread_t *, es_descriptor_t * ); VLC_EXPORT( decoder_t *, input_RunDecoder, ( input_thread_t *, es_descriptor_t * ) );
void input_EndDecoder( input_thread_t *, es_descriptor_t * ); VLC_EXPORT( void, input_EndDecoder, ( input_thread_t *, es_descriptor_t * ) );
VLC_EXPORT( void, input_DecodePES, ( decoder_t *, pes_packet_t * ) ); VLC_EXPORT( void, input_DecodePES, ( decoder_t *, pes_packet_t * ) );
VLC_EXPORT( void, input_DecodeBlock,( decoder_t *, block_t * ) ); VLC_EXPORT( void, input_DecodeBlock,( decoder_t *, block_t * ) );
......
...@@ -142,38 +142,22 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -142,38 +142,22 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
id = malloc( sizeof( sout_stream_id_t ) ); id = malloc( sizeof( sout_stream_id_t ) );
vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); id->p_es = malloc( sizeof( es_descriptor_t ) );
id->p_es = input_AddES( p_sys->p_input, memset( id->p_es, 0, sizeof( es_descriptor_t ) );
NULL, /* no program */ id->p_es->i_cat = p_fmt->i_cat;
12, /* es_id */
p_fmt->i_cat, /* es category */
NULL, /* description */
0 ); /* no extra data */
if( !id->p_es )
{
vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock );
msg_Err( p_stream, "cannot create es" );
free( id );
return NULL;
}
id->p_es->i_stream_id = 1;
id->p_es->i_fourcc = p_fmt->i_codec; id->p_es->i_fourcc = p_fmt->i_codec;
id->p_es->b_force_decoder = VLC_TRUE; id->p_es->b_force_decoder = VLC_TRUE;
es_format_Copy( &id->p_es->fmt, p_fmt ); es_format_Copy( &id->p_es->fmt, p_fmt );
if( input_SelectES( p_sys->p_input, id->p_es ) ) id->p_es->p_dec = input_RunDecoder( p_sys->p_input, id->p_es );
if( id->p_es->p_dec == NULL )
{ {
input_DelES( p_sys->p_input, id->p_es ); msg_Err( p_stream, "cannot create decoder for fcc=`%4.4s'",
vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); (char*)&p_fmt->i_codec );
free( id->p_es );
msg_Err( p_stream, "cannot select es" );
free( id ); free( id );
return NULL; return NULL;
} }
vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock );
return id; return id;
} }
...@@ -182,8 +166,9 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id ) ...@@ -182,8 +166,9 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
{ {
sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_sys_t *p_sys = p_stream->p_sys;
input_DelES( p_sys->p_input, id->p_es ); input_EndDecoder( p_sys->p_input, id->p_es );
free( id->p_es );
free( id ); free( id );
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -199,7 +184,6 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -199,7 +184,6 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
sout_buffer_t *p_next; sout_buffer_t *p_next;
block_t *p_block; block_t *p_block;
vlc_mutex_lock( &p_sys->p_input->stream.stream_lock );
if( id->p_es->p_dec && p_buffer->i_size > 0 && if( id->p_es->p_dec && p_buffer->i_size > 0 &&
(p_block = block_New( p_stream, p_buffer->i_size )) ) (p_block = block_New( p_stream, p_buffer->i_size )) )
{ {
...@@ -213,7 +197,6 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -213,7 +197,6 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
input_DecodeBlock( id->p_es->p_dec, p_block ); input_DecodeBlock( id->p_es->p_dec, p_block );
} }
vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock );
/* *** go to next buffer *** */ /* *** go to next buffer *** */
p_next = p_buffer->p_next; p_next = p_buffer->p_next;
......
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