demux: ttml: fix use after free (CID #1374347)
[vlc.git] / modules / access_output / dummy.c
blob8b2e6bc4c1673ae249d369445e04618c68e257e2
1 /*****************************************************************************
2 * dummy.c
3 *****************************************************************************
4 * Copyright (C) 2001, 2002, 2004 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
25 * Preamble
26 *****************************************************************************/
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
32 #include <vlc_common.h>
33 #include <vlc_plugin.h>
34 #include <vlc_sout.h>
35 #include <vlc_block.h>
37 /*****************************************************************************
38 * Module descriptor
39 *****************************************************************************/
40 static int Open ( vlc_object_t * );
41 static void Close( vlc_object_t * );
43 vlc_module_begin ()
44 set_description( N_("Dummy stream output") )
45 set_shortname( N_( "Dummy" ))
46 set_capability( "sout access", 0 )
47 set_category( CAT_SOUT )
48 set_subcategory( SUBCAT_SOUT_ACO )
49 add_shortcut( "dummy" )
50 set_callbacks( Open, Close )
51 vlc_module_end ()
54 /*****************************************************************************
55 * Exported prototypes
56 *****************************************************************************/
57 static ssize_t Write( sout_access_out_t *, block_t * );
58 static int Seek ( sout_access_out_t *, off_t );
60 /*****************************************************************************
61 * Open: open the file
62 *****************************************************************************/
63 static int Open( vlc_object_t *p_this )
65 sout_access_out_t *p_access = (sout_access_out_t*)p_this;
67 p_access->p_sys = NULL;
68 p_access->pf_write = Write;
69 p_access->pf_seek = Seek;
71 msg_Dbg( p_access, "dummy stream output access opened" );
72 return VLC_SUCCESS;
75 /*****************************************************************************
76 * Close: close the target
77 *****************************************************************************/
78 static void Close( vlc_object_t * p_this )
80 sout_access_out_t *p_access = (sout_access_out_t*)p_this;
81 msg_Dbg( p_access, "dummy stream output access closed" );
84 /*****************************************************************************
85 * Read: standard read on a file descriptor.
86 *****************************************************************************/
87 static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
89 size_t i_write = 0;
90 block_t *b = p_buffer;
92 while( b )
94 i_write += b->i_buffer;
96 b = b->p_next;
99 block_ChainRelease( p_buffer );
101 (void)p_access;
102 return i_write;
105 /*****************************************************************************
106 * Seek: seek to a specific location in a file
107 *****************************************************************************/
108 static int Seek( sout_access_out_t *p_access, off_t i_pos )
110 (void)p_access; (void)i_pos;
111 return 0;