/*****************************************************************************
* rc.c : remote control stdin/stdout module for vlc
*****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2004 - 2005 VideoLAN
* $Id$
*
* Author: Peter Surda <shurdeek@panorama.sth.ac.at>
static vlc_bool_t ReadCommand( intf_thread_t *, char *, int * );
+static playlist_item_t *parse_MRL( intf_thread_t *, char * );
+
static int Input ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int Playlist ( vlc_object_t *, char const *,
int i_socket;
char *psz_unix_path;
vlc_bool_t b_extend;
-
+
#ifdef WIN32
HANDLE hConsoleIn;
vlc_bool_t b_quiet;
"You can set the address and port the interface will bind to." )
#define EXTEND_TEXT N_("Extended help")
#define EXTEND_LONGTEXT N_("List additional commands.")
-
#ifdef WIN32
#define QUIET_TEXT N_("Do not open a DOS command box interface")
#endif
vlc_module_begin();
+ set_category( CAT_INTERFACE );
+ set_subcategory( SUBCAT_INTERFACE_GENERAL );
set_description( _("Remote control interface") );
add_bool( "rc-show-pos", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
#ifdef HAVE_ISATTY
static int Activate( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*)p_this;
+ playlist_t *p_playlist;
char *psz_host, *psz_unix_path;
int i_socket = -1;
CONSOLE_INTRO_MSG;
#endif
+ /* Force "no-view" mode */
+ p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if( p_playlist )
+ {
+ vlc_mutex_lock( &p_playlist->object_lock );
+ p_playlist->status.i_view = -1;
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ vlc_object_release( p_playlist );
+ }
+
msg_rc( _("Remote control interface initialized, `h' for help\n") );
return VLC_SUCCESS;
}
var_AddCallback( p_intf, "prev", Playlist, NULL );
var_Create( p_intf, "next", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "next", Playlist, NULL );
-
+ var_Create( p_intf, "goto", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "goto", Playlist, NULL );
+
+ /* marquee on the fly items */
var_Create( p_intf, "marq-marquee", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-marquee", Other, NULL );
var_Create( p_intf, "marq-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-x", Other, NULL );
var_Create( p_intf, "marq-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-y", Other, NULL );
+ var_Create( p_intf, "marq-position", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "marq-position", Other, NULL );
+ var_Create( p_intf, "marq-color", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "marq-color", Other, NULL );
+ var_Create( p_intf, "marq-opacity", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "marq-opacity", Other, NULL );
var_Create( p_intf, "marq-timeout", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "marq-timeout", Other, NULL );
-
+ var_Create( p_intf, "marq-size", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "marq-size", Other, NULL );
+
+ var_Create( p_intf, "mosaic-alpha", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-alpha", Other, NULL );
+ var_Create( p_intf, "mosaic-height", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-height", Other, NULL );
+ var_Create( p_intf, "mosaic-width", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-width", Other, NULL );
+ var_Create( p_intf, "mosaic-xoffset", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-xoffset", Other, NULL );
+ var_Create( p_intf, "mosaic-yoffset", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-yoffset", Other, NULL );
+ var_Create( p_intf, "mosaic-vborder", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-vborder", Other, NULL );
+ var_Create( p_intf, "mosaic-hborder", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-hborder", Other, NULL );
+ var_Create( p_intf, "mosaic-position",
+ VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-position", Other, NULL );
+ var_Create( p_intf, "mosaic-rows", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-rows", Other, NULL );
+ var_Create( p_intf, "mosaic-cols", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-cols", Other, NULL );
+ var_Create( p_intf, "mosaic-keep-aspect-ratio",
+ VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "mosaic-keep-aspect-ratio", Other, NULL );
+
+ /* time on the fly items */
+ var_Create( p_intf, "time-format", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-format", Other, NULL );
+ var_Create( p_intf, "time-x", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-x", Other, NULL );
+ var_Create( p_intf, "time-y", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-y", Other, NULL );
+ var_Create( p_intf, "time-position", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-position", Other, NULL );
+ var_Create( p_intf, "time-color", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-color", Other, NULL );
+ var_Create( p_intf, "time-opacity", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-opacity", Other, NULL );
+ var_Create( p_intf, "time-size", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "time-size", Other, NULL );
+
var_Create( p_intf, "pause", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "pause", Input, NULL );
var_Create( p_intf, "seek", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
var_Create( p_intf, "chapter_p", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "chapter_p", Input, NULL );
+ var_Create( p_intf, "fastforward", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "fastforward", Input, NULL );
+ var_Create( p_intf, "rewind", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
+ var_AddCallback( p_intf, "rewind", Input, NULL );
+
var_Create( p_intf, "volume", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
var_AddCallback( p_intf, "volume", Volume, NULL );
var_Create( p_intf, "volup", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
val.psz_string = psz_arg;
i_ret = var_Set( p_intf, psz_cmd, val );
- msg_rc( _("%s: returned %i (%s)\n"),
+ msg_rc( "%s: returned %i (%s)\n",
psz_cmd, i_ret, vlc_error( i_ret ) );
}
/* Or maybe it's a global command */
i_ret = var_Set( p_intf->p_libvlc, psz_cmd, val );
if( i_ret != 0 )
{
- msg_rc( _("%s: returned %i (%s)\n"),
+ msg_rc( "%s: returned %i (%s)\n",
psz_cmd, i_ret, vlc_error( i_ret ) );
}
}
}
msg_rc( "| \n" );
}
- msg_rc( _("+----[ end of stream info ]\n") );
+ msg_rc( "+----[ end of stream info ]\n" );
vlc_mutex_unlock( &p_input->input.p_item->lock );
}
else
{
- msg_rc( _("no input\n") );
+ msg_rc( "no input\n" );
}
}
else if( !strcmp( psz_cmd, "is_playing" ) )
case 'h':
case 'H':
msg_rc(_("+----[ Remote control commands ]\n"));
- msg_rc("| \n");
+ msg_rc( "| \n");
msg_rc(_("| add XYZ . . . . . . . . . . add XYZ to playlist\n"));
msg_rc(_("| playlist . . . show items currently in playlist\n"));
msg_rc(_("| play . . . . . . . . . . . . . . . . play stream\n"));
msg_rc(_("| stop . . . . . . . . . . . . . . . . stop stream\n"));
msg_rc(_("| next . . . . . . . . . . . . next playlist item\n"));
msg_rc(_("| prev . . . . . . . . . . previous playlist item\n"));
+ msg_rc(_("| goto . . . . . . . . . . . . goto item at index\n"));
msg_rc(_("| title [X] . . . . set/get title in current item\n"));
msg_rc(_("| title_n . . . . . . next title in current item\n"));
msg_rc(_("| title_p . . . . previous title in current item\n"));
msg_rc(_("| chapter [X] . . set/get chapter in current item\n"));
msg_rc(_("| chapter_n . . . . next chapter in current item\n"));
msg_rc(_("| chapter_p . . previous chapter in current item\n"));
- msg_rc("| \n");
+ msg_rc( "| \n");
msg_rc(_("| seek X . seek in seconds, for instance `seek 12'\n"));
msg_rc(_("| pause . . . . . . . . . . . . . . toggle pause\n"));
+ msg_rc(_("| fastforward . . . . . . . set to maximum rate\n"));
+ msg_rc(_("| rewind . . . . . . . . . . set to minimum rate\n"));
msg_rc(_("| f . . . . . . . . . . . . . . toggle fullscreen\n"));
msg_rc(_("| info . . . information about the current stream\n"));
- msg_rc("| \n");
+ msg_rc( "| \n");
msg_rc(_("| volume [X] . . . . . . . . set/get audio volume\n"));
msg_rc(_("| volup [X] . . . . . raise audio volume X steps\n"));
msg_rc(_("| voldown [X] . . . . lower audio volume X steps\n"));
msg_rc(_("| adev [X] . . . . . . . . . set/get audio device\n"));
msg_rc(_("| achan [X]. . . . . . . . set/get audio channels\n"));
- msg_rc("| \n");
+ msg_rc( "| \n");
+
if (p_intf->p_sys->b_extend)
{
- msg_rc(_("| marq-marquee STRING . . overlay STRING in video\n"));
- msg_rc(_("| marq-x X . . . . . .offset of marquee, from left\n"));
- msg_rc(_("| marq-y Y . . . . . . offset of marquee, from top\n"));
- msg_rc(_("| marq-timeout T. . . . .timeout of marquee, in ms\n"));
- msg_rc("| \n");
+ msg_rc(_("| marq-marquee STRING . . overlay STRING in video\n"));
+ msg_rc(_("| marq-x X . . . . . offset of marquee, from left\n"));
+ msg_rc(_("| marq-y Y . . . . . . offset of marquee, from top\n"));
+ msg_rc(_("| marq-position #. . . .relative position control\n"));
+ msg_rc(_("| marq-color # . . . . font color of marquee, RGB\n"));
+ msg_rc(_("| marq-opacity # . . . . . . . .opacity of marquee\n"));
+ msg_rc(_("| marq-timeout T. . . . timeout of marquee, in ms\n"));
+ msg_rc(_("| marq-size # . . . font size of marquee, in pixels\n"));
+ msg_rc( "| \n");
+ msg_rc(_("| time-format STRING . . . overlay STRING in video\n"));
+ msg_rc(_("| time-x X . . . . .offset of timestamp, from left\n"));
+ msg_rc(_("| time-y Y . . . . . offset of timestamp, from top\n"));
+ msg_rc(_("| time-position #. . . .relative position control\n"));
+ msg_rc(_("| time-color # . . . font color of timestamp, RGB\n"));
+ msg_rc(_("| time-opacity # . . . . . . .opacity of timestamp\n"));
+ msg_rc(_("| time-size # . .font size of timestamp, in pixels\n"));
+ msg_rc( "| \n");
}
msg_rc(_("| help . . . . . . . . . . . . . this help message\n"));
- msg_rc(_("| logout . . . . . .exit (if in socket connection)\n"));
+ msg_rc(_("| logout . . . . . exit (if in socket connection)\n"));
msg_rc(_("| quit . . . . . . . . . . . . . . . . . quit vlc\n"));
- msg_rc("| \n");
+ msg_rc( "| \n");
msg_rc(_("+----[ end of help ]\n"));
break;
vlc_object_release( p_input );
return VLC_SUCCESS;
}
-
+ else if ( !strcmp( psz_cmd, "fastforward" ) )
+ {
+ val.i_int = INPUT_RATE_MAX;
+
+ var_Set( p_input, "rate", val );
+ vlc_object_release( p_input );
+ return VLC_SUCCESS;
+ }
+ else if ( !strcmp( psz_cmd, "rewind" ) )
+ {
+ val.i_int = INPUT_RATE_MIN;
+
+ var_Set( p_input, "rate", val );
+ vlc_object_release( p_input );
+ return VLC_SUCCESS;
+ }
else if( !strcmp( psz_cmd, "chapter" ) ||
!strcmp( psz_cmd, "chapter_n" ) ||
!strcmp( psz_cmd, "chapter_p" ) )
var_Get( p_input, "chapter", &val );
var_Change( p_input, "chapter", VLC_VAR_GETCHOICES,
&val_list, NULL );
- msg_rc( _("Currently playing chapter %d/%d\n"),
+ msg_rc( "Currently playing chapter %d/%d\n",
val.i_int, val_list.p_list->i_count );
var_Change( p_this, "chapter", VLC_VAR_FREELIST,
&val_list, NULL );
var_Get( p_input, "title", &val );
var_Change( p_input, "title", VLC_VAR_GETCHOICES,
&val_list, NULL );
- msg_rc( _("Currently playing title %d/%d\n"),
+ msg_rc( "Currently playing title %d/%d\n",
val.i_int, val_list.p_list->i_count );
var_Change( p_this, "title", VLC_VAR_FREELIST,
&val_list, NULL );
static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
+ vlc_value_t val;
intf_thread_t *p_intf = (intf_thread_t*)p_this;
playlist_t *p_playlist;
{
playlist_Play( p_playlist );
}
+ else if (!strcmp( psz_cmd, "goto" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ playlist_Goto( p_playlist, val.i_int);
+ }
+ }
else if( !strcmp( psz_cmd, "stop" ) )
{
playlist_Stop( p_playlist );
}
- else if( !strcmp( psz_cmd, "add" ) )
+ else if( !strcmp( psz_cmd, "add" ) &&
+ newval.psz_string && *newval.psz_string )
{
- msg_rc( _("trying to add %s to playlist\n"), newval.psz_string );
- playlist_Add( p_playlist, newval.psz_string, newval.psz_string,
- PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
+ playlist_item_t *p_item = parse_MRL( p_intf, newval.psz_string );
+
+ if( p_item )
+ {
+ msg_rc( "trying to add %s to playlist\n", newval.psz_string );
+ playlist_AddItem( p_playlist, p_item,
+ PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END );
+ }
}
else if( !strcmp( psz_cmd, "playlist" ) )
{
int i;
for ( i = 0; i < p_playlist->i_size; i++ )
{
- msg_rc( "|%s%s %s|\n", i == p_playlist->i_index?"*":" ",
+ msg_rc( "|%s%s %s|%s|\n", i == p_playlist->i_index ? "*" : " ",
p_playlist->pp_items[i]->input.psz_name,
- p_playlist->pp_items[i]->input.psz_uri );
+ p_playlist->pp_items[i]->input.psz_uri,
+ p_playlist->pp_items[i]->i_parents > 0 ?
+ p_playlist->pp_items[i]->pp_parents[0]->p_parent->input.psz_name : "" );
}
if ( i == 0 )
{
- msg_rc( _("| no entries\n") );
+ msg_rc( "| no entries\n" );
}
}
*/
else
{
- msg_rc( _("unknown command!\n") );
+ msg_rc( "unknown command!\n" );
}
vlc_object_release( p_playlist );
if( strlen( newval.psz_string ) > 0 )
{
val.psz_string = newval.psz_string;
- var_Set( p_inp, "marq-marquee", val );
+ var_Set( p_inp->p_libvlc, "marq-marquee", val );
}
else
{
val.psz_string = "";
- var_Set( p_inp, "marq-marquee", val);
+ var_Set( p_inp->p_libvlc, "marq-marquee", val);
}
}
else if( !strcmp( psz_cmd, "marq-x" ) )
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
- var_Set( p_inp, "marq-x", val );
+ var_Set( p_inp->p_libvlc, "marq-x", val );
}
}
else if( !strcmp( psz_cmd, "marq-y" ) )
if( strlen( newval.psz_string ) > 0)
{
val.i_int = atoi( newval.psz_string );
- var_Set( p_inp, "marq-y", val );
+ var_Set( p_inp->p_libvlc, "marq-y", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "marq-position" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "marq-position", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "marq-color" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = strtol( newval.psz_string, NULL, 0 );
+ var_Set( p_inp->p_libvlc, "marq-color", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "marq-opacity" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = strtol( newval.psz_string, NULL, 0 );
+ var_Set( p_inp->p_libvlc, "marq-opacity", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "marq-size" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "marq-size", val );
}
}
else if( !strcmp( psz_cmd, "marq-timeout" ) )
var_Set( p_inp, "marq-timeout", val );
}
}
-
+ else if( !strcmp( psz_cmd, "mosaic-alpha" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-alpha", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-height" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-height", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-width" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-width", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-xoffset" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-xoffset", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-yoffset" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-yoffset", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-vborder" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-vborder", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-hborder" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-hborder", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-position" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-position", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-rows" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-rows", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-cols" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-cols", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "mosaic-keep-aspect-ratio" ) )
+ {
+ if( strlen( newval.psz_string) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "mosaic-keep-aspect-ratio", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-format" ) )
+ {
+ if( strlen( newval.psz_string ) > 0 )
+ {
+ val.psz_string = newval.psz_string;
+ var_Set( p_inp->p_libvlc, "time-format", val );
+ }
+ else
+ {
+ val.psz_string = "";
+ var_Set( p_inp->p_libvlc, "time-format", val);
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-x" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "time-x", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-y" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "time-y", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-position" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "time-position", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-color" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = strtol( newval.psz_string, NULL, 0 );
+ var_Set( p_inp->p_libvlc, "time-color", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-opacity" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = strtol( newval.psz_string, NULL, 0 );
+ var_Set( p_inp->p_libvlc, "time-opacity", val );
+ }
+ }
+ else if( !strcmp( psz_cmd, "time-size" ) )
+ {
+ if( strlen( newval.psz_string ) > 0)
+ {
+ val.i_int = atoi( newval.psz_string );
+ var_Set( p_inp->p_libvlc, "time-size", val );
+ }
+ }
+
/*
* sanity check
*/
else
{
- msg_rc( _("unknown command!\n") );
+ msg_rc( "unknown command!\n" );
}
vlc_object_release( p_pl );
audio_volume_t i_volume = atoi( newval.psz_string );
if ( i_volume > AOUT_VOLUME_MAX )
{
- msg_rc( _("Volume must be in the range %d-%d\n"), AOUT_VOLUME_MIN,
+ msg_rc( "Volume must be in the range %d-%d\n", AOUT_VOLUME_MIN,
AOUT_VOLUME_MAX );
i_error = VLC_EBADVAR;
}
}
else
{
- msg_rc( _("Volume is %d\n"), i_volume );
+ msg_rc( "Volume is %d\n", i_volume );
i_error = VLC_SUCCESS;
}
}
i_error = VLC_EGENERIC;
}
- if ( !i_error ) msg_rc( _("Volume is %d\n"), i_volume );
+ if ( !i_error ) msg_rc( "Volume is %d\n", i_volume );
return i_error;
}
}
var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST,
&val, &text );
- msg_rc( _("+----[ end of %s ]\n"), val_name.psz_string );
+ msg_rc( "+----[ end of %s ]\n", val_name.psz_string );
if( val_name.psz_string ) free( val_name.psz_string );
i_error = VLC_SUCCESS;
return VLC_FALSE;
}
+
+/*****************************************************************************
+ * parse_MRL: build a playlist item from a full mrl
+ *****************************************************************************
+ * MRL format: "simplified-mrl [:option-name[=option-value]]"
+ * We don't check for '"' or '\'', we just assume that a ':' that follows a
+ * space is a new option. Should be good enough for our purpose.
+ *****************************************************************************/
+static playlist_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
+{
+#define SKIPSPACE( p ) { while( *p && ( *p == ' ' || *p == '\t' ) ) p++; }
+#define SKIPTRAILINGSPACE( p, d ) \
+ { char *e=d; while( e > p && (*(e-1)==' ' || *(e-1)=='\t') ){e--;*e=0;} }
+
+ playlist_item_t *p_item = NULL;
+ char *psz_item = NULL, *psz_item_mrl = NULL, *psz_orig;
+ char **ppsz_options = NULL;
+ int i, i_options = 0;
+
+ if( !psz_mrl ) return 0;
+
+ psz_mrl = psz_orig = strdup( psz_mrl );
+ while( *psz_mrl )
+ {
+ SKIPSPACE( psz_mrl );
+ psz_item = psz_mrl;
+
+ for( ; *psz_mrl; psz_mrl++ )
+ {
+ if( (*psz_mrl == ' ' || *psz_mrl == '\t') && psz_mrl[1] == ':' )
+ {
+ /* We have a complete item */
+ break;
+ }
+ if( (*psz_mrl == ' ' || *psz_mrl == '\t') &&
+ (psz_mrl[1] == '"' || psz_mrl[1] == '\'') && psz_mrl[2] == ':')
+ {
+ /* We have a complete item */
+ break;
+ }
+ }
+
+ if( *psz_mrl ) { *psz_mrl = 0; psz_mrl++; }
+ SKIPTRAILINGSPACE( psz_item, psz_item + strlen( psz_item ) );
+
+ /* Remove '"' and '\'' if necessary */
+ if( *psz_item == '"' && psz_item[strlen(psz_item)-1] == '"' )
+ { psz_item++; psz_item[strlen(psz_item)-1] = 0; }
+ if( *psz_item == '\'' && psz_item[strlen(psz_item)-1] == '\'' )
+ { psz_item++; psz_item[strlen(psz_item)-1] = 0; }
+
+ if( !psz_item_mrl ) psz_item_mrl = psz_item;
+ else if( *psz_item )
+ {
+ i_options++;
+ ppsz_options = realloc( ppsz_options, i_options * sizeof(char *) );
+ ppsz_options[i_options - 1] = &psz_item[1];
+ }
+
+ if( *psz_mrl ) SKIPSPACE( psz_mrl );
+ }
+
+ /* Now create a playlist item */
+ if( psz_item_mrl )
+ {
+ p_item = playlist_ItemNew( p_intf, psz_item_mrl, psz_item_mrl );
+ for( i = 0; i < i_options; i++ )
+ {
+ playlist_ItemAddOption( p_item, ppsz_options[i] );
+ }
+ }
+
+ if( i_options ) free( ppsz_options );
+ free( psz_orig );
+
+ return p_item;
+}