1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2001, 2002 VideoLAN
5 * $Id: dummy.c,v 1.3 2003/03/03 14:21:08 gbazin Exp $
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Eric Petit <titer@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
29 #include <sys/types.h>
36 #include <vlc/input.h>
43 /*****************************************************************************
45 *****************************************************************************/
46 static int Open ( vlc_object_t * );
47 static void Close ( vlc_object_t * );
49 static int Write( sout_access_out_t *, sout_buffer_t * );
50 static int Seek ( sout_access_out_t *, off_t );
52 /*****************************************************************************
54 *****************************************************************************/
56 set_description( _("Dummy stream ouput") );
57 set_capability( "sout access", 0 );
58 add_shortcut( "dummy" );
59 set_callbacks( Open, Close );
63 /*****************************************************************************
65 *****************************************************************************/
66 static int Open( vlc_object_t *p_this )
68 sout_access_out_t *p_access = (sout_access_out_t*)p_this;
70 p_access->p_sys = NULL;
71 p_access->pf_write = Write;
72 p_access->pf_seek = Seek;
74 msg_Info( p_access, "dummy stream output access launched" );
78 /*****************************************************************************
79 * Close: close the target
80 *****************************************************************************/
81 static void Close( vlc_object_t * p_this )
83 sout_access_out_t *p_access = (sout_access_out_t*)p_this;
84 msg_Info( p_access, "Close" );
87 /*****************************************************************************
88 * Read: standard read on a file descriptor.
89 *****************************************************************************/
90 static int Write( sout_access_out_t *p_access, sout_buffer_t *p_buffer )
96 sout_buffer_t *p_next;
97 i_write += p_buffer->i_size;
98 p_next = p_buffer->p_next;
99 sout_BufferDelete( p_access->p_sout, p_buffer );
103 msg_Dbg( p_access, "Dummy Skipped: len:"I64Fd, (int64_t)i_write );
108 /*****************************************************************************
109 * Seek: seek to a specific location in a file
110 *****************************************************************************/
111 static int Seek( sout_access_out_t *p_access, off_t i_pos )
113 msg_Dbg( p_access, "Seek: pos:"I64Fd, (int64_t)i_pos );