*****************************************************************************/
#include <vlc/vlc.h>
-#include <stdlib.h> /* malloc(), free() */
-#include <string.h>
#include <errno.h> /* ENOMEM */
-#include <stdio.h>
#include <ctype.h>
#include <signal.h>
set_subcategory( SUBCAT_INTERFACE_MAIN );
set_description( _("Remote control interface") );
add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
-#ifdef HAVE_ISATTY
- add_bool( "rc-fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, VLC_TRUE );
-#endif
- add_string( "rc-unix", 0, NULL, UNIX_TEXT, UNIX_LONGTEXT, VLC_TRUE );
- add_string( "rc-host", 0, NULL, HOST_TEXT, HOST_LONGTEXT, VLC_TRUE );
#ifdef WIN32
add_bool( "rc-quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, VLC_FALSE );
+#else
+#if defined (HAVE_ISATTY)
+ add_bool( "rc-fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, VLC_TRUE );
+#endif
+ add_string( "rc-unix", 0, NULL, UNIX_TEXT, UNIX_LONGTEXT, VLC_TRUE );
#endif
+ add_string( "rc-host", 0, NULL, HOST_TEXT, HOST_LONGTEXT, VLC_TRUE );
set_capability( "interface", 20 );
set_callbacks( Activate, Deactivate );
char *psz_host, *psz_unix_path;
int *pi_socket = NULL;
-#if defined(HAVE_ISATTY) && !defined(WIN32)
+#ifndef WIN32
+#if defined(HAVE_ISATTY)
/* Check that stdin is a TTY */
if( !config_GetInt( p_intf, "rc-fake-tty" ) && !isatty( 0 ) )
{
{
int i_socket;
-#if !defined(AF_LOCAL) || defined(WIN32)
+#ifndef AF_LOCAL
msg_Warn( p_intf, "your OS doesn't support filesystem sockets" );
free( psz_unix_path );
return VLC_EGENERIC;
}
pi_socket[0] = i_socket;
pi_socket[1] = -1;
-#endif
+#endif /* AF_LOCAL */
}
+#endif /* !WIN32 */
if( ( pi_socket == NULL ) &&
( psz_host = config_GetPsz( p_intf, "rc-host" ) ) != NULL )
if( p_intf->p_sys->hConsoleIn == INVALID_HANDLE_VALUE )
{
msg_Err( p_intf, "couldn't find user input handle" );
- p_intf->b_die = VLC_TRUE;
+ vlc_object_kill( p_intf );
}
#endif
{
if( !p_input->b_dead || !p_input->b_die )
{
- msg_rc( STATUS_CHANGE "( new input: %s )",
- input_GetItem(p_input)->psz_uri );
+ char *psz_uri =
+ input_item_GetURI( input_GetItem( p_input ) );
+ msg_rc( STATUS_CHANGE "( new input: %s )", psz_uri );
+ free( psz_uri );
msg_rc( STATUS_CHANGE "( audio volume: %d )",
config_GetInt( p_intf, "volume" ));
}
char *psz_alias = psz_cmd + 1;
char *psz_mycmd = strdup( psz_arg );
char *psz_myarg = strchr( psz_mycmd, ' ' );
- int i_ret = VLC_EGENERIC;
+ char *psz_msg;
- *psz_myarg = '\0';
- psz_myarg ++;
- vlc_object_t *p_obj =
- vlc_object_find_name( p_input->p_libvlc, psz_alias,
- FIND_CHILD );
-
- if( !p_obj )
- msg_rc( "Unknown destination object!" );
+ if( !psz_myarg )
+ {
+ msg_rc( "Not enough parameters." );
+ }
else
{
- int i_type;
- if( (i_type = var_Type( p_obj, psz_mycmd )) & VLC_VAR_ISCOMMAND )
- {
- i_type &= 0xf0;
- if( i_type == VLC_VAR_INTEGER )
- {
- i_ret = var_SetInteger( p_obj, psz_mycmd,
- atoi( psz_myarg ) );
- }
- else if( i_type == VLC_VAR_FLOAT )
- {
- i_ret = var_SetFloat( p_obj, psz_mycmd,
- atof( psz_myarg ) );
- }
- else if( i_type == VLC_VAR_STRING )
- {
- i_ret = var_SetString( p_obj, psz_mycmd,
- psz_myarg );
- }
- else if( i_type == VLC_VAR_BOOL )
- {
- i_ret = var_SetBool( p_obj, psz_mycmd,
- atoi( psz_myarg ) );
- }
- else
- {
- msg_rc( "Unhandled command type. Fix the code!" );
- }
- }
- else
+ *psz_myarg = '\0';
+ psz_myarg ++;
+
+ var_Command( p_intf, psz_alias, psz_mycmd, psz_myarg,
+ &psz_msg );
+
+ if( psz_msg )
{
- msg_rc( "Unknown command! %d", i_type );
+ msg_rc( psz_msg );
+ free( psz_msg );
}
- vlc_object_release( p_obj );
}
free( psz_mycmd );
- msg_rc( "%s on object %s: returned %i (%s)",
- psz_mycmd, psz_alias, i_ret, vlc_error( i_ret ) );
}
/* If the user typed a registered local command, try it */
else if( var_Type( p_intf, psz_cmd ) & VLC_VAR_ISCOMMAND )
psz_cmd, i_ret, vlc_error( i_ret ) );
}
/* Or maybe it's a global command */
- else if( var_Type( p_intf->p_libvlc_global, psz_cmd ) & VLC_VAR_ISCOMMAND )
+ else if( var_Type( p_intf->p_libvlc, psz_cmd ) & VLC_VAR_ISCOMMAND )
{
vlc_value_t val;
int i_ret;
val.psz_string = psz_arg;
/* FIXME: it's a global command, but we should pass the
- * local object as an argument, not p_intf->p_libvlc_global. */
- i_ret = var_Set( p_intf->p_libvlc_global, psz_cmd, val );
+ * local object as an argument, not p_intf->p_libvlc. */
+ i_ret = var_Set( p_intf->p_libvlc, psz_cmd, val );
if( i_ret != 0 )
{
msg_rc( "%s: returned %i (%s)",
Help( p_intf, b_longhelp );
}
+#if 0
else if( !strcmp( psz_cmd, "check-updates" ) )
{
checkUpdates( p_intf, psz_arg );
}
+#endif
else if( !strcmp( psz_cmd, "key" ) || !strcmp( psz_cmd, "hotkey" ) )
{
var_SetInteger( p_intf->p_libvlc, "key-pressed",
if( p_playlist->p_input )
{
/* Replay the current state of the system. */
- msg_rc( STATUS_CHANGE "( new input: %s )",
- input_GetItem(p_playlist->p_input)->psz_uri );
+ char *psz_uri =
+ input_item_GetURI( input_GetItem( p_playlist->p_input ) );
+ msg_rc( STATUS_CHANGE "( new input: %s )", psz_uri );
+ free( psz_uri );
msg_rc( STATUS_CHANGE "( audio volume: %d )",
config_GetInt( p_intf, "volume" ));
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
- p_this->p_libvlc->b_die = VLC_TRUE;
+ vlc_object_kill( p_this->p_libvlc );
return VLC_SUCCESS;
}
p_newintf = intf_Create( p_this->p_libvlc, newval.psz_string, 0, NULL );
if( p_newintf )
{
- p_newintf->b_block = VLC_FALSE;
if( intf_RunThread( p_newintf ) )
{
vlc_object_detach( p_newintf );
}
else
/* Standard input closed: exit */
- p_intf->b_die = VLC_TRUE;
+ vlc_object_kill( p_intf );
p_buffer[ *pi_size ] = 0;
return VLC_TRUE;
return p_item;
}
+#if 0
/*****************************************************************************
* checkUpdates : check for updates
****************************************************************************/
}
update_Delete( p_u );
}
+#endif