Commit 30a61d4f authored by Thomas Guillem's avatar Thomas Guillem

vout: move and hide vout_EnableFilter()

Since it's only used by lib/video.c.

Ref #17761
parent bf9ef35e
......@@ -170,8 +170,6 @@ VLC_API void vout_PutSubpicture( vout_thread_t *, subpicture_t * );
VLC_API int vout_RegisterSubpictureChannel( vout_thread_t * );
VLC_API void vout_FlushSubpictureChannel( vout_thread_t *, int );
VLC_API void vout_EnableFilter( vout_thread_t *, const char *,bool , bool );
/**@}*/
#endif /* _VLC_VIDEO_H */
......@@ -35,6 +35,7 @@
#include <vlc/libvlc_media_player.h>
#include <vlc_common.h>
#include <vlc_modules.h>
#include <vlc_input.h>
#include <vlc_vout.h>
......@@ -657,6 +658,94 @@ void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
/* module helpers */
/* ************** */
static void vout_EnableFilter( vout_thread_t *p_vout, const char *psz_name,
bool b_add, bool b_setconfig )
{
char *psz_parser;
char *psz_string;
const char *psz_filter_type;
module_t *p_obj = module_find( psz_name );
if( !p_obj )
{
msg_Err( p_vout, "Unable to find filter module \"%s\".", psz_name );
return;
}
if( module_provides( p_obj, "video filter" ) )
{
psz_filter_type = "video-filter";
}
else if( module_provides( p_obj, "sub source" ) )
{
psz_filter_type = "sub-source";
}
else if( module_provides( p_obj, "sub filter" ) )
{
psz_filter_type = "sub-filter";
}
else
{
msg_Err( p_vout, "Unknown video filter type." );
return;
}
psz_string = var_GetString( p_vout, psz_filter_type );
/* Todo : Use some generic chain manipulation functions */
if( !psz_string ) psz_string = strdup("");
psz_parser = strstr( psz_string, psz_name );
if( b_add )
{
if( !psz_parser )
{
psz_parser = psz_string;
if( asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
psz_string, psz_name ) == -1 )
{
free( psz_parser );
return;
}
free( psz_parser );
}
else
{
free( psz_string );
return;
}
}
else
{
if( psz_parser )
{
memmove( psz_parser, psz_parser + strlen(psz_name) +
(*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
strlen(psz_parser + strlen(psz_name)) + 1 );
/* Remove trailing : : */
if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
{
*(psz_string+strlen(psz_string ) -1 ) = '\0';
}
}
else
{
free( psz_string );
return;
}
}
if( b_setconfig )
{
config_PutPsz( p_vout, psz_filter_type, psz_string );
}
var_SetString( p_vout, psz_filter_type, psz_string );
free( psz_string );
}
static bool find_sub_source_by_name( libvlc_media_player_t *p_mi, const char *restrict name )
{
vout_thread_t *vout = GetVout( p_mi, 0 );
......
......@@ -714,7 +714,6 @@ vout_PutPicture
vout_PutSubpicture
vout_RegisterSubpictureChannel
vout_FlushSubpictureChannel
vout_EnableFilter
vout_GetSnapshot
vout_OSDIcon
vout_OSDMessage
......
......@@ -438,98 +438,6 @@ exit:
free( psz_path );
}
/*****************************************************************************
* Handle filters
*****************************************************************************/
void vout_EnableFilter( vout_thread_t *p_vout, const char *psz_name,
bool b_add, bool b_setconfig )
{
char *psz_parser;
char *psz_string;
const char *psz_filter_type;
module_t *p_obj = module_find( psz_name );
if( !p_obj )
{
msg_Err( p_vout, "Unable to find filter module \"%s\".", psz_name );
return;
}
if( module_provides( p_obj, "video filter" ) )
{
psz_filter_type = "video-filter";
}
else if( module_provides( p_obj, "sub source" ) )
{
psz_filter_type = "sub-source";
}
else if( module_provides( p_obj, "sub filter" ) )
{
psz_filter_type = "sub-filter";
}
else
{
msg_Err( p_vout, "Unknown video filter type." );
return;
}
psz_string = var_GetString( p_vout, psz_filter_type );
/* Todo : Use some generic chain manipulation functions */
if( !psz_string ) psz_string = strdup("");
psz_parser = strstr( psz_string, psz_name );
if( b_add )
{
if( !psz_parser )
{
psz_parser = psz_string;
if( asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s",
psz_string, psz_name ) == -1 )
{
free( psz_parser );
return;
}
free( psz_parser );
}
else
{
free( psz_string );
return;
}
}
else
{
if( psz_parser )
{
memmove( psz_parser, psz_parser + strlen(psz_name) +
(*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
strlen(psz_parser + strlen(psz_name)) + 1 );
/* Remove trailing : : */
if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
{
*(psz_string+strlen(psz_string ) -1 ) = '\0';
}
}
else
{
free( psz_string );
return;
}
}
if( b_setconfig )
{
config_PutPsz( p_vout, psz_filter_type, psz_string );
}
var_SetString( p_vout, psz_filter_type, psz_string );
free( psz_string );
}
/*****************************************************************************
* Object variables callbacks
*****************************************************************************/
......
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