]> git.sesse.net Git - vlc/blob - modules/stream_out/dummy.c
* all: new sout scheme. Now a chain of module are created that can
[vlc] / modules / stream_out / dummy.c
1 /*****************************************************************************
2  * dummy.c
3  *****************************************************************************
4  * Copyright (C) 2001, 2002 VideoLAN
5  * $Id: dummy.c,v 1.1 2003/04/13 20:00:21 fenrir Exp $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
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 General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>
28 #include <string.h>
29
30 #include <vlc/vlc.h>
31 #include <vlc/sout.h>
32
33 /*****************************************************************************
34  * Exported prototypes
35  *****************************************************************************/
36 static int      Open    ( vlc_object_t * );
37 static void     Close   ( vlc_object_t * );
38
39 static sout_stream_id_t *Add ( sout_stream_t *, sout_format_t * );
40 static int               Del ( sout_stream_t *, sout_stream_id_t * );
41 static int               Send( sout_stream_t *, sout_stream_id_t *, sout_buffer_t* );
42
43 /*****************************************************************************
44  * Module descriptor
45  *****************************************************************************/
46 vlc_module_begin();
47     set_description( _("Dummy stream") );
48     set_capability( "sout stream", 50 );
49     add_shortcut( "dummy" );
50     set_callbacks( Open, Close );
51 vlc_module_end();
52
53 /*****************************************************************************
54  * Open:
55  *****************************************************************************/
56 static int Open( vlc_object_t *p_this )
57 {
58     sout_stream_t   *p_stream = (sout_stream_t*)p_this;
59
60     p_stream->pf_add    = Add;
61     p_stream->pf_del    = Del;
62     p_stream->pf_send   = Send;
63
64     p_stream->p_sys     = NULL;
65
66     return VLC_SUCCESS;
67 }
68
69 /*****************************************************************************
70  * Close:
71  *****************************************************************************/
72
73 static void Close( vlc_object_t * p_this )
74 {
75     sout_stream_t   *p_stream = (sout_stream_t*)p_this;
76
77 }
78
79 struct sout_stream_id_t
80 {
81     int i_d_u_m_m_y;
82 };
83
84
85 static sout_stream_id_t * Add      ( sout_stream_t *p_stream, sout_format_t *p_fmt )
86 {
87     sout_stream_id_t *id;
88
89     id = malloc( sizeof( sout_stream_id_t ) );
90     id->i_d_u_m_m_y = 0;
91
92     return id;
93 }
94
95 static int     Del      ( sout_stream_t *p_stream, sout_stream_id_t *id )
96 {
97     free( id );
98
99     return VLC_SUCCESS;
100 }
101
102 static int     Send     ( sout_stream_t *p_stream, sout_stream_id_t *id, sout_buffer_t *p_buffer )
103 {
104     sout_buffer_t *p_next;
105
106     while( p_buffer )
107     {
108         p_next = p_buffer->p_next;
109
110         sout_BufferDelete( p_stream->p_sout, p_buffer );
111         p_buffer = p_next;
112     }
113
114     return VLC_SUCCESS;
115 }
116