]> git.sesse.net Git - vlc/blob - include/stream_output.h
Updated release numbering for all ipk's
[vlc] / include / stream_output.h
1 /*****************************************************************************
2  * stream_output.h : stream output module
3  *****************************************************************************
4  * Copyright (C) 2002 VideoLAN
5  * $Id: stream_output.h,v 1.5 2003/02/16 14:10:44 fenrir Exp $
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
8  *          Laurent Aimar <fenrir@via.ecp.fr>
9  *          Eric Petit <titer@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * sout_instance_t: stream output thread descriptor
28  *****************************************************************************/
29
30 /*
31  * i_allocated_size: size of allocated buffer
32  * p_allocated_buffer: where data has been allocated
33  *
34  * i_buffer_size: sizeof buffer from p_buffer
35  * p_buffer: where data begins
36  * i_size: size of valid data
37  *
38  */
39 struct sout_buffer_t
40 {
41     size_t                  i_allocated_size;
42     byte_t                  *p_allocated_buffer;
43
44     size_t                  i_buffer_size;
45     byte_t                  *p_buffer;
46
47     size_t                  i_size;
48     mtime_t                 i_length;
49
50     mtime_t                 i_dts;
51     mtime_t                 i_pts;
52
53     int                     i_bitrate;
54
55     struct sout_buffer_t    *p_next;
56 };
57
58 struct sout_packet_format_t
59 {
60     int             i_cat;      // AUDIO_ES, VIDEO_ES, SPU_ES
61     vlc_fourcc_t    i_fourcc;
62
63     void            *p_format;  // WAVEFORMATEX or BITMAPINFOHEADER
64
65 };
66
67 struct sout_fifo_t
68 {
69     vlc_mutex_t         lock;                         /* fifo data lock */
70     vlc_cond_t          wait;         /* fifo data conditional variable */
71
72     int                 i_depth;
73     sout_buffer_t       *p_first;
74     sout_buffer_t       **pp_last;
75 };
76
77 struct sout_input_t
78 {
79     vlc_mutex_t             lock;
80
81     sout_instance_t         *p_sout;
82
83     sout_packet_format_t    input_format;
84     sout_fifo_t             *p_fifo;
85
86     void                    *p_mux_data;
87 };
88
89 #define SOUT_METHOD_NONE        0x00
90 #define SOUT_METHOD_FILE        0x10
91 #define SOUT_METHOD_NETWORK     0x20
92
93
94 struct sout_access_out_t
95 {
96     VLC_COMMON_MEMBERS
97
98     module_t                *p_module;
99
100     sout_instance_t         *p_sout;
101
102     char                    *psz_access;
103     char                    *psz_name;
104     sout_access_out_sys_t   *p_sys;
105     int                     (* pf_seek  )( sout_access_out_t *,
106                                            off_t );
107     int                     (* pf_write )( sout_access_out_t *,
108                                            sout_buffer_t * );
109 };
110
111 struct sout_instance_t
112 {
113     VLC_COMMON_MEMBERS
114
115     char * psz_dest;
116     char * psz_access;
117     char * psz_mux;
118     char * psz_name;
119
120     int                     i_method;
121
122     sout_access_out_t       *p_access;
123
124     module_t                *p_mux;
125     void                    *p_mux_data;
126     int                     i_mux_preheader;
127     int                     (* pf_mux_addstream )( sout_instance_t *,
128                                                    sout_input_t * );
129     int                     (* pf_mux_delstream )( sout_instance_t *,
130                                                    sout_input_t * );
131     int                     (* pf_mux )          ( sout_instance_t * );
132
133
134     vlc_mutex_t             lock;
135
136     int                     i_nb_inputs;
137     sout_input_t            **pp_inputs;
138 };
139
140
141
142
143 /*****************************************************************************
144  * Prototypes
145  *****************************************************************************/
146 #define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b)
147 VLC_EXPORT( sout_instance_t *, __sout_NewInstance,  ( vlc_object_t *, char * ) );
148 VLC_EXPORT( void,              sout_DeleteInstance, ( sout_instance_t * ) );
149
150 VLC_EXPORT( sout_fifo_t *,   sout_FifoCreate,     ( sout_instance_t * ) );
151 VLC_EXPORT( void,            sout_FifoDestroy,    ( sout_instance_t *, sout_fifo_t * ) );
152 VLC_EXPORT( void,            sout_FifoFree,       ( sout_instance_t *,sout_fifo_t * ) );
153
154 VLC_EXPORT( void,            sout_FifoPut,        ( sout_fifo_t *, sout_buffer_t* ) );
155 VLC_EXPORT( sout_buffer_t *, sout_FifoGet,        ( sout_fifo_t * ) );
156 VLC_EXPORT( sout_buffer_t *, sout_FifoShow,       ( sout_fifo_t * ) );
157
158
159 #define sout_InputNew( a, b ) __sout_InputNew( VLC_OBJECT(a), b )
160 VLC_EXPORT( sout_input_t *, __sout_InputNew,       ( vlc_object_t *, sout_packet_format_t * ) );
161 VLC_EXPORT( int,            sout_InputDelete,      ( sout_input_t * ) );
162 VLC_EXPORT( int,            sout_InputSendBuffer,  ( sout_input_t *, sout_buffer_t* ) );
163
164 VLC_EXPORT( sout_buffer_t*, sout_BufferNew,    ( sout_instance_t *, size_t ) );
165 VLC_EXPORT( int,            sout_BufferRealloc,( sout_instance_t *, sout_buffer_t*, size_t ) );
166 VLC_EXPORT( int,            sout_BufferReallocFromPreHeader,( sout_instance_t *, sout_buffer_t*, size_t ) );
167 VLC_EXPORT( int,            sout_BufferDelete, ( sout_instance_t *, sout_buffer_t* ) );
168 VLC_EXPORT( sout_buffer_t*, sout_BufferDuplicate,(sout_instance_t *, sout_buffer_t * ) );
169 VLC_EXPORT( void,           sout_BufferChain,  ( sout_buffer_t **, sout_buffer_t * ) );
170
171 VLC_EXPORT( sout_access_out_t *, sout_AccessOutNew, ( sout_instance_t *, char *psz_access, char *psz_name ) );
172 VLC_EXPORT( void,                sout_AccessDelete, ( sout_access_out_t * ) );
173 VLC_EXPORT( int,                 sout_AccessSeek,   ( sout_access_out_t *, off_t ) );
174 VLC_EXPORT( int,                 sout_AccessWrite,  ( sout_access_out_t *, sout_buffer_t * ) );
175