On Sun, 15 Apr 2012, Samuel Pitoiset wrote:

This option is the stream identifier to play or to publish.
Sometimes the URL parser cannot determine the correct
playpath automatically, so it must be given explicitly
using this option (ie. -rtmp_playpath).
---
libavformat/rtmpproto.c |   26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)

Pushed, with minor fixups:

@@ -890,14 +891,22 @@ static int rtmp_open(URLContext *s, const char *uri, int 
flags)
        rt->app = old_app;
    }

-    if (!strchr(fname, ':') &&
-        (!strcmp(fname + strlen(fname) - 4, ".f4v") ||
-         !strcmp(fname + strlen(fname) - 4, ".mp4"))) {
-        memcpy(rt->playpath, "mp4:", 5);
-    } else {
-        rt->playpath[0] = 0;
+    if (!rt->playpath) {
+        rt->playpath = av_malloc(PLAYPATH_MAX_LENGTH);
+        if (!rt->playpath) {
+            rtmp_close(s);
+            return AVERROR(ENOMEM);
+        }
+
+        if (!strchr(fname, ':') &&
+            (!strcmp(fname + strlen(fname) - 4, ".f4v") ||
+             !strcmp(fname + strlen(fname) - 4, ".mp4"))) {
+            memcpy(rt->playpath, "mp4:", 5);
+        } else {
+            rt->playpath[0] = 0;
+        }
+        strncat(rt->playpath, fname, strlen(rt->playpath) - 5);
    }
-    strncat(rt->playpath, fname, sizeof(rt->playpath) - 5);

This shouldn't be strlen(), but PLAYPATH_MAX_LENGTH, changed before I pushed.

static const AVOption rtmp_options[] = {
    {"rtmp_app", "Name of application to connect to on the RTMP server", 
OFFSET(app), 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},
    { NULL },
};

I added ENC to this one, too, as explained in the previous mail.

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

Reply via email to