[rtmpdump] r313 - in trunk: librtmp/rtmp.c librtmp/rtmp.h rtmpdump.c rtmpgw.c

hyc subversion at mplayerhq.hu
Mon Mar 8 23:44:56 CET 2010


Author: hyc
Date: Mon Mar  8 23:44:55 2010
New Revision: 313

Log:
Move Default flashVer into library, let SetupStream set the default

Modified:
   trunk/librtmp/rtmp.c
   trunk/librtmp/rtmp.h
   trunk/rtmpdump.c
   trunk/rtmpgw.c

Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c	Mon Mar  8 16:31:32 2010	(r312)
+++ trunk/librtmp/rtmp.c	Mon Mar  8 23:44:55 2010	(r313)
@@ -198,6 +198,21 @@ RTMP_UpdateBufferMS(RTMP * r)
   RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS);
 }
 
+#undef OSS
+#ifdef WIN32
+#define OSS	"WIN"
+#elif defined(__sun__)
+#define OSS	"SOL"
+#elif defined(__APPLE__)
+#define OSS	"MAC"
+#elif defined(__linux__)
+#define OSS	"LNX"
+#else
+#define OSS	"GNU"
+#endif
+static const char DEFAULT_FLASH_VER[] = OSS " 10,0,32,18";
+const AVal RTMP_DefaultFlashVer = {(char *)DEFAULT_FLASH_VER, sizeof(DEFAULT_FLASH_VER)-1};
+
 void
 RTMP_SetupStream(RTMP * r,
 		 int protocol,
@@ -224,19 +239,19 @@ RTMP_SetupStream(RTMP * r,
   Log(LOGDEBUG, "Port     : %d", port);
   Log(LOGDEBUG, "Playpath : %s", playpath->av_val);
 
-  if (tcUrl)
+  if (tcUrl && tcUrl->av_val)
     Log(LOGDEBUG, "tcUrl    : %s", tcUrl->av_val);
-  if (swfUrl)
+  if (swfUrl && swfUrl->av_val)
     Log(LOGDEBUG, "swfUrl   : %s", swfUrl->av_val);
-  if (pageUrl)
+  if (pageUrl && pageUrl->av_val)
     Log(LOGDEBUG, "pageUrl  : %s", pageUrl->av_val);
-  if (app)
+  if (app && app->av_val)
     Log(LOGDEBUG, "app      : %.*s", app->av_len, app->av_val);
-  if (auth)
+  if (auth && auth->av_val)
     Log(LOGDEBUG, "auth     : %s", auth->av_val);
-  if (subscribepath)
+  if (subscribepath && subscribepath->av_val)
     Log(LOGDEBUG, "subscribepath : %s", subscribepath->av_val);
-  if (flashVer)
+  if (flashVer && flashVer->av_val)
     Log(LOGDEBUG, "flashVer : %s", flashVer->av_val);
   if (dTime > 0)
     Log(LOGDEBUG, "SeekTime      : %.3f sec", (double) dTime / 1000.0);
@@ -282,19 +297,21 @@ RTMP_SetupStream(RTMP * r,
       r->Link.socksport = 0;
     }
 
-  if (tcUrl)
+  if (tcUrl && tcUrl->av_len)
     r->Link.tcUrl = *tcUrl;
-  if (swfUrl)
+  if (swfUrl && swfUrl->av_len)
     r->Link.swfUrl = *swfUrl;
-  if (pageUrl)
+  if (pageUrl && pageUrl->av_len)
     r->Link.pageUrl = *pageUrl;
-  if (app)
+  if (app && app->av_len)
     r->Link.app = *app;
-  if (auth)
+  if (auth && auth->av_len)
     r->Link.auth = *auth;
-  if (flashVer)
+  if (flashVer && flashVer->av_len)
     r->Link.flashVer = *flashVer;
-  if (subscribepath)
+  else
+    r->Link.flashVer = RTMP_DefaultFlashVer;
+  if (subscribepath && subscribepath->av_len)
     r->Link.subscribepath = *subscribepath;
   r->Link.seekTime = dTime;
   r->Link.length = dLength;

Modified: trunk/librtmp/rtmp.h
==============================================================================
--- trunk/librtmp/rtmp.h	Mon Mar  8 16:31:32 2010	(r312)
+++ trunk/librtmp/rtmp.h	Mon Mar  8 23:44:55 2010	(r313)
@@ -74,6 +74,7 @@ extern "C" {
 #define	RTMP_CHANNELS	65600
 
 extern const char RTMPProtocolStringsLower[][7];
+extern const AVal RTMP_DefaultFlashVer;
 extern bool RTMP_ctrlC;
 
 uint32_t RTMP_GetTime();

Modified: trunk/rtmpdump.c
==============================================================================
--- trunk/rtmpdump.c	Mon Mar  8 16:31:32 2010	(r312)
+++ trunk/rtmpdump.c	Mon Mar  8 23:44:55 2010	(r313)
@@ -1242,15 +1242,6 @@ main(int argc, char **argv)
 
   char *flvFile = 0;
 
-#undef OSS
-#ifdef WIN32
-#define	OSS	"WIN"
-#else
-#define OSS	"LNX"
-#endif
-
-  char DEFAULT_FLASH_VER[] = OSS " 10,0,22,87";
-
   signal(SIGINT, sigIntHandler);
   signal(SIGTERM, sigIntHandler);
 #ifndef WIN32
@@ -1369,7 +1360,7 @@ main(int argc, char **argv)
 	    ("                        Z:(null), NB:name:boolean, NS:name:string, NN:name:number\n");
 	  LogPrintf
 	    ("--flashVer|-f string    Flash version string (default: \"%s\")\n",
-	     DEFAULT_FLASH_VER);
+	     RTMP_DefaultFlashVer.av_val);
 	  LogPrintf
 	    ("--live|-v               Save a live stream, no --resume (seeking) of live streams possible\n");
 	  LogPrintf
@@ -1678,12 +1669,6 @@ main(int argc, char **argv)
     }
 #endif
 
-  if (flashVer.av_len == 0)
-    {
-      STR2AVAL(flashVer, DEFAULT_FLASH_VER);
-    }
-
-
   if (tcUrl.av_len == 0 && app.av_len != 0)
     {
       char str[512] = { 0 };

Modified: trunk/rtmpgw.c
==============================================================================
--- trunk/rtmpgw.c	Mon Mar  8 16:31:32 2010	(r312)
+++ trunk/rtmpgw.c	Mon Mar  8 23:44:55 2010	(r313)
@@ -210,8 +210,6 @@ RTMP_REQUEST defaultRTMPRequest;
 
 bool ParseOption(char opt, char *arg, RTMP_REQUEST * req);
 
-char DEFAULT_FLASH_VER[] = "LNX 10,0,22,87";
-
 #ifdef _DEBUG
 uint32_t debugTS = 0;
 
@@ -688,11 +686,6 @@ void processTCPrequest(STREAMING_SERVER 
       req.protocol = RTMP_PROTOCOL_RTMP;
     }
 
-  if (req.flashVer.av_len == 0)
-    {
-      STR2AVAL(req.flashVer, DEFAULT_FLASH_VER);
-    }
-
   if (req.tcUrl.av_len == 0 && req.app.av_len != 0)
     {
       char str[512] = { 0 };
@@ -1304,7 +1297,7 @@ main(int argc, char **argv)
 	    ("                        Z:(null), NB:name:boolean, NS:name:string, NN:name:number\n");
 	  LogPrintf
 	    ("--flashVer|-f string    Flash version string (default: \"%s\")\n",
-	     DEFAULT_FLASH_VER);
+	     RTMP_DefaultFlashVer.av_val);
 	  LogPrintf
 	    ("--live|-v               Get a live stream, no --resume (seeking) of live streams possible\n");
 	  LogPrintf


More information about the rtmpdump mailing list