mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-16 04:11:12 +00:00
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>
This commit is contained in:
parent
aee046a895
commit
8ddadf56f6
@ -2604,14 +2604,13 @@ static int inject_fake_duration_metadata(RTMPContext *rt)
|
|||||||
* and 'playpath' is a file name (the rest of the path,
|
* and 'playpath' is a file name (the rest of the path,
|
||||||
* may be prefixed with "mp4:")
|
* 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;
|
RTMPContext *rt = s->priv_data;
|
||||||
char proto[8], hostname[256], path[1024], auth[100], *fname;
|
char proto[8], hostname[256], path[1024], auth[100], *fname;
|
||||||
char *old_app, *qmark, *n, fname_buffer[1024];
|
char *old_app, *qmark, *n, fname_buffer[1024];
|
||||||
uint8_t buf[2048];
|
uint8_t buf[2048];
|
||||||
int port;
|
int port;
|
||||||
AVDictionary *opts = NULL;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (rt->listen_timeout > 0)
|
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, "rtmpt") || !strcmp(proto, "rtmpts")) {
|
||||||
if (!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 */
|
/* open the http tunneling connection */
|
||||||
ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL);
|
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);
|
ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL);
|
||||||
} else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) {
|
} else if (!strcmp(proto, "rtmpe") || (!strcmp(proto, "rtmpte"))) {
|
||||||
if (!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 */
|
/* open the encrypted connection */
|
||||||
ff_url_join(buf, sizeof(buf), "ffrtmpcrypt", NULL, hostname, port, NULL);
|
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:
|
reconnect:
|
||||||
if ((ret = ffurl_open_whitelist(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
|
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) {
|
s->protocol_whitelist, s->protocol_blacklist, s)) < 0) {
|
||||||
av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
|
av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -2896,7 +2895,7 @@ reconnect:
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
av_dict_free(&opts);
|
av_dict_free(opts);
|
||||||
rtmp_close(s);
|
rtmp_close(s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -3141,7 +3140,7 @@ static const AVClass flavor##_class = { \
|
|||||||
\
|
\
|
||||||
const URLProtocol ff_##flavor##_protocol = { \
|
const URLProtocol ff_##flavor##_protocol = { \
|
||||||
.name = #flavor, \
|
.name = #flavor, \
|
||||||
.url_open = rtmp_open, \
|
.url_open2 = rtmp_open, \
|
||||||
.url_read = rtmp_read, \
|
.url_read = rtmp_read, \
|
||||||
.url_read_seek = rtmp_seek, \
|
.url_read_seek = rtmp_seek, \
|
||||||
.url_read_pause = rtmp_pause, \
|
.url_read_pause = rtmp_pause, \
|
||||||
|
Loading…
Reference in New Issue
Block a user