comparison rtpproto.c @ 885:da1d5db0ce5c libavformat

COSMETICS: Remove all trailing whitespace.
author diego
date Sat, 17 Dec 2005 18:14:38 +0000
parents 056991ab9f10
children d70e50f1495f
comparison
equal deleted inserted replaced
884:2ece9c9dd94c 885:da1d5db0ce5c
54 char hostname[256]; 54 char hostname[256];
55 int port; 55 int port;
56 56
57 char buf[1024]; 57 char buf[1024];
58 char path[1024]; 58 char path[1024];
59 59
60 url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, 60 url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
61 path, sizeof(path), uri); 61 path, sizeof(path), uri);
62 62
63 snprintf(buf, sizeof(buf), "udp://%s:%d%s", hostname, port, path); 63 snprintf(buf, sizeof(buf), "udp://%s:%d%s", hostname, port, path);
64 udp_set_remote_url(s->rtp_hd, buf); 64 udp_set_remote_url(s->rtp_hd, buf);
65 65
99 url_add_option(buf, buf_size, "ttl=%d", ttl); 99 url_add_option(buf, buf_size, "ttl=%d", ttl);
100 } 100 }
101 101
102 /* 102 /*
103 * url syntax: rtp://host:port[?option=val...] 103 * url syntax: rtp://host:port[?option=val...]
104 * option: 'multicast=1' : enable multicast 104 * option: 'multicast=1' : enable multicast
105 * 'ttl=n' : set the ttl value (for multicast only) 105 * 'ttl=n' : set the ttl value (for multicast only)
106 * 'localport=n' : set the local port to n 106 * 'localport=n' : set the local port to n
107 * 107 *
108 */ 108 */
109 static int rtp_open(URLContext *h, const char *uri, int flags) 109 static int rtp_open(URLContext *h, const char *uri, int flags)
112 int port, is_output, is_multicast, ttl, local_port; 112 int port, is_output, is_multicast, ttl, local_port;
113 char hostname[256]; 113 char hostname[256];
114 char buf[1024]; 114 char buf[1024];
115 char path[1024]; 115 char path[1024];
116 const char *p; 116 const char *p;
117 117
118 is_output = (flags & URL_WRONLY); 118 is_output = (flags & URL_WRONLY);
119 119
120 s = av_mallocz(sizeof(RTPContext)); 120 s = av_mallocz(sizeof(RTPContext));
121 if (!s) 121 if (!s)
122 return -ENOMEM; 122 return -ENOMEM;
123 h->priv_data = s; 123 h->priv_data = s;
124 124
125 url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, 125 url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
126 path, sizeof(path), uri); 126 path, sizeof(path), uri);
127 /* extract parameters */ 127 /* extract parameters */
128 is_multicast = 0; 128 is_multicast = 0;
129 ttl = -1; 129 ttl = -1;
130 local_port = -1; 130 local_port = -1;
145 goto fail; 145 goto fail;
146 local_port = udp_get_local_port(s->rtp_hd); 146 local_port = udp_get_local_port(s->rtp_hd);
147 /* XXX: need to open another connexion if the port is not even */ 147 /* XXX: need to open another connexion if the port is not even */
148 148
149 /* well, should suppress localport in path */ 149 /* well, should suppress localport in path */
150 150
151 build_udp_url(buf, sizeof(buf), 151 build_udp_url(buf, sizeof(buf),
152 hostname, port + 1, local_port + 1, is_multicast, ttl); 152 hostname, port + 1, local_port + 1, is_multicast, ttl);
153 if (url_open(&s->rtcp_hd, buf, flags) < 0) 153 if (url_open(&s->rtcp_hd, buf, flags) < 0)
154 goto fail; 154 goto fail;
155 155
156 /* just to ease handle access. XXX: need to suppress direct handle 156 /* just to ease handle access. XXX: need to suppress direct handle
157 access */ 157 access */
158 s->rtp_fd = udp_get_file_handle(s->rtp_hd); 158 s->rtp_fd = udp_get_file_handle(s->rtp_hd);
159 s->rtcp_fd = udp_get_file_handle(s->rtcp_hd); 159 s->rtcp_fd = udp_get_file_handle(s->rtcp_hd);
160 160
161 h->max_packet_size = url_get_max_packet_size(s->rtp_hd); 161 h->max_packet_size = url_get_max_packet_size(s->rtp_hd);
162 h->is_streamed = 1; 162 h->is_streamed = 1;
163 return 0; 163 return 0;
164 164
165 fail: 165 fail:
166 if (s->rtp_hd) 166 if (s->rtp_hd)
233 static int rtp_write(URLContext *h, uint8_t *buf, int size) 233 static int rtp_write(URLContext *h, uint8_t *buf, int size)
234 { 234 {
235 RTPContext *s = h->priv_data; 235 RTPContext *s = h->priv_data;
236 int ret; 236 int ret;
237 URLContext *hd; 237 URLContext *hd;
238 238
239 if (buf[1] >= 200 && buf[1] <= 204) { 239 if (buf[1] >= 200 && buf[1] <= 204) {
240 /* RTCP payload type */ 240 /* RTCP payload type */
241 hd = s->rtcp_hd; 241 hd = s->rtcp_hd;
242 } else { 242 } else {
243 /* RTP payload type */ 243 /* RTP payload type */