Commit 7bc11355 authored by Antoine Cellerier's avatar Antoine Cellerier

Add new module_FindName function to find a module when given it's name. Use...

Add new module_FindName function to find a module when given it's name. Use this to fix the qt interface extended panel (video filters).
Change module_Exists to take the module name (and not short name) as parameter. Update the only known use of that function acordingly.
parent 4de1a9ca
......@@ -109,6 +109,10 @@ VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) );
#define module_Exists(a,b) __module_Exists(VLC_OBJECT(a),b)
VLC_EXPORT( vlc_bool_t, __module_Exists, ( vlc_object_t *, const char * ) );
/* Use only if you know what you're doing... */
#define module_FindName(a,b) __module_FindName(VLC_OBJECT(a),b)
VLC_EXPORT( module_t *, __module_FindName, ( vlc_object_t *, const char * ) );
VLC_EXPORT( module_t *, vlc_module_create, ( vlc_object_t * ) );
VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) );
VLC_EXPORT( int, vlc_module_set, (module_t *module, int propid, void *value) );
......
......@@ -756,7 +756,7 @@ static int ParseImageAttachments( decoder_t *p_dec )
fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
/* Find a suitable decoder module */
if( module_Exists( p_dec, "SDL Image decoder" ) )
if( module_Exists( p_dec, "sdl_image" ) )
{
/* ffmpeg thinks it can handle bmp properly but it can't (at least
* not all of them), so use sdl_image if it is available */
......
......@@ -208,29 +208,25 @@ void ExtVideo::ChangeVFiltersString( char *psz_name, vlc_bool_t b_add )
char *psz_parser, *psz_string;
char *psz_filter_type;
msg_Err( p_intf, "FIXME %s %s %d.", __FILE__, __func__, __LINE__ );
return;
#if 0
/* Please leave p_libvlc_global. This is where cached modules are
* stored. We're not trying to find a module instance. */
vlc_object_t *p_obj = (vlc_object_t *)
vlc_object_find_name( vlc_global_object(), psz_name, FIND_CHILD );
module_t *p_obj = module_FindName( p_intf, psz_name );
if( !p_obj )
{
msg_Err( p_intf, "Unable to find filter module \"%s\n.", psz_name );
return;
}
if( module_IsCapable( (module_t*)p_obj, "video filter2" ) )
if( module_IsCapable( p_obj, "video filter2" ) )
{
psz_filter_type = "video-filter";
}
else if( module_IsCapable( (module_t*)p_obj, "video filter" ) )
else if( module_IsCapable( p_obj, "video filter" ) )
{
psz_filter_type = "vout-filter";
}
else if( module_IsCapable( (module_t*)p_obj, "sub filter" ) )
else if( module_IsCapable( p_obj, "sub filter" ) )
{
psz_filter_type = "sub-filter";
}
......@@ -311,7 +307,6 @@ void ExtVideo::ChangeVFiltersString( char *psz_name, vlc_bool_t b_add )
}
free( psz_string );
#endif
}
void ExtVideo::updateFilters()
......
......@@ -766,27 +766,46 @@ void __module_Unneed( vlc_object_t * p_this, module_t * p_module )
}
/*****************************************************************************
* module_Exists: tell if a module exists.
*****************************************************************************
* This function is a boolean function that tells if a module exist or not.
* module_FindName: get a pointer to a module_t given it's name.
*****************************************************************************/
vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name )
module_t *__module_FindName( vlc_object_t *p_this, const char * psz_name )
{
vlc_list_t *p_list;
int i;
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i = 0 ; i < p_list->i_count; i++)
{
const char *psz_module_name =
((module_t *) p_list->p_values[i].p_object)->psz_shortname;
module_t *p_module = ((module_t *) p_list->p_values[i].p_object);
const char *psz_module_name = p_module->psz_object_name;
if( psz_module_name && !strcmp( psz_module_name, psz_name ) )
{
/* We can release the list, and return yes */
vlc_list_release( p_list ); return VLC_TRUE;
vlc_list_release( p_list );
vlc_object_yield( p_module );
return p_module;
}
}
vlc_list_release( p_list ); return VLC_FALSE;
vlc_list_release( p_list );
return NULL;
}
/*****************************************************************************
* module_Exists: tell if a module exists.
*****************************************************************************
* This function is a boolean function that tells if a module exist or not.
*****************************************************************************/
vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name )
{
module_t *p_module = __module_FindName( p_this, psz_name );
if( p_module )
{
vlc_object_release( p_module );
return VLC_TRUE;
}
else
{
return VLC_FALSE;
}
}
......
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