Revision 21a569f3 libavformat/udp.c

View differences:

libavformat/udp.c
245 245
int udp_set_remote_url(URLContext *h, const char *uri)
246 246
{
247 247
    UDPContext *s = h->priv_data;
248
    char hostname[256];
248
    char hostname[256], buf[10];
249 249
    int port;
250
    const char *p;
250 251

  
251 252
    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
252 253

  
......
256 257
        return AVERROR(EIO);
257 258
    }
258 259
    s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr);
260
    p = strchr(uri, '?');
261
    if (p) {
262
        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
263
            int was_connected = s->is_connected;
264
            s->is_connected = strtol(buf, NULL, 10);
265
            if (s->is_connected && !was_connected) {
266
                if (connect(s->udp_fd, (struct sockaddr *) &s->dest_addr,
267
                            s->dest_addr_len)) {
268
                    s->is_connected = 0;
269
                    av_log(NULL, AV_LOG_ERROR, "connect: %s\n", strerror(errno));
270
                    return AVERROR(EIO);
271
                }
272
            }
273
        }
274
    }
259 275

  
260 276
    return 0;
261 277
}

Also available in: Unified diff