[rtmpdump] branch master updated. 75a6167 Fix bogus optarg refs in prev commit

gitolite gil at avcodec.org
Tue Oct 30 16:20:39 CET 2012


The branch, master has been updated
       via  75a6167863bc415845b9130d6f8f437cbdc185f7 (commit)
       via  3fcbcb9a0bae6de03401f32939d3d243cdd7b865 (commit)
      from  87d47b876f818fe5c949e08c699238bc22a3c7b1 (commit)


- Log -----------------------------------------------------------------
commit 75a6167863bc415845b9130d6f8f437cbdc185f7
Author:     Howard Chu <hyc at highlandsun.com>
AuthorDate: Tue Oct 30 08:20:14 2012 -0700
Commit:     Howard Chu <hyc at highlandsun.com>
CommitDate: Tue Oct 30 08:20:14 2012 -0700

    Fix bogus optarg refs in prev commit

diff --git a/rtmpgw.c b/rtmpgw.c
index ab255d4..3e47602 100644
--- a/rtmpgw.c
+++ b/rtmpgw.c
@@ -921,7 +921,7 @@ ParseOption(char opt, char *arg, RTMP_REQUEST * req)
 	break;
       }
     case 'i':
-      STR2AVAL(req->fullUrl, optarg);
+      STR2AVAL(req->fullUrl, arg);
       break;
     case 's':
       STR2AVAL(req->swfUrl, arg);
@@ -942,7 +942,7 @@ ParseOption(char opt, char *arg, RTMP_REQUEST * req)
       STR2AVAL(req->auth, arg);
       break;
     case 'C':
-      parseAMF(&req->extras, optarg, &req->edepth);
+      parseAMF(&req->extras, arg, &req->edepth);
       break;
     case 'm':
       req->timeout = atoi(arg);

commit 3fcbcb9a0bae6de03401f32939d3d243cdd7b865
Author:     Bastien Nocera <hadess at hadess.net>
AuthorDate: Thu Jul 19 17:22:03 2012 +0100
Commit:     Howard Chu <hyc at highlandsun.com>
CommitDate: Tue Oct 30 08:18:09 2012 -0700

    Make rtmpgw handle full RTMP URLs with "-i"
    
    or --url. Just as rtmpdump and librtmp already can.

diff --git a/rtmpgw.c b/rtmpgw.c
index 0cf56bb..ab255d4 100644
--- a/rtmpgw.c
+++ b/rtmpgw.c
@@ -85,6 +85,7 @@ typedef struct
   uint32_t bufferTime;
 
   char *rtmpurl;
+  AVal fullUrl;
   AVal playpath;
   AVal swfUrl;
   AVal tcUrl;
@@ -469,14 +470,14 @@ void processTCPrequest(STREAMING_SERVER * server,	// server socket and state (ou
     }
 
   // do necessary checks right here to make sure the combined request of default values and GET parameters is correct
-  if (!req.hostname.av_len)
+  if (!req.hostname.av_len && !req.fullUrl.av_len)
     {
       RTMP_Log(RTMP_LOGERROR,
 	  "You must specify a hostname (--host) or url (-r \"rtmp://host[:port]/playpath\") containing a hostname");
       status = "400 Missing Hostname";
       goto filenotfound;
     }
-  if (req.playpath.av_len == 0)
+  if (req.playpath.av_len == 0 && !req.fullUrl.av_len)
     {
       RTMP_Log(RTMP_LOGERROR,
 	  "You must specify a playpath (--playpath) or url (-r \"rtmp://host[:port]/playpath\") containing a playpath");
@@ -484,19 +485,19 @@ void processTCPrequest(STREAMING_SERVER * server,	// server socket and state (ou
       goto filenotfound;;
     }
 
-  if (req.protocol == RTMP_PROTOCOL_UNDEFINED)
+  if (req.protocol == RTMP_PROTOCOL_UNDEFINED && !req.fullUrl.av_len)
     {
       RTMP_Log(RTMP_LOGWARNING,
 	  "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP");
       req.protocol = RTMP_PROTOCOL_RTMP;
     }
-  if (req.rtmpport == -1)
+  if (req.rtmpport == -1 && !req.fullUrl.av_len)
     {
       RTMP_Log(RTMP_LOGWARNING,
 	  "You haven't specified a port (--port) or rtmp url (-r), using default port");
       req.rtmpport = 0;
     }
-  if (req.rtmpport == 0)
+  if (req.rtmpport == 0 && !req.fullUrl.av_len)
     {
       if (req.protocol & RTMP_FEATURE_SSL)
 	req.rtmpport = 443;
@@ -552,9 +553,20 @@ void processTCPrequest(STREAMING_SERVER * server,	// server socket and state (ou
   RTMP_Log(RTMP_LOGDEBUG, "Setting buffer time to: %dms", req.bufferTime);
   RTMP_Init(&rtmp);
   RTMP_SetBufferMS(&rtmp, req.bufferTime);
-  RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost,
-		   &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset,
-		   req.bLiveStream, req.timeout);
+  if (!req.fullUrl.av_len)
+    {
+      RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost,
+		       &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset,
+		       req.bLiveStream, req.timeout);
+    }
+  else
+    {
+      if (RTMP_SetupURL(&rtmp, req.fullUrl.av_val) == FALSE)
+        {
+          RTMP_Log(RTMP_LOGERROR, "Couldn't parse URL: %s", req.fullUrl.av_val);
+          return;
+        }
+    }
   /* backward compatibility, we always sent this as true before */
   if (req.auth.av_len)
     rtmp.Link.lFlags |= RTMP_LF_AUTH;
@@ -908,6 +920,9 @@ ParseOption(char opt, char *arg, RTMP_REQUEST * req)
 	  }
 	break;
       }
+    case 'i':
+      STR2AVAL(req->fullUrl, optarg);
+      break;
     case 's':
       STR2AVAL(req->swfUrl, arg);
       break;
@@ -993,6 +1008,7 @@ main(int argc, char **argv)
   int opt;
   struct option longopts[] = {
     {"help", 0, NULL, 'h'},
+    {"url", 1, NULL, 'i'},
     {"host", 1, NULL, 'n'},
     {"port", 1, NULL, 'c'},
     {"socks", 1, NULL, 'S'},
@@ -1040,7 +1056,7 @@ main(int argc, char **argv)
 
   while ((opt =
 	  getopt_long(argc, argv,
-		      "hvqVzr:s:t:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts,
+		      "hvqVzr:s:t:i:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts,
 		      NULL)) != -1)
     {
       switch (opt)
@@ -1050,6 +1066,8 @@ main(int argc, char **argv)
 	    ("\nThis program serves media content streamed from RTMP onto HTTP.\n\n");
 	  RTMP_LogPrintf("--help|-h               Prints this help screen.\n");
 	  RTMP_LogPrintf
+	    ("--url|-i url            URL with options included (e.g. rtmp://host[:port]/path swfUrl=url tcUrl=url)\n");
+	  RTMP_LogPrintf
 	    ("--rtmp|-r url           URL (e.g. rtmp://host[:port]/path)\n");
 	  RTMP_LogPrintf
 	    ("--host|-n hostname      Overrides the hostname in the rtmp url\n");

-----------------------------------------------------------------------

Summary of changes:
 rtmpgw.c |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)


hooks/post-receive
-- 



More information about the rtmpdump mailing list