[rtmpdump] r320 - in trunk: rtmpdump.c rtmpgw.c

hyc subversion at mplayerhq.hu
Wed Mar 10 08:04:30 CET 2010


Author: hyc
Date: Wed Mar 10 08:04:29 2010
New Revision: 320

Log:
Fix default ports

Modified:
   trunk/rtmpdump.c
   trunk/rtmpgw.c

Modified: trunk/rtmpdump.c
==============================================================================
--- trunk/rtmpdump.c	Wed Mar 10 07:57:31 2010	(r319)
+++ trunk/rtmpdump.c	Wed Mar 10 08:04:29 2010	(r320)
@@ -1607,22 +1607,28 @@ main(int argc, char **argv)
       return RD_FAILED;
     }
 
+  if (protocol == RTMP_PROTOCOL_UNDEFINED)
+    {
+      Log(LOGWARNING,
+	  "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP");
+      protocol = RTMP_PROTOCOL_RTMP;
+    }
   if (port == -1)
     {
       Log(LOGWARNING,
 	  "You haven't specified a port (--port) or rtmp url (-r), using default port 1935");
-      port = 1935;
+      port = 0;
     }
   if (port == 0)
     {
-      port = 1935;
-    }
-  if (protocol == RTMP_PROTOCOL_UNDEFINED)
-    {
-      Log(LOGWARNING,
-	  "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP");
-      protocol = RTMP_PROTOCOL_RTMP;
+      if (protocol & RTMP_FEATURE_SSL)
+	port = 443;
+      else if (protocol & RTMP_FEATURE_HTTP)
+	port = 80;
+      else
+	port = 1935;
     }
+
   if (flvFile == 0)
     {
       Log(LOGWARNING,

Modified: trunk/rtmpgw.c
==============================================================================
--- trunk/rtmpgw.c	Wed Mar 10 07:57:31 2010	(r319)
+++ trunk/rtmpgw.c	Wed Mar 10 08:04:29 2010	(r320)
@@ -673,32 +673,38 @@ void processTCPrequest(STREAMING_SERVER 
       goto filenotfound;;
     }
 
-  if (req.rtmpport == -1)
-    {
-      Log(LOGWARNING,
-	  "You haven't specified a port (--port) or rtmp url (-r), using default port 1935");
-      req.rtmpport = 1935;
-    }
   if (req.protocol == RTMP_PROTOCOL_UNDEFINED)
     {
       Log(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)
+    {
+      Log(LOGWARNING,
+	  "You haven't specified a port (--port) or rtmp url (-r), using default port");
+      req.rtmpport = 0;
+    }
+  if (req.rtmpport == 0)
+    {
+      if (req.protocol & RTMP_FEATURE_SSL)
+	req.rtmpport = 443;
+      else if (req.protocol & RTMP_FEATURE_HTTP)
+	req.rtmpport = 80;
+      else
+	req.rtmpport = 1935;
+    }
 
   if (req.tcUrl.av_len == 0 && req.app.av_len != 0)
     {
       char str[512] = { 0 };
-      snprintf(str, 511, "%s://%s/%s", RTMPProtocolStringsLower[req.protocol],
-	       req.hostname, req.app.av_val);
+      snprintf(str, 511, "%s://%s:%d/%s", RTMPProtocolStringsLower[req.protocol],
+	       req.hostname, req.rtmpport, req.app.av_val);
       req.tcUrl.av_len = strlen(str);
       req.tcUrl.av_val = (char *) malloc(req.tcUrl.av_len + 1);
       strcpy(req.tcUrl.av_val, str);
     }
 
-  if (req.rtmpport == 0)
-    req.rtmpport = 1935;
-
   if (req.swfVfy)
     {
         if (RTMP_HashSWF(req.swfUrl.av_val, &req.swfSize, req.hash, req.swfAge) == 0)


More information about the rtmpdump mailing list