From patchwork Fri Mar 17 03:53:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 2980 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp86112vsy; Thu, 16 Mar 2017 20:54:06 -0700 (PDT) X-Received: by 10.28.169.199 with SMTP id s190mr762889wme.2.1489722845934; Thu, 16 Mar 2017 20:54:05 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g10si1370042wme.166.2017.03.16.20.54.05; Thu, 16 Mar 2017 20:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04CCB688290; Fri, 17 Mar 2017 05:53:45 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy19.qq.com (smtpproxy19.qq.com [184.105.206.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 637C06882D3 for ; Fri, 17 Mar 2017 05:53:36 +0200 (EET) X-QQ-mid: bizesmtp1t1489722825tv5nzjk1z Received: from localhost (unknown [123.120.42.140]) by esmtp4.qq.com (ESMTP) with id ; Fri, 17 Mar 2017 11:53:44 +0800 (CST) X-QQ-SSF: 01100000000000F0F930B00A0000000 X-QQ-FEAT: oP8qruwI8aWCWzZ4aKGNEeF9XNGDSYqzwLoO77HqVPQ85TpVPBK+kX6QwqdTE JRpXL8i6EfRo1TZdwJ/TbDSIYpkrtrjsVJdnPfEiIKuyASSSNiOuI5dEK2CcUbEBib00Vj9 n5IhA9QK54+dfafM5w7HwRJ3B87qwJdmcInXpw6IEDqDVWBGUpIIImKTJHsVmv8Vp1MIIql MKxf0mRgTHKsX5Nlizc4FdozIyjLblMwBxzGRpwl90PWVM6K3rerExMCcfj97phB2yBTG5b xbkv284XsNKOLO X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 Mar 2017 11:53:42 +0800 Message-Id: <20170317035342.95588-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1 (Apple Git-78) X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v3] avformat/rtmpproto: change rtmp_open from url_open to url_open2 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" use the option set by user Reported-by: Lancelot Lai Signed-off-by: Steven Liu --- libavformat/rtmpproto.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 5d7ad79..7b2bd81 100644 --- a/libavformat/rtmpproto.c +++ b/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, \