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