Commit 00f8067d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

HTTP: set volume on playlist

parent 4ba623ec
......@@ -418,7 +418,7 @@ static void ParseExecute( httpd_file_sys_t *p_args, char *p_buffer,
state = "stop";
}
aout_VolumeGet( p_args->p_intf, &i_volume );
aout_VolumeGet( p_sys->p_playlist, &i_volume );
sprintf( volume, "%d", (int)i_volume );
p_args->vars = mvar_New( "variables", "" );
......
......@@ -256,7 +256,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
int i_value;
ExtractURIValue( p_request, "value", vol, 8 );
aout_VolumeGet( p_intf, &i_volume );
aout_VolumeGet( p_sys->p_playlist, &i_volume );
decode_URI( vol );
if( vol[0] == '+' )
......@@ -264,12 +264,12 @@ static void MacroDo( httpd_file_sys_t *p_args,
i_value = atoi( vol + 1 );
if( (i_volume + i_value) > AOUT_VOLUME_MAX )
{
aout_VolumeSet( p_intf , AOUT_VOLUME_MAX );
aout_VolumeSet( p_sys->p_playlist, AOUT_VOLUME_MAX );
msg_Dbg( p_intf, "requested volume set: max" );
}
else
{
aout_VolumeSet( p_intf , (i_volume + i_value) );
aout_VolumeSet( p_sys->p_playlist, (i_volume + i_value) );
msg_Dbg( p_intf, "requested volume set: +%i", (i_volume + i_value) );
}
}
......@@ -278,12 +278,12 @@ static void MacroDo( httpd_file_sys_t *p_args,
i_value = atoi( vol + 1 );
if( (i_volume - i_value) < AOUT_VOLUME_MIN )
{
aout_VolumeSet( p_intf , AOUT_VOLUME_MIN );
aout_VolumeSet( p_sys->p_playlist, AOUT_VOLUME_MIN );
msg_Dbg( p_intf, "requested volume set: min" );
}
else
{
aout_VolumeSet( p_intf , (i_volume - i_value) );
aout_VolumeSet( p_sys->p_playlist, (i_volume - i_value) );
msg_Dbg( p_intf, "requested volume set: -%i", (i_volume - i_value) );
}
}
......@@ -291,7 +291,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
{
i_value = atoi( vol );
if( (i_value <= 400) && (i_value>=0) ){
aout_VolumeSet( p_intf, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);
aout_VolumeSet( p_sys->p_playlist, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);
msg_Dbg( p_intf, "requested volume set: %i%%", atoi( vol ));
}
}
......@@ -300,7 +300,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
i_value = atoi( vol );
if( ( i_value <= AOUT_VOLUME_MAX ) && ( i_value >= AOUT_VOLUME_MIN ) )
{
aout_VolumeSet( p_intf , atoi( vol ) );
aout_VolumeSet( p_sys->p_playlist, atoi( vol ) );
msg_Dbg( p_intf, "requested volume set: %i", atoi( vol ) );
}
}
......
......@@ -944,38 +944,38 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
char *psz_vol = SSPop( st );
int i_value;
audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume );
aout_VolumeGet( p_sys->p_playlist, &i_volume );
if( psz_vol[0] == '+' )
{
i_value = atoi( psz_vol );
if( (i_volume + i_value) > AOUT_VOLUME_MAX )
aout_VolumeSet( p_intf, AOUT_VOLUME_MAX );
aout_VolumeSet( p_sys->p_playlist, AOUT_VOLUME_MAX );
else
aout_VolumeSet( p_intf, i_volume + i_value );
aout_VolumeSet( p_sys->p_playlist, i_volume + i_value );
}
else if( psz_vol[0] == '-' )
{
i_value = atoi( psz_vol );
if( (i_volume + i_value) < AOUT_VOLUME_MIN )
aout_VolumeSet( p_intf, AOUT_VOLUME_MIN );
aout_VolumeSet( p_sys->p_playlist, AOUT_VOLUME_MIN );
else
aout_VolumeSet( p_intf, i_volume + i_value );
aout_VolumeSet( p_sys->p_playlist, i_volume + i_value );
}
else if( strstr( psz_vol, "%") != NULL )
{
i_value = atoi( psz_vol );
if( i_value < 0 ) i_value = 0;
if( i_value > 400 ) i_value = 400;
aout_VolumeSet( p_intf, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);
aout_VolumeSet( p_sys->p_playlist, (i_value * (AOUT_VOLUME_MAX - AOUT_VOLUME_MIN))/400+AOUT_VOLUME_MIN);
}
else
{
i_value = atoi( psz_vol );
if( i_value > AOUT_VOLUME_MAX ) i_value = AOUT_VOLUME_MAX;
if( i_value < AOUT_VOLUME_MIN ) i_value = AOUT_VOLUME_MIN;
aout_VolumeSet( p_intf, i_value );
aout_VolumeSet( p_sys->p_playlist, i_value );
}
aout_VolumeGet( p_intf, &i_volume );
aout_VolumeGet( p_sys->p_playlist, &i_volume );
free( psz_vol );
}
else if( !strcmp( s, "vlc_get_meta" ) )
......
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