]> git.sesse.net Git - vlc/blobdiff - modules/control/rc.c
White space and indentation fixes.
[vlc] / modules / control / rc.c
index 0c25f55d3270dd5e834d19dd704856c6c57281a1..c4409152cc0cbee036fd5deb7630723d8381df4a 100644 (file)
@@ -183,15 +183,16 @@ vlc_module_begin();
     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 );
@@ -206,7 +207,8 @@ static int Activate( vlc_object_t *p_this )
     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 ) )
     {
@@ -220,7 +222,7 @@ static int Activate( vlc_object_t *p_this )
     {
         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;
@@ -278,8 +280,9 @@ static int Activate( vlc_object_t *p_this )
         }
         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 )
@@ -454,7 +457,7 @@ static void Run( intf_thread_t *p_intf )
     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
 
@@ -601,56 +604,27 @@ static void Run( intf_thread_t *p_intf )
             char *psz_alias = psz_cmd + 1;
             char *psz_mycmd = strdup( psz_arg );
             char *psz_myarg = strchr( psz_mycmd, ' ' );
-            int i_ret = VLC_EGENERIC;
-
-            *psz_myarg = '\0';
-            psz_myarg ++;
-            vlc_object_t *p_obj =
-                vlc_object_find_name( p_input->p_libvlc, psz_alias,
-                                      FIND_CHILD );
+            char *psz_msg;
 
-            if( !p_obj )
-                msg_rc( "Unknown destination object!" );
+            if( !psz_myarg )
+            {
+                msg_rc( "Not enough parameters." );
+            }
             else
             {
-                int i_type;
-                if( (i_type = var_Type( p_obj, psz_mycmd )) & VLC_VAR_ISCOMMAND )
-                {
-                    i_type &= 0xf0;
-                    if( i_type == VLC_VAR_INTEGER )
-                    {
-                        i_ret = var_SetInteger( p_obj, psz_mycmd,
-                                                atoi( psz_myarg ) );
-                    }
-                    else if( i_type == VLC_VAR_FLOAT )
-                    {
-                        i_ret = var_SetFloat( p_obj, psz_mycmd,
-                                              atof( psz_myarg ) );
-                    }
-                    else if( i_type == VLC_VAR_STRING )
-                    {
-                        i_ret = var_SetString( p_obj, psz_mycmd,
-                                               psz_myarg );
-                    }
-                    else if( i_type == VLC_VAR_BOOL )
-                    {
-                        i_ret = var_SetBool( p_obj, psz_mycmd,
-                                             atoi( psz_myarg ) );
-                    }
-                    else
-                    {
-                        msg_rc( "Unhandled command type. Fix the code!" );
-                    }
-                }
-                else
+                *psz_myarg = '\0';
+                psz_myarg ++;
+
+                var_Command( p_intf, psz_alias, psz_mycmd, psz_myarg,
+                             &psz_msg );
+
+                if( psz_msg )
                 {
-                    msg_rc( "Unknown command! %d", i_type );
+                    msg_rc( psz_msg );
+                    free( psz_msg );
                 }
-                vlc_object_release( p_obj );
             }
             free( psz_mycmd );
-            msg_rc( "%s on object %s: returned %i (%s)",
-                    psz_mycmd, psz_alias, i_ret, vlc_error( i_ret ) );
         }
         /* If the user typed a registered local command, try it */
         else if( var_Type( p_intf, psz_cmd ) & VLC_VAR_ISCOMMAND )
@@ -915,35 +889,35 @@ static void Help( intf_thread_t *p_intf, vlc_bool_t b_longhelp)
 
     if (b_longhelp)
     {
-        msg_rc(_("| marq-marquee name  STRING  . . overlay STRING in video"));
-        msg_rc(_("| marq-x name X . . . . . . . . . . . .offset from left"));
-        msg_rc(_("| marq-y name Y . . . . . . . . . . . . offset from top"));
-        msg_rc(_("| marq-position name #. . .  .relative position control"));
-        msg_rc(_("| marq-color name # . . . . . . . . . . font color, RGB"));
-        msg_rc(_("| marq-opacity name # . . . . . . . . . . . . . opacity"));
-        msg_rc(_("| marq-timeout name T. . . . . . . . . . timeout, in ms"));
-        msg_rc(_("| marq-size name # . . . . . . . . font size, in pixels"));
+        msg_rc(_("| @name marq-marquee  STRING  . . overlay STRING in video"));
+        msg_rc(_("| @name marq-x X . . . . . . . . . . . .offset from left"));
+        msg_rc(_("| @name marq-y Y . . . . . . . . . . . . offset from top"));
+        msg_rc(_("| @name marq-position #. . .  .relative position control"));
+        msg_rc(_("| @name marq-color # . . . . . . . . . . font color, RGB"));
+        msg_rc(_("| @name marq-opacity # . . . . . . . . . . . . . opacity"));
+        msg_rc(_("| @name marq-timeout T. . . . . . . . . . timeout, in ms"));
+        msg_rc(_("| @name marq-size # . . . . . . . . font size, in pixels"));
         msg_rc(  "| ");
-        msg_rc(_("| logo-file name STRING . . .the overlay file path/name"));
-        msg_rc(_("| logo-x name X . . . . . . . . . . . .offset from left"));
-        msg_rc(_("| logo-y name Y . . . . . . . . . . . . offset from top"));
-        msg_rc(_("| logo-position name #. . . . . . . . relative position"));
-        msg_rc(_("| logo-transparency name #. . . . . . . . .transparency"));
+        msg_rc(_("| @name logo-file STRING . . .the overlay file path/name"));
+        msg_rc(_("| @name logo-x X . . . . . . . . . . . .offset from left"));
+        msg_rc(_("| @name logo-y Y . . . . . . . . . . . . offset from top"));
+        msg_rc(_("| @name logo-position #. . . . . . . . relative position"));
+        msg_rc(_("| @name logo-transparency #. . . . . . . . .transparency"));
         msg_rc(  "| ");
-        msg_rc(_("| mosaic-alpha name # . . . . . . . . . . . . . . alpha"));
-        msg_rc(_("| mosaic-height name #. . . . . . . . . . . . . .height"));
-        msg_rc(_("| mosaic-width name # . . . . . . . . . . . . . . width"));
-        msg_rc(_("| mosaic-xoffset name # . . . .top left corner position"));
-        msg_rc(_("| mosaic-yoffset name # . . . .top left corner position"));
-        msg_rc(_("| mosaic-offsets name x,y(,x,y)*. . . . list of offsets"));
-        msg_rc(_("| mosaic-align name 0..2,4..6,8..10. . .mosaic alignment"));
-        msg_rc(_("| mosaic-vborder name # . . . . . . . . vertical border"));
-        msg_rc(_("| mosaic-hborder name # . . . . . . . horizontal border"));
-        msg_rc(_("| mosaic-position name {0=auto,1=fixed} . . . .position"));
-        msg_rc(_("| mosaic-rows name #. . . . . . . . . . .number of rows"));
-        msg_rc(_("| mosaic-cols name #. . . . . . . . . . .number of cols"));
-        msg_rc(_("| mosaic-order name id(,id)* . . . . order of pictures "));
-        msg_rc(_("| mosaic-keep-aspect-ratio name {0,1} . . .aspect ratio"));
+        msg_rc(_("| @name mosaic-alpha # . . . . . . . . . . . . . . alpha"));
+        msg_rc(_("| @name mosaic-height #. . . . . . . . . . . . . .height"));
+        msg_rc(_("| @name mosaic-width # . . . . . . . . . . . . . . width"));
+        msg_rc(_("| @name mosaic-xoffset # . . . .top left corner position"));
+        msg_rc(_("| @name mosaic-yoffset # . . . .top left corner position"));
+        msg_rc(_("| @name mosaic-offsets x,y(,x,y)*. . . . list of offsets"));
+        msg_rc(_("| @name mosaic-align 0..2,4..6,8..10. . .mosaic alignment"));
+        msg_rc(_("| @name mosaic-vborder # . . . . . . . . vertical border"));
+        msg_rc(_("| @name mosaic-hborder # . . . . . . . horizontal border"));
+        msg_rc(_("| @name mosaic-position {0=auto,1=fixed} . . . .position"));
+        msg_rc(_("| @name mosaic-rows #. . . . . . . . . . .number of rows"));
+        msg_rc(_("| @name mosaic-cols #. . . . . . . . . . .number of cols"));
+        msg_rc(_("| @name mosaic-order id(,id)* . . . . order of pictures "));
+        msg_rc(_("| @name mosaic-keep-aspect-ratio {0,1} . . .aspect ratio"));
         msg_rc(  "| ");
         msg_rc(_("| check-updates [newer] [equal] [older]\n"
                  "|               [undef] [info] [source] [binary] [plugin]"));
@@ -1473,7 +1447,7 @@ static int Quit( vlc_object_t *p_this, char const *psz_cmd,
         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;
 }
 
@@ -1988,7 +1962,7 @@ vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size )
         }
         else
             /* Standard input closed: exit */
-            p_intf->b_die = VLC_TRUE;
+            vlc_object_kill( p_intf );
 
         p_buffer[ *pi_size ] = 0;
         return VLC_TRUE;