]> git.sesse.net Git - vlc/blobdiff - modules/control/rc.c
Fix OSD when auto-scaling
[vlc] / modules / control / rc.c
index 2c6d574137c31ad9b3bf3c3f7b13771a025b738f..92d8ae49c3beeb3aff3d5fe7c693ae22800c18b5 100644 (file)
@@ -38,7 +38,7 @@
 #include <assert.h>
 
 #include <vlc_interface.h>
-#include <vlc_aout.h>
+#include <vlc_aout_intf.h>
 #include <vlc_vout.h>
 #include <vlc_osd.h>
 #include <vlc_playlist.h>
@@ -87,7 +87,7 @@ static void RegisterCallbacks( intf_thread_t * );
 
 static bool ReadCommand( intf_thread_t *, char *, int * );
 
-static input_item_t *parse_MRL( intf_thread_t *, char * );
+static input_item_t *parse_MRL( const char * );
 
 static int  Input        ( vlc_object_t *, char const *,
                            vlc_value_t, vlc_value_t, void * );
@@ -126,7 +126,7 @@ struct intf_sys_t
 
     /* status changes */
     vlc_mutex_t       status_lock;
-    playlist_status_t i_last_state;
+    int               i_last_state;
     playlist_t        *p_playlist;
     bool              b_input_buffering;
 
@@ -136,10 +136,8 @@ struct intf_sys_t
 #endif
 };
 
-#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, ... )
+VLC_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];
@@ -153,6 +151,7 @@ static void __msg_rc( intf_thread_t *p_intf, const char *psz_fmt, ... )
         net_vaPrintf( p_intf, p_intf->p_sys->i_socket, NULL, fmt_eol, args );
     va_end( args );
 }
+#define msg_rc( ... ) msg_rc( p_intf, __VA_ARGS__ )
 
 /*****************************************************************************
  * Module descriptor
@@ -186,21 +185,24 @@ vlc_module_begin ()
     set_category( CAT_INTERFACE )
     set_subcategory( SUBCAT_INTERFACE_MAIN )
     set_description( N_("Remote control interface") )
-    add_bool( "rc-show-pos", false, NULL, POS_TEXT, POS_LONGTEXT, true )
+    add_bool( "rc-show-pos", false, POS_TEXT, POS_LONGTEXT, true )
 
 #ifdef WIN32
-    add_bool( "rc-quiet", false, NULL, QUIET_TEXT, QUIET_LONGTEXT, false )
+    add_bool( "rc-quiet", false, QUIET_TEXT, QUIET_LONGTEXT, false )
 #else
 #if defined (HAVE_ISATTY)
-    add_bool( "rc-fake-tty", false, NULL, TTY_TEXT, TTY_LONGTEXT, true )
+    add_bool( "rc-fake-tty", false, TTY_TEXT, TTY_LONGTEXT, true )
 #endif
-    add_string( "rc-unix", NULL, NULL, UNIX_TEXT, UNIX_LONGTEXT, true )
+    add_string( "rc-unix", NULL, UNIX_TEXT, UNIX_LONGTEXT, true )
 #endif
-    add_string( "rc-host", NULL, NULL, HOST_TEXT, HOST_LONGTEXT, true )
+    add_string( "rc-host", NULL, HOST_TEXT, HOST_LONGTEXT, true )
 
     set_capability( "interface", 20 )
 
     set_callbacks( Activate, Deactivate )
+#ifdef WIN32
+    add_shortcut( "rc" )
+#endif
 vlc_module_end ()
 
 /*****************************************************************************
@@ -215,7 +217,7 @@ static int Activate( vlc_object_t *p_this )
 #ifndef WIN32
 #if defined(HAVE_ISATTY)
     /* Check that stdin is a TTY */
-    if( !var_InheritInteger( p_intf, "rc-fake-tty" ) && !isatty( 0 ) )
+    if( !var_InheritBool( p_intf, "rc-fake-tty" ) && !isatty( 0 ) )
     {
         msg_Warn( p_intf, "fd 0 is not a TTY" );
         return VLC_EGENERIC;
@@ -329,11 +331,12 @@ static int Activate( vlc_object_t *p_this )
     p_intf->pf_run = Run;
 
 #ifdef WIN32
-    p_intf->p_sys->b_quiet = var_InheritInteger( p_intf, "rc-quiet" );
-    if( !p_intf->p_sys->b_quiet ) { CONSOLE_INTRO_MSG; }
-#else
-    CONSOLE_INTRO_MSG;
+    p_intf->p_sys->b_quiet = var_InheritBool( p_intf, "rc-quiet" );
+    if( !p_intf->p_sys->b_quiet )
 #endif
+    {
+        CONSOLE_INTRO_MSG;
+    }
 
     msg_rc( "%s", _("Remote control interface initialized. Type `help' for help.") );
     return VLC_SUCCESS;
@@ -442,7 +445,7 @@ static void Run( intf_thread_t *p_intf )
     playlist_t *     p_playlist = pl_Get( p_intf );
 
     char p_buffer[ MAX_LINE_LENGTH + 1 ];
-    bool b_showpos = var_InheritInteger( p_intf, "rc-show-pos" );
+    bool b_showpos = var_InheritBool( p_intf, "rc-show-pos" );
     bool b_longhelp = false;
 
     int  i_size = 0;
@@ -458,7 +461,7 @@ static void Run( intf_thread_t *p_intf )
 
     /* status callbacks */
     /* Listen to audio volume updates */
-    var_AddCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf );
+    var_AddCallback( p_playlist, "volume", VolumeChanged, p_intf );
 
 #ifdef WIN32
     /* Get the file descriptor of the console input */
@@ -499,7 +502,7 @@ static void Run( intf_thread_t *p_intf )
                     msg_rc( STATUS_CHANGE "( new input: %s )", psz_uri );
                     free( psz_uri );
                     msg_rc( STATUS_CHANGE "( audio volume: %d )",
-                            config_GetInt( p_intf, "volume" ));
+                            (int)config_GetInt( p_intf, "volume" ));
                 }
                 var_AddCallback( p_input, "intf-event", InputEvent, p_intf );
             }
@@ -512,10 +515,8 @@ static void Run( intf_thread_t *p_intf )
 
             if( p_playlist )
             {
-                PL_LOCK;
-                p_intf->p_sys->i_last_state = (int) PLAYLIST_STOPPED;
+                p_intf->p_sys->i_last_state = PLAYLIST_STOPPED;
                 msg_rc( STATUS_CHANGE "( stop state: 0 )" );
-                PL_UNLOCK;
             }
         }
 
@@ -524,6 +525,8 @@ static void Run( intf_thread_t *p_intf )
         {
             PL_LOCK;
             int status = playlist_Status( p_playlist );
+            PL_UNLOCK;
+
             if( p_intf->p_sys->i_last_state != status )
             {
                 if( status == PLAYLIST_STOPPED )
@@ -542,7 +545,6 @@ static void Run( intf_thread_t *p_intf )
                     msg_rc( STATUS_CHANGE "( pause state: 4 )" );
                 }
             }
-            PL_UNLOCK;
         }
 
         if( p_input && b_showpos )
@@ -789,7 +791,7 @@ static void Run( intf_thread_t *p_intf )
         vlc_object_release( p_input );
     }
 
-    var_DelCallback( p_intf->p_libvlc, "volume-change", VolumeChanged, p_intf );
+    var_DelCallback( p_playlist, "volume", VolumeChanged, p_intf );
     vlc_restorecancel( canc );
 }
 
@@ -896,12 +898,12 @@ static void Help( intf_thread_t *p_intf, bool b_longhelp)
 static int VolumeChanged( vlc_object_t *p_this, char const *psz_cmd,
     vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
+    (void) p_this;
     VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(newval);
     intf_thread_t *p_intf = (intf_thread_t*)p_data;
 
     vlc_mutex_lock( &p_intf->p_sys->status_lock );
-    msg_rc( STATUS_CHANGE "( audio volume: %d )",
-            config_GetInt( p_this, "volume") );
+    msg_rc( STATUS_CHANGE "( audio volume: %"PRId64" )", newval.i_int );
     vlc_mutex_unlock( &p_intf->p_sys->status_lock );
     return VLC_SUCCESS;
 }
@@ -1067,17 +1069,17 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
     }
     else if ( !strcmp( psz_cmd, "faster" ) )
     {
-        var_TriggerCallback( p_input, "rate-faster" );
+        var_TriggerCallback( p_intf->p_sys->p_playlist, "rate-faster" );
         i_error = VLC_SUCCESS;
     }
     else if ( !strcmp( psz_cmd, "slower" ) )
     {
-        var_TriggerCallback( p_input, "rate-slower" );
+        var_TriggerCallback( p_intf->p_sys->p_playlist, "rate-slower" );
         i_error = VLC_SUCCESS;
     }
     else if ( !strcmp( psz_cmd, "normal" ) )
     {
-        var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT );
+        var_SetFloat( p_intf->p_sys->p_playlist, "rate", 1. );
         i_error = VLC_SUCCESS;
     }
     else if ( !strcmp( psz_cmd, "frame" ) )
@@ -1185,10 +1187,12 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
             for ( i = 0; i < val.p_list->i_count; i++ )
             {
                 if ( i_value == val.p_list->p_values[i].i_int )
-                    msg_rc( "| %i - %s *", val.p_list->p_values[i].i_int,
+                    msg_rc( "| %"PRId64" - %s *",
+                            val.p_list->p_values[i].i_int,
                             text.p_list->p_values[i].psz_string );
                 else
-                    msg_rc( "| %i - %s", val.p_list->p_values[i].i_int,
+                    msg_rc( "| %"PRId64" - %s",
+                            val.p_list->p_values[i].i_int,
                             text.p_list->p_values[i].psz_string );
             }
             var_FreeList( &val, &text );
@@ -1265,8 +1269,8 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
 
         if( strlen( newval.psz_string ) > 0 )
         {
-            if ( ( !strncmp( newval.psz_string, "on", 2 ) && ( val.b_bool == true ) ) ||
-                 ( !strncmp( newval.psz_string, "off", 3 ) && ( val.b_bool == false ) ) )
+            if ( ( !strncmp( newval.psz_string, "on", 2 )  &&  val.b_bool ) ||
+                 ( !strncmp( newval.psz_string, "off", 3 ) && !val.b_bool ) )
             {
                 b_update = false;
             }
@@ -1287,8 +1291,8 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
 
         if( strlen( newval.psz_string ) > 0 )
         {
-            if ( ( !strncmp( newval.psz_string, "on", 2 ) && ( val.b_bool == true ) ) ||
-                 ( !strncmp( newval.psz_string, "off", 3 ) && ( val.b_bool == false ) ) )
+            if ( ( !strncmp( newval.psz_string, "on", 2 )  &&  val.b_bool ) ||
+                 ( !strncmp( newval.psz_string, "off", 3 ) && !val.b_bool ) )
             {
                 b_update = false;
             }
@@ -1309,8 +1313,8 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
 
         if( strlen( newval.psz_string ) > 0 )
         {
-            if ( ( !strncmp( newval.psz_string, "on", 2 ) && ( val.b_bool == true ) ) ||
-                 ( !strncmp( newval.psz_string, "off", 3 ) && ( val.b_bool == false ) ) )
+            if ( ( !strncmp( newval.psz_string, "on", 2 )  &&  val.b_bool ) ||
+                 ( !strncmp( newval.psz_string, "off", 3 ) && !val.b_bool ) )
             {
                 b_update = false;
             }
@@ -1325,23 +1329,24 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     }
     else if (!strcmp( psz_cmd, "goto" ) )
     {
+        PL_LOCK;
         int i_pos = atoi( newval.psz_string );
-        /* The playlist stores 2 times the same item: onelevel & category */
-        int i_size = p_playlist->items.i_size / 2;
+        int i_size = p_playlist->items.i_size;
 
         if( i_pos <= 0 )
             msg_rc( "%s", _("Error: `goto' needs an argument greater than zero.") );
         else if( i_pos <= i_size )
         {
             playlist_item_t *p_item, *p_parent;
-            p_item = p_parent = p_playlist->items.p_elems[i_pos*2-1];
+            p_item = p_parent = p_playlist->items.p_elems[i_pos-1];
             while( p_parent->p_parent )
                 p_parent = p_parent->p_parent;
-            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Unlocked,
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked,
                     p_parent, p_item );
         }
         else
             msg_rc( _("Playlist has only %d elements"), i_size );
+        PL_UNLOCK;
     }
     else if( !strcmp( psz_cmd, "stop" ) )
     {
@@ -1355,7 +1360,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     else if( !strcmp( psz_cmd, "add" ) &&
              newval.psz_string && *newval.psz_string )
     {
-        input_item_t *p_item = parse_MRL( p_intf, newval.psz_string );
+        input_item_t *p_item = parse_MRL( newval.psz_string );
 
         if( p_item )
         {
@@ -1373,7 +1378,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     else if( !strcmp( psz_cmd, "enqueue" ) &&
              newval.psz_string && *newval.psz_string )
     {
-        input_item_t *p_item = parse_MRL( p_intf, newval.psz_string );
+        input_item_t *p_item = parse_MRL( newval.psz_string );
 
         if( p_item )
         {
@@ -1395,8 +1400,10 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
 
     else if( !strcmp( psz_cmd, "sort" ))
     {
+        PL_LOCK;
         playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_onelevel,
                                     SORT_ARTIST, ORDER_NORMAL );
+        PL_UNLOCK;
     }
     else if( !strcmp( psz_cmd, "status" ) )
     {
@@ -1409,10 +1416,12 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
             msg_rc( STATUS_CHANGE "( new input: %s )", psz_uri );
             free( psz_uri );
             msg_rc( STATUS_CHANGE "( audio volume: %d )",
-                    config_GetInt( p_intf, "volume" ));
+                    (int)config_GetInt( p_intf, "volume" ));
 
             PL_LOCK;
-            switch( playlist_Status(p_playlist) )
+            int status = playlist_Status(p_playlist);
+            PL_UNLOCK;
+            switch( status )
             {
                 case PLAYLIST_STOPPED:
                     msg_rc( STATUS_CHANGE "( stop state: 5 )" );
@@ -1427,7 +1436,6 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
                     msg_rc( STATUS_CHANGE "( unknown state: -1 )" );
                     break;
             }
-            PL_UNLOCK;
             vlc_object_release( p_input );
         }
     }
@@ -1488,31 +1496,19 @@ static int Volume( vlc_object_t *p_this, char const *psz_cmd,
     {
         /* Set. */
         audio_volume_t i_volume = atoi( newval.psz_string );
-        if ( (i_volume > (audio_volume_t)AOUT_VOLUME_MAX) )
-        {
-            msg_rc( "Volume must be in the range %d-%d.", AOUT_VOLUME_MIN,
-                    AOUT_VOLUME_MAX );
-            i_error = VLC_EBADVAR;
-        }
-        else
-        {
-            if( i_volume == AOUT_VOLUME_MIN )
-                aout_ToggleMute( p_playlist, NULL );
-            if( !aout_VolumeSet( p_playlist, i_volume ) )
-                i_error = VLC_SUCCESS;
-            osd_Volume( p_this );
-            msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume );
-        }
+        if( i_volume == 0 )
+            aout_ToggleMute( p_playlist, NULL );
+        if( !aout_VolumeSet( p_playlist, i_volume ) )
+            i_error = VLC_SUCCESS;
+        osd_Volume( p_this );
+        msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume );
     }
     else
     {
         /* Get. */
-        audio_volume_t i_volume;
-        if ( !aout_VolumeGet( p_playlist, &i_volume ) )
-        {
-            msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume );
-            i_error = VLC_SUCCESS;
-        }
+        audio_volume_t i_volume = aout_VolumeGet( p_playlist );
+        msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume );
+        i_error = VLC_SUCCESS;
     }
 
     return i_error;
@@ -1528,7 +1524,6 @@ static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd,
         playlist_CurrentInput( p_intf->p_sys->p_playlist );
     int i_nb_steps = atoi(newval.psz_string);
     int i_error = VLC_SUCCESS;
-    int i_volume_step = 0;
 
     if( !p_input )
         return VLC_ENOOBJ;
@@ -1541,22 +1536,10 @@ static int VolumeMove( vlc_object_t *p_this, char const *psz_cmd,
         return VLC_EGENERIC;
     }
 
-    i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
-    if ( i_nb_steps <= 0 || i_nb_steps > (AOUT_VOLUME_MAX/i_volume_step) )
-    {
-        i_nb_steps = 1;
-    }
-
-    if ( !strcmp(psz_cmd, "volup") )
-    {
-        if ( aout_VolumeUp( p_this, i_nb_steps, &i_volume ) < 0 )
-            i_error = VLC_EGENERIC;
-    }
-    else
-    {
-        if ( aout_VolumeDown( p_this, i_nb_steps, &i_volume ) < 0 )
-            i_error = VLC_EGENERIC;
-    }
+    if( !strcmp(psz_cmd, "voldown") )
+        i_nb_steps *= -1;
+    if( aout_VolumeUp( p_intf->p_sys->p_playlist, i_nb_steps, &i_volume ) < 0 )
+        i_error = VLC_EGENERIC;
     osd_Volume( p_this );
 
     if ( !i_error ) msg_rc( STATUS_CHANGE "( audio volume: %d )", i_volume );
@@ -1699,7 +1682,6 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     input_thread_t *p_input =
         playlist_CurrentInput( p_intf->p_sys->p_playlist );
-    aout_instance_t * p_aout;
     const char * psz_variable;
     vlc_value_t val_name;
     int i_error;
@@ -1714,7 +1696,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
         return VLC_EGENERIC;
     }
 
-    p_aout = input_GetAout( p_input );
+    vlc_object_t * p_aout = (vlc_object_t *)input_GetAout( p_input );
     vlc_object_release( p_input );
     if ( p_aout == NULL )
          return VLC_ENOOBJ;
@@ -1729,8 +1711,8 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
     }
 
     /* Get the descriptive name of the variable */
-    var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_GETTEXT,
-                 &val_name, NULL );
+    var_Change( 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 )
@@ -1739,17 +1721,17 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
         vlc_value_t val, text;
         int i, i_value;
 
-        if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 )
+        if ( var_Get( p_aout, psz_variable, &val ) < 0 )
         {
-            vlc_object_release( (vlc_object_t *)p_aout );
+            vlc_object_release( p_aout );
             return VLC_EGENERIC;
         }
         i_value = val.i_int;
 
-        if ( var_Change( (vlc_object_t *)p_aout, psz_variable,
+        if ( var_Change( p_aout, psz_variable,
                          VLC_VAR_GETLIST, &val, &text ) < 0 )
         {
-            vlc_object_release( (vlc_object_t *)p_aout );
+            vlc_object_release( p_aout );
             return VLC_EGENERIC;
         }
 
@@ -1757,10 +1739,10 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
         for ( i = 0; i < val.p_list->i_count; i++ )
         {
             if ( i_value == val.p_list->p_values[i].i_int )
-                msg_rc( "| %i - %s *", val.p_list->p_values[i].i_int,
+                msg_rc( "| %"PRId64" - %s *", val.p_list->p_values[i].i_int,
                         text.p_list->p_values[i].psz_string );
             else
-                msg_rc( "| %i - %s", val.p_list->p_values[i].i_int,
+                msg_rc( "| %"PRId64" - %s", val.p_list->p_values[i].i_int,
                         text.p_list->p_values[i].psz_string );
         }
         var_FreeList( &val, &text );
@@ -1774,9 +1756,9 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
         vlc_value_t val;
         val.i_int = atoi( newval.psz_string );
 
-        i_error = var_Set( (vlc_object_t *)p_aout, psz_variable, val );
+        i_error = var_Set( p_aout, psz_variable, val );
     }
-    vlc_object_release( (vlc_object_t *)p_aout );
+    vlc_object_release( p_aout );
 
     return i_error;
 }
@@ -1868,42 +1850,43 @@ static int updateStatistics( intf_thread_t *p_intf, input_item_t *p_item )
 
     /* Input */
     msg_rc("%s", _("+-[Incoming]"));
-    msg_rc(_("| input bytes read : %8.0f kB"),
-            (float)(p_item->p_stats->i_read_bytes)/1000 );
+    msg_rc(_("| input bytes read : %8.0f KiB"),
+            (float)(p_item->p_stats->i_read_bytes)/1024 );
     msg_rc(_("| input bitrate    :   %6.0f kb/s"),
             (float)(p_item->p_stats->f_input_bitrate)*8000 );
-    msg_rc(_("| demux bytes read : %8.0f kB"),
-            (float)(p_item->p_stats->i_demux_read_bytes)/1000 );
+    msg_rc(_("| demux bytes read : %8.0f KiB"),
+            (float)(p_item->p_stats->i_demux_read_bytes)/1024 );
     msg_rc(_("| demux bitrate    :   %6.0f kb/s"),
             (float)(p_item->p_stats->f_demux_bitrate)*8000 );
-    msg_rc(_("| demux corrupted  :    %5i"),
+    msg_rc(_("| demux corrupted  :    %5"PRIi64),
             p_item->p_stats->i_demux_corrupted );
-    msg_rc(_("| discontinuities  :    %5i"),
+    msg_rc(_("| discontinuities  :    %5"PRIi64),
             p_item->p_stats->i_demux_discontinuity );
     msg_rc("|");
     /* Video */
     msg_rc("%s", _("+-[Video Decoding]"));
-    msg_rc(_("| video decoded    :    %5i"),
+    msg_rc(_("| video decoded    :    %5"PRIi64),
             p_item->p_stats->i_decoded_video );
-    msg_rc(_("| frames displayed :    %5i"),
+    msg_rc(_("| frames displayed :    %5"PRIi64),
             p_item->p_stats->i_displayed_pictures );
-    msg_rc(_("| frames lost      :    %5i"),
+    msg_rc(_("| frames lost      :    %5"PRIi64),
             p_item->p_stats->i_lost_pictures );
     msg_rc("|");
     /* Audio*/
     msg_rc("%s", _("+-[Audio Decoding]"));
-    msg_rc(_("| audio decoded    :    %5i"),
+    msg_rc(_("| audio decoded    :    %5"PRIi64),
             p_item->p_stats->i_decoded_audio );
-    msg_rc(_("| buffers played   :    %5i"),
+    msg_rc(_("| buffers played   :    %5"PRIi64),
             p_item->p_stats->i_played_abuffers );
-    msg_rc(_("| buffers lost     :    %5i"),
+    msg_rc(_("| buffers lost     :    %5"PRIi64),
             p_item->p_stats->i_lost_abuffers );
     msg_rc("|");
     /* Sout */
     msg_rc("%s", _("+-[Streaming]"));
-    msg_rc(_("| packets sent     :    %5i"), p_item->p_stats->i_sent_packets );
-    msg_rc(_("| bytes sent       : %8.0f kB"),
-            (float)(p_item->p_stats->i_sent_bytes)/1000 );
+    msg_rc(_("| packets sent     :    %5"PRIi64),
+           p_item->p_stats->i_sent_packets );
+    msg_rc(_("| bytes sent       : %8.0f KiB"),
+            (float)(p_item->p_stats->i_sent_bytes)/1024 );
     msg_rc(_("| sending bitrate  :   %6.0f kb/s"),
             (float)(p_item->p_stats->f_send_bitrate*8)*1000 );
     msg_rc("|");
@@ -1915,7 +1898,7 @@ static int updateStatistics( intf_thread_t *p_intf, input_item_t *p_item )
 }
 
 #ifdef WIN32
-bool ReadWin32( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
+static bool ReadWin32( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
 {
     INPUT_RECORD input_record;
     DWORD i_dw;
@@ -2041,20 +2024,22 @@ bool ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
  * 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 input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
+static input_item_t *parse_MRL( const char *mrl )
 {
 #define SKIPSPACE( p ) { while( *p == ' ' || *p == '\t' ) p++; }
 #define SKIPTRAILINGSPACE( p, d ) \
     { char *e=d; while( e > p && (*(e-1)==' ' || *(e-1)=='\t') ){e--;*e=0;} }
 
     input_item_t *p_item = NULL;
-    char *psz_item = NULL, *psz_item_mrl = NULL, *psz_orig;
+    char *psz_item = NULL, *psz_item_mrl = NULL, *psz_orig, *psz_mrl;
     char **ppsz_options = NULL;
     int i, i_options = 0;
 
-    if( !psz_mrl ) return 0;
+    if( !mrl ) return 0;
 
-    psz_mrl = psz_orig = strdup( psz_mrl );
+    psz_mrl = psz_orig = strdup( mrl );
+    if( !psz_mrl )
+        return NULL;
     while( *psz_mrl )
     {
         SKIPSPACE( psz_mrl );
@@ -2084,7 +2069,15 @@ static input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
         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;
+        if( !psz_item_mrl )
+        {
+            psz_item_mrl = make_URI( psz_item, NULL );
+            if( !psz_item_mrl )
+            {
+                free( psz_orig );
+                return NULL;
+            }
+        }
         else if( *psz_item )
         {
             i_options++;
@@ -2098,11 +2091,12 @@ static input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
     /* Now create a playlist item */
     if( psz_item_mrl )
     {
-        p_item = input_item_New( p_intf, psz_item_mrl, NULL );
+        p_item = input_item_New( psz_item_mrl, NULL );
         for( i = 0; i < i_options; i++ )
         {
             input_item_AddOption( p_item, ppsz_options[i], VLC_INPUT_OPTION_TRUSTED );
         }
+        free( psz_item_mrl );
     }
 
     if( i_options ) free( ppsz_options );