]> git.sesse.net Git - vlc/blobdiff - modules/control/rc.c
dynamic, per-subpicture, font size control -- i_font_size added to subpicture_region_...
[vlc] / modules / control / rc.c
index 9e6d609f2b7815ba9c446fb9c101d4b046b525ed..6d5fe5d76e454bb2d9053caf3a27daed2d038417 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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>
@@ -174,6 +174,7 @@ vlc_module_end();
 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;
 
@@ -277,6 +278,17 @@ static int Activate( vlc_object_t *p_this )
     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;
 }
@@ -343,16 +355,68 @@ static void Run( intf_thread_t *p_intf )
     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 );
@@ -370,6 +434,11 @@ static void Run( intf_thread_t *p_intf )
     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 );
@@ -607,43 +676,59 @@ static void Run( intf_thread_t *p_intf )
         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;
 
@@ -708,7 +793,22 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
         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" ) )
@@ -797,6 +897,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
 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;
 
@@ -820,6 +921,14 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
     {
         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 );
@@ -841,9 +950,11 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         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 )
         {
@@ -915,6 +1026,38 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
             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" ) )
     {
         if( strlen( newval.psz_string ) > 0) 
@@ -923,7 +1066,156 @@ static int Other( vlc_object_t *p_this, char const *psz_cmd,
             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
      */