/*****************************************************************************
* rc.c : remote control stdin/stdout module for vlc
*****************************************************************************
- * Copyright (C) 2004-2007 the VideoLAN team
+ * Copyright (C) 2004-2009 the VideoLAN team
* $Id$
*
* Author: Peter Surda <shurdeek@panorama.sth.ac.at>
/*****************************************************************************
* Preamble
*****************************************************************************/
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <vlc_plugin.h>
#include <errno.h> /* ENOMEM */
#include <ctype.h>
#include <signal.h>
+#include <assert.h>
#include <vlc_interface.h>
#include <vlc_aout.h>
# include <sys/un.h>
#endif
-#define MAX_LINE_LENGTH 256
+#define MAX_LINE_LENGTH 1024
#define STATUS_CHANGE "status change: "
-static const char *ppsz_input_state[] = { N_("Initializing"), N_("Opening"), N_("Buffer"), N_("Play"), N_("Pause"), N_("Stop"), N_("Error") };
+/* input_state_e from <vlc_input.h> */
+static const char *ppsz_input_state[] = {
+ [INIT_S] = N_("Initializing"),
+ [OPENING_S] = N_("Opening"),
+ [PLAYING_S] = N_("Play"),
+ [PAUSE_S] = N_("Pause"),
+ [END_S] = N_("End"),
+ [ERROR_S] = N_("Error"),
+};
/*****************************************************************************
* Local prototypes
#define msg_rc( ... ) __msg_rc( p_intf, __VA_ARGS__ )
+LIBVLC_FORMAT(2, 3)
static void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
{
va_list args;
+ char fmt_eol[strlen (psz_fmt) + 3];
+
+ snprintf (fmt_eol, sizeof (fmt_eol), "%s\r\n", psz_fmt);
va_start( args, psz_fmt );
if( p_intf->p_sys->i_socket == -1 )
- {
- utf8_vfprintf( stdout, psz_fmt, args );
- printf( "\r\n" );
- }
+ utf8_vfprintf( stdout, fmt_eol, args );
else
- {
- net_vaPrintf( p_intf, p_intf->p_sys->i_socket, NULL, psz_fmt, args );
- net_Write( p_intf, p_intf->p_sys->i_socket, NULL, (uint8_t*)"\r\n", 2 );
- }
+ net_vaPrintf( p_intf, p_intf->p_sys->i_socket, NULL, fmt_eol, args );
va_end( args );
}
"open." )
#endif
-vlc_module_begin();
- set_shortname( _("RC"));
- set_category( CAT_INTERFACE );
- set_subcategory( SUBCAT_INTERFACE_MAIN );
- set_description( _("Remote control interface") );
- add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, true );
+vlc_module_begin ()
+ set_shortname( N_("RC"))
+ set_category( CAT_INTERFACE )
+ set_subcategory( SUBCAT_INTERFACE_MAIN )
+ set_description( N_("Remote control interface") )
+ add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, true )
#ifdef WIN32
- add_bool( "rc-quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, false );
+ add_bool( "rc-quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, false )
#else
#if defined (HAVE_ISATTY)
- add_bool( "rc-fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, true );
+ add_bool( "rc-fake-tty", 0, NULL, TTY_TEXT, TTY_LONGTEXT, true )
#endif
- add_string( "rc-unix", 0, NULL, UNIX_TEXT, UNIX_LONGTEXT, true );
+ add_string( "rc-unix", 0, NULL, UNIX_TEXT, UNIX_LONGTEXT, true )
#endif
- add_string( "rc-host", 0, NULL, HOST_TEXT, HOST_LONGTEXT, true );
+ add_string( "rc-host", 0, NULL, HOST_TEXT, HOST_LONGTEXT, true )
- set_capability( "interface", 20 );
+ set_capability( "interface", 20 )
- set_callbacks( Activate, Deactivate );
-vlc_module_end();
+ set_callbacks( Activate, Deactivate )
+vlc_module_end ()
/*****************************************************************************
* Activate: initialize and create stuff
static int Activate( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*)p_this;
- char *psz_host, *psz_unix_path;
+ char *psz_host, *psz_unix_path = NULL;
int *pi_socket = NULL;
#ifndef WIN32
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( !p_intf->p_sys )
- {
- msg_Err( p_intf, "no memory" );
return VLC_ENOMEM;
- }
p_intf->p_sys->pi_socket_listen = pi_socket;
p_intf->p_sys->i_socket = -1;
input_thread_t * p_input;
playlist_t * p_playlist;
- char p_buffer[ MAX_LINE_LENGTH + 1 ];
+ char p_buffer[ MAX_LINE_LENGTH + 1 ];
bool b_showpos = config_GetInt( p_intf, "rc-show-pos" );
bool b_longhelp = false;
- int i_size = 0;
- int i_oldpos = 0;
- int i_newpos;
+ int i_size = 0;
+ int i_oldpos = 0;
+ int i_newpos;
+ int canc = vlc_savecancel();
p_buffer[0] = 0;
p_input = NULL;
}
#endif
- while( !intf_ShouldDie( p_intf ) )
+ while( vlc_object_alive( p_intf ) )
{
char *psz_cmd, *psz_arg;
bool b_complete;
FIND_ANYWHERE );
if( p_input )
{
- p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST,
- FIND_PARENT );
+ p_playlist = pl_Hold( p_input );
}
}
/* New input has been registered */
if( p_input )
{
- if( !p_input->b_dead || !p_input->b_die )
+ if( !p_input->b_dead || vlc_object_alive (p_input) )
{
char *psz_uri =
input_item_GetURI( input_GetItem( p_input ) );
if( p_playlist )
{
- vlc_mutex_lock( &p_playlist->object_lock );
+ PL_LOCK;
p_intf->p_sys->i_last_state = (int) PLAYLIST_STOPPED;
msg_rc( STATUS_CHANGE "( stop state: 0 )" );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
}
}
- if( (p_input != NULL) && !p_input->b_dead && !p_input->b_die &&
+ if( (p_input != NULL) && !p_input->b_dead && vlc_object_alive (p_input) &&
(p_playlist != NULL) )
{
- vlc_mutex_lock( &p_playlist->object_lock );
- if( (p_intf->p_sys->i_last_state != p_playlist->status.i_status) &&
- (p_playlist->status.i_status == PLAYLIST_STOPPED) )
- {
- p_intf->p_sys->i_last_state = PLAYLIST_STOPPED;
- msg_rc( STATUS_CHANGE "( stop state: 5 )" );
- }
- else if(
- (p_intf->p_sys->i_last_state != p_playlist->status.i_status) &&
- (p_playlist->status.i_status == PLAYLIST_RUNNING) )
- {
- p_intf->p_sys->i_last_state = p_playlist->status.i_status;
- msg_rc( STATUS_CHANGE "( play state: 3 )" );
- }
- else if(
- (p_intf->p_sys->i_last_state != p_playlist->status.i_status) &&
- (p_playlist->status.i_status == PLAYLIST_PAUSED) )
+ PL_LOCK;
+ int status = playlist_Status( p_playlist );
+ if( p_intf->p_sys->i_last_state != status )
{
- p_intf->p_sys->i_last_state = p_playlist->status.i_status;
- msg_rc( STATUS_CHANGE "( pause state: 4 )" );
+ if( status == PLAYLIST_STOPPED )
+ {
+ p_intf->p_sys->i_last_state = PLAYLIST_STOPPED;
+ msg_rc( STATUS_CHANGE "( stop state: 5 )" );
+ }
+ else if( status == PLAYLIST_RUNNING )
+ {
+ p_intf->p_sys->i_last_state = PLAYLIST_RUNNING;
+ msg_rc( STATUS_CHANGE "( play state: 3 )" );
+ }
+ else if( status == PLAYLIST_PAUSED )
+ {
+ p_intf->p_sys->i_last_state = PLAYLIST_PAUSED;
+ msg_rc( STATUS_CHANGE "( pause state: 4 )" );
+ }
}
- vlc_mutex_unlock( &p_playlist->object_lock );
+ PL_UNLOCK;
}
if( p_input && b_showpos )
if( psz_msg )
{
- msg_rc( psz_msg );
+ msg_rc( "%s", psz_msg );
free( psz_msg );
}
}
{
vlc_value_t time;
var_Get( p_input, "time", &time );
- msg_rc( "%i", time.i_time / 1000000);
+ msg_rc( "%"PRIu64, time.i_time / 1000000);
}
}
else if( !strcmp( psz_cmd, "get_length" ) )
{
vlc_value_t time;
var_Get( p_input, "length", &time );
- msg_rc( "%i", time.i_time / 1000000);
+ msg_rc( "%"PRIu64, time.i_time / 1000000);
}
}
else if( !strcmp( psz_cmd, "get_title" ) )
{
if( ! p_input )
{
- msg_rc("");
+ msg_rc("%s", "");
}
else
{
}
var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf );
+ vlc_restorecancel( canc );
}
static void Help( intf_thread_t *p_intf, bool b_longhelp)
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input )
{
- msg_rc( STATUS_CHANGE "( time-offset: %d )",
- var_GetInteger( p_input, "time-offset" ) );
+ msg_rc( STATUS_CHANGE "( time-offset: %"PRId64"s )",
+ (var_GetTime( p_input, "time-offset" )/1000000) );
vlc_object_release( p_input );
}
vlc_mutex_unlock( &p_intf->p_sys->status_lock );
VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
intf_thread_t *p_intf = (intf_thread_t*)p_data;
playlist_t *p_playlist = NULL;
- input_thread_t *p_input = NULL;
+ char cmd[6];
vlc_mutex_lock( &p_intf->p_sys->status_lock );
- p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
- if( p_input )
- {
- p_playlist = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_PARENT );
- if( p_playlist )
- {
- char cmd[6];
- switch( p_playlist->status.i_status )
- {
- case PLAYLIST_STOPPED:
- strcpy( cmd, "stop" );
- break;
- case PLAYLIST_RUNNING:
- strcpy( cmd, "play" );
- break;
- case PLAYLIST_PAUSED:
- strcpy( cmd, "pause" );
- break;
- default:
- cmd[0] = '\0';
- } /* var_GetInteger( p_input, "state" ) */
- msg_rc( STATUS_CHANGE "( %s state: %d ): %s",
- &cmd[0], newval.i_int,
- ppsz_input_state[ newval.i_int ] );
- vlc_object_release( p_playlist );
- }
- vlc_object_release( p_input );
- }
+ p_playlist = pl_Hold( p_intf );
+ PL_LOCK;
+ int i_status = playlist_Status( p_playlist );
+ PL_UNLOCK;
+ pl_Release( p_intf );
+
+ switch( i_status )
+ {
+ case PLAYLIST_STOPPED:
+ strcpy( cmd, "stop" );
+ break;
+ case PLAYLIST_RUNNING:
+ strcpy( cmd, "play" );
+ break;
+ case PLAYLIST_PAUSED:
+ strcpy( cmd, "pause" );
+ break;
+ default:
+ cmd[0] = '\0';
+ } /* var_GetInteger( p_input, "state" ) */
+ msg_rc( STATUS_CHANGE "( %s state: %d ): %s", cmd, newval.i_int,
+ ppsz_input_state[ newval.i_int ] );
+
vlc_mutex_unlock( &p_intf->p_sys->status_lock );
return VLC_SUCCESS;
}
if( !p_input ) return VLC_ENOOBJ;
var_Get( p_input, "state", &val );
- if( ( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) &&
+ if( ( val.i_int == PAUSE_S ) &&
( strcmp( psz_cmd, "pause" ) != 0 ) )
{
msg_rc( _("Press menu select or pause to continue.") );
}
else if ( !strcmp( psz_cmd, "fastforward" ) )
{
- val.i_int = config_GetInt( p_intf, "key-jump+extrashort" );
- var_Set( p_intf->p_libvlc, "key-pressed", val );
+ if( var_GetBool( p_input, "can-rate" ) )
+ {
+ int i_rate = var_GetInteger( p_input, "rate" );
+ i_rate = (i_rate < 0) ? -i_rate : i_rate * 2;
+ var_SetInteger( p_input, "rate", i_rate );
+ }
+ else
+ {
+ val.i_int = config_GetInt( p_intf, "key-jump+extrashort" );
+ var_Set( p_intf->p_libvlc, "key-pressed", val );
+ }
vlc_object_release( p_input );
return VLC_SUCCESS;
}
else if ( !strcmp( psz_cmd, "rewind" ) )
{
- val.i_int = config_GetInt( p_intf, "key-jump-extrashort" );
- var_Set( p_intf->p_libvlc, "key-pressed", val );
+ if( var_GetBool( p_input, "can-rewind" ) )
+ {
+ int i_rate = var_GetInteger( p_input, "rate" );
+ i_rate = (i_rate > 0) ? -i_rate : i_rate / 2;
+ var_SetInteger( p_input, "rate", i_rate );
+ }
+ else
+ {
+ val.i_int = config_GetInt( p_intf, "key-jump-extrashort" );
+ var_Set( p_intf->p_libvlc, "key-pressed", val );
+ }
vlc_object_release( p_input );
return VLC_SUCCESS;
}
}
else
{
- vlc_value_t val_list;
-
/* Get. */
var_Get( p_input, "chapter", &val );
- var_Change( p_input, "chapter", VLC_VAR_GETCHOICES,
- &val_list, NULL );
- msg_rc( "Currently playing chapter %d/%d.",
- val.i_int, val_list.p_list->i_count );
- var_Change( p_this, "chapter", VLC_VAR_FREELIST,
- &val_list, NULL );
+ int i_chapter_count = var_CountChoices( p_input, "chapter" );
+ msg_rc( "Currently playing chapter %d/%d.", val.i_int,
+ i_chapter_count );
}
}
else if( !strcmp( psz_cmd, "chapter_n" ) )
- {
- val.b_bool = true;
- var_Set( p_input, "next-chapter", val );
- }
+ var_SetVoid( p_input, "next-chapter" );
else if( !strcmp( psz_cmd, "chapter_p" ) )
- {
- val.b_bool = true;
- var_Set( p_input, "prev-chapter", val );
- }
+ var_SetVoid( p_input, "prev-chapter" );
vlc_object_release( p_input );
return VLC_SUCCESS;
}
}
else
{
- vlc_value_t val_list;
-
/* Get. */
var_Get( p_input, "title", &val );
- var_Change( p_input, "title", VLC_VAR_GETCHOICES,
- &val_list, NULL );
- msg_rc( "Currently playing title %d/%d.",
- val.i_int, val_list.p_list->i_count );
- var_Change( p_this, "title", VLC_VAR_FREELIST,
- &val_list, NULL );
+ int i_title_count = var_CountChoices( p_input, "title" );
+ msg_rc( "Currently playing title %d/%d.", val.i_int,
+ i_title_count );
}
}
else if( !strcmp( psz_cmd, "title_n" ) )
- {
- val.b_bool = true;
- var_Set( p_input, "next-title", val );
- }
+ var_SetVoid( p_input, "next-title" );
else if( !strcmp( psz_cmd, "title_p" ) )
- {
- val.b_bool = true;
- var_Set( p_input, "prev-title", val );
- }
+ var_SetVoid( p_input, "prev-title" );
vlc_object_release( p_input );
return VLC_SUCCESS;
msg_rc( "| %i - %s", val.p_list->p_values[i].i_int,
text.p_list->p_values[i].psz_string );
}
- var_Change( p_input, psz_variable, VLC_VAR_FREELIST,
- &val, &text );
+ var_FreeList( &val, &text );
msg_rc( "+----[ end of %s ]", val_name.psz_string );
free( val_name.psz_string );
vlc_value_t val;
intf_thread_t *p_intf = (intf_thread_t*)p_this;
- playlist_t *p_playlist = pl_Yield( p_this );
+ playlist_t *p_playlist = pl_Hold( p_this );
+ input_thread_t * p_input = playlist_CurrentInput( p_playlist );
- PL_LOCK;
- if( p_playlist->p_input )
+ if( p_input )
{
- var_Get( p_playlist->p_input, "state", &val );
- if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+ var_Get( p_input, "state", &val );
+ vlc_object_release( p_input );
+
+ if( val.i_int == PAUSE_S )
{
msg_rc( _("Type 'menu select' or 'pause' to continue.") );
- vlc_object_release( p_playlist );
- PL_UNLOCK;
+ pl_Release( p_this );
return VLC_EGENERIC;
}
}
- PL_UNLOCK;
/* Parse commands that require a playlist */
if( !strcmp( psz_cmd, "prev" ) )
p_item = p_parent = p_playlist->items.p_elems[i_pos*2-1];
while( p_parent->p_parent )
p_parent = p_parent->p_parent;
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true,
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Unlocked,
p_parent, p_item );
}
else
else if( !strcmp( psz_cmd, "clear" ) )
{
playlist_Stop( p_playlist );
- playlist_Clear( p_playlist, false );
+ playlist_Clear( p_playlist, pl_Unlocked );
}
else if( !strcmp( psz_cmd, "add" ) &&
newval.psz_string && *newval.psz_string )
msg_rc( "Trying to add %s to playlist.", newval.psz_string );
int i_ret =playlist_AddInput( p_playlist, p_item,
PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, true,
- false );
+ pl_Unlocked );
vlc_gc_decref( p_item );
if( i_ret != VLC_SUCCESS )
{
msg_rc( "trying to enqueue %s to playlist", newval.psz_string );
if( playlist_AddInput( p_playlist, p_item,
PLAYLIST_APPEND, PLAYLIST_END, true,
- false ) != VLC_SUCCESS )
+ pl_Unlocked ) != VLC_SUCCESS )
{
return VLC_EGENERIC;
}
}
else if( !strcmp( psz_cmd, "status" ) )
{
- if( p_playlist->p_input )
+ input_thread_t * p_input = playlist_CurrentInput( p_playlist );
+ if( p_input )
{
/* Replay the current state of the system. */
char *psz_uri =
- input_item_GetURI( input_GetItem( p_playlist->p_input ) );
+ 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" ));
PL_LOCK;
- switch( p_playlist->status.i_status )
+ switch( playlist_Status(p_playlist) )
{
case PLAYLIST_STOPPED:
msg_rc( STATUS_CHANGE "( stop state: 5 )" );
break;
}
PL_UNLOCK;
+ vlc_object_release( p_input );
}
}
msg_rc( "unknown command!" );
}
- vlc_object_release( p_playlist );
+ pl_Release( p_this );
return VLC_SUCCESS;
}
{
VLC_UNUSED(p_data); VLC_UNUSED(psz_cmd);
VLC_UNUSED(oldval); VLC_UNUSED(newval);
- playlist_t *p_playlist;
- p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( p_playlist )
- {
- playlist_Stop( p_playlist );
- vlc_object_release( p_playlist );
- }
- vlc_object_kill( p_this->p_libvlc );
+ libvlc_Quit( p_this->p_libvlc );
return VLC_SUCCESS;
}
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
- intf_thread_t *p_newintf = NULL;
-
- p_newintf = intf_Create( p_this->p_libvlc, newval.psz_string, 0, NULL );
- if( p_newintf )
- {
- if( intf_RunThread( p_newintf ) )
- {
- vlc_object_detach( p_newintf );
- intf_Destroy( p_newintf );
- }
- }
- return VLC_SUCCESS;
+ return intf_Create( p_this->p_libvlc, newval.psz_string );
}
static int Volume( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t val;
var_Get( p_input, "state", &val );
- if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+ if( val.i_int == PAUSE_S )
{
msg_rc( _("Type 'menu select' or 'pause' to continue.") );
vlc_object_release( p_input );
vlc_value_t val;
var_Get( p_input, "state", &val );
- if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) )
+ if( val.i_int == PAUSE_S )
{
msg_rc( _("Type 'menu select' or 'pause' to continue.") );
vlc_object_release( p_input );
{
psz_variable = "video-snapshot";
}
+ else
+ /* This case can't happen */
+ assert( 0 );
if( newval.psz_string && *newval.psz_string )
{
i_error = var_Set( p_vout, psz_variable, newval );
}
}
- else if( !strcmp( psz_cmd, "snapshot" ) )
+ else if( !strcmp( psz_cmd, "snapshot" ) )
{
vlc_value_t val;
val.b_bool = true;
VLC_VAR_GETLIST, &val, &text ) < 0 )
{
vlc_object_release( p_vout );
+ free( psz_value );
return VLC_EGENERIC;
}
}
free( psz_value );
}
- var_Change( p_vout, psz_variable, VLC_VAR_FREELIST,
- &val, &text );
+ var_FreeList( &val, &text );
msg_rc( "+----[ end of %s ]", val_name.psz_string );
free( val_name.psz_string );
vlc_value_t val;
var_Get( p_input, "state", &val );
- if( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) {
+ if( val.i_int == PAUSE_S )
+ {
msg_rc( _("Type 'menu select' or 'pause' to continue.") );
vlc_object_release( p_input );
return VLC_EGENERIC;
msg_rc( "| %i - %s", 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, &text );
+ var_FreeList( &val, &text );
msg_rc( "+----[ end of %s ]", val_name.psz_string );
free( val_name.psz_string );
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
intf_thread_t *p_intf = (intf_thread_t*)p_this;
playlist_t *p_playlist = NULL;
+ int i_error = VLC_SUCCESS;
vlc_value_t val;
- int i_error = VLC_EGENERIC;
if ( !*newval.psz_string )
{
msg_rc( _("Please provide one of the following parameters:") );
msg_rc( "[on|off|up|down|left|right|select]" );
- return i_error;
+ return VLC_EGENERIC;
}
- p_playlist = vlc_object_find( p_this, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
- if( !p_playlist )
- return VLC_ENOOBJ;
+ p_playlist = pl_Hold( p_this );
+ input_thread_t * p_input = playlist_CurrentInput( p_playlist );
- if( p_playlist->p_input )
+ if( p_input )
{
- var_Get( p_playlist->p_input, "state", &val );
- if( ( ( val.i_int == PAUSE_S ) || ( val.i_int == PLAYLIST_PAUSED ) ) &&
+ var_Get( p_input, "state", &val );
+ vlc_object_release( p_input );
+
+ if( ( val.i_int == PAUSE_S ) &&
( strcmp( newval.psz_string, "select" ) != 0 ) )
{
msg_rc( _("Type 'menu select' or 'pause' to continue.") );
- vlc_object_release( p_playlist );
+ pl_Release( p_this );
return VLC_EGENERIC;
}
}
- vlc_object_release( p_playlist );
+ pl_Release( p_this );
val.psz_string = strdup( newval.psz_string );
+ if( !val.psz_string )
+ return VLC_ENOMEM;
if( !strcmp( val.psz_string, "on" ) || !strcmp( val.psz_string, "show" ))
osd_MenuShow( p_this );
- else if( !strcmp( val.psz_string, "off" ) || !strcmp( val.psz_string, "hide" ) )
+ else if( !strcmp( val.psz_string, "off" )
+ || !strcmp( val.psz_string, "hide" ) )
osd_MenuHide( p_this );
else if( !strcmp( val.psz_string, "up" ) )
osd_MenuUp( p_this );
{
msg_rc( _("Please provide one of the following parameters:") );
msg_rc( "[on|off|up|down|left|right|select]" );
- free( val.psz_string );
- return i_error;
+ i_error = VLC_EGENERIC;
}
- i_error = VLC_SUCCESS;
free( val.psz_string );
return i_error;
}
while( WaitForSingleObject( p_intf->p_sys->hConsoleIn,
INTF_IDLE_SLEEP/1000 ) == WAIT_OBJECT_0 )
{
- while( !intf_ShouldDie( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
+ while( vlc_object_alive( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
ReadConsoleInput( p_intf->p_sys->hConsoleIn, &input_record,
1, &i_dw ) )
{
}
#endif
- while( !intf_ShouldDie( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
+ while( vlc_object_alive( p_intf ) && *pi_size < MAX_LINE_LENGTH &&
(i_read = net_Read( p_intf, p_intf->p_sys->i_socket == -1 ?
0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL,
(uint8_t *)p_buffer + *pi_size, 1, false ) ) > 0 )
{
/* Standard input closed: exit */
vlc_value_t empty;
- Quit( p_intf, NULL, empty, empty, NULL );
+ Quit( VLC_OBJECT(p_intf), NULL, empty, empty, NULL );
}
p_buffer[ *pi_size ] = 0;
/* Now create a playlist item */
if( psz_item_mrl )
{
- p_item = input_ItemNew( p_intf, psz_item_mrl, NULL );
+ p_item = input_item_New( p_intf, psz_item_mrl, NULL );
for( i = 0; i < i_options; i++ )
{
- input_ItemAddOption( p_item, ppsz_options[i] );
+ input_item_AddOption( p_item, ppsz_options[i], VLC_INPUT_OPTION_TRUSTED );
}
}