]> git.sesse.net Git - vlc/blobdiff - modules/misc/dummy/input.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / misc / dummy / input.c
index 1b3a8f53eb65030a43274bebaa2fe9ee32184418..d4a0d76247c72ed5a9eba3a439f1353ccde8725d 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * 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>
+#include <vlc_interface.h>
+#include <vlc_access.h>
+#include <vlc_demux.h>
+#include <vlc_playlist.h>
+
+#include "dummy.h"
 
 /*****************************************************************************
  * Access functions.
@@ -70,6 +72,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;
@@ -115,12 +118,14 @@ struct demux_sys_t
 
     /* Used for the pause command */
     mtime_t expiration;
+    /* The command to run */
+    char* psz_command;
 };
 enum
 {
     COMMAND_NOP  = 0,
     COMMAND_QUIT = 1,
-    COMMAND_LOOP = 2,
     COMMAND_PAUSE= 3,
 };
 
@@ -160,14 +165,6 @@ 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 */
     if( i_len > 6 && !strncasecmp( psz_name, "pause:", 6 ) )
     {
@@ -177,7 +174,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
         p_sys->expiration = mdate() + (mtime_t)i_arg * (mtime_t)1000000;
         return VLC_SUCCESS;
     }
-
     msg_Err( p_demux, "unknown command `%s'", psz_name );
 
     free( p_sys );
@@ -201,6 +198,7 @@ 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 );
 
@@ -213,29 +211,25 @@ static int Demux( demux_t *p_demux )
     switch( p_sys->i_command )
     {
         case COMMAND_QUIT:
-            p_demux->p_vlc->b_die = 1;
-            return 0;
-
-        case COMMAND_LOOP:
-            playlist_Goto( p_playlist, 0 );
+            b_eof = VLC_TRUE;
+            vlc_object_kill( p_demux->p_libvlc );
             break;
 
         case COMMAND_PAUSE:
             if( mdate() >= p_sys->expiration )
-            {
-                return 0;
-            }
-            msleep( 10000 );
+                b_eof = VLC_TRUE;
+            else
+                msleep( 10000 );
             break;
-
         case COMMAND_NOP:
         default:
-            return 0;
+            b_eof = VLC_TRUE;
+            break;
     }
 
     vlc_object_release( p_playlist );
-
-    return 1;
+    return b_eof ? 0 : 1;
 }
 
 static int DemuxControl( demux_t *p_demux, int i_query, va_list args )