]> git.sesse.net Git - vlc/blob - include/vlc_streaming.h
* Qt4 stream output dialog
[vlc] / include / vlc_streaming.h
1 /*****************************************************************************
2  * vlc_streaming.h: Methods and descriptions for Streaming profiles
3  *****************************************************************************
4  * Copyright (C) 2002-2005 the VideoLAN team
5  * $Id: stream_output.h 14151 2006-02-04 00:08:50Z zorglub $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _VLC_STREAMING_H_
25 #define _VLC_STREAMING_H_
26
27 #include <vlc/vlc.h>
28
29 /***********************************************************************
30  * Predefined lists of streaming data
31  ***********************************************************************/
32
33 #ifdef WIN32
34 #define VCODECS_NUMBER 13
35 #else
36 #define VCODECS_NUMBER 12
37 #endif
38
39 #define ACODECS_NUMBER 9
40
41 /// Keep this up to date !
42 #define MUXERS_NUMBER 10
43 enum
44 {
45     MUX_PS, MUX_TS, MUX_MPEG, MUX_OGG, MUX_RAW,
46     MUX_ASF, MUX_AVI, MUX_MP4, MUX_MOV, MUX_WAV,
47 };
48
49 enum { ACCESS_HTTP, ACCESS_UDP, ACCESS_MMS, ACCESS_RTP, ACCESS_FILE };
50
51 struct codec_desc_t {
52     char *psz_display;
53     char *psz_codec;
54     char *psz_descr;
55     int muxers[MUXERS_NUMBER];
56 };
57 //extern const struct codec vcodecs_array[];
58 //extern const struct codec acodecs_array[];
59
60 struct method_desc_t {
61     char *psz_access;
62     char *psz_method;
63     char *psz_descr;
64     char *psz_address;
65     int   muxers[MUXERS_NUMBER];
66 };
67 //xtern const struct method methods_array[];
68
69 struct mux_desc_t {
70     int   id;
71     char *psz_mux;
72     char *psz_encap;
73     char *psz_descr;
74 };
75 //extern const struct mux_desc_t muxers_array[];
76
77
78 /* Standard bitrates arrays */
79 //static const char * vbitrates_array[] =
80 //{ "3072", "2048", "1024", "768", "512", "384", "256", "192", "128", "96",
81 //  "64" };
82
83 //static const char *abitrates_array[] =
84 //{ "512", "256", "192", "128", "96", "64", "32", "16" } ;
85 //
86
87
88 /***********************************************************************
89  * Streaming profiles
90  ***********************************************************************/
91
92 /****************** Parameters handling *********************/
93 struct sout_param_t
94 {
95     int i_type;
96     int i_element;
97     char *psz_id;
98     char *psz_string;
99     vlc_value_t value;
100 };
101
102 struct sout_pcat_t
103 {
104     char *psz_name;
105     int i_params;
106     sout_param_t **pp_params;
107 };
108
109 void streaming_ParameterApply( sout_param_t *p_param, char **ppsz_dest,
110                            int *pi_dest, float *pf_dest, vlc_bool_t *pb_dest );
111
112
113 /******** Module types definitions and parametrable elements ***************/
114
115 /* Transcode */
116 enum { I_VB, I_AB, I_CHANNELS, F_SCALE, B_SOVERLAY, PSZ_VC, PSZ_AC, PSZ_SC,
117        PSZ_VE, PSZ_AE };
118 struct sout_transcode_t
119 {
120     int i_vb, i_ab, i_channels;
121     float f_scale;
122     vlc_bool_t b_soverlay;
123     char *psz_vcodec;
124     char *psz_acodec, *psz_scodec, *psz_venc, *psz_aenc;
125     char *psz_additional;
126
127     int i_params; sout_param_t **pp_params;
128 };
129 void streaming_TranscodeParametersApply( sout_transcode_t *p_module );
130
131 /* Standard */
132 enum { PSZ_MUX, PSZ_ACCESS, PSZ_URL, PSZ_NAME, PSZ_GROUP };
133 struct sout_std_t
134 {
135     char *psz_mux, *psz_access;
136     char *psz_url, *psz_name, *psz_group;
137     int i_params; sout_param_t **pp_params;
138 };
139 void streaming_StdParametersApply( sout_std_t *p_module );
140
141 /* Display */
142 struct sout_display_t
143 {
144 };
145
146 /* Duplicate */
147 struct sout_duplicate_t
148 {
149     int i_children, i_conditions;
150     sout_chain_t **pp_children;
151     char **ppsz_conditions;
152 };
153
154 /******* Generic profile structures and manipulation functions ********/
155 typedef union
156 {
157     sout_transcode_t *p_transcode;
158     sout_std_t       *p_std;
159     sout_duplicate_t *p_duplicate;
160     sout_display_t   *p_display;
161 } sout_module_type_t;
162
163 struct sout_module_t
164 {
165     int i_type;
166     sout_module_type_t typed;
167     sout_module_t *p_parent;
168 };
169
170 enum { SOUT_MOD_TRANSCODE, SOUT_MOD_STD, SOUT_MOD_RTP, SOUT_MOD_DUPLICATE,
171        SOUT_MOD_DISPLAY };
172
173 struct sout_chain_t
174 {
175     int i_modules;
176     sout_module_t **pp_modules;
177
178     int i_options;
179     char **ppsz_options;
180
181     int i_pcats;
182     sout_pcat_t **pp_pcats;
183 };
184
185 static inline sout_chain_t *streaming_ChainNew(void)
186 {
187     DECMALLOC_NULL( p_chain, sout_chain_t );
188     memset( p_chain, 0, sizeof( sout_chain_t ) );
189     p_chain->i_options = 0;
190     return p_chain;
191 }
192
193 struct streaming_profile_t
194 {
195     char *psz_title;
196     char *psz_description;
197     sout_chain_t *p_chain;
198 };
199
200 /**************** GUI interaction *****************/
201 struct sout_gui_descr_t
202 {
203     /* Access */
204     vlc_bool_t b_local, b_file, b_http, b_mms, b_rtp, b_udp, b_dump;
205     char *psz_file, *psz_http, *psz_mms, *psz_rtp, *psz_udp;
206     int i_http, i_mms, i_rtp, i_udp;
207
208     /* Mux */
209     char *psz_mux;
210
211     /* Transcode */
212     vlc_bool_t b_soverlay;
213     char *psz_vcodec, *psz_acodec, *psz_scodec;
214     int i_vb, i_ab, i_channels;
215     float f_scale;
216
217     /* Misc */
218     vlc_bool_t b_sap, b_all_es;
219     char *psz_group, *psz_name;
220     int i_ttl;
221 };
222
223 VLC_EXPORT(void, streaming_GuiDescToChain,(vlc_object_t*, sout_chain_t*, sout_gui_descr_t*));
224 VLC_EXPORT(char*, streaming_ChainToPsz,(sout_chain_t*));
225
226 /***************** Profile parsing ***********************/
227
228 struct profile_parser_t
229 {
230     char *psz_profile;
231     streaming_profile_t *p_profile;
232 };
233
234 #endif