]> git.sesse.net Git - vlc/blob - include/stream_output.h
Added stream output. (common work with titer).
[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.2 2002/12/14 21:32:41 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 struct sout_buffer_t
31 {
32     size_t                  i_allocated_size;
33     byte_t                  *p_buffer;
34
35     size_t                  i_size;
36 //    mtime_t                 i_date;
37     mtime_t                 i_length;
38
39     mtime_t                 i_dts;
40     mtime_t                 i_pts;
41
42     int                     i_bitrate;
43
44     struct sout_buffer_t    *p_next;
45 };
46
47 struct sout_packet_format_t
48 {
49     int             i_cat;      // AUDIO_ES, VIDEO_ES, SPU_ES
50     vlc_fourcc_t    i_fourcc;
51
52     void            *p_format;  // WAVEFORMATEX or BITMAPINFOHEADER
53
54 };
55
56 struct sout_fifo_t
57 {
58     vlc_mutex_t         lock;                         /* fifo data lock */
59     vlc_cond_t          wait;         /* fifo data conditional variable */
60
61     int                 i_depth;
62     sout_buffer_t       *p_first;
63     sout_buffer_t       **pp_last;
64 };
65
66 struct sout_input_t
67 {
68     vlc_mutex_t             lock;
69
70     sout_instance_t         *p_sout;
71
72     sout_packet_format_t    input_format;
73     sout_fifo_t             *p_fifo;
74
75     void                    *p_mux_data;
76 };
77
78 #define SOUT_METHOD_NONE        0x00
79 #define SOUT_METHOD_FILE        0x10
80 #define SOUT_METHOD_NETWORK     0x20
81
82 struct sout_instance_t
83 {
84     VLC_COMMON_MEMBERS
85
86     char * psz_dest;
87     char * psz_access;
88     char * psz_mux;
89     char * psz_name;
90
91     module_t                *p_access;
92     int                     i_method;
93     void                    *p_access_data;
94     int                     (* pf_write )( sout_instance_t *, sout_buffer_t * );
95     int                     (* pf_seek  )( sout_instance_t *, off_t );
96
97     module_t                *p_mux;
98     void                    *p_mux_data;
99     int                     (* pf_mux_addstream )( sout_instance_t *,
100                                                    sout_input_t * );
101     int                     (* pf_mux_delstream )( sout_instance_t *,
102                                                    sout_input_t * );
103     int                     (* pf_mux )          ( sout_instance_t * );
104
105
106     vlc_mutex_t             lock;
107
108     int                     i_nb_inputs;
109     sout_input_t            **pp_inputs;
110 };
111
112
113
114
115 /*****************************************************************************
116  * Prototypes
117  *****************************************************************************/
118 #define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b)
119 VLC_EXPORT( sout_instance_t *, __sout_NewInstance,  ( vlc_object_t *, char * ) );
120 VLC_EXPORT( void,              sout_DeleteInstance, ( sout_instance_t * ) );
121
122 VLC_EXPORT( sout_fifo_t *,   sout_FifoCreate,     ( sout_instance_t * ) );
123 VLC_EXPORT( void,            sout_FifoDestroy,    ( sout_instance_t *, sout_fifo_t * ) );
124 VLC_EXPORT( void,            sout_FifoFree,       ( sout_instance_t *,sout_fifo_t * ) );
125
126 VLC_EXPORT( void,            sout_FifoPut,        ( sout_fifo_t *, sout_buffer_t* ) );
127 VLC_EXPORT( sout_buffer_t *, sout_FifoGet,        ( sout_fifo_t * ) );
128 VLC_EXPORT( sout_buffer_t *, sout_FifoShow,       ( sout_fifo_t * ) );
129
130
131 #define sout_InputNew( a, b ) __sout_InputNew( VLC_OBJECT(a), b )
132 VLC_EXPORT( sout_input_t *, __sout_InputNew,       ( vlc_object_t *, sout_packet_format_t * ) );
133 VLC_EXPORT( int,            sout_InputDelete,      ( sout_input_t * ) );
134 VLC_EXPORT( int,            sout_InputSendBuffer,  ( sout_input_t *, sout_buffer_t* ) );
135
136 VLC_EXPORT( sout_buffer_t*, sout_BufferNew,    ( sout_instance_t *, size_t ) );
137 VLC_EXPORT( int,            sout_BufferRealloc,( sout_instance_t *, sout_buffer_t*, size_t ) );
138 VLC_EXPORT( int,            sout_BufferDelete, ( sout_instance_t *, sout_buffer_t* ) );
139 VLC_EXPORT( sout_buffer_t*, sout_BufferDuplicate,(sout_instance_t *, sout_buffer_t * ) );