]> granicus.if.org Git - rtmpdump/commitdiff
Move Default flashVer into library, let SetupStream set the default
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Mon, 8 Mar 2010 22:44:55 +0000 (22:44 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Mon, 8 Mar 2010 22:44:55 +0000 (22:44 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@313 400ebc74-4327-4243-bc38-086b20814532

librtmp/rtmp.c
librtmp/rtmp.h
rtmpdump.c
rtmpgw.c

index b3f043b70d07b0931a8e854bc979f2ab5ff675a2..197feed7d88445eafcb7e1e509c829c6bc9bda4b 100644 (file)
@@ -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;
index 90742cb925c96579600c2dd0c308dddae43a3e35..78ec049aad00027f0b03f326bcacbfe6efbb5ab2 100644 (file)
@@ -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();
index 84d33059a4d4ac52bbd00701d5d419ea8aec1575..685c41cd99c35a48ccf7ce25d89e33be71bee216 100644 (file)
@@ -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 };
index e8b16c7f58ac92110fb51d5829ea1f93db032f33..705f4b545163b7c57d6a0c62ede96814be7fc6d0 100644 (file)
--- a/rtmpgw.c
+++ b/rtmpgw.c
@@ -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 * server,  // server socket and state (ou
       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