diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2012-06-17 20:24:43 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-06-17 22:56:56 +0300 |
commit | 8e50c57dcb481479f2fd46f9bdb6a9776b0d9fa6 (patch) | |
tree | 2f2fc14e25bde9931fe32829352363423b655025 /libavformat/rtmpproto.c | |
parent | 35127bf156df09ebf43f1ad7ea236653f7ba7707 (diff) | |
download | ffmpeg-8e50c57dcb481479f2fd46f9bdb6a9776b0d9fa6.tar.gz |
RTMPT protocol support
This adds two protocols, but one of them is an internal implementation
detail just used as an abstraction layer/generalization in the code. The
RTMPT protocol implementation uses rtmphttp:// as an alternative to the
tcp:// protocol. This allows moving most of the lower level logic out
from the higher level generic rtmp code.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r-- | libavformat/rtmpproto.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index b3ae5a21e6..b3e2a30f48 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1112,9 +1112,15 @@ 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 (port < 0) - port = RTMP_DEFAULT_PORT; - ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); + if (!strcmp(proto, "rtmpt")) { + /* open the http tunneling connection */ + ff_url_join(buf, sizeof(buf), "rtmphttp", NULL, hostname, port, NULL); + } else { + /* open the tcp connection */ + if (port < 0) + port = RTMP_DEFAULT_PORT; + ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL); + } if ((ret = ffurl_open(&rt->stream, buf, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL)) < 0) { @@ -1425,3 +1431,21 @@ URLProtocol ff_rtmp_protocol = { .flags = URL_PROTOCOL_FLAG_NETWORK, .priv_data_class= &rtmp_class, }; + +static const AVClass rtmpt_class = { + .class_name = "rtmpt", + .item_name = av_default_item_name, + .option = rtmp_options, + .version = LIBAVUTIL_VERSION_INT, +}; + +URLProtocol ff_rtmpt_protocol = { + .name = "rtmpt", + .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 = &rtmpt_class, +}; |