1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
|
/*****************************************************************
* gmerlin-avdecoder - a general purpose multimedia decoding library
*
* Copyright (c) 2001 - 2012 Members of the Gmerlin project
* gmerlin-general@lists.sourceforge.net
* http://gmerlin.sourceforge.net
*
* 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, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#ifndef __BGAV_SDP_H_
#define __BGAV_SDP_H_
typedef struct bgav_sdp_s bgav_sdp_t;
/* Origin (o=) */
typedef struct
{
char * username; /* NULL if "-" */
uint64_t session_id;
uint64_t session_version;
char * network_type;
char * addr_type;
char * addr;
} bgav_sdp_origin_t;
/* Connection description (c=) */
typedef struct
{
char *type;
char *addr;
uint32_t ttl;
uint32_t num_addr;
} bgav_sdp_connection_desc_t;
/* Bandwidth description (b=) */
typedef enum
{
BGAV_SDP_BANDWIDTH_MODIFIER_NONE = 0,
BGAV_SDP_BANDWIDTH_MODIFIER_CT,
BGAV_SDP_BANDWIDTH_MODIFIER_AS,
BGAV_SDP_BANDWIDTH_MODIFIER_USER,
} bgav_sdp_bandwidth_modifier_t;
typedef struct
{
bgav_sdp_bandwidth_modifier_t modifier;
char * user_bandwidth;
unsigned long bandwidth;
} bgav_sdp_bandwidth_desc_t;
/* Attribute (a=) */
typedef enum
{
BGAV_SDP_TYPE_NONE = 0,
BGAV_SDP_TYPE_BOOLEAN = 1,
BGAV_SDP_TYPE_INT = 2,
BGAV_SDP_TYPE_STRING = 3,
BGAV_SDP_TYPE_DATA = 4,
BGAV_SDP_TYPE_GENERIC = 5, /* Everything else */
} bgav_sdp_attr_type_t;
typedef struct
{
char * name;
bgav_sdp_attr_type_t type;
union
{
char * str;
void * data;
int i;
} val;
int data_len;
} bgav_sdp_attr_t;
/* Key (k=) */
typedef enum
{
BGAV_SDP_KEY_TYPE_NONE = 0,
BGAV_SDP_KEY_TYPE_CLEAR,
BGAV_SDP_KEY_TYPE_BASE64,
BGAV_SDP_KEY_TYPE_URI,
BGAV_SDP_KEY_TYPE_PROMPT,
} bgav_sdp_key_type_t;
typedef struct key_desc_t
{
bgav_sdp_key_type_t type;
char *key;
} bgav_sdp_key_desc_t;
/* Media Description (m=) */
typedef struct
{
/* From the m= line */
char * media; /* audio, video etc */
int port;
int num_ports;
char * protocol;
int num_formats;
char ** formats;
/* Additional stuff */
char * media_title; /* i=* (media title) */
bgav_sdp_connection_desc_t connection; /* c= */
bgav_sdp_bandwidth_desc_t bandwidth; /* b= */
bgav_sdp_key_desc_t key; /* k= */
/* a= */
int num_attributes;
bgav_sdp_attr_t * attributes;
} bgav_sdp_media_desc_t;
/* Whole sdp structure */
struct bgav_sdp_s
{
int protocol_version; /* v= */
bgav_sdp_origin_t origin; /* o= */
char * session_name; /* s= */
char * session_description; /* i= */
char * uri; /* u= */
char * email; /* e= */
char * phone; /* p= */
bgav_sdp_connection_desc_t connection; /* c= */
bgav_sdp_bandwidth_desc_t bandwidth; /* b= */
/* t= One or more time descriptions (see below) */
// z=* (time zone adjustments)
bgav_sdp_key_desc_t key; /* k=* (encryption key) */
// a=* (zero or more session attribute lines)
// Zero or more media descriptions (see below)
// int num_time_descriptions;
// time_desc_t * time_descriptions;
int num_attributes;
bgav_sdp_attr_t * attributes;
int num_media;
bgav_sdp_media_desc_t * media;
};
/* Obtain attributes */
/*
* These functions return FALSE if
* there is a type mismatch, or no attribute with the
* specified name is found
*/
int bgav_sdp_get_attr_string(bgav_sdp_attr_t * attrs, int num_attrs,
const char * name, char ** ret);
int bgav_sdp_get_attr_data(bgav_sdp_attr_t * attrs, int num_attrs,
const char * name, uint8_t ** ret, int * size);
int bgav_sdp_get_attr_int(bgav_sdp_attr_t * attrs, int num_attrs,
const char * name, int*);
int bgav_sdp_get_attr_rtpmap(bgav_sdp_attr_t * attrs, int num_attrs, int format, char ** ret);
int bgav_sdp_get_attr_fmtp(bgav_sdp_attr_t * attrs, int num_attrs, int format, char ** ret);
/* Init, free */
int bgav_sdp_parse(const bgav_options_t * opt,
const char * data, bgav_sdp_t * ret);
void bgav_sdp_free(bgav_sdp_t * s);
/* Dump the entire struct to stderr */
void bgav_sdp_dump(bgav_sdp_t * s);
#endif // __BGAV_SDP_H_
|