Makes the two protocols nearly seamless.
---
It isn't complete and some options might be mapped in better ways.
libavformat/librtmp.c | 114
++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 111 insertions(+), 3 deletions(-)
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index 7133bd6..1996ba9 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -37,7 +37,21 @@ typedef struct LibRTMPContext {
const AVClass *class;
RTMP rtmp;
char *app;
+ char *conn;
+ char *subscribe;
char *playpath;
+ char *tcurl; ///< url of the target stream
+ char *flashver; ///< version of the flash plugin
+ char *swfhash; ///< SHA256 hash of the
decompressed SWF file (32 bytes)
+ char *swfurl;
+ char *swfverify;
+ char *pageurl;
+ char *client_buffer_time;
+ int flush_interval;
+ int swfsize;
+ int live;
+ int listen;
+ int listen_timeout;
} LibRTMPContext;
static void rtmp_log(int level, const char *fmt, va_list args)
@@ -99,7 +113,40 @@ static int rtmp_open(URLContext *s, const char
*uri, int flags)
if (ctx->app || ctx->playpath) {
int len = strlen(s->filename) + 1;
if (ctx->app) len += strlen(ctx->app) + sizeof("
app=");
- if (ctx->playpath) len += strlen(ctx->playpath) + sizeof("
playpath=");
+ if (ctx->tcurl) len += strlen(ctx->tcurl) + sizeof("
tcUrl=");
+ if (ctx->pageurl) len += strlen(ctx->pageurl) + sizeof("
pageUrl=");
+ if (ctx->swfurl) len += strlen(ctx->swfurl) + sizeof("
swfUrl=");
+ if (ctx->flashver) len += strlen(ctx->flashver) + sizeof("
flashver=");
+
+ if (ctx->conn) {
+ char *sep, *p = ctx->conn;
+ int options = 0;
+
+ while (p) {
+ options++;
+ p += strspn(p, " ");
+ if (!*p)
+ break;
+ sep = strchr(p, ' ');
+ if (sep)
+ p = sep + 1;
+ else
+ break;
+ }
+ len += options * sizeof(" conn=");
+ len += strlen(ctx->conn);
+ }
+
+ if (ctx->playpath)
+ len += strlen(ctx->playpath) + sizeof(" playpath=");
+ if (ctx->live)
+ len += sizeof(" live=1");
+ if (ctx->subscribe)
+ len += strlen(ctx->subscribe) + sizeof(" subscribe=");
+
+ if (ctx->client_buffer_time)
+ len += strlen(ctx->client_buffer_time) + sizeof(" buffer=");
+
if (!(filename = av_malloc(len)))
return AVERROR(ENOMEM);
@@ -109,10 +156,53 @@ static int rtmp_open(URLContext *s, const char
*uri, int flags)
av_strlcat(filename, " app=", len);
av_strlcat(filename, ctx->app, len);
}
+ if (ctx->tcurl) {
+ av_strlcat(filename, " tcUrl=", len);
+ av_strlcat(filename, ctx->tcurl, len);
+ }
+ if (ctx->pageurl) {
+ av_strlcat(filename, " pageUrl=", len);
+ av_strlcat(filename, ctx->pageurl, len);
+ }
+ if (ctx->swfurl) {
+ av_strlcat(filename, " swfUrl=", len);
+ av_strlcat(filename, ctx->pageurl, len);
+ }
+ if (ctx->flashver) {
+ av_strlcat(filename, " flashVer=", len);
+ av_strlcat(filename, ctx->flashver, len);
+ }
+ if (ctx->conn) {
+ char *sep, *p = ctx->conn;
+ while (p) {
+ av_strlcat(filename, " conn=", len);
+ p += strspn(p, " ");
+ if (!*p)
+ break;
+ sep = strchr(p, ' ');
+ if (sep)
+ *sep = '\0';
+ av_strlcat(filename, p, len);
+
+ if (sep)
+ p = sep + 1;
+ }
+ }