diff mbox

[FFmpeg-devel,v3] avformat/rtmpproto: change rtmp_open from url_open to url_open2

Message ID 20170317035342.95588-1-lq@chinaffmpeg.org
State Accepted
Commit 8ddadf56f621ddaeaa877e5739c03645ee7e57f8
Headers show

Commit Message

Steven Liu March 17, 2017, 3:53 a.m. UTC
use the option set by user

Reported-by: Lancelot Lai <laihy23@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/rtmpproto.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Steven Liu March 22, 2017, 10:17 a.m. UTC | #1
2017-03-17 11:53 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:

> use the option set by user
>
> Reported-by: Lancelot Lai <laihy23@gmail.com>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  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,                \
> --
> 2.10.1 (Apple Git-78)
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


Applied


Thanks
diff mbox

Patch

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,                \