Commit d926bc98 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

vout: Rename vout_Destroy to vout_CloseAndDestroy.

parent 6d4e9224
...@@ -536,7 +536,8 @@ struct vout_thread_t ...@@ -536,7 +536,8 @@ struct vout_thread_t
* *
* You can call vout_Request on a vout created by vout_Create or by a previous * You can call vout_Request on a vout created by vout_Create or by a previous
* call to vout_Request. * call to vout_Request.
* You can release the returned value either by vout_Request or vout_Destroy. * You can release the returned value either by vout_Request or vout_Close()
* followed by a vlc_object_release() or shorter vout_CloseAndRelease()
* *
* \param p_this a vlc object * \param p_this a vlc object
* \param p_vout a vout candidate * \param p_vout a vout candidate
...@@ -560,11 +561,26 @@ VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *p_this, vout_thr ...@@ -560,11 +561,26 @@ VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *p_this, vout_thr
VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *p_this, video_format_t *p_fmt ) ); VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *p_this, video_format_t *p_fmt ) );
/** /**
* This function will destroy a vout created by vout_Create or vout_Request. * This function will close a vout created by vout_Create or vout_Request.
* The associated vout module is closed.
* Note: It is not released yet, you'll have to call vlc_object_release()
* or use the convenient vout_CloseAndRelease().
* *
* \param p_vout the vout to destroy * \param p_vout the vout to close
*/ */
VLC_EXPORT( void, vout_Destroy, ( vout_thread_t *p_vout ) ); VLC_EXPORT( void, vout_Close, ( vout_thread_t *p_vout ) );
/**
* This function will close a vout created by vout_Create
* and then release it.
*
* \param p_vout the vout to close and release
*/
static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
{
vout_Close( p_vout );
vlc_object_release( p_vout );
}
/* */ /* */
VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) ); VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
......
...@@ -387,7 +387,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -387,7 +387,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
--p_vout->p_sys->i_clones; --p_vout->p_sys->i_clones;
DEL_CALLBACKS( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones], DEL_CALLBACKS( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones],
SendEvents ); SendEvents );
vout_Destroy( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] ); vout_CloseAndRelease( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones] );
} }
} }
......
...@@ -412,7 +412,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -412,7 +412,7 @@ static void End( vout_thread_t *p_vout )
} }
if( p_vout->p_sys->p_vout ) if( p_vout->p_sys->p_vout )
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
/***************************************************************************** /*****************************************************************************
...@@ -456,7 +456,7 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -456,7 +456,7 @@ static int Manage( vout_thread_t *p_vout )
if( p_vout->p_sys->p_vout ) if( p_vout->p_sys->p_vout )
{ {
DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents ); DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
fmt.i_width = fmt.i_visible_width = p_vout->p_sys->i_width; fmt.i_width = fmt.i_visible_width = p_vout->p_sys->i_width;
......
...@@ -433,7 +433,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -433,7 +433,7 @@ static void End( vout_thread_t *p_vout )
} }
if( p_vout->p_sys->p_vout ) if( p_vout->p_sys->p_vout )
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
/***************************************************************************** /*****************************************************************************
...@@ -2063,7 +2063,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -2063,7 +2063,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd,
if( p_vout->p_sys->p_vout ) if( p_vout->p_sys->p_vout )
{ {
DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents ); DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
/* Try to open a new video output */ /* Try to open a new video output */
......
...@@ -489,7 +489,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -489,7 +489,7 @@ static void End( vout_thread_t *p_vout )
var_DelCallback( p_sys->p_vout, "mouse-x", MouseEvent, p_vout); var_DelCallback( p_sys->p_vout, "mouse-x", MouseEvent, p_vout);
var_DelCallback( p_sys->p_vout, "mouse-y", MouseEvent, p_vout); var_DelCallback( p_sys->p_vout, "mouse-y", MouseEvent, p_vout);
vout_Destroy( p_sys->p_vout ); vout_CloseAndRelease( p_sys->p_vout );
if( p_sys->p_blend->p_module ) if( p_sys->p_blend->p_module )
module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module ); module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module );
......
...@@ -201,7 +201,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -201,7 +201,7 @@ static void End( vout_thread_t *p_vout )
var_DelCallback( p_vout->p_sys->p_vout, "mouse-y", MouseEvent, p_vout); var_DelCallback( p_vout->p_sys->p_vout, "mouse-y", MouseEvent, p_vout);
var_DelCallback( p_vout->p_sys->p_vout, "mouse-clicked", MouseEvent, p_vout); var_DelCallback( p_vout->p_sys->p_vout, "mouse-clicked", MouseEvent, p_vout);
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -395,7 +395,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -395,7 +395,7 @@ static void End( vout_thread_t *p_vout )
p_vout->p_sys->p_opencv = NULL; p_vout->p_sys->p_opencv = NULL;
} }
vout_Destroy( p_vout->p_sys->p_vout ) vout_CloseAndRelease( p_vout->p_sys->p_vout )
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -1903,7 +1903,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -1903,7 +1903,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
DEL_CALLBACKS( DEL_CALLBACKS(
p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout, p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
SendEvents ); SendEvents );
vout_Destroy( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout ); vout_CloseAndRelease( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
} }
} }
} }
......
...@@ -304,7 +304,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -304,7 +304,7 @@ static void End( vout_thread_t *p_vout )
var_DelCallback( p_vout->p_sys->p_vout, "mouse-y", MouseEvent, p_vout); var_DelCallback( p_vout->p_sys->p_vout, "mouse-y", MouseEvent, p_vout);
var_DelCallback( p_vout->p_sys->p_vout, "mouse-clicked", MouseEvent, p_vout); var_DelCallback( p_vout->p_sys->p_vout, "mouse-clicked", MouseEvent, p_vout);
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
#define SHUFFLE_WIDTH 81 #define SHUFFLE_WIDTH 81
......
...@@ -287,7 +287,7 @@ static void End( vout_thread_t *p_vout ) ...@@ -287,7 +287,7 @@ static void End( vout_thread_t *p_vout )
free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig ); free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
} }
vout_Destroy( p_vout->p_sys->p_vout ); vout_CloseAndRelease( p_vout->p_sys->p_vout );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -584,7 +584,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) ...@@ -584,7 +584,7 @@ static void RemoveAllVout( vout_thread_t *p_vout )
DEL_CALLBACKS( DEL_CALLBACKS(
p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout, p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout,
SendEvents ); SendEvents );
vout_Destroy( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout ); vout_CloseAndRelease( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout );
} }
} }
} }
......
...@@ -478,10 +478,10 @@ vlm_MessageNew ...@@ -478,10 +478,10 @@ vlm_MessageNew
__vlm_New __vlm_New
__vout_AllocatePicture __vout_AllocatePicture
vout_ChromaCmp vout_ChromaCmp
vout_Close
vout_ControlWindow vout_ControlWindow
__vout_CopyPicture __vout_CopyPicture
__vout_Create __vout_Create
vout_Destroy
vout_CreatePicture vout_CreatePicture
vout_DatePicture vout_DatePicture
vout_DestroyPicture vout_DestroyPicture
......
...@@ -129,7 +129,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -129,7 +129,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
* TODO: support for reusing video outputs with proper _thread-safe_ * TODO: support for reusing video outputs with proper _thread-safe_
* reference handling. */ * reference handling. */
if( p_vout ) if( p_vout )
vout_Destroy( p_vout ); vout_CloseAndRelease( p_vout );
return NULL; return NULL;
} }
...@@ -441,7 +441,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) ...@@ -441,7 +441,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
if( p_vout->b_error ) if( p_vout->b_error )
{ {
msg_Err( p_vout, "video output creation failed" ); msg_Err( p_vout, "video output creation failed" );
vout_Destroy( p_vout ); vout_CloseAndRelease( p_vout );
return NULL; return NULL;
} }
...@@ -449,20 +449,20 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) ...@@ -449,20 +449,20 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
} }
/***************************************************************************** /*****************************************************************************
* vout_Destroy: destroys a vout created by vout_Create. * vout_Close: Close a vout created by vout_Create.
***************************************************************************** *****************************************************************************
* You HAVE to call it on vout created by vout_Create. You should NEVER call * You HAVE to call it on vout created by vout_Create before vlc_object_release.
* it on vout not obtained though vout_Create (like with vout_Request or * You should NEVER call it on vout not obtained though vout_Create
* vlc_object_find.) * (like with vout_Request or vlc_object_find.)
* You can use vout_CloseAndRelease() as a convenient method.
*****************************************************************************/ *****************************************************************************/
void vout_Destroy( vout_thread_t *p_vout ) void vout_Close( vout_thread_t *p_vout )
{ {
assert( p_vout ); assert( p_vout );
vlc_object_kill( p_vout ); vlc_object_kill( p_vout );
vlc_thread_join( p_vout ); vlc_thread_join( p_vout );
module_Unneed( p_vout, p_vout->p_module ); module_Unneed( p_vout, p_vout->p_module );
vlc_object_release( p_vout );
} }
/* */ /* */
......
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