From 88d2e1238610a9b72b0bbd64716bcb866d6d8d38 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Fri, 28 Sep 2012 11:59:09 -0400
Subject: [PATCH 1/1] rtpproto: add "reuse" option
---
libavformat/rtpproto.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 17b0f64..c17ac80 100644
|
a
|
b
|
static av_printf_format(3, 4) void url_add_option(char *buf, int buf_size, const |
| 102 | 102 | static void build_udp_url(char *buf, int buf_size, |
| 103 | 103 | const char *hostname, int port, |
| 104 | 104 | int local_port, int ttl, |
| 105 | | int max_packet_size, int connect) |
| | 105 | int max_packet_size, int connect, |
| | 106 | int reuse) |
| 106 | 107 | { |
| 107 | 108 | ff_url_join(buf, buf_size, "udp", NULL, hostname, port, NULL); |
| 108 | 109 | if (local_port >= 0) |
| … |
… |
static void build_udp_url(char *buf, int buf_size, |
| 113 | 114 | url_add_option(buf, buf_size, "pkt_size=%d", max_packet_size); |
| 114 | 115 | if (connect) |
| 115 | 116 | url_add_option(buf, buf_size, "connect=1"); |
| | 117 | if (reuse) |
| | 118 | url_add_option(buf, buf_size, "reuse=1"); |
| 116 | 119 | url_add_option(buf, buf_size, "fifo_size=0"); |
| 117 | 120 | } |
| 118 | 121 | |
| … |
… |
static int rtp_open(URLContext *h, const char *uri, int flags) |
| 137 | 140 | { |
| 138 | 141 | RTPContext *s = h->priv_data; |
| 139 | 142 | int rtp_port, rtcp_port, |
| 140 | | ttl, connect, |
| | 143 | ttl, connect, reuse, |
| 141 | 144 | local_rtp_port, local_rtcp_port, max_packet_size; |
| 142 | 145 | char hostname[256]; |
| 143 | 146 | char buf[1024]; |
| … |
… |
static int rtp_open(URLContext *h, const char *uri, int flags) |
| 153 | 156 | local_rtcp_port = -1; |
| 154 | 157 | max_packet_size = -1; |
| 155 | 158 | connect = 0; |
| | 159 | reuse = 0; |
| 156 | 160 | |
| 157 | 161 | p = strchr(uri, '?'); |
| 158 | 162 | if (p) { |
| … |
… |
static int rtp_open(URLContext *h, const char *uri, int flags) |
| 177 | 181 | if (av_find_info_tag(buf, sizeof(buf), "connect", p)) { |
| 178 | 182 | connect = strtol(buf, NULL, 10); |
| 179 | 183 | } |
| | 184 | if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) { |
| | 185 | reuse = strtol(buf, NULL, 10); |
| | 186 | } |
| 180 | 187 | } |
| 181 | 188 | |
| 182 | 189 | build_udp_url(buf, sizeof(buf), |
| 183 | 190 | hostname, rtp_port, local_rtp_port, ttl, max_packet_size, |
| 184 | | connect); |
| | 191 | connect, reuse); |
| 185 | 192 | if (ffurl_open(&s->rtp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) |
| 186 | 193 | goto fail; |
| 187 | 194 | if (local_rtp_port>=0 && local_rtcp_port<0) |
| … |
… |
static int rtp_open(URLContext *h, const char *uri, int flags) |
| 189 | 196 | |
| 190 | 197 | build_udp_url(buf, sizeof(buf), |
| 191 | 198 | hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size, |
| 192 | | connect); |
| | 199 | connect, 0); |
| 193 | 200 | if (ffurl_open(&s->rtcp_hd, buf, flags, &h->interrupt_callback, NULL) < 0) |
| 194 | 201 | goto fail; |
| 195 | 202 | |