avformat/rtmpproto: change rtmp_open from url_open to url_open2

use the option set by user

Reported-by: Lancelot Lai <laihy23@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
pull/244/merge
Steven Liu 8 years ago
parent aee046a895
commit 8ddadf56f6
  1. 13
      libavformat/rtmpproto.c

@ -2604,14 +2604,13 @@ static int inject_fake_duration_metadata(RTMPContext *rt)
* and 'playpath' is a file name (the rest of the path,
* may be prefixed with "mp4:")
*/
static int rtmp_open(URLContext *s, const char *uri, int flags)
static int rtmp_open(URLContext *s, const char *uri, int flags, AVDictionary **opts)
{
RTMPContext *rt = s->priv_data;
char proto[8], hostname[256], path[1024], auth[100], *fname;
char *old_app, *qmark, *n, fname_buffer[1024];
uint8_t buf[2048];
int port;
AVDictionary *opts = NULL;
int ret;
if (rt->listen_timeout > 0)
@ -2648,7 +2647,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
}
if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) {
if (!strcmp(proto, "rtmpts"))
av_dict_set(&opts, "ffrtmphttp_tls", "1", 1);
av_dict_set(opts, "ffrtmphttp_tls", "1", 1);
/* open the http tunneling connection */
ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL);
@ -2659,7 +2658,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL);
} else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) {
if (!strcmp(proto, "rtmpte"))
av_dict_set(&opts, "ffrtmpcrypt_tunneling", "1", 1);
av_dict_set(opts, "ffrtmpcrypt_tunneling", "1", 1);
/* open the encrypted connection */
ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, hostname, port, NULL);
@ -2678,7 +2677,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
reconnect:
if ((ret = ffurl_open_whitelist(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, &opts,
&s->interrupt_callback, opts,
s->protocol_whitelist, s->protocol_blacklist, s)) < 0) {
av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
goto fail;
@ -2896,7 +2895,7 @@ reconnect:
return 0;
fail:
av_dict_free(&opts);
av_dict_free(opts);
rtmp_close(s);
return ret;
}
@ -3141,7 +3140,7 @@ static const AVClass flavor##_class = { \
\
const URLProtocol ff_##flavor##_protocol = { \
.name = #flavor, \
.url_open = rtmp_open, \
.url_open2 = rtmp_open, \
.url_read = rtmp_read, \
.url_read_seek = rtmp_seek, \
.url_read_pause = rtmp_pause, \

Loading…
Cancel
Save