]> git.sesse.net Git - vlc/blobdiff - modules/misc/dummy/input.c
macosx: Fix a memleak.
[vlc] / modules / misc / dummy / input.c
index f05eebf54db47362f4699dcfc71fe26c7eb67e19..03de41627d53299ab3be191771e586d6b5525ec3 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * 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 the VideoLAN team
  * $Id$
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_interface.h>
 #include <vlc_access.h>
 #include <vlc_demux.h>
-#include <vlc_playlist.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 );
@@ -89,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;
 
@@ -107,6 +106,7 @@ int E_(OpenAccess)( vlc_object_t *p_this )
     p_access->p_sys = NULL;
 
     /* Force dummy demux plug-in */
+    free( p_access->psz_demux );
     p_access->psz_demux = strdup( "vlc" );
 
     return VLC_SUCCESS;
@@ -141,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;
@@ -154,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'" );
@@ -162,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'" );
@@ -170,7 +170,7 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
         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 );
@@ -189,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;
 
@@ -202,17 +202,8 @@ 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;
     bool b_eof = 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;
-    }
-
     switch( p_sys->i_command )
     {
         case COMMAND_QUIT:
@@ -233,7 +224,6 @@ static int Demux( demux_t *p_demux )
             break;
     }
 
-    vlc_object_release( p_playlist );
     return b_eof ? 0 : 1;
 }