annotate stream/realrtsp/sdpplin.c @ 23611:ecbb54f8d299

make opt argument of demux_info_get const.
author reimar
date Sun, 24 Jun 2007 10:20:42 +0000
parents 7ea888a4b348
children 430da0c9fcce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
1 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
2 * This file was ported to MPlayer from xine CVS sdpplin.c,v 1.1 2002/12/24 01:30:22
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
3 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
4
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
5 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
6 * Copyright (C) 2002 the xine project
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
7 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
8 * This file is part of xine, a free video player.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
9 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
10 * xine is free software; you can redistribute it and/or modify
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
13 * (at your option) any later version.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
14 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
15 * xine is distributed in the hope that it will be useful,
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
18 * GNU General Public License for more details.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
19 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
23 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
24 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
25 * sdp/sdpplin parser.
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
26 *
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
27 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
28
15930
f59fdc0d0d14 Do some sanity checks before writing stream information
rtognimp
parents: 15797
diff changeset
29 #include "config.h"
18799
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents: 18095
diff changeset
30 #include "../librtsp/rtsp.h"
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
31 #include "sdpplin.h"
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
32 #include "xbuffer.h"
15930
f59fdc0d0d14 Do some sanity checks before writing stream information
rtognimp
parents: 15797
diff changeset
33 #include "mp_msg.h"
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
34
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
35 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
36 #define LOG
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
37 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
38
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
39 /*
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
40 * Decodes base64 strings (based upon b64 package)
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
41 */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
42
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
43 static char *b64_decode(const char *in, char *out, int *size)
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
44 {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
45 char dtable[256]; /* Encode / decode table */
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
46 int i,j,k;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
47
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
48 for (i = 0; i < 255; i++) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
49 dtable[i] = 0x80;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
50 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
51 for (i = 'A'; i <= 'Z'; i++) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
52 dtable[i] = 0 + (i - 'A');
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
53 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
54 for (i = 'a'; i <= 'z'; i++) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
55 dtable[i] = 26 + (i - 'a');
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
56 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
57 for (i = '0'; i <= '9'; i++) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
58 dtable[i] = 52 + (i - '0');
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
59 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
60 dtable['+'] = 62;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
61 dtable['/'] = 63;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
62 dtable['='] = 0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
63
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
64 k=0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
65
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
66 /*CONSTANTCONDITION*/
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
67 for (j=0; j<strlen(in); j+=4)
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
68 {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
69 char a[4], b[4];
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
70
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
71 for (i = 0; i < 4; i++) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
72 int c = in[i+j];
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
73
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
74 if (dtable[c] & 0x80) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
75 printf("Illegal character '%c' in input.\n", c);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
76 // exit(1);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
77 return NULL;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
78 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
79 a[i] = (char) c;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
80 b[i] = (char) dtable[c];
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
81 }
15932
9bb26af4f477 Revert fix v1.3, it breaks streams with cook audio (ex.
rtognimp
parents: 15930
diff changeset
82 out = xbuffer_ensure_size(out, k+4);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
83 out[k++] = (b[0] << 2) | (b[1] >> 4);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
84 out[k++] = (b[1] << 4) | (b[2] >> 2);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
85 out[k++] = (b[2] << 6) | b[3];
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
86 i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
87 if (i < 3) {
15932
9bb26af4f477 Revert fix v1.3, it breaks streams with cook audio (ex.
rtognimp
parents: 15930
diff changeset
88 out[k]=0;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
89 *size=k;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
90 return out;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
91 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
92 }
15932
9bb26af4f477 Revert fix v1.3, it breaks streams with cook audio (ex.
rtognimp
parents: 15930
diff changeset
93 out[k]=0;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
94 *size=k;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
95 return out;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
96 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
97
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
98 static char *nl(char *data) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
99
12266
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
100 char *nlptr = (data) ? strchr(data,'\n') : NULL;
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
101 return (nlptr) ? nlptr + 1 : NULL;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
102 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
103
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
104 static int filter(const char *in, const char *filter, char **out) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
105
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
106 int flen=strlen(filter);
12266
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
107 int len;
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
108
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
109 if (!in)
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
110 return 0;
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
111
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
112 len = (strchr(in,'\n')) ? strchr(in,'\n')-in : strlen(in);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
113
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
114 if (!strncmp(in,filter,flen))
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
115 {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
116 if(in[flen]=='"') flen++;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
117 if(in[len-1]==13) len--;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
118 if(in[len-1]=='"') len--;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
119 *out = xbuffer_copyin(*out, 0, in+flen, len-flen+1);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
120 (*out)[len-flen]=0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
121
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
122 return len-flen;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
123 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
124
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
125 return 0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
126 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
127 static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
128
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
129 sdpplin_stream_t *desc=calloc(1,sizeof(sdpplin_stream_t));
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
130 char *buf=xbuffer_init(32);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
131 char *decoded=xbuffer_init(32);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
132 int handled;
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
133 int got_mimetype;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
134
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
135 if (filter(*data, "m=", &buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
136 desc->id = strdup(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
137 } else
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
138 {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
139 printf("sdpplin: no m= found.\n");
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
140 free(desc);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
141 xbuffer_free(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
142 return NULL;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
143 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
144 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
145
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
146 got_mimetype = 0;
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
147
12266
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
148 while (*data && **data && *data[0]!='m') {
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
149 #ifdef LOG
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
150 {
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
151 int len=strchr(*data,'\n')-(*data);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
152 buf = xbuffer_copyin(buf, 0, *data, len+1);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
153 buf[len]=0;
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
154 printf("libreal: sdpplin_stream: '%s'\n", buf);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
155 }
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
156 #endif
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
157
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
158 handled=0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
159
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
160 if(filter(*data,"a=control:streamid=",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
161 desc->stream_id=atoi(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
162 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
163 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
164 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
165
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
166 if(filter(*data,"a=MaxBitRate:integer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
167 desc->max_bit_rate=atoi(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
168 if (!desc->avg_bit_rate)
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
169 desc->avg_bit_rate=desc->max_bit_rate;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
170 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
171 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
172 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
173
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
174 if(filter(*data,"a=MaxPacketSize:integer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
175 desc->max_packet_size=atoi(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
176 if (!desc->avg_packet_size)
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
177 desc->avg_packet_size=desc->max_packet_size;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
178 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
179 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
180 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
181
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
182 if(filter(*data,"a=StartTime:integer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
183 desc->start_time=atoi(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
184 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
185 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
186 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
187
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
188 if(filter(*data,"a=Preroll:integer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
189 desc->preroll=atoi(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
190 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
191 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
192 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
193
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
194 if(filter(*data,"a=length:npt=",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
195 desc->duration=(uint32_t)(atof(buf)*1000);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
196 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
197 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
198 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
199
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
200 if(filter(*data,"a=StreamName:string;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
201 desc->stream_name=strdup(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
202 desc->stream_name_size=strlen(desc->stream_name);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
203 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
204 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
205 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
206
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
207 if(filter(*data,"a=mimetype:string;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
208 desc->mime_type=strdup(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
209 desc->mime_type_size=strlen(desc->mime_type);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
210 handled=1;
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
211 got_mimetype = 1;
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
212 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
213 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
214
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
215 if(filter(*data,"a=OpaqueData:buffer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
216 decoded = b64_decode(buf, decoded, &(desc->mlti_data_size));
19070
16990c298b7b more sizeof(char) fun
reynaldo
parents: 18799
diff changeset
217 desc->mlti_data=malloc(desc->mlti_data_size);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
218 memcpy(desc->mlti_data, decoded, desc->mlti_data_size);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
219 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
220 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
221 #ifdef LOG
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
222 printf("mlti_data_size: %i\n", desc->mlti_data_size);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
223 #endif
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
224 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
225
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
226 if(filter(*data,"a=ASMRuleBook:string;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
227 desc->asm_rule_book=strdup(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
228 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
229 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
230 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
231
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
232 if(!handled) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
233 #ifdef LOG
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
234 int len=strchr(*data,'\n')-(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
235 buf = xbuffer_copyin(buf, 0, *data, len+1);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
236 buf[len]=0;
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
237 printf("libreal: sdpplin_stream: not handled: '%s'\n", buf);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
238 #endif
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
239 *data=nl(*data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
240 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
241 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
242
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
243 if (!got_mimetype) {
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
244 mp_msg(MSGT_OPEN, MSGL_V, "libreal: sdpplin_stream: no mimetype\n");
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
245 desc->mime_type = strdup("audio/x-pn-realaudio");
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
246 desc->mime_type_size = strlen(desc->mime_type);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
247 if (desc->stream_id)
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
248 mp_msg(MSGT_OPEN, MSGL_WARN, "libreal: sdpplin_stream: implicit mimetype for stream_id != 0, weird.\n");
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
249 }
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
250
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
251 xbuffer_free(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
252 xbuffer_free(decoded);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
253
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
254 return desc;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
255 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
256
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
257 sdpplin_t *sdpplin_parse(char *data) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
258
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
259 sdpplin_t *desc=calloc(1,sizeof(sdpplin_t));
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
260 char *buf=xbuffer_init(32);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
261 char *decoded=xbuffer_init(32);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
262 int handled;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
263 int len;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
264
12266
096072d234c6 Some sanity and bound checking
rtognimp
parents: 9922
diff changeset
265 while (data && *data) {
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
266 #ifdef LOG
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
267 {
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
268 int len=strchr(data,'\n')-(data);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
269 buf = xbuffer_copyin(buf, 0, data, len+1);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
270 buf[len]=0;
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
271 printf("libreal: sdpplin: '%s'\n", buf);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
272 }
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
273 #endif
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
274
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
275 handled=0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
276
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
277 if (filter(data, "m=", &buf)) {
18095
5327871ea0e5 missing free in case sdpplin_parse_stream returns invalid stream.
reimar
parents: 15932
diff changeset
278 sdpplin_stream_t *stream=sdpplin_parse_stream(&data);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
279 #ifdef LOG
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
280 printf("got data for stream id %u\n", stream->stream_id);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
281 #endif
15930
f59fdc0d0d14 Do some sanity checks before writing stream information
rtognimp
parents: 15797
diff changeset
282 if (desc->stream && (stream->stream_id >= 0) && (stream->stream_id < desc->stream_count))
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
283 desc->stream[stream->stream_id]=stream;
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
284 else if (desc->stream)
18095
5327871ea0e5 missing free in case sdpplin_parse_stream returns invalid stream.
reimar
parents: 15932
diff changeset
285 {
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
286 mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: bad stream_id %d (must be >= 0, < %d). Broken sdp?\n",
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
287 stream->stream_id, desc->stream_count);
18095
5327871ea0e5 missing free in case sdpplin_parse_stream returns invalid stream.
reimar
parents: 15932
diff changeset
288 free(stream);
19093
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
289 } else {
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
290 mp_msg(MSGT_OPEN, MSGL_V, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown.\n");
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
291 if (stream->stream_id == 0) {
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
292 desc->stream_count=1;
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
293 desc->stream=malloc(sizeof(sdpplin_stream_t*));
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
294 desc->stream[0]=stream;
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
295 } else {
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
296 mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown and stream_id != 0. Broken sdp?\n");
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
297 free(stream);
aca5ce3701e9 Assume that missing streamcount means one stream, and missing mimetype
rtogni
parents: 19070
diff changeset
298 }
18095
5327871ea0e5 missing free in case sdpplin_parse_stream returns invalid stream.
reimar
parents: 15932
diff changeset
299 }
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
300 continue;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
301 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
302
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
303 if(filter(data,"a=Title:buffer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
304 decoded=b64_decode(buf, decoded, &len);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
305 desc->title=strdup(decoded);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
306 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
307 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
308 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
309
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
310 if(filter(data,"a=Author:buffer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
311 decoded=b64_decode(buf, decoded, &len);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
312 desc->author=strdup(decoded);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
313 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
314 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
315 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
316
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
317 if(filter(data,"a=Copyright:buffer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
318 decoded=b64_decode(buf, decoded, &len);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
319 desc->copyright=strdup(decoded);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
320 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
321 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
322 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
323
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
324 if(filter(data,"a=Abstract:buffer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
325 decoded=b64_decode(buf, decoded, &len);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
326 desc->abstract=strdup(decoded);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
327 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
328 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
329 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
330
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
331 if(filter(data,"a=StreamCount:integer;",&buf)) {
15930
f59fdc0d0d14 Do some sanity checks before writing stream information
rtognimp
parents: 15797
diff changeset
332 desc->stream_count=(unsigned int)atoi(buf);
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
333 desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
334 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
335 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
336 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
337
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
338 if(filter(data,"a=Flags:integer;",&buf)) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
339 desc->flags=atoi(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
340 handled=1;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
341 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
342 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
343
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
344 if(!handled) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
345 #ifdef LOG
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
346 int len=strchr(data,'\n')-data;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
347 buf = xbuffer_copyin(buf, 0, data, len+1);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
348 buf[len]=0;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
349 printf("libreal: sdpplin: not handled: '%s'\n", buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
350 #endif
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
351 data=nl(data);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
352 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
353 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
354
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
355 xbuffer_free(buf);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
356 xbuffer_free(decoded);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
357
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
358 return desc;
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
359 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
360
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
361 void sdpplin_free(sdpplin_t *description) {
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
362
21788
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
363 int i;
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
364
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
365 if (!description)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
366 return;
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
367
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
368 for (i = 0; i < description->stream_count; i++) {
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
369 if (description->stream[i]) {
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
370 if (description->stream[i]->stream_name)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
371 free(description->stream[i]->stream_name);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
372 if (description->stream[i]->mime_type)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
373 free(description->stream[i]->mime_type);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
374 if (description->stream[i]->mlti_data)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
375 free(description->stream[i]->mlti_data);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
376 if (description->stream[i]->asm_rule_book)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
377 free(description->stream[i]->asm_rule_book);
21790
7ea888a4b348 More free() that were forgotten in r21806 memleak fix
rtogni
parents: 21788
diff changeset
378 free(description->stream[i]);
21788
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
379 }
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
380 }
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
381
21790
7ea888a4b348 More free() that were forgotten in r21806 memleak fix
rtogni
parents: 21788
diff changeset
382 if(description->stream_count)
7ea888a4b348 More free() that were forgotten in r21806 memleak fix
rtogni
parents: 21788
diff changeset
383 free(description->stream);
21788
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
384 if (description->title)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
385 free(description->title);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
386 if (description->author)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
387 free(description->author);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
388 if (description->copyright)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
389 free(description->copyright);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
390 if (description->abstract)
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
391 free(description->abstract);
04281be4fbdd Memleak fix (implement sdpplin_free() and use it)
rtogni
parents: 19271
diff changeset
392
9922
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
393 free(description);
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
394 }
6cb7a295ab0e Real rstp:// streaming support, ported from xine
rtognimp
parents:
diff changeset
395