This option specifies the name of live stream to subscribe.
Defaults to rtmp_playpath.
---
 doc/protocols.texi      | 3 +++
 libavformat/rtmpproto.c | 9 +++++++--
 libavformat/version.h   | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index ff872fc..9821904 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -237,6 +237,9 @@ value will be sent.
 Stream identifier to play or to publish. This option overrides the
 parameter specified in the URI.
 
+@item rtmp_subscribe
+Name of live stream to subscribe to. Defaults to rtmp_playpath.
+
 @item rtmp_swfurl
 URL of the SWF player for the media. By default no value will be sent.
 
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index c6d327f..d4e9dc4 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -91,6 +91,7 @@ typedef struct RTMPContext {
     char*         flashver;                   ///< version of the flash plugin
     char*         swfurl;                     ///< url of the swf player
     char*         pageurl;                    ///< url of the web page
+    char*         subscribe;                  ///< name of live stream to 
subscribe
     int           server_bw;                  ///< server bandwidth
     int           client_buffer_time;         ///< client buffer time in ms
     int           flush_interval;             ///< number of packets flushed 
in the same request (RTMPT only)
@@ -607,18 +608,21 @@ static int gen_bytes_read(URLContext *s, RTMPContext *rt, 
uint32_t ts)
 static int gen_fcsubscribe_stream(URLContext *s, RTMPContext *rt)
 {
     RTMPPacket pkt;
+    char *subscribe;
     uint8_t *p;
     int ret;
 
+    subscribe = rt->subscribe ? rt->subscribe : rt->playpath;
+
     if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE,
-                                     0, 27 + strlen(rt->playpath))) < 0)
+                                     0, 27 + strlen(subscribe))) < 0)
         return ret;
 
     p = pkt.data;
     ff_amf_write_string(&p, "FCSubscribe");
     ff_amf_write_number(&p, rt->nb_invokes);
     ff_amf_write_null(&p);
-    ff_amf_write_string(&p, rt->playpath);
+    ff_amf_write_string(&p, subscribe);
 
     ret = ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size,
                                rt->prev_pkt[1]);
@@ -1621,6 +1625,7 @@ static const AVOption rtmp_options[] = {
     {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, 
"rtmp_live"},
     {"rtmp_pageurl", "URL of the web page in which the media was embedded. By 
default no value will be sent.", OFFSET(pageurl), AV_OPT_TYPE_STRING, {.str = 
NULL }, 0, 0, DEC},
     {"rtmp_playpath", "Stream identifier to play or to publish", 
OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
+    {"rtmp_subscribe", "Name of live stream to subscribe to. Defaults to 
rtmp_playpath.", OFFSET(subscribe), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, 
DEC},
     {"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", 
OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},
     {"rtmp_tcurl", "URL of the target stream. Defaults to 
proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 
0, 0, DEC|ENC},
     { NULL },
diff --git a/libavformat/version.h b/libavformat/version.h
index 6a11bf9..55026e8 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR 54
 #define LIBAVFORMAT_VERSION_MINOR 13
-#define LIBAVFORMAT_VERSION_MICRO  0
+#define LIBAVFORMAT_VERSION_MICRO  1
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
1.7.11.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to