]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtmpproto.c
caf: fix 'pakt' chunk parsing
[ffmpeg] / libavformat / rtmpproto.c
index 07af403f5097fb28660316a5580bce34591f0635..5c40eb5517b948e1d7de5db666742fbcc3e9e984 100644 (file)
@@ -1111,6 +1111,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
     char *old_app;
     uint8_t buf[2048];
     int port;
+    AVDictionary *opts = NULL;
     int ret;
 
     rt->is_input = !(flags & AVIO_FLAG_WRITE);
@@ -1118,7 +1119,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
     av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
                  path, sizeof(path), s->filename);
 
-    if (!strcmp(proto, "rtmpt")) {
+    if (!strcmp(proto, "rtmpt") || !strcmp(proto, "rtmpts")) {
+        if (!strcmp(proto, "rtmpts"))
+            av_dict_set(&opts, "ffrtmphttp_tls", "1", 1);
+
         /* open the http tunneling connection */
         ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL);
     } else if (!strcmp(proto, "rtmps")) {
@@ -1134,7 +1138,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
     }
 
     if ((ret = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
-                          &s->interrupt_callback, NULL)) < 0) {
+                          &s->interrupt_callback, &opts)) < 0) {
         av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
         goto fail;
     }
@@ -1266,6 +1270,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
     return 0;
 
 fail:
+    av_dict_free(&opts);
     rtmp_close(s);
     return ret;
 }
@@ -1484,3 +1489,21 @@ URLProtocol ff_rtmpt_protocol = {
     .flags           = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &rtmpt_class,
 };
+
+static const AVClass rtmpts_class = {
+    .class_name = "rtmpts",
+    .item_name  = av_default_item_name,
+    .option     = rtmp_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
+URLProtocol ff_rtmpts_protocol = {
+    .name            = "rtmpts",
+    .url_open        = rtmp_open,
+    .url_read        = rtmp_read,
+    .url_write       = rtmp_write,
+    .url_close       = rtmp_close,
+    .priv_data_size  = sizeof(RTMPContext),
+    .flags           = URL_PROTOCOL_FLAG_NETWORK,
+    .priv_data_class = &rtmpts_class,
+};