This can be used to restart a plugin without going through the whole
module_need(). This only makes sense if you are sure that the plugin
will accept the object parameters. In other words, do not change any
object parameter that could influence the plugin probing decision.
VLC_EXPORT( bool, module_exists, (const char *) );
VLC_EXPORT( module_t *, module_find, (const char *) );
VLC_EXPORT( bool, module_exists, (const char *) );
VLC_EXPORT( module_t *, module_find, (const char *) );
+int module_start(vlc_object_t *, module_t *);
+void module_stop(vlc_object_t *, module_t *);
+
VLC_EXPORT( module_config_t *, module_config_get, ( const module_t *, unsigned * ) );
VLC_EXPORT( void, module_config_free, ( module_config_t * ) );
VLC_EXPORT( module_config_t *, module_config_get, ( const module_t *, unsigned * ) );
VLC_EXPORT( void, module_config_free, ( module_config_t * ) );
vlc_release (&m->vlc_gc_data);
}
vlc_release (&m->vlc_gc_data);
}
+#undef module_start
+int module_start (vlc_object_t *obj, module_t *m)
+{
+ return m->pf_activate ? (m->pf_activate (obj)) : VLC_SUCCESS;
+}
+
+#undef module_stop
+void module_stop (vlc_object_t *obj, module_t *m)
+{
+ if (m->pf_deactivate)
+ m->pf_deactivate (obj);
+}
+
/**
* Frees the flat list of VLC modules.
* @param list list obtained by module_list_get()
/**
* Frees the flat list of VLC modules.
* @param list list obtained by module_list_get()
p_this->b_force = p_list[i].b_force;
p_this->b_force = p_list[i].b_force;
- int ret = VLC_SUCCESS;
- if( p_cand->pf_activate )
- ret = p_cand->pf_activate( p_this );
- switch( ret )
+ switch( module_start( p_this, p_cand ) )
{
case VLC_SUCCESS:
/* good module! */
{
case VLC_SUCCESS:
/* good module! */
*/
void module_unneed( vlc_object_t * p_this, module_t * p_module )
{
*/
void module_unneed( vlc_object_t * p_this, module_t * p_module )
{
- /* Use the close method */
- if( p_module->pf_deactivate )
- {
- p_module->pf_deactivate( p_this );
- }
-
msg_Dbg( p_this, "removing module \"%s\"", p_module->psz_object_name );
msg_Dbg( p_this, "removing module \"%s\"", p_module->psz_object_name );
+ module_stop( p_this, p_module );
module_release( p_module );
}
module_release( p_module );
}