Browse code

RTMPS protocol support

Signed-off-by: Martin Storsjö <martin@martin.st>

Samuel Pitoiset authored on 2012/07/17 19:02:42
Showing 9 changed files
... ...
@@ -35,6 +35,7 @@ version <next>:
35 35
 - TechSmith Screen Codec 2 decoder
36 36
 - AAC encoding via libfdk-aac
37 37
 - Microsoft Expression Encoder Screen decoder
38
+- RTMPS protocol support
38 39
 
39 40
 
40 41
 version 0.8:
... ...
@@ -1543,6 +1543,8 @@ mmsh_protocol_select="http_protocol"
1543 1543
 mmst_protocol_deps="network"
1544 1544
 rtmp_protocol_deps="!librtmp_protocol"
1545 1545
 rtmp_protocol_select="tcp_protocol"
1546
+rtmps_protocol_deps="!librtmp_protocol"
1547
+rtmps_protocol_select="tls_protocol"
1546 1548
 rtmpt_protocol_deps="!librtmp_protocol"
1547 1549
 rtmpt_protocol_select="ffrtmphttp_protocol"
1548 1550
 rtp_protocol_select="udp_protocol"
... ...
@@ -844,7 +844,7 @@ performance on systems without hardware floating point support).
844 844
 @item pipe         @tab X
845 845
 @item RTMP         @tab X
846 846
 @item RTMPE        @tab E
847
-@item RTMPS        @tab E
847
+@item RTMPS        @tab X
848 848
 @item RTMPT        @tab X
849 849
 @item RTMPTE       @tab E
850 850
 @item RTP          @tab X
... ...
@@ -247,6 +247,13 @@ For example to read with @command{avplay} a multimedia resource named
247 247
 avplay rtmp://myserver/vod/sample
248 248
 @end example
249 249
 
250
+@section rtmps
251
+
252
+Real-Time Messaging Protocol over a secure SSL connection.
253
+
254
+The Real-Time Messaging Protocol (RTMPS) is used for streaming
255
+multimedia content across an encrypted connection.
256
+
250 257
 @section rtmpt
251 258
 
252 259
 Real-Time Messaging Protocol tunneled through HTTP.
... ...
@@ -352,6 +352,7 @@ OBJS-$(CONFIG_MMST_PROTOCOL)             += mmst.o mms.o asf.o
352 352
 OBJS-$(CONFIG_MD5_PROTOCOL)              += md5proto.o
353 353
 OBJS-$(CONFIG_PIPE_PROTOCOL)             += file.o
354 354
 OBJS-$(CONFIG_RTMP_PROTOCOL)             += rtmpproto.o rtmppkt.o
355
+OBJS-$(CONFIG_RTMPS_PROTOCOL)            += rtmpproto.o rtmppkt.o
355 356
 OBJS-$(CONFIG_RTMPT_PROTOCOL)            += rtmpproto.o rtmppkt.o
356 357
 OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
357 358
 OBJS-$(CONFIG_SCTP_PROTOCOL)             += sctp.o
... ...
@@ -258,6 +258,7 @@ void av_register_all(void)
258 258
     REGISTER_PROTOCOL (MD5,  md5);
259 259
     REGISTER_PROTOCOL (PIPE, pipe);
260 260
     REGISTER_PROTOCOL (RTMP, rtmp);
261
+    REGISTER_PROTOCOL (RTMPS, rtmps);
261 262
     REGISTER_PROTOCOL (RTMPT, rtmpt);
262 263
     REGISTER_PROTOCOL (RTP, rtp);
263 264
     REGISTER_PROTOCOL (SCTP, sctp);
... ...
@@ -25,6 +25,7 @@
25 25
 #include "avformat.h"
26 26
 
27 27
 #define RTMP_DEFAULT_PORT 1935
28
+#define RTMPS_DEFAULT_PORT 443
28 29
 
29 30
 #define RTMP_HANDSHAKE_PACKET_SIZE 1536
30 31
 
... ...
@@ -1121,6 +1121,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
1121 1121
     if (!strcmp(proto, "rtmpt")) {
1122 1122
         /* open the http tunneling connection */
1123 1123
         ff_url_join(buf, sizeof(buf), "ffrtmphttp", NULL, hostname, port, NULL);
1124
+    } else if (!strcmp(proto, "rtmps")) {
1125
+        /* open the tls connection */
1126
+        if (port < 0)
1127
+            port = RTMPS_DEFAULT_PORT;
1128
+        ff_url_join(buf, sizeof(buf), "tls", NULL, hostname, port, NULL);
1124 1129
     } else {
1125 1130
         /* open the tcp connection */
1126 1131
         if (port < 0)
... ...
@@ -1444,6 +1449,24 @@ URLProtocol ff_rtmp_protocol = {
1444 1444
     .priv_data_class= &rtmp_class,
1445 1445
 };
1446 1446
 
1447
+static const AVClass rtmps_class = {
1448
+    .class_name = "rtmps",
1449
+    .item_name  = av_default_item_name,
1450
+    .option     = rtmp_options,
1451
+    .version    = LIBAVUTIL_VERSION_INT,
1452
+};
1453
+
1454
+URLProtocol ff_rtmps_protocol = {
1455
+    .name            = "rtmps",
1456
+    .url_open        = rtmp_open,
1457
+    .url_read        = rtmp_read,
1458
+    .url_write       = rtmp_write,
1459
+    .url_close       = rtmp_close,
1460
+    .priv_data_size  = sizeof(RTMPContext),
1461
+    .flags           = URL_PROTOCOL_FLAG_NETWORK,
1462
+    .priv_data_class = &rtmps_class,
1463
+};
1464
+
1447 1465
 static const AVClass rtmpt_class = {
1448 1466
     .class_name = "rtmpt",
1449 1467
     .item_name  = av_default_item_name,
... ...
@@ -30,7 +30,7 @@
30 30
 #include "libavutil/avutil.h"
31 31
 
32 32
 #define LIBAVFORMAT_VERSION_MAJOR 54
33
-#define LIBAVFORMAT_VERSION_MINOR  7
33
+#define LIBAVFORMAT_VERSION_MINOR  8
34 34
 #define LIBAVFORMAT_VERSION_MICRO  0
35 35
 
36 36
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \