]> git.sesse.net Git - vlc/blobdiff - modules/misc/dummy/input.c
Remove /* inside comment
[vlc] / modules / misc / dummy / input.c
index fe13e7e0ae6e2d21eef8098cfa2f73fb3aaf1b49..86169fce482c4e4ffccb68b0e679ce1439f90bbc 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * input_dummy.c: dummy input plugin, to manage "vlc:***" special options
+ * input_dummy.c: dummy input plugin, to manage "vlc://" special options
  *****************************************************************************
- * Copyright (C) 2001, 2002 VideoLAN
+ * Copyright (C) 2001, 2002 the VideoLAN team
  * $Id$
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
-#include <string.h>
 
-#include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include <vlc/input.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_interface.h>
+#include <vlc_access.h>
+#include <vlc_demux.h>
+
+#include "dummy.h"
 
 /*****************************************************************************
  * Access functions.
  *****************************************************************************/
-static int AccessRead( access_t *p_access, uint8_t *p, int i_size )
+static ssize_t AccessRead( access_t *p_access, uint8_t *p, size_t i_size )
 {
+    VLC_UNUSED(p_access);
     memset( p, 0, i_size );
     return i_size;
 }
 static int AccessControl( access_t *p_access, int i_query, va_list args )
 {
-    vlc_bool_t   *pb_bool;
+    bool   *pb_bool;
     int          *pi_int;
     int64_t      *pi_64;
 
@@ -52,8 +58,8 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
         case ACCESS_CAN_FASTSEEK:
         case ACCESS_CAN_PAUSE:
         case ACCESS_CAN_CONTROL_PACE:
-            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
-            *pb_bool = VLC_FALSE;
+            pb_bool = (bool*)va_arg( args, bool* );
+            *pb_bool = false;
             break;
 
         /* */
@@ -70,6 +76,7 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
         /* */
         case ACCESS_SET_PAUSE_STATE:
         case ACCESS_GET_TITLE_INFO:
+        case ACCESS_GET_META:
         case ACCESS_SET_TITLE:
         case ACCESS_SET_SEEKPOINT:
             return VLC_EGENERIC;
@@ -81,7 +88,7 @@ static int AccessControl( access_t *p_access, int i_query, va_list args )
     return VLC_SUCCESS;
 }
 
-int E_(OpenAccess)( vlc_object_t *p_this )
+int OpenAccess( vlc_object_t *p_this )
 {
     access_t *p_access = (access_t*)p_this;
 
@@ -93,12 +100,13 @@ int E_(OpenAccess)( vlc_object_t *p_this )
     p_access->info.i_update = 0;
     p_access->info.i_size = 0;
     p_access->info.i_pos = 0;
-    p_access->info.b_eof = VLC_FALSE;
+    p_access->info.b_eof = false;
     p_access->info.i_title = 0;
     p_access->info.i_seekpoint = 0;
     p_access->p_sys = NULL;
 
     /* Force dummy demux plug-in */
+    free( p_access->psz_demux );
     p_access->psz_demux = strdup( "vlc" );
 
     return VLC_SUCCESS;
@@ -115,7 +123,7 @@ struct demux_sys_t
 
     /* Used for the pause command */
     mtime_t expiration;
-    
     /* The command to run */
     char* psz_command;
 };
@@ -123,9 +131,7 @@ enum
 {
     COMMAND_NOP  = 0,
     COMMAND_QUIT = 1,
-    COMMAND_LOOP = 2,
     COMMAND_PAUSE= 3,
-    COMMAND_RUN  = 4,
 };
 
 static int Demux( demux_t * );
@@ -135,7 +141,7 @@ static int DemuxControl( demux_t *, int, va_list );
 /*****************************************************************************
  * OpenDemux: initialize the target, ie. parse the command
  *****************************************************************************/
-int E_(OpenDemux) ( vlc_object_t *p_this )
+int OpenDemux ( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t*)p_this;
     char * psz_name = p_demux->psz_path;
@@ -148,7 +154,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
     p_demux->pf_control = DemuxControl;
     p_demux->p_sys      = p_sys = malloc( sizeof( demux_sys_t ) );
 
-    /* Check for a "vlc:nop" command */
+    /* Check for a "vlc://nop" command */
     if( i_len == 3 && !strncasecmp( psz_name, "nop", 3 ) )
     {
         msg_Info( p_demux, "command `nop'" );
@@ -156,7 +162,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
         return VLC_SUCCESS;
     }
 
-    /* Check for a "vlc:quit" command */
+    /* Check for a "vlc://quit" command */
     if( i_len == 4 && !strncasecmp( psz_name, "quit", 4 ) )
     {
         msg_Info( p_demux, "command `quit'" );
@@ -164,15 +170,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
         return VLC_SUCCESS;
     }
 
-    /* Check for a "vlc:loop" command */
-    if( i_len == 4 && !strncasecmp( psz_name, "loop", 4 ) )
-    {
-        msg_Info( p_demux, "command `loop'" );
-        p_sys->i_command = COMMAND_LOOP;
-        return VLC_SUCCESS;
-    }
-
-    /* Check for a "vlc:pause:***" command */
+    /* Check for a "vlc://pause:***" command */
     if( i_len > 6 && !strncasecmp( psz_name, "pause:", 6 ) )
     {
         i_arg = atoi( psz_name + 6 );
@@ -181,17 +179,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
         p_sys->expiration = mdate() + (mtime_t)i_arg * (mtime_t)1000000;
         return VLC_SUCCESS;
     }
-    
-    /* Check for a "vlc:run:***" command */
-    if ( i_len > 4 && !strncasecmp( psz_name, "run:", 4 ) )
-    {
-       p_sys->psz_command = malloc( i_len - 4 );
-       strcpy( p_sys->psz_command, psz_name + 4 );
-       msg_Info( p_demux, "command `run program %s'", p_sys->psz_command );
-       p_sys->i_command = COMMAND_RUN;
-       return VLC_SUCCESS;
-    } 
-
     msg_Err( p_demux, "unknown command `%s'", psz_name );
 
     free( p_sys );
@@ -201,7 +189,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
 /*****************************************************************************
  * CloseDemux: initialize the target, ie. parse the command
  *****************************************************************************/
-void E_(CloseDemux) ( vlc_object_t *p_this )
+void CloseDemux ( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t*)p_this;
 
@@ -214,53 +202,34 @@ void E_(CloseDemux) ( vlc_object_t *p_this )
 static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
-    playlist_t *p_playlist;
-    vlc_bool_t b_eof = VLC_FALSE;
-
-    p_playlist = vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST, FIND_PARENT );
-
-    if( p_playlist == NULL )
-    {
-        msg_Err( p_demux, "we are not attached to a playlist" );
-        return -1;
-    }
+    bool b_eof = false;
 
     switch( p_sys->i_command )
     {
         case COMMAND_QUIT:
-            b_eof = p_demux->p_vlc->b_die = VLC_TRUE;
-            break;
-
-        case COMMAND_LOOP:
-            playlist_Goto( p_playlist, 0 );
+            b_eof = true;
+            vlc_object_kill( p_demux->p_libvlc );
             break;
 
         case COMMAND_PAUSE:
             if( mdate() >= p_sys->expiration )
-                b_eof = VLC_TRUE;
+                b_eof = true;
             else
                 msleep( 10000 );
             break;
-        
-        case COMMAND_RUN:
-            var_SetString( p_playlist, "run-program-command", p_sys->psz_command );
-            free( p_sys->psz_command );
-            b_eof = VLC_TRUE;
-            break;
-
         case COMMAND_NOP:
         default:
-            b_eof = VLC_TRUE;
-            break;       
+            b_eof = true;
+            break;
     }
 
-    vlc_object_release( p_playlist );
     return b_eof ? 0 : 1;
 }
 
 static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
 {
-    return demux2_vaControlHelper( p_demux->s,
+    return demux_vaControlHelper( p_demux->s,
                                    0, 0, 0, 1,
                                    i_query, args );
 }