From d926bc98dd544cbd5d20b4cf3b6c3250baa51eb6 Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Thu, 17 Jul 2008 23:03:08 +0200 Subject: [PATCH] vout: Rename vout_Destroy to vout_CloseAndDestroy. --- include/vlc_vout.h | 24 ++++++++++++++++++++---- modules/video_filter/clone.c | 2 +- modules/video_filter/crop.c | 4 ++-- modules/video_filter/deinterlace.c | 4 ++-- modules/video_filter/logo.c | 2 +- modules/video_filter/magnify.c | 2 +- modules/video_filter/opencv_wrapper.c | 2 +- modules/video_filter/panoramix.c | 2 +- modules/video_filter/puzzle.c | 2 +- modules/video_filter/transform.c | 2 +- modules/video_filter/wall.c | 2 +- src/libvlccore.sym | 2 +- src/video_output/video_output.c | 16 ++++++++-------- 13 files changed, 41 insertions(+), 25 deletions(-) diff --git a/include/vlc_vout.h b/include/vlc_vout.h index ef625b3b3c..a016575ab5 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -536,7 +536,8 @@ struct vout_thread_t * * You can call vout_Request on a vout created by vout_Create or by a previous * 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_vout a vout candidate @@ -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 ) ); /** - * 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 ) ); diff --git a/modules/video_filter/clone.c b/modules/video_filter/clone.c index 368f7d5b8b..5d125e060c 100644 --- a/modules/video_filter/clone.c +++ b/modules/video_filter/clone.c @@ -387,7 +387,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) --p_vout->p_sys->i_clones; DEL_CALLBACKS( p_vout->p_sys->pp_vout[p_vout->p_sys->i_clones], 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] ); } } diff --git a/modules/video_filter/crop.c b/modules/video_filter/crop.c index e220268f39..67f0e5c3b8 100644 --- a/modules/video_filter/crop.c +++ b/modules/video_filter/crop.c @@ -412,7 +412,7 @@ static void End( vout_thread_t *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 ) if( p_vout->p_sys->p_vout ) { 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; diff --git a/modules/video_filter/deinterlace.c b/modules/video_filter/deinterlace.c index 919e94e627..da41364859 100644 --- a/modules/video_filter/deinterlace.c +++ b/modules/video_filter/deinterlace.c @@ -433,7 +433,7 @@ static void End( vout_thread_t *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, if( p_vout->p_sys->p_vout ) { 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 */ diff --git a/modules/video_filter/logo.c b/modules/video_filter/logo.c index bf6bb52266..016c2ff5d9 100644 --- a/modules/video_filter/logo.c +++ b/modules/video_filter/logo.c @@ -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-y", MouseEvent, p_vout); - vout_Destroy( p_sys->p_vout ); + vout_CloseAndRelease( p_sys->p_vout ); if( p_sys->p_blend->p_module ) module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module ); diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c index a314050b73..9d9d8a08ab 100644 --- a/modules/video_filter/magnify.c +++ b/modules/video_filter/magnify.c @@ -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-clicked", MouseEvent, p_vout); - vout_Destroy( p_vout->p_sys->p_vout ); + vout_CloseAndRelease( p_vout->p_sys->p_vout ); } /***************************************************************************** diff --git a/modules/video_filter/opencv_wrapper.c b/modules/video_filter/opencv_wrapper.c index b38e215c61..7192d9f26e 100644 --- a/modules/video_filter/opencv_wrapper.c +++ b/modules/video_filter/opencv_wrapper.c @@ -395,7 +395,7 @@ static void End( vout_thread_t *p_vout ) p_vout->p_sys->p_opencv = NULL; } - vout_Destroy( p_vout->p_sys->p_vout ) + vout_CloseAndRelease( p_vout->p_sys->p_vout ) } /***************************************************************************** diff --git a/modules/video_filter/panoramix.c b/modules/video_filter/panoramix.c index eda2d7f070..1d4a8ba70a 100644 --- a/modules/video_filter/panoramix.c +++ b/modules/video_filter/panoramix.c @@ -1903,7 +1903,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) DEL_CALLBACKS( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout, 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 ); } } } diff --git a/modules/video_filter/puzzle.c b/modules/video_filter/puzzle.c index a87c101523..9d0455c557 100644 --- a/modules/video_filter/puzzle.c +++ b/modules/video_filter/puzzle.c @@ -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-clicked", MouseEvent, p_vout); - vout_Destroy( p_vout->p_sys->p_vout ); + vout_CloseAndRelease( p_vout->p_sys->p_vout ); } #define SHUFFLE_WIDTH 81 diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c index a8eee2c9b0..e367817b71 100644 --- a/modules/video_filter/transform.c +++ b/modules/video_filter/transform.c @@ -287,7 +287,7 @@ static void End( vout_thread_t *p_vout ) free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig ); } - vout_Destroy( p_vout->p_sys->p_vout ); + vout_CloseAndRelease( p_vout->p_sys->p_vout ); } /***************************************************************************** diff --git a/modules/video_filter/wall.c b/modules/video_filter/wall.c index aeec730bdc..6db6d57538 100644 --- a/modules/video_filter/wall.c +++ b/modules/video_filter/wall.c @@ -584,7 +584,7 @@ static void RemoveAllVout( vout_thread_t *p_vout ) DEL_CALLBACKS( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout, 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 ); } } } diff --git a/src/libvlccore.sym b/src/libvlccore.sym index 3e7bdddb0d..3d888f22a3 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -478,10 +478,10 @@ vlm_MessageNew __vlm_New __vout_AllocatePicture vout_ChromaCmp +vout_Close vout_ControlWindow __vout_CopyPicture __vout_Create -vout_Destroy vout_CreatePicture vout_DatePicture vout_DestroyPicture diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index bddbf187a8..e0837c6bb4 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -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_ * reference handling. */ if( p_vout ) - vout_Destroy( p_vout ); + vout_CloseAndRelease( p_vout ); return NULL; } @@ -441,7 +441,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) if( p_vout->b_error ) { msg_Err( p_vout, "video output creation failed" ); - vout_Destroy( p_vout ); + vout_CloseAndRelease( p_vout ); return NULL; } @@ -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 - * it on vout not obtained though vout_Create (like with vout_Request or - * vlc_object_find.) + * You HAVE to call it on vout created by vout_Create before vlc_object_release. + * You should NEVER call it on vout not obtained though vout_Create + * (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 ); vlc_object_kill( p_vout ); vlc_thread_join( p_vout ); module_Unneed( p_vout, p_vout->p_module ); - vlc_object_release( p_vout ); } /* */ -- 2.39.2