[vlc-commits] spatializer: use the Close as an operations callback
Alexandre Janniaux
git at videolan.org
Mon Oct 12 15:55:50 CEST 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Tue Aug 25 18:50:04 2020 +0200| [67d84ece151a8a9c8bcbab26859368cf4323e732] | committer: Steve Lhomme
spatializer: use the Close as an operations callback
The close callback is now typed instead of a vlc_object_t.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=67d84ece151a8a9c8bcbab26859368cf4323e732
---
modules/audio_filter/spatializer/spatializer.cpp | 45 ++++++++++++------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp
index a1f78d30af..2129723628 100644
--- a/modules/audio_filter/spatializer/spatializer.cpp
+++ b/modules/audio_filter/spatializer/spatializer.cpp
@@ -49,7 +49,6 @@ using std::nothrow;
* Module descriptor
*****************************************************************************/
static int Open ( vlc_object_t * );
-static void Close( vlc_object_t * );
#define ROOMSIZE_TEXT N_("Room size")
#define ROOMSIZE_LONGTEXT N_("Defines the virtual surface of the room" \
@@ -74,7 +73,7 @@ vlc_module_begin ()
set_category( CAT_AUDIO )
set_subcategory( SUBCAT_AUDIO_AFILTER )
- set_callbacks( Open, Close )
+ set_callback( Open )
add_shortcut( "spatializer" )
add_float_with_range( "spatializer-roomsize", 0.85, 0., 1.1,
ROOMSIZE_TEXT, ROOMSIZE_LONGTEXT, false )
@@ -134,6 +133,26 @@ enum { num_callbacks=sizeof(callbacks)/sizeof(callback_s) };
static block_t *DoWork( filter_t *, block_t * );
+/*****************************************************************************
+ * Close: close the filter
+ *****************************************************************************/
+static void Close( filter_t *p_filter )
+{
+ filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
+ vlc_object_t *p_aout = vlc_object_parent(p_filter);
+
+ /* Delete the callbacks */
+ for(unsigned i=0;i<num_callbacks;++i)
+ {
+ var_DelCallback( p_aout, callbacks[i].psz_name,
+ callbacks[i].fp_callback, p_sys );
+ }
+
+ delete p_sys->p_reverbm;
+ free( p_sys );
+ msg_Dbg( &p_filter->obj, "Closing filter spatializer" );
+}
+
/*****************************************************************************
* Open:
*****************************************************************************/
@@ -177,6 +196,7 @@ static int Open( vlc_object_t *p_this )
FilterOperationInitializer()
{
ops.filter_audio = DoWork;
+ ops.close = Close;
};
} filter_ops;
@@ -184,27 +204,6 @@ static int Open( vlc_object_t *p_this )
return VLC_SUCCESS;
}
-/*****************************************************************************
- * Close: close the plugin
- *****************************************************************************/
-static void Close( vlc_object_t *p_this )
-{
- filter_t *p_filter = (filter_t *)p_this;
- filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
- vlc_object_t *p_aout = vlc_object_parent(p_filter);
-
- /* Delete the callbacks */
- for(unsigned i=0;i<num_callbacks;++i)
- {
- var_DelCallback( p_aout, callbacks[i].psz_name,
- callbacks[i].fp_callback, p_sys );
- }
-
- delete p_sys->p_reverbm;
- free( p_sys );
- msg_Dbg( p_this, "Closing filter spatializer" );
-}
-
/*****************************************************************************
* SpatFilter: process samples buffer
* DoWork: call SpatFilter
More information about the vlc-commits
mailing list