X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fvideo_output%2Fvout_intf.c;h=57e15e83490f98fe3b411331b0011b2aae69d753;hb=c3a1a3712f639eff527d030d129734934aa8b919;hp=f7fe56e862000aa8936b5ccb9397ed8c21e1f753;hpb=6ec5618a564992a88b105966aacdf3e2762bcce1;p=vlc diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c index f7fe56e862..57e15e8349 100644 --- a/src/video_output/vout_intf.c +++ b/src/video_output/vout_intf.c @@ -24,11 +24,14 @@ /***************************************************************************** * Preamble *****************************************************************************/ + +#include + +#include #include /* free() */ #include /* opendir() */ #include /* opendir() */ -#include #include #include @@ -445,7 +448,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) picture_t *p_pif; vlc_value_t val, format; DIR *path; - + int i_ret; var_Get( p_vout, "snapshot-path", &val ); @@ -647,7 +650,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) FILE *p_file; do { - asprintf( &psz_filename, "%s/%s%d.%s", val.psz_string, + asprintf( &psz_filename, "%s/%s%05d.%s", val.psz_string, psz_prefix, i_num++, format.psz_string ); } while( ( p_file = fopen( psz_filename, "r" ) ) && !fclose( p_file ) ); @@ -727,6 +730,59 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic ) return VLC_SUCCESS; } +/***************************************************************************** + * Handle filters + *****************************************************************************/ + +void vout_EnableFilter( vout_thread_t *p_vout, char *psz_name, + vlc_bool_t b_add, vlc_bool_t b_setconfig ) +{ + char *psz_parser; + char *psz_string = config_GetPsz( p_vout, "vout-filter" ); + + /* 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; + asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s", + psz_string, psz_name ); + free( psz_parser ); + } + else + 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, "vout-filter", psz_string ); + + var_SetString( p_vout, "vout-filter", psz_string ); + free( psz_string ); +} + /***************************************************************************** * vout_ControlDefault: default methods for video output control. *****************************************************************************/