* rc.c : remote control stdin/stdout plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: rc.c,v 1.28 2003/02/20 16:07:38 gbazin Exp $
+ * $Id: rc.c,v 1.37 2003/07/28 07:16:50 fenrir Exp $
*
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
*
#endif
#include <sys/types.h>
-#include "error.h"
+#include "vlc_error.h"
#define MAX_LINE_LENGTH 256
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-#define POS_TEXT N_("show stream position")
+#define POS_TEXT N_("Show stream position")
#define POS_LONGTEXT N_("Show the current position in seconds within the stream from time to time.")
-#define TTY_TEXT N_("fake TTY")
+#define TTY_TEXT N_("Fake TTY")
#define TTY_LONGTEXT N_("Force the rc plugin to use stdin as if it was a TTY.")
vlc_module_begin();
#ifdef HAVE_ISATTY
add_bool( "fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, VLC_TRUE );
#endif
- set_description( _("remote control interface module") );
+ set_description( _("remote control interface") );
set_capability( "interface", 20 );
set_callbacks( Activate, NULL );
vlc_module_end();
double f_ratio = 1.0;
- p_input = NULL;
- p_playlist = NULL;
-
#ifdef WIN32
HANDLE hConsoleIn;
INPUT_RECORD input_record;
DWORD i_dummy2;
#endif
+ p_input = NULL;
+ p_playlist = NULL;
+
/* Register commands that will be cleaned up upon object destruction */
var_Create( p_intf, "quit", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "quit", Quit, NULL );
{
#ifdef WIN32
if( input_record.EventType != KEY_EVENT ||
- !input_record.Event.KeyEvent.bKeyDown )
+ !input_record.Event.KeyEvent.bKeyDown ||
+ input_record.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT ||
+ input_record.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL||
+ input_record.Event.KeyEvent.wVirtualKeyCode == VK_MENU ||
+ input_record.Event.KeyEvent.wVirtualKeyCode == VK_CAPITAL )
{
/* nothing interesting */
continue;
}
else if( !strcmp( psz_cmd, "seek" ) )
{
- input_Seek( p_input, atoi( newval.psz_string ),
- INPUT_SEEK_SECONDS | INPUT_SEEK_SET );
+ if( strlen( newval.psz_string ) > 0 &&
+ newval.psz_string[strlen( newval.psz_string ) - 1] == '%' )
+ {
+ input_Seek( p_input, atoi( newval.psz_string ),
+ INPUT_SEEK_PERCENT | INPUT_SEEK_SET );
+ }
+ else
+ {
+ input_Seek( p_input, atoi( newval.psz_string ),
+ INPUT_SEEK_SECONDS | INPUT_SEEK_SET );
+ }
+ vlc_object_release( p_input );
+ return VLC_SUCCESS;
}
else if( !strcmp( psz_cmd, "chapter" ) ||
!strcmp( psz_cmd, "chapter_n" ) ||
else if( !strcmp( psz_cmd, "add" ) )
{
printf( "trying to add %s to playlist\n", newval.psz_string );
- playlist_Add( p_playlist, newval.psz_string,
+ playlist_Add( p_playlist, newval.psz_string, NULL, 0,
PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
}
else if( !strcmp( psz_cmd, "playlist" ) )
{
aout_instance_t * p_aout;
const char * psz_variable;
- const char * psz_name;
+ vlc_value_t val_name;
int i_error;
p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT, FIND_ANYWHERE );
if ( !strcmp( psz_cmd, "adev" ) )
{
psz_variable = "audio-device";
- psz_name = "audio devices";
}
else
{
psz_variable = "audio-channels";
- psz_name = "audio channels";
}
+ /* Get the descriptive name of the variable */
+ var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_GETTEXT,
+ &val_name, NULL );
+ if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
+
if ( !*newval.psz_string )
{
/* Retrieve all registered ***. */
- vlc_value_t val;
- int i;
- char * psz_value;
+ vlc_value_t val, text;
+ int i, i_value;
if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 )
{
vlc_object_release( (vlc_object_t *)p_aout );
return VLC_EGENERIC;
}
- psz_value = val.psz_string;
+ i_value = val.i_int;
if ( var_Change( (vlc_object_t *)p_aout, psz_variable,
- VLC_VAR_GETLIST, &val ) < 0 )
+ VLC_VAR_GETLIST, &val, &text ) < 0 )
{
- free( psz_value );
vlc_object_release( (vlc_object_t *)p_aout );
return VLC_EGENERIC;
}
- printf( "+----[ %s ]\n", psz_name );
+ printf( "+----[ %s ]\n", val_name.psz_string );
for ( i = 0; i < val.p_list->i_count; i++ )
{
- if ( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
- printf( "| %s *\n", val.p_list->p_values[i].psz_string );
+ if ( i_value == val.p_list->p_values[i].i_int )
+ printf( "| %i - %s *\n", val.p_list->p_values[i].i_int,
+ text.p_list->p_values[i].psz_string );
else
- printf( "| %s\n", val.p_list->p_values[i].psz_string );
+ printf( "| %i - %s\n", val.p_list->p_values[i].i_int,
+ text.p_list->p_values[i].psz_string );
}
var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST,
- &val );
- printf( "+----[ end of %s ]\n", psz_name );
+ &val, &text );
+ printf( "+----[ end of %s ]\n", val_name.psz_string );
- free( psz_value );
+ if( val_name.psz_string ) free( val_name.psz_string );
i_error = VLC_SUCCESS;
}
else
{
vlc_value_t val;
- val.psz_string = newval.psz_string;
+ val.i_int = atoi( newval.psz_string );
i_error = var_Set( (vlc_object_t *)p_aout, psz_variable, val );
}