Commit faf9b659 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* modules/audio_output/input.c: created variables to allow for a autogenerated

  Visualizations menu (is this the right location?)
  Problems currently are: Doesn't work on the fly. where to start?
  For that reason it now also uses config options instead of variables.
* modules/visualization/visual/visual.c: small adaptions
* modules/gui/macosx/controls.m: fix warnings.
parent afc9d70d
......@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: controls.m,v 1.50 2003/10/31 15:54:53 hartman Exp $
* $Id: controls.m,v 1.51 2003/11/02 06:33:49 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -54,7 +54,7 @@
if( playlist_IsPlaying( p_playlist ) )
{
vout_OSDMessage( p_intf, _( "Pause" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Pause" ) );
playlist_Pause( p_playlist );
vlc_object_release( p_playlist );
}
......@@ -63,7 +63,7 @@
if( !playlist_IsEmpty( p_playlist ) )
{
playlist_Play( p_playlist );
vout_OSDMessage( p_intf, _( "Play" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Play" ) );
vlc_object_release( p_playlist );
}
else
......@@ -81,7 +81,7 @@
FIND_ANYWHERE );
if( p_playlist != NULL )
{
vout_OSDMessage( p_intf, _( "Stop" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Stop" ) );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
......@@ -97,7 +97,7 @@
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-faster", val );
vout_OSDMessage( p_intf, _( "Faster" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Faster" ) );
vlc_object_release( p_input );
}
}
......@@ -112,7 +112,7 @@
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-slower", val );
vout_OSDMessage( p_intf, _( "Slower" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Slower" ) );
vlc_object_release( p_input );
}
}
......@@ -163,7 +163,7 @@
#undef p_area
vlc_object_release( p_playlist );
vout_OSDMessage( p_intf, _( "Previous" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Previous" ) );
}
- (IBAction)next:(id)sender
......@@ -212,7 +212,7 @@
#undef p_area
vlc_object_release( p_playlist );
vout_OSDMessage( p_intf, _( "Next" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Next" ) );
}
- (IBAction)random:(id)sender
......@@ -231,11 +231,11 @@
var_Set( p_playlist, "random", val );
if( val.b_bool )
{
vout_OSDMessage( p_intf, _( "Shuffle On" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Shuffle On" ) );
}
else
{
vout_OSDMessage( p_intf, _( "Shuffle Off" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Shuffle Off" ) );
}
vlc_object_release( p_playlist );
......@@ -257,11 +257,11 @@
var_Set( p_playlist, "repeat", val );
if( val.b_bool )
{
vout_OSDMessage( p_intf, _( "Repeat On" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Repeat On" ) );
}
else
{
vout_OSDMessage( p_intf, _( "Repeat Off" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Repeat Off" ) );
}
vlc_object_release( p_playlist );
......@@ -283,11 +283,11 @@
var_Set( p_playlist, "loop", val );
if( val.b_bool )
{
vout_OSDMessage( p_intf, _( "Loop On" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Loop On" ) );
}
else
{
vout_OSDMessage( p_intf, _( "Loop Off" ) );
vout_OSDMessage( (vlc_object_t *)p_intf, _( "Loop Off" ) );
}
vlc_object_release( p_playlist );
......@@ -379,7 +379,7 @@
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
sprintf( string, "Vol %d%%", i_volume*100/AOUT_VOLUME_MAX );
vout_OSDMessage( p_intf, string );
vout_OSDMessage( (vlc_object_t *)p_intf, string );
}
- (IBAction)windowAction:(id)sender
......
......@@ -2,7 +2,7 @@
* visual.c : Visualisation system
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: visual.c,v 1.10 2003/09/24 10:21:32 zorglub Exp $
* $Id: visual.c,v 1.11 2003/11/02 06:33:49 hartman Exp $
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
*
......@@ -101,6 +101,8 @@ vlc_module_end();
*****************************************************************************/
static void DoWork( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
static int FilterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static struct
{
char *psz_name;
......@@ -122,6 +124,7 @@ static int Open( vlc_object_t *p_this )
{
aout_filter_t *p_filter = (aout_filter_t *)p_this;
aout_filter_sys_t *p_sys;
vlc_value_t val;
char *psz_effects, *psz_parser;
......@@ -150,8 +153,13 @@ static int Open( vlc_object_t *p_this )
p_sys->effect = NULL;
/* Parse the effect list */
psz_parser = psz_effects = config_GetPsz( p_filter, "effect-list" );
var_Create( p_filter, "effect-list", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_filter, "effect-list", &val);
psz_parser = psz_effects = strdup( val.psz_string );
free( val.psz_string );
msg_Dbg( p_filter , "Building list of effects" );
var_AddCallback( p_filter, "effect-list", FilterCallback, NULL );
while( psz_parser && *psz_parser != '\0' )
{
......@@ -335,3 +343,17 @@ static void Close( vlc_object_t *p_this )
free( p_filter->p_sys );
}
/*****************************************************************************
* FilterCallback: called when changing the deinterlace method on the fly.
*****************************************************************************/
static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
aout_filter_t *p_filter = (aout_filter_t *)p_this;
/* restart this baby */
msg_Dbg( p_filter, "We should restart the visual filter" );
return VLC_SUCCESS;
}
......@@ -2,7 +2,7 @@
* input.c : internal management of input streams for the audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: input.c,v 1.38 2003/09/02 18:06:45 gbazin Exp $
* $Id: input.c,v 1.39 2003/11/02 06:33:49 hartman Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -28,6 +28,7 @@
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/input.h> /* for input_thread_t and i_pts_delay */
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
......@@ -36,6 +37,8 @@
#include "audio_output.h"
#include "aout_internal.h"
static int VisualizationCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/*****************************************************************************
* aout_InputNew : allocate a new input and rework the filter pipeline
......@@ -43,7 +46,7 @@
int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
{
audio_sample_format_t intermediate_format;
vlc_value_t val, text;
char * psz_filters;
aout_FormatPrint( p_aout, "input", &p_input->input );
......@@ -150,8 +153,37 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
}
free( psz_filters );
}
var_Create( p_aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
text.psz_string = _("Visualizations");
var_Change( p_aout, "visual", VLC_VAR_SETTEXT, &text, NULL );
val.psz_string = ""; text.psz_string = _("Disable");
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "random"; text.psz_string = _("Random");
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "scope"; text.psz_string = _("Scope");
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "spectrum"; text.psz_string = _("Spectrum");
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "goom"; text.psz_string = _("Goom");
var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
if( var_Get( p_aout, "effect-list", &val ) == VLC_SUCCESS )
{
var_Set( p_aout, "visual", val );
}
var_AddCallback( p_aout, "visual", VisualizationCallback, NULL );
var_Create( p_aout, "audio-filter", VLC_VAR_STRING );
text.psz_string = _("Audio filters");
var_Change( p_aout, "audio-filter", VLC_VAR_SETTEXT, &text, NULL );
var_Change( p_aout, "audio-filter", VLC_VAR_INHERITVALUE, &val, NULL );
if( var_Get( p_aout, "audio-filter", &val ) == VLC_SUCCESS )
{
var_Set( p_aout, "audio-filter", val );
}
//var_AddCallback( p_aout, "audio-filter", AudioFilterCallback, NULL );
/* Prepare hints for the buffer allocator. */
p_input->input_alloc.i_alloc_type = AOUT_ALLOC_HEAP;
p_input->input_alloc.i_bytes_per_sec = -1;
......@@ -390,3 +422,48 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
return 0;
}
static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
input_thread_t *p_input;
vlc_value_t val;
char *psz_mode = newval.psz_string;
char *psz_filter;
unsigned int i;
psz_filter = config_GetPsz( p_aout, "audio-filter" );
if( !psz_mode || !*psz_mode )
{
config_PutPsz( p_aout, "audio-filter", "" );
}
else
{
if( !psz_filter || !*psz_filter )
{
config_PutPsz( p_aout, "audio-filter", "visual" );
}
else
{
if( strstr( psz_filter, "visual" ) == NULL )
{
psz_filter = realloc( psz_filter, strlen( psz_filter ) + 20 );
strcat( psz_filter, ",visual" );
}
config_PutPsz( p_aout, "audio-filter", psz_filter );
}
}
if( psz_mode && *psz_mode )
{
config_PutPsz( p_aout, "effect-list", psz_mode );
}
if( psz_filter ) free( psz_filter );
return VLC_SUCCESS;
}
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