vlc_streaming.h 7.68 KB
Newer Older
1 2 3 4
/*****************************************************************************
 * vlc_streaming.h: Methods and descriptions for Streaming profiles
 *****************************************************************************
 * Copyright (C) 2002-2005 the VideoLAN team
5
 * $Id$
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef _VLC_STREAMING_H_
#define _VLC_STREAMING_H_

27 28 29 30
/***********************************************************************
 * Predefined lists of streaming data
 ***********************************************************************/

31 32 33 34 35 36 37 38 39 40 41 42
#ifdef WIN32
#define VCODECS_NUMBER 13
#else
#define VCODECS_NUMBER 12
#endif

#define ACODECS_NUMBER 9

/// Keep this up to date !
#define MUXERS_NUMBER 10
enum
{
43 44
    MUX_PS, MUX_TS, MUX_MPEG, MUX_OGG, MUX_RAW,
    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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82

struct codec_desc_t {
    char *psz_display;
    char *psz_codec;
    char *psz_descr;
    int muxers[MUXERS_NUMBER];
};
//extern const struct codec vcodecs_array[];
//extern const struct codec acodecs_array[];

struct method_desc_t {
    char *psz_access;
    char *psz_method;
    char *psz_descr;
    char *psz_address;
    int   muxers[MUXERS_NUMBER];
};
//xtern const struct method methods_array[];

struct mux_desc_t {
    int   id;
    char *psz_mux;
    char *psz_encap;
    char *psz_descr;
};
//extern const struct mux_desc_t muxers_array[];


/* Standard bitrates arrays */
//static const char * vbitrates_array[] =
//{ "3072", "2048", "1024", "768", "512", "384", "256", "192", "128", "96",
//  "64" };

//static const char *abitrates_array[] =
//{ "512", "256", "192", "128", "96", "64", "32", "16" } ;
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
//


/***********************************************************************
 * Streaming profiles
 ***********************************************************************/

/****************** Parameters handling *********************/
struct sout_param_t
{
    int i_type;
    int i_element;
    char *psz_id;
    char *psz_string;
    vlc_value_t value;
};

struct sout_pcat_t
{
    char *psz_name;
    int i_params;
    sout_param_t **pp_params;
};
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 112 113 114 115


/******** Module types definitions and parametrable elements ***************/

/* Transcode */
enum { I_VB, I_AB, I_CHANNELS, F_SCALE, B_SOVERLAY, PSZ_VC, PSZ_AC, PSZ_SC,
       PSZ_VE, PSZ_AE };
116 117
struct sout_transcode_t
{
118 119 120
    int32_t i_vb;
    int32_t i_ab;
    int32_t i_channels;
121
    float f_scale;
122
    bool b_soverlay;
Clément Stenac's avatar
Clément Stenac committed
123
    char *psz_vcodec;
124 125 126 127
    char *psz_acodec;
    char *psz_scodec;
    char *psz_venc;
    char *psz_aenc;
128
    char *psz_additional;
129

130 131
    int32_t i_params;
    sout_param_t **pp_params;
132
};
133
void streaming_TranscodeParametersApply( sout_transcode_t *p_module );
134

135 136 137
/* Standard */
enum { PSZ_MUX, PSZ_ACCESS, PSZ_URL, PSZ_NAME, PSZ_GROUP };
struct sout_std_t
138
{
139 140 141 142 143 144 145
    char *psz_mux;
    char *psz_access;
    char *psz_url;
    char *psz_name;
    char *psz_group;
    int i_params;
    sout_param_t **pp_params;
146
};
147
void streaming_StdParametersApply( sout_std_t *p_module );
148

149 150
/* Display */
struct sout_display_t
151 152 153
{
};

154
/* Duplicate */
155 156
struct sout_duplicate_t
{
157 158
    int i_children;
    int i_conditions;
159
    sout_chain_t **pp_children;
Clément Stenac's avatar
Clément Stenac committed
160
    char **ppsz_conditions;
161 162
};

163
/******* Generic profile structures and manipulation functions ********/
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
typedef union
{
    sout_transcode_t *p_transcode;
    sout_std_t       *p_std;
    sout_duplicate_t *p_duplicate;
    sout_display_t   *p_display;
} sout_module_type_t;

struct sout_module_t
{
    int i_type;
    sout_module_type_t typed;
    sout_module_t *p_parent;
};

179 180
enum { SOUT_MOD_TRANSCODE, SOUT_MOD_STD, SOUT_MOD_RTP, SOUT_MOD_DUPLICATE,
       SOUT_MOD_DISPLAY };
181 182 183 184 185 186 187 188

struct sout_chain_t
{
    int i_modules;
    sout_module_t **pp_modules;

    int i_options;
    char **ppsz_options;
189 190 191

    int i_pcats;
    sout_pcat_t **pp_pcats;
192 193
};

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
194
static inline sout_chain_t *streaming_ChainNew(void)
195 196 197 198 199 200 201 202 203 204 205 206 207 208
{
    DECMALLOC_NULL( p_chain, sout_chain_t );
    memset( p_chain, 0, sizeof( sout_chain_t ) );
    p_chain->i_options = 0;
    return p_chain;
}

struct streaming_profile_t
{
    char *psz_title;
    char *psz_description;
    sout_chain_t *p_chain;
};

209 210 211 212 213 214 215
/** struct for holding account information needed to access the services */
struct streaming_account_t
{
    char *psz_username; /*< username of account */
    char *psz_password; /*< password of account */
};

216
/**************** GUI interaction *****************/
217
/** struct to hold user interface information */
218
struct sout_gui_descr_t
219
{
220
    /* Access types */
221 222 223 224 225 226 227 228
    bool b_local;   /*< local access module */
    bool b_file;    /*< file access module */
    bool b_http;    /*< http access module */
    bool b_mms;     /*< mms access module */
    bool b_rtp;     /*< rtp access module */
    bool b_udp;     /*< udp access module */
    bool b_dump;    /*< dump access module */
    bool b_icecast; /*< icecast access module */
229 230 231 232 233 234 235 236 237 238 239 240 241

    char *psz_file;     /*< filename */
    char *psz_http;     /*< HTTP servername or ipaddress */
    char *psz_mms;      /*< MMS servername or ipaddress */
    char *psz_rtp;      /*< RTP servername or ipaddress */
    char *psz_udp;      /*< UDP servername or ipaddress */
    char *psz_icecast;  /*< Icecast servername or ipaddress*/

    int32_t i_http;     /*< http port number */
    int32_t i_mms;      /*< mms port number */
    int32_t i_rtp;      /*< rtp port number */
    int32_t i_udp;      /*< udp port number */
    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 249 250 251 252 253 254
    char *psz_vcodec;   /*< video codec to use in transcoding */
    char *psz_acodec;   /*< audio codec to use in transcoding */
    char *psz_scodec;   /*< subtitle codec to use in transcoding */
    int32_t i_vb;       /*< video bitrate to use in transcoding */
    int32_t i_ab;       /*< audio bitrate to use in transcoding */
    int32_t i_channels; /*< number of audio channels to use in transcoding */
    float f_scale;      /*< scaling factor to use in transcoding */
255 256

    /* Misc */
257 258
    bool b_sap;   /*< send SAP announcement */
    bool b_all_es;/*< send all elementary streams from source stream */
259 260 261 262 263
    char *psz_group;    /*< SAP Group name */
    char *psz_name;     /*< SAP name */
    int32_t i_ttl;      /*< Time To Live (TTL) for network traversal */

    /* Icecast */
264
    char *psz_icecast_mountpoint;/*< path to Icecast mountpoint */
265
    struct streaming_account_t sa_icecast;  /*< Icecast account information */
266 267
};

Clément Stenac's avatar
Clément Stenac committed
268 269 270
VLC_EXPORT(void, streaming_GuiDescToChain,(vlc_object_t*, sout_chain_t*, sout_gui_descr_t*));
VLC_EXPORT(char*, streaming_ChainToPsz,(sout_chain_t*));

271
/***************** Profile parsing ***********************/
272 273 274 275 276 277 278

struct profile_parser_t
{
    char *psz_profile;
    streaming_profile_t *p_profile;
};

279
#endif