]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtspdec.c
configure: Drop weak dependencies on external libraries for webm muxer
[ffmpeg] / libavformat / rtspdec.c
index bb9c67473a72621e0d9121a61b69bcb25b0b0fb7..8e8b3403e5a4637557af019ac52329eefa051746 100644 (file)
@@ -32,6 +32,7 @@
 #include "rtpproto.h"
 #include "rtsp.h"
 #include "rdt.h"
+#include "tls.h"
 #include "url.h"
 
 static const struct RTSPStatusMessage {
@@ -113,7 +114,7 @@ static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code,
     if (extracontent)
         av_strlcat(message, extracontent, sizeof(message));
     av_strlcat(message, "\r\n", sizeof(message));
-    av_dlog(s, "Sending response:\n%s", message);
+    av_log(s, AV_LOG_TRACE, "Sending response:\n%s", message);
     ffurl_write(rt->rtsp_hd_out, message, strlen(message));
 
     return 0;
@@ -149,8 +150,8 @@ static inline int rtsp_read_request(AVFormatContext *s,
         if (ret)
             return ret;
         if (rbuflen > 1) {
-            av_dlog(s, "Parsing[%d]: %s\n", rbuflen, rbuf);
-            ff_rtsp_parse_line(request, rbuf, rt, method);
+            av_log(s, AV_LOG_TRACE, "Parsing[%d]: %s\n", rbuflen, rbuf);
+            ff_rtsp_parse_line(s, request, rbuf, rt, method);
         }
     } while (rbuflen > 0);
     if (request->seq != rt->seq + 1) {
@@ -292,9 +293,9 @@ static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl)
             snprintf(buf, sizeof(buf), "%d", rt->buffer_size);
             av_dict_set(&opts, "buffer_size", buf, 0);
             ff_url_join(url, sizeof(url), "rtp", NULL, host, localport, NULL);
-            av_dlog(s, "Opening: %s", url);
+            av_log(s, AV_LOG_TRACE, "Opening: %s", url);
             ret = ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
-                             &s->interrupt_callback, &opts);
+                             &s->interrupt_callback, &opts, rt->protocols, NULL);
             av_dict_free(&opts);
             if (ret)
                 localport += 2;
@@ -304,7 +305,7 @@ static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl)
             return ret;
         }
 
-        av_dlog(s, "Listening on: %d",
+        av_log(s, AV_LOG_TRACE, "Listening on: %d",
                 ff_rtp_get_local_rtp_port(rtsp_st->rtp_handle));
         if ((ret = ff_rtsp_open_transport_ctx(s, rtsp_st))) {
             rtsp_send_reply(s, RTSP_STATUS_TRANSPORT, NULL, request.seq);
@@ -638,6 +639,13 @@ static int rtsp_listen(AVFormatContext *s)
     int ret;
     enum RTSPMethod methodcode;
 
+    if (!rt->protocols) {
+        rt->protocols = ffurl_get_protocols(s->protocol_whitelist,
+                                            s->protocol_blacklist);
+        if (!rt->protocols)
+            return AVERROR(ENOMEM);
+    }
+
     /* extract hostname and port */
     av_url_split(proto, sizeof(proto), auth, sizeof(auth), host, sizeof(host),
                  &port, path, sizeof(path), s->filename);
@@ -659,7 +667,7 @@ static int rtsp_listen(AVFormatContext *s)
                 "?listen&listen_timeout=%d", rt->initial_timeout * 1000);
 
     if (ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
-                         &s->interrupt_callback, NULL)) {
+                         &s->interrupt_callback, NULL, rt->protocols, NULL)) {
         av_log(s, AV_LOG_ERROR, "Unable to open RTSP for listening\n");
         return ret;
     }
@@ -692,7 +700,6 @@ static int rtsp_listen(AVFormatContext *s)
             return AVERROR_INVALIDDATA;
         }
     }
-    return 0;
 }
 
 static int rtsp_probe(AVProbeData *p)
@@ -750,7 +757,7 @@ int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
     int id, len, i, ret;
     RTSPStream *rtsp_st;
 
-    av_dlog(s, "tcp_read_packet:\n");
+    av_log(s, AV_LOG_TRACE, "tcp_read_packet:\n");
 redo:
     for (;;) {
         RTSPMessageHeader reply;
@@ -769,7 +776,7 @@ redo:
         return -1;
     id  = buf[0];
     len = AV_RB16(buf + 1);
-    av_dlog(s, "id=%d len=%d\n", id, len);
+    av_log(s, AV_LOG_TRACE, "id=%d len=%d\n", id, len);
     if (len > buf_size || len < 12)
         goto redo;
     /* get the data */