Commit 7db16547 authored by Olivier Teulière's avatar Olivier Teulière

* modules/control/hotkeys.c and lirc.c: fixed a refcount problem + small

   coding style changes
parent eebed017
......@@ -200,8 +200,7 @@ static void Run( intf_thread_t *p_intf )
/* Update the vout */
if( p_vout == NULL )
{
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
p_intf->p_sys->p_vout = p_vout;
}
else if( p_vout->b_die )
......@@ -255,7 +254,7 @@ static void Run( intf_thread_t *p_intf )
{
i_delay--;
input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
vout_OSDMessage( p_intf, "Subtitle delay %i ms",i_delay*100);
vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
}
}
else if( i_action == ACTIONID_SUBDELAY_UP )
......@@ -266,7 +265,7 @@ static void Run( intf_thread_t *p_intf )
{
i_delay++;
input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
vout_OSDMessage( p_intf, "Subtitle delay %i ms",i_delay*100);
vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
}
}
else if( i_action == ACTIONID_VOL_MUTE )
......@@ -280,7 +279,7 @@ static void Run( intf_thread_t *p_intf )
else
{
vout_OSDMessage( p_intf, "Vol %d%%",
i_newvol*100/AOUT_VOLUME_MAX );
i_newvol * 100 / AOUT_VOLUME_MAX );
}
}
else if( i_action == ACTIONID_FULLSCREEN && p_vout )
......@@ -317,17 +316,12 @@ static void Run( intf_thread_t *p_intf )
FIND_ANYWHERE );
if( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vout_OSDMessage( p_intf, _( "Play" ) );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
}
}
}
else if( p_input )
{
if( i_action == ACTIONID_PAUSE )
......@@ -414,7 +408,8 @@ static void Run( intf_thread_t *p_intf )
}
else if( i_action == ACTIONID_POSITION )
{
playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
playlist_t *p_playlist =
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
char psz_duration[MSTRTIME_MAX_SIZE];
char psz_time[MSTRTIME_MAX_SIZE];
......@@ -433,8 +428,9 @@ static void Run( intf_thread_t *p_intf )
if( dur != -1 )
{
secstotimestr( psz_duration, dur/1000000 );
vout_OSDMessage( p_playlist, "%s / %s", psz_time, psz_duration );
secstotimestr( psz_duration, dur / 1000000 );
vout_OSDMessage( p_playlist, "%s / %s",
psz_time, psz_duration );
}
else if( i_seconds > 0 )
{
......@@ -526,8 +522,8 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
vlc_value_t val;
int i_position;
char psz_bookmark_name[11];
playlist_t *p_playlist = vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
playlist_t *p_playlist =
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
sprintf( psz_bookmark_name, "bookmark%i", i_num );
var_Create( p_intf, psz_bookmark_name, VLC_VAR_STRING|VLC_VAR_DOINHERIT );
......@@ -536,9 +532,10 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
if( p_playlist )
{
char *psz_bookmark = strdup( val.psz_string );
for( i_position = 0 ; i_position < p_playlist->i_size ; i_position++)
for( i_position = 0; i_position < p_playlist->i_size; i_position++)
{
if( !strcmp( psz_bookmark, p_playlist->pp_items[i_position]->input.psz_uri ) )
if( !strcmp( psz_bookmark,
p_playlist->pp_items[i_position]->input.psz_uri ) )
{
playlist_Goto( p_playlist, i_position );
break;
......@@ -551,16 +548,18 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
static void SetBookmark( intf_thread_t *p_intf, int i_num )
{
vlc_value_t val;
playlist_t *p_playlist = vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
playlist_t *p_playlist =
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
char psz_bookmark_name[11];
sprintf( psz_bookmark_name, "bookmark%i", i_num );
var_Create( p_intf, psz_bookmark_name, VLC_VAR_STRING|VLC_VAR_DOINHERIT );
var_Create( p_intf, psz_bookmark_name,
VLC_VAR_STRING|VLC_VAR_DOINHERIT );
val.psz_string = strdup( p_playlist->pp_items[p_playlist->i_index]->input.psz_uri );
var_Set( p_intf, psz_bookmark_name, val );
msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num, val.psz_string );
msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num,
val.psz_string );
vlc_object_release( p_playlist );
}
}
......@@ -2,7 +2,7 @@
* lirc.c : lirc module for vlc
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: lirc.c,v 1.11 2004/02/15 19:40:41 sigmunau Exp $
* $Id$
*
* Author: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -196,13 +196,15 @@ static void Run( intf_thread_t *p_intf )
{
audio_volume_t i_newvol;
aout_VolumeUp( p_intf, 1, &i_newvol );
vout_OSDMessage( p_intf, _("Vol %%%d"), i_newvol*100/AOUT_VOLUME_MAX );
vout_OSDMessage( p_intf, _("Vol %%%d"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
else if( !strcmp( c, "VOL_DOWN" ) )
{
audio_volume_t i_newvol;
aout_VolumeDown( p_intf, 1, &i_newvol );
vout_OSDMessage( p_intf, _("Vol %%%d"), i_newvol*100/AOUT_VOLUME_MAX );
vout_OSDMessage( p_intf, _("Vol %%%d"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
else if( !strcmp( c, "MUTE" ) )
{
......@@ -214,7 +216,8 @@ static void Run( intf_thread_t *p_intf )
}
else
{
vout_OSDMessage( p_intf, _("Vol %d%%"), i_newvol*100/AOUT_VOLUME_MAX );
vout_OSDMessage( p_intf, _("Vol %d%%"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
}
if( p_vout )
......@@ -286,14 +289,9 @@ static void Run( intf_thread_t *p_intf )
FIND_ANYWHERE );
if( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
}
continue;
}
......@@ -334,10 +332,11 @@ static void Run( intf_thread_t *p_intf )
{
if( !strcmp( c, "AUDIO_TRACK" ) )
{
vlc_value_t val,list,list2;
vlc_value_t val, list, list2;
int i_count, i;
var_Get( p_input, "audio-es", &val );
var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES, &list, &list2 );
var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
&list, &list2 );
i_count = list.p_list->i_count;
for( i = 0; i < i_count; i++ )
{
......@@ -349,28 +348,34 @@ static void Run( intf_thread_t *p_intf )
/* value of audio-es was not in choices list */
if( i == i_count )
{
msg_Warn( p_input, "invalid current audio track, selecting 0" );
var_Set( p_input, "audio-es", list.p_list->p_values[0] );
msg_Warn( p_input,
"invalid current audio track, selecting 0" );
var_Set( p_input, "audio-es",
list.p_list->p_values[0] );
i = 0;
}
else if( i == i_count - 1 )
{
var_Set( p_input, "audio-es", list.p_list->p_values[0] );
var_Set( p_input, "audio-es",
list.p_list->p_values[0] );
i = 0;
}
else
{
var_Set( p_input, "audio-es", list.p_list->p_values[i+1] );
i = i + 1;
var_Set( p_input, "audio-es",
list.p_list->p_values[i+1] );
i++;
}
vout_OSDMessage( VLC_OBJECT(p_input), _("Audio track: %s"), list2.p_list->p_values[i].psz_string );
vout_OSDMessage( VLC_OBJECT(p_input), _("Audio track: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( !strcmp( c, "SUBTITLE_TRACK" ) )
{
vlc_value_t val,list,list2;
vlc_value_t val, list, list2;
int i_count, i;
var_Get( p_input, "spu-es", &val );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES, &list, &list2 );
var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
&list, &list2 );
i_count = list.p_list->i_count;
for( i = 0; i < i_count; i++ )
{
......
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