Changeset dd066314d5dde1a5d828d2c51c0296dd7b04bac7

Show
Ignore:
Timestamp:
17/07/08 20:00:46 (4 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1216317646 +0200
git-parent:

[8006b9d92aa68fc941e930bee4866f49ed238b60]

git-author:
Laurent Aimar <fenrir@videolan.org> 1216317227 +0200
Message:

Revived vout_Destroy from the dead.
No you CANNOT release a vout by vlc_object_release if you have created
it by vout_Request or vout_Create.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_vout.h

    r81c7b06 rdd06631  
    525525 * Prototypes 
    526526 *****************************************************************************/ 
     527 
     528/** 
     529 * This function will 
     530 *  - returns a suitable vout (if requested by a non NULL p_fmt) 
     531 *  - recycles an old vout (if given) by either destroying it or by saving it 
     532 *  for latter usage. 
     533 * 
     534 * The purpose of this function is to avoid unnecessary creation/destruction of 
     535 * vout (and to allow optional vout reusing). 
     536 * 
     537 * You can call vout_Request on a vout created by vout_Create or by a previous 
     538 * call to vout_Request. 
     539 * You can release the returned value either by vout_Request or vout_Destroy. 
     540 * 
     541 * \param p_this a vlc object 
     542 * \param p_vout a vout candidate 
     543 * \param p_fmt the video format requested or NULL 
     544 * \return a vout if p_fmt is non NULL and the request is successfull, NULL 
     545 * otherwise 
     546 */ 
    527547#define vout_Request(a,b,c) __vout_Request(VLC_OBJECT(a),b,c) 
    528 VLC_EXPORT( vout_thread_t *, __vout_Request,    ( vlc_object_t *, vout_thread_t *, video_format_t * ) ); 
     548VLC_EXPORT( vout_thread_t *, __vout_Request,    ( vlc_object_t *p_this, vout_thread_t *p_vout, video_format_t *p_fmt ) ); 
     549 
     550/** 
     551 * This function will create a suitable vout for a given p_fmt. It will never 
     552 * reuse an already existing unused vout. 
     553 * 
     554 * You have to call either vout_Destroy or vout_Request on the returned value 
     555 * \param p_this a vlc object to which the returned vout will be attached 
     556 * \param p_fmt the video format requested 
     557 * \return a vout if the request is successfull, NULL otherwise 
     558 */ 
    529559#define vout_Create(a,b) __vout_Create(VLC_OBJECT(a),b) 
    530 VLC_EXPORT( vout_thread_t *, __vout_Create,       ( vlc_object_t *, video_format_t * ) ); 
    531 VLC_EXPORT( int, vout_VarCallback, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) ); 
    532  
     560VLC_EXPORT( vout_thread_t *, __vout_Create,       ( vlc_object_t *p_this, video_format_t *p_fmt ) ); 
     561 
     562/** 
     563 * This function will destroy a vout created by vout_Create or vout_Request. 
     564 * 
     565 * \param p_vout the vout to destroy 
     566 */ 
     567VLC_EXPORT( void,            vout_Destroy,        ( vout_thread_t *p_vout ) ); 
     568 
     569/* */ 
    533570VLC_EXPORT( int,             vout_ChromaCmp,      ( uint32_t, uint32_t ) ); 
    534571 
  • src/libvlccore.sym

    r81b983e rdd06631  
    482482__vout_CopyPicture 
    483483__vout_Create 
     484vout_Destroy 
    484485vout_CreatePicture 
    485486vout_DatePicture 
     
    502503vout_UnlinkPicture 
    503504vout_vaControlDefault 
    504 vout_VarCallback 
    505505__xml_Create 
    506506xml_Delete 
  • src/video_output/video_output.c

    r1a112b8 rdd06631  
    130130         * reference handling. */ 
    131131        if( p_vout ) 
    132         { 
    133             spu_Attach( p_vout->p_spu, p_this, false ); 
    134             vlc_object_kill( p_vout ); 
    135             vlc_thread_join( p_vout ); 
    136             module_Unneed( p_vout, p_vout->p_module ); 
    137             vlc_object_release( p_vout ); 
    138         } 
     132            vout_Destroy( p_vout ); 
    139133        return NULL; 
    140134    } 
     
    448442    { 
    449443        msg_Err( p_vout, "video output creation failed" ); 
    450  
    451         /* Make sure the thread is destroyed and data released */ 
    452         vlc_object_kill( p_vout ); 
    453         vlc_thread_join( p_vout ); 
    454         module_Unneed( p_vout, p_vout->p_module ); 
    455         vlc_object_release( p_vout ); 
     444        vout_Destroy( p_vout ); 
    456445        return NULL; 
    457446    } 
     
    460449} 
    461450 
     451/***************************************************************************** 
     452 * vout_Destroy: destroys a vout created by vout_Create. 
     453 ***************************************************************************** 
     454 * You HAVE to call it on vout created by vout_Create. You should NEVER call 
     455 * it on vout not obtained though vout_Create (like with vout_Request or 
     456 * vlc_object_find.) 
     457 *****************************************************************************/ 
     458void vout_Destroy( vout_thread_t *p_vout ) 
     459{ 
     460    assert( p_vout ); 
     461 
     462    vlc_object_kill( p_vout ); 
     463    vlc_thread_join( p_vout ); 
     464    module_Unneed( p_vout, p_vout->p_module ); 
     465    vlc_object_release( p_vout ); 
     466} 
     467 
     468/* */ 
    462469static void vout_Destructor( vlc_object_t * p_this ) 
    463470{ 
     
    13881395 
    13891396/***************************************************************************** 
    1390  * vout_VarCallback: generic callback for intf variables 
    1391  *****************************************************************************/ 
    1392 int vout_VarCallback( vlc_object_t * p_this, const char * psz_variable, 
    1393                       vlc_value_t oldval, vlc_value_t newval, 
    1394                       void *p_data ) 
    1395 { 
    1396     vout_thread_t * p_vout = (vout_thread_t *)p_this; 
    1397     vlc_value_t val; 
    1398     (void)psz_variable; (void)newval; (void)oldval; (void)p_data; 
    1399     val.b_bool = true; 
    1400     var_Set( p_vout, "intf-change", val ); 
    1401     return VLC_SUCCESS; 
    1402 } 
    1403  
    1404 /***************************************************************************** 
    14051397 * Helper thread for object variables callbacks. 
    14061398 * Only used to avoid deadlocks when using the video embedded mode.