]> git.sesse.net Git - vlc/blob - include/vlc_streaming.h
signal si redumdant after kill
[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$
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 /***********************************************************************
28  * Predefined lists of streaming data
29  ***********************************************************************/
30
31 #ifdef WIN32
32 #define VCODECS_NUMBER 13
33 #else
34 #define VCODECS_NUMBER 12
35 #endif
36
37 #define ACODECS_NUMBER 9
38
39 /// Keep this up to date !
40 #define MUXERS_NUMBER 10
41 enum
42 {
43     MUX_PS, MUX_TS, MUX_MPEG, MUX_OGG, MUX_RAW,
44     MUX_ASF, MUX_AVI, MUX_MP4, MUX_MOV, MUX_WAV,
45 };
46
47 enum { ACCESS_HTTP, ACCESS_UDP, ACCESS_MMS, ACCESS_RTP, ACCESS_FILE };
48
49 struct codec_desc_t {
50     char *psz_display;
51     char *psz_codec;
52     char *psz_descr;
53     int muxers[MUXERS_NUMBER];
54 };
55 //extern const struct codec vcodecs_array[];
56 //extern const struct codec acodecs_array[];
57
58 struct method_desc_t {
59     char *psz_access;
60     char *psz_method;
61     char *psz_descr;
62     char *psz_address;
63     int   muxers[MUXERS_NUMBER];
64 };
65 //xtern const struct method methods_array[];
66
67 struct mux_desc_t {
68     int   id;
69     char *psz_mux;
70     char *psz_encap;
71     char *psz_descr;
72 };
73 //extern const struct mux_desc_t muxers_array[];
74
75
76 /* Standard bitrates arrays */
77 //static const char * vbitrates_array[] =
78 //{ "3072", "2048", "1024", "768", "512", "384", "256", "192", "128", "96",
79 //  "64" };
80
81 //static const char *abitrates_array[] =
82 //{ "512", "256", "192", "128", "96", "64", "32", "16" } ;
83 //
84
85
86 /***********************************************************************
87  * Streaming profiles
88  ***********************************************************************/
89
90 /****************** Parameters handling *********************/
91 struct sout_param_t
92 {
93     int i_type;
94     int i_element;
95     char *psz_id;
96     char *psz_string;
97     vlc_value_t value;
98 };
99
100 struct sout_pcat_t
101 {
102     char *psz_name;
103     int i_params;
104     sout_param_t **pp_params;
105 };
106
107 void streaming_ParameterApply( sout_param_t *p_param, char **ppsz_dest,
108                            int *pi_dest, float *pf_dest, bool *pb_dest );
109
110
111 /******** Module types definitions and parametrable elements ***************/
112
113 /* Transcode */
114 enum { I_VB, I_AB, I_CHANNELS, F_SCALE, B_SOVERLAY, PSZ_VC, PSZ_AC, PSZ_SC,
115        PSZ_VE, PSZ_AE };
116 struct sout_transcode_t
117 {
118     int32_t i_vb;
119     int32_t i_ab;
120     int32_t i_channels;
121     float f_scale;
122     bool b_soverlay;
123     char *psz_vcodec;
124     char *psz_acodec;
125     char *psz_scodec;
126     char *psz_venc;
127     char *psz_aenc;
128     char *psz_additional;
129
130     int32_t i_params;
131     sout_param_t **pp_params;
132 };
133 void streaming_TranscodeParametersApply( sout_transcode_t *p_module );
134
135 /* Standard */
136 enum { PSZ_MUX, PSZ_ACCESS, PSZ_URL, PSZ_NAME, PSZ_GROUP };
137 struct sout_std_t
138 {
139     char *psz_mux;
140     char *psz_access;
141     char *psz_url;
142     char *psz_name;
143     char *psz_group;
144     int i_params;
145     sout_param_t **pp_params;
146 };
147 void streaming_StdParametersApply( sout_std_t *p_module );
148
149 /* Display */
150 struct sout_display_t
151 {
152 };
153
154 /* Duplicate */
155 struct sout_duplicate_t
156 {
157     int i_children;
158     int i_conditions;
159     sout_chain_t **pp_children;
160     char **ppsz_conditions;
161 };
162
163 /******* Generic profile structures and manipulation functions ********/
164 typedef union
165 {
166     sout_transcode_t *p_transcode;
167     sout_std_t       *p_std;
168     sout_duplicate_t *p_duplicate;
169     sout_display_t   *p_display;
170 } sout_module_type_t;
171
172 struct sout_module_t
173 {
174     int i_type;
175     sout_module_type_t typed;
176     sout_module_t *p_parent;
177 };
178
179 enum { SOUT_MOD_TRANSCODE, SOUT_MOD_STD, SOUT_MOD_RTP, SOUT_MOD_DUPLICATE,
180        SOUT_MOD_DISPLAY };
181
182 struct sout_chain_t
183 {
184     int i_modules;
185     sout_module_t **pp_modules;
186
187     int i_options;
188     char **ppsz_options;
189
190     int i_pcats;
191     sout_pcat_t **pp_pcats;
192 };
193
194 static inline sout_chain_t *streaming_ChainNew(void)
195 {
196     DECMALLOC_NULL( p_chain, sout_chain_t );
197     memset( p_chain, 0, sizeof( sout_chain_t ) );
198     p_chain->i_options = 0;
199     return p_chain;
200 }
201
202 struct streaming_profile_t
203 {
204     char *psz_title;
205     char *psz_description;
206     sout_chain_t *p_chain;
207 };
208
209 /** struct for holding account information needed to access the services */
210 struct streaming_account_t
211 {
212     char *psz_username; /*< username of account */
213     char *psz_password; /*< password of account */
214 };
215
216 /**************** GUI interaction *****************/
217 /** struct to hold user interface information */
218 struct sout_gui_descr_t
219 {
220     /* Access types */
221     bool b_local;   /*< local access module */
222     bool b_file;    /*< file access module */
223     bool b_http;    /*< http access module */
224     bool b_mms;     /*< mms access module */
225     bool b_rtp;     /*< rtp access module */
226     bool b_udp;     /*< udp access module */
227     bool b_dump;    /*< dump access module */
228     bool b_icecast; /*< icecast access module */
229
230     char *psz_file;     /*< filename */
231     char *psz_http;     /*< HTTP servername or ipaddress */
232     char *psz_mms;      /*< MMS servername or ipaddress */
233     char *psz_rtp;      /*< RTP servername or ipaddress */
234     char *psz_udp;      /*< UDP servername or ipaddress */
235     char *psz_icecast;  /*< Icecast servername or ipaddress*/
236
237     int32_t i_http;     /*< http port number */
238     int32_t i_mms;      /*< mms port number */
239     int32_t i_rtp;      /*< rtp port number */
240     int32_t i_udp;      /*< udp port number */
241     int32_t i_icecast;  /*< icecast port number */
242
243     /* Mux */
244     char *psz_mux;      /*< name of muxer to use in streaming */
245
246     /* Transcode */
247     bool b_soverlay; /*< enable burning overlay in the video */
248     char *psz_vcodec;   /*< video codec to use in transcoding */
249     char *psz_acodec;   /*< audio codec to use in transcoding */
250     char *psz_scodec;   /*< subtitle codec to use in transcoding */
251     int32_t i_vb;       /*< video bitrate to use in transcoding */
252     int32_t i_ab;       /*< audio bitrate to use in transcoding */
253     int32_t i_channels; /*< number of audio channels to use in transcoding */
254     float f_scale;      /*< scaling factor to use in transcoding */
255
256     /* Misc */
257     bool b_sap;   /*< send SAP announcement */
258     bool b_all_es;/*< send all elementary streams from source stream */
259     char *psz_group;    /*< SAP Group name */
260     char *psz_name;     /*< SAP name */
261     int32_t i_ttl;      /*< Time To Live (TTL) for network traversal */
262
263     /* Icecast */
264     char *psz_icecast_mountpoint;/*< path to Icecast mountpoint */
265     struct streaming_account_t sa_icecast;  /*< Icecast account information */
266 };
267
268 VLC_EXPORT(void, streaming_GuiDescToChain,(vlc_object_t*, sout_chain_t*, sout_gui_descr_t*));
269 VLC_EXPORT(char*, streaming_ChainToPsz,(sout_chain_t*));
270
271 /***************** Profile parsing ***********************/
272
273 struct profile_parser_t
274 {
275     char *psz_profile;
276     streaming_profile_t *p_profile;
277 };
278
279 #endif