*****************************************************************************/
#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_myarg = strchr( psz_mycmd, ' ' );
char *psz_msg;
- *psz_myarg = '\0';
- psz_myarg ++;
-
- var_Command( p_input, psz_alias, psz_mycmd, psz_myarg, &psz_msg );
+ if( !psz_myarg )
+ {
+ msg_rc( "Not enough parameters." );
+ }
+ else
+ {
+ *psz_myarg = '\0';
+ psz_myarg ++;
+ var_Command( p_intf, psz_alias, psz_mycmd, psz_myarg,
+ &psz_msg );
- if( psz_msg )
- {
- msg_rc( psz_msg );
- free( psz_msg );
+ if( psz_msg )
+ {
+ msg_rc( psz_msg );
+ free( psz_msg );
+ }
}
free( psz_mycmd );
}
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)",
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;
}
}
else
/* Standard input closed: exit */
- p_intf->b_die = VLC_TRUE;
+ vlc_object_kill( p_intf );
p_buffer[ *pi_size ] = 0;
return VLC_TRUE;