[FFmpeg-cvslog] lavf: forward protocol_whitelist for the remaining cases

Andreas Cadhalpun git at videolan.org
Fri Aug 5 17:22:07 EEST 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Wed Feb  3 01:01:34 2016 +0100| [a16018461b2f5c652b246a9aed1ab04623e96470] | committer: Michael Niedermayer

lavf: forward protocol_whitelist for the remaining cases

Also set a default_whitelist for mmsh and ffrtmphttp.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a16018461b2f5c652b246a9aed1ab04623e96470
---

 libavformat/mmsh.c     | 9 +++++++++
 libavformat/rtmphttp.c | 9 +++++++++
 libavformat/rtsp.c     | 8 ++++++++
 3 files changed, 26 insertions(+)

diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index d18e2d8..13c0ffe 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -246,6 +246,14 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim
              host, port, mmsh->request_seq++);
     av_opt_set(mms->mms_hd->priv_data, "headers", headers, 0);
 
+    if (!mms->mms_hd->protocol_whitelist && h->protocol_whitelist) {
+        mms->mms_hd->protocol_whitelist = av_strdup(h->protocol_whitelist);
+        if (!mms->mms_hd->protocol_whitelist) {
+            err = AVERROR(ENOMEM);
+            goto fail;
+        }
+    }
+
     err = ffurl_connect(mms->mms_hd, NULL);
     if (err) {
         goto fail;
@@ -410,4 +418,5 @@ const URLProtocol ff_mmsh_protocol = {
     .url_read_seek  = mmsh_read_seek,
     .priv_data_size = sizeof(MMSHContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
+    .default_whitelist = "http,tcp",
 };
diff --git a/libavformat/rtmphttp.c b/libavformat/rtmphttp.c
index 31f5d43..e5ce10c 100644
--- a/libavformat/rtmphttp.c
+++ b/libavformat/rtmphttp.c
@@ -220,6 +220,14 @@ static int rtmp_http_open(URLContext *h, const char *uri, int flags)
     av_opt_set(rt->stream->priv_data, "multiple_requests", "1", 0);
     av_opt_set_bin(rt->stream->priv_data, "post_data", "", 1, 0);
 
+    if (!rt->stream->protocol_whitelist && h->protocol_whitelist) {
+        rt->stream->protocol_whitelist = av_strdup(h->protocol_whitelist);
+        if (!rt->stream->protocol_whitelist) {
+            ret = AVERROR(ENOMEM);
+            goto fail;
+        }
+    }
+
     /* open the http context */
     if ((ret = ffurl_connect(rt->stream, NULL)) < 0)
         goto fail;
@@ -274,4 +282,5 @@ const URLProtocol ff_ffrtmphttp_protocol = {
     .priv_data_size = sizeof(RTMP_HTTPContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class= &ffrtmphttp_class,
+    .default_whitelist = "https,http,tcp,tls",
 };
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 21c80c1..15e1ab8 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1752,6 +1752,14 @@ redirect:
                  sessioncookie);
         av_opt_set(rt->rtsp_hd->priv_data, "headers", headers, 0);
 
+        if (!rt->rtsp_hd->protocol_whitelist && s->protocol_whitelist) {
+            rt->rtsp_hd->protocol_whitelist = av_strdup(s->protocol_whitelist);
+            if (!rt->rtsp_hd->protocol_whitelist) {
+                err = AVERROR(ENOMEM);
+                goto fail;
+            }
+        }
+
         /* complete the connection */
         if (ffurl_connect(rt->rtsp_hd, NULL)) {
             err = AVERROR(EIO);



More information about the ffmpeg-cvslog mailing list