vlc | branch: master | Thomas Guillem <[email protected]> | Tue Mar 14 14:05:14 2017 +0100| [30a61d4fff84cc02448948a45415ebe146fe9f72] | committer: Thomas Guillem
vout: move and hide vout_EnableFilter() Since it's only used by lib/video.c. Ref #17761 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30a61d4fff84cc02448948a45415ebe146fe9f72 --- include/vlc_vout.h | 2 - lib/video.c | 89 ++++++++++++++++++++++++++++++++++++++++++ src/libvlccore.sym | 1 - src/video_output/vout_intf.c | 92 -------------------------------------------- 4 files changed, 89 insertions(+), 95 deletions(-) diff --git a/include/vlc_vout.h b/include/vlc_vout.h index d236d51..a6fb0af 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -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 */ diff --git a/lib/video.c b/lib/video.c index 69c5fb8..a275f72 100644 --- a/lib/video.c +++ b/lib/video.c @@ -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 ); diff --git a/src/libvlccore.sym b/src/libvlccore.sym index 57c8349..8c4d6cd 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -714,7 +714,6 @@ vout_PutPicture vout_PutSubpicture vout_RegisterSubpictureChannel vout_FlushSubpictureChannel -vout_EnableFilter vout_GetSnapshot vout_OSDIcon vout_OSDMessage diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c index 262da21..b494908 100644 --- a/src/video_output/vout_intf.c +++ b/src/video_output/vout_intf.c @@ -439,98 +439,6 @@ exit: } /***************************************************************************** - * 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 *****************************************************************************/ static int CropCallback( vlc_object_t *object, char const *cmd, _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
