Commit c3a1a371 authored by Clément Stenac's avatar Clément Stenac

Filter handling helpers moved to core

Will have to be updated/factorized when new chain and filter stuff is in.
parent aa742bd4
......@@ -200,5 +200,6 @@ VLC_EXPORT( int, __aout_VolumeMute, ( vlc_object_t *, audio_volume_t * ) );
VLC_EXPORT( int, aout_Restart, ( aout_instance_t * p_aout ) );
VLC_EXPORT( int, aout_FindAndRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
VLC_EXPORT( int, aout_ChannelsRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
VLC_EXPORT( void, aout_EnableFilter, (vlc_object_t *, const char *, vlc_bool_t ));
#endif /* _VLC_AUDIO_OUTPUT_H */
......@@ -246,6 +246,8 @@ VLC_EXPORT( void, vout_ReleaseWindow, ( vout_thread_t *, void * ) );
VLC_EXPORT( int, vout_ControlWindow, ( vout_thread_t *, void *, int, va_list ) );
void vout_IntfInit( vout_thread_t * );
VLC_EXPORT( void, vout_EnableFilter, ( vout_thread_t *, char *,vlc_bool_t , vlc_bool_t ) );
static inline int vout_vaControl( vout_thread_t *p_vout, int i_query,
va_list args )
......
......@@ -534,6 +534,8 @@ struct module_symbols_t
int (*utf8_fprintf_inner) (FILE *, const char *, ...);
int (*utf8_vfprintf_inner) (FILE *stream, const char *fmt, va_list ap);
int (*net_SetDSCP_inner) (int fd, uint8_t dscp);
void (*vout_EnableFilter_inner) (vout_thread_t *, char *,vlc_bool_t , vlc_bool_t);
void (*aout_EnableFilter_inner) (vlc_object_t *, const char *, vlc_bool_t);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -1003,6 +1005,8 @@ struct module_symbols_t
# define utf8_fprintf (p_symbols)->utf8_fprintf_inner
# define utf8_vfprintf (p_symbols)->utf8_vfprintf_inner
# define net_SetDSCP (p_symbols)->net_SetDSCP_inner
# define vout_EnableFilter (p_symbols)->vout_EnableFilter_inner
# define aout_EnableFilter (p_symbols)->aout_EnableFilter_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1475,6 +1479,8 @@ struct module_symbols_t
((p_symbols)->utf8_fprintf_inner) = utf8_fprintf; \
((p_symbols)->utf8_vfprintf_inner) = utf8_vfprintf; \
((p_symbols)->net_SetDSCP_inner) = net_SetDSCP; \
((p_symbols)->vout_EnableFilter_inner) = vout_EnableFilter; \
((p_symbols)->aout_EnableFilter_inner) = aout_EnableFilter; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__playlist_ItemNew_deprecated = NULL; \
(p_symbols)->__playlist_ItemCopy_deprecated = NULL; \
......
......@@ -124,7 +124,7 @@ QMenu *PlaylistDialog::SDMenu()
{
a->setChecked( true );
}
CONNECT( a , trigerred(), SDMapper, map() );
CONNECT( a , triggered(), SDMapper, map() );
SDMapper->setMapping( a, i>=0? p_parser->pp_shortcuts[i] :
p_parser->psz_object_name );
menu->addAction( a );
......
......@@ -461,3 +461,71 @@ int aout_ChannelsRestart( vlc_object_t * p_this, const char * psz_variable,
aout_Restart( p_aout );
return 0;
}
/** Enable or disable an audio filter
* \param p_this a vlc object
* \param psz_name name of the filter
* \param b_add are we adding or removing the filter ?
*/
void aout_EnableFilter( vlc_object_t *p_this, const char *psz_name,
vlc_bool_t b_add )
{
char *psz_parser, *psz_string;
aout_instance_t * p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout )
psz_string = var_GetString( p_aout, "audio-filter" );
else
psz_string = config_GetPsz( p_this, "audio-filter" );
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
{
vlc_object_release( p_aout );
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 );
if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
{
*(psz_string+strlen(psz_string ) -1 ) = '\0';
}
}
else
{
free( psz_string );
return;
}
}
if( p_aout == NULL )
config_PutPsz( p_this, "audio-filter", psz_string );
else
{
var_SetString( p_aout, "audio-filter", psz_string );
for( int i = 0; i < p_aout->i_nb_inputs; i++ )
p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
vlc_object_release( p_aout );
}
free( psz_string );
}
......@@ -730,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.
*****************************************************************************/
......
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