Changeset 5d0cd08833ac4ab692b2091f7e2b67c362f0268f

Show
Ignore:
Timestamp:
03/10/04 13:02:58 (4 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1078920178 +0000
git-parent:

[4c29602d3802b5d72143b5093036a4e347b8c96a]

git-author:
Laurent Aimar <fenrir@videolan.org> 1078920178 +0000
Message:
  • 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).
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/input_ext-plugins.h

    rf3f4117 r5d0cd08  
    44 ***************************************************************************** 
    55 * Copyright (C) 1999-2002 VideoLAN 
    6  * $Id: input_ext-plugins.h,v 1.47 2004/01/26 20:48:09 fenrir Exp
     6 * $Id
    77 * 
    88 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    5656 * Prototypes from input_dec.c 
    5757 *****************************************************************************/ 
    58 decoder_t * input_RunDecoder( input_thread_t *, es_descriptor_t * ); 
    59 void input_EndDecoder( input_thread_t *, es_descriptor_t * ); 
     58VLC_EXPORT( decoder_t *, input_RunDecoder, ( input_thread_t *, es_descriptor_t * ) ); 
     59VLC_EXPORT( void, input_EndDecoder, ( input_thread_t *, es_descriptor_t * ) ); 
    6060 
    6161VLC_EXPORT( void, input_DecodePES, ( decoder_t *, pes_packet_t * ) ); 
  • modules/stream_out/display.c

    r70b1f9b r5d0cd08  
    143143    id = malloc( sizeof( sout_stream_id_t ) ); 
    144144 
    145     vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 
    146     id->p_es = input_AddES( p_sys->p_input, 
    147                             NULL,           /* no program */ 
    148                             12,             /* es_id */ 
    149                             p_fmt->i_cat,   /* es category */ 
    150                             NULL,           /* description */ 
    151                             0 );            /* no extra data */ 
    152  
    153     if( !id->p_es
    154     { 
    155         vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 
    156  
    157         msg_Err( p_stream, "cannot create es" ); 
     145    id->p_es = malloc( sizeof( es_descriptor_t ) ); 
     146    memset( id->p_es, 0, sizeof( es_descriptor_t ) ); 
     147    id->p_es->i_cat         = p_fmt->i_cat; 
     148    id->p_es->i_fourcc      = p_fmt->i_codec; 
     149    id->p_es->b_force_decoder = VLC_TRUE; 
     150    es_format_Copy( &id->p_es->fmt, p_fmt ); 
     151 
     152    id->p_es->p_dec = input_RunDecoder( p_sys->p_input, id->p_es ); 
     153    if( id->p_es->p_dec == NULL
     154    { 
     155        msg_Err( p_stream, "cannot create decoder for fcc=`%4.4s'", 
     156                 (char*)&p_fmt->i_codec ); 
     157        free( id->p_es ); 
    158158        free( id ); 
    159159        return NULL; 
    160160    } 
    161     id->p_es->i_stream_id   = 1; 
    162     id->p_es->i_fourcc      = p_fmt->i_codec; 
    163     id->p_es->b_force_decoder = VLC_TRUE; 
    164  
    165     es_format_Copy( &id->p_es->fmt, p_fmt ); 
    166  
    167     if( input_SelectES( p_sys->p_input, id->p_es ) ) 
    168     { 
    169         input_DelES( p_sys->p_input, id->p_es ); 
    170         vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 
    171  
    172         msg_Err( p_stream, "cannot select es" ); 
    173         free( id ); 
    174         return NULL; 
    175     } 
    176     vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 
    177161 
    178162    return id; 
     
    183167    sout_stream_sys_t *p_sys = p_stream->p_sys; 
    184168 
    185     input_DelES( p_sys->p_input, id->p_es ); 
    186  
     169    input_EndDecoder( p_sys->p_input, id->p_es ); 
     170 
     171    free( id->p_es ); 
    187172    free( id ); 
    188173 
     
    200185        block_t *p_block; 
    201186 
    202         vlc_mutex_lock( &p_sys->p_input->stream.stream_lock ); 
    203187        if( id->p_es->p_dec && p_buffer->i_size > 0 && 
    204188            (p_block = block_New( p_stream, p_buffer->i_size )) ) 
     
    214198            input_DecodeBlock( id->p_es->p_dec, p_block ); 
    215199        } 
    216         vlc_mutex_unlock( &p_sys->p_input->stream.stream_lock ); 
    217200 
    218201        /* *** go to next buffer *** */