]> git.sesse.net Git - vlc/blobdiff - modules/access_output/dummy.c
* access_output: sout_buffer_t -> block_t.
[vlc] / modules / access_output / dummy.c
index 39f529ad75c2114016885eba287d3fa873cd9b11..3f9ee82fa716dc72c744fec94782cc2afdec9e4d 100644 (file)
@@ -2,7 +2,7 @@
  * dummy.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: dummy.c,v 1.3 2003/03/03 14:21:08 gbazin Exp $
+ * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Eric Petit <titer@videolan.org>
  * Preamble
  *****************************************************************************/
 #include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
 
 #include <vlc/vlc.h>
-#include <vlc/input.h>
 #include <vlc/sout.h>
 
-#ifdef HAVE_UNISTD_H
-#   include <unistd.h>
-#endif
-
-/*****************************************************************************
- * Exported prototypes
- *****************************************************************************/
-static int     Open   ( vlc_object_t * );
-static void    Close  ( vlc_object_t * );
-
-static int     Write( sout_access_out_t *, sout_buffer_t * );
-static int     Seek ( sout_access_out_t *, off_t  );
-
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+static int  Open ( vlc_object_t * );
+static void Close( vlc_object_t * );
+
 vlc_module_begin();
     set_description( _("Dummy stream ouput") );
     set_capability( "sout access", 0 );
@@ -60,6 +44,12 @@ vlc_module_begin();
 vlc_module_end();
 
 
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+static int     Write( sout_access_out_t *, block_t * );
+static int     Seek ( sout_access_out_t *, off_t  );
+
 /*****************************************************************************
  * Open: open the file
  *****************************************************************************/
@@ -71,7 +61,7 @@ static int Open( vlc_object_t *p_this )
     p_access->pf_write = Write;
     p_access->pf_seek  = Seek;
 
-    msg_Info( p_access, "dummy stream output access launched" );
+    msg_Dbg( p_access, "dummy stream output access opened" );
     return VLC_SUCCESS;
 }
 
@@ -81,28 +71,27 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t * p_this )
 {
     sout_access_out_t   *p_access = (sout_access_out_t*)p_this;
-    msg_Info( p_access, "Close" );
+    msg_Dbg( p_access, "dummy stream output access closed" );
 }
 
 /*****************************************************************************
  * Read: standard read on a file descriptor.
  *****************************************************************************/
-static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
+static int Write( sout_access_out_t *p_access, block_t *p_buffer )
 {
-    size_t i_write = 0;
+    int64_t i_write = 0;
+    block_t *b = p_buffer;
 
-    do
+    while( b )
     {
-        sout_buffer_t *p_next;
-        i_write += p_buffer->i_size;
-        p_next = p_buffer->p_next;
-        sout_BufferDelete( p_access->p_sout, p_buffer );
-        p_buffer = p_next;
-    } while( p_buffer );
+        i_write += b->i_buffer;
+
+        b = b->p_next;
+    }
 
-    msg_Dbg( p_access, "Dummy Skipped: len:"I64Fd, (int64_t)i_write );
+    block_ChainRelease( p_buffer );
 
-    return( i_write );
+    return i_write;
 }
 
 /*****************************************************************************
@@ -110,8 +99,7 @@ static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
  *****************************************************************************/
 static int Seek( sout_access_out_t *p_access, off_t i_pos )
 {
-    msg_Dbg( p_access, "Seek: pos:"I64Fd, (int64_t)i_pos );
-    return( 0 );
+    return 0;
 }