[vlc-commits] aout_ChangeFilterString: use vlc_object instead of audio_output
Rémi Denis-Courmont
git at videolan.org
Sat Aug 6 21:53:22 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 6 21:17:26 2011 +0300| [da5f53e5c095382cec86d5ce728e3182ad85f356] | committer: Rémi Denis-Courmont
aout_ChangeFilterString: use vlc_object instead of audio_output
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=da5f53e5c095382cec86d5ce728e3182ad85f356
---
src/audio_output/aout_internal.h | 3 +-
src/audio_output/common.c | 2 +-
src/audio_output/input.c | 100 ++++++++++++++++++--------------------
src/audio_output/intf.c | 2 +-
4 files changed, 51 insertions(+), 56 deletions(-)
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 7bd3081..80c218d 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -175,7 +175,8 @@ void aout_FormatsPrint(vlc_object_t *, const char *,
const audio_sample_format_t *);
#define aout_FormatsPrint(o, t, a, b) \
aout_FormatsPrint(VLC_OBJECT(o), t, a, b)
-bool aout_ChangeFilterString( vlc_object_t *, audio_output_t *, const char *psz_variable, const char *psz_name, bool b_add );
+bool aout_ChangeFilterString( vlc_object_t *manager, vlc_object_t *aout,
+ const char *var, const char *name, bool b_add );
/* From dec.c */
int aout_DecNew(audio_output_t *, const audio_sample_format_t *,
diff --git a/src/audio_output/common.c b/src/audio_output/common.c
index 2ca195f..28175f1 100644
--- a/src/audio_output/common.c
+++ b/src/audio_output/common.c
@@ -664,7 +664,7 @@ static int FilterOrder( const char *psz_name )
/* This function will add or remove a a module from a string list (colon
* separated). It will return true if there is a modification
* In case p_aout is NULL, we will use configuration instead of variable */
-bool aout_ChangeFilterString( vlc_object_t *p_obj, audio_output_t *p_aout,
+bool aout_ChangeFilterString( vlc_object_t *p_obj, vlc_object_t *p_aout,
const char *psz_variable,
const char *psz_name, bool b_add )
{
diff --git a/src/audio_output/input.c b/src/audio_output/input.c
index 4cbc596..715b88f 100644
--- a/src/audio_output/input.c
+++ b/src/audio_output/input.c
@@ -135,7 +135,7 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
var_SetString( p_aout, "visual", val.psz_string );
free( val.psz_string );
}
- var_AddCallback( p_aout, "visual", VisualizationCallback, NULL );
+ var_AddCallback( p_aout, "visual", VisualizationCallback, p_input );
}
if( var_Type( p_aout, "equalizer" ) == 0 )
@@ -767,81 +767,75 @@ vout_thread_t *aout_filter_RequestVout( filter_t *p_filter,
p_vout, p_fmt, p_input->b_recycle_vout );
}
-static int ChangeFiltersString( audio_output_t * p_aout, const char* psz_variable,
- const char *psz_name, bool b_add )
+static inline bool ChangeFiltersString (vlc_object_t *aout, const char *var,
+ const char *filter, bool add)
{
- return aout_ChangeFilterString( VLC_OBJECT(p_aout), p_aout,
- psz_variable, psz_name, b_add ) ? 1 : 0;
+ return aout_ChangeFilterString (aout, aout, var, filter, add);
}
-static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int VisualizationCallback (vlc_object_t *obj, char const *var,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *data)
{
- audio_output_t *p_aout = (audio_output_t *)p_this;
- char *psz_mode = newval.psz_string;
- (void)psz_cmd; (void)oldval; (void)p_data;
+ const char *mode = newval.psz_string;
+ aout_input_t *input = data;
- if( !psz_mode || !*psz_mode )
+ if (!*mode)
{
- ChangeFiltersString( p_aout, "audio-visual", "goom", false );
- ChangeFiltersString( p_aout, "audio-visual", "visual", false );
- ChangeFiltersString( p_aout, "audio-visual", "projectm", false );
+ ChangeFiltersString (obj, "audio-visual", "goom", false);
+ ChangeFiltersString (obj, "audio-visual", "visual", false);
+ ChangeFiltersString (obj, "audio-visual", "projectm", false);
+ }
+ else if (!strcmp ("goom", mode))
+ {
+ ChangeFiltersString (obj, "audio-visual", "visual", false );
+ ChangeFiltersString (obj, "audio-visual", "goom", true );
+ ChangeFiltersString (obj, "audio-visual", "projectm", false );
+ }
+ else if (!strcmp ("projectm", mode))
+ {
+ ChangeFiltersString (obj, "audio-visual", "visual", false);
+ ChangeFiltersString (obj, "audio-visual", "goom", false);
+ ChangeFiltersString (obj, "audio-visual", "projectm", true);
}
else
{
- if( !strcmp( "goom", psz_mode ) )
- {
- ChangeFiltersString( p_aout, "audio-visual", "visual", false );
- ChangeFiltersString( p_aout, "audio-visual", "goom", true );
- ChangeFiltersString( p_aout, "audio-visual", "projectm", false );
- }
- else if( !strcmp( "projectm", psz_mode ) )
- {
- ChangeFiltersString( p_aout, "audio-visual", "visual", false );
- ChangeFiltersString( p_aout, "audio-visual", "goom", false );
- ChangeFiltersString( p_aout, "audio-visual", "projectm", true );
- }
- else
- {
- var_Create( p_aout, "effect-list", VLC_VAR_STRING );
- var_SetString( p_aout, "effect-list", psz_mode );
+ var_Create (obj, "effect-list", VLC_VAR_STRING);
+ var_SetString (obj, "effect-list", mode);
- ChangeFiltersString( p_aout, "audio-visual", "goom", false );
- ChangeFiltersString( p_aout, "audio-visual", "visual", true );
- ChangeFiltersString( p_aout, "audio-visual", "projectm", false );
- }
+ ChangeFiltersString (obj, "audio-visual", "goom", false);
+ ChangeFiltersString (obj, "audio-visual", "visual", true);
+ ChangeFiltersString (obj, "audio-visual", "projectm", false);
}
- /* That sucks */
- AoutInputsMarkToRestart( p_aout );
+ /* That sucks FIXME: use "input" instead of cast */
+ AoutInputsMarkToRestart ((audio_output_t *)obj);
+ (void) var; (void) oldval;
return VLC_SUCCESS;
}
-static int EqualizerCallback( vlc_object_t *p_this, char const *psz_cmd,
- vlc_value_t oldval, vlc_value_t newval, void *p_data )
+static int EqualizerCallback (vlc_object_t *obj, char const *cmd,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *data)
{
- audio_output_t *p_aout = (audio_output_t *)p_this;
- char *psz_mode = newval.psz_string;
- int i_ret;
- (void)psz_cmd; (void)oldval; (void)p_data;
+ char *mode = newval.psz_string;
+ aout_input_t *input = data;
+ bool ret;
- if( !psz_mode || !*psz_mode )
- {
- i_ret = ChangeFiltersString( p_aout, "audio-filter", "equalizer",
- false );
- }
+ (void) cmd; (void) oldval;
+ if (!*mode)
+ ret = ChangeFiltersString (obj, "audio-filter", "equalizer", false);
else
{
- var_Create( p_aout, "equalizer-preset", VLC_VAR_STRING );
- var_SetString( p_aout, "equalizer-preset", psz_mode );
- i_ret = ChangeFiltersString( p_aout, "audio-filter", "equalizer",
- true );
+ var_Create (obj, "equalizer-preset", VLC_VAR_STRING);
+ var_SetString (obj, "equalizer-preset", mode);
+ ret = ChangeFiltersString (obj, "audio-filter", "equalizer", true);
}
/* That sucks */
- if( i_ret == 1 )
- AoutInputsMarkToRestart( p_aout );
+ if (ret)
+ AoutInputsMarkToRestart ((audio_output_t *)obj);
return VLC_SUCCESS;
}
diff --git a/src/audio_output/intf.c b/src/audio_output/intf.c
index 4c54f67..90f5cb7 100644
--- a/src/audio_output/intf.c
+++ b/src/audio_output/intf.c
@@ -278,7 +278,7 @@ void aout_EnableFilter( vlc_object_t *p_this, const char *psz_name,
{
audio_output_t *p_aout = findAout( p_this );
- if( aout_ChangeFilterString( p_this, p_aout, "audio-filter", psz_name, b_add ) )
+ if( aout_ChangeFilterString( p_this, VLC_OBJECT(p_aout), "audio-filter", psz_name, b_add ) )
{
if( p_aout )
AoutInputsMarkToRestart( p_aout );
More information about the vlc-commits
mailing list