From: hyc Date: Mon, 8 Mar 2010 22:44:55 +0000 (+0000) Subject: Move Default flashVer into library, let SetupStream set the default X-Git-Tag: v2.4~222 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86fd72f9c49e25b1e8c1351fc16fa6219e761cee;p=rtmpdump Move Default flashVer into library, let SetupStream set the default git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@313 400ebc74-4327-4243-bc38-086b20814532 --- diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index b3f043b..197feed 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -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; diff --git a/librtmp/rtmp.h b/librtmp/rtmp.h index 90742cb..78ec049 100644 --- a/librtmp/rtmp.h +++ b/librtmp/rtmp.h @@ -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(); diff --git a/rtmpdump.c b/rtmpdump.c index 84d3305..685c41c 100644 --- a/rtmpdump.c +++ b/rtmpdump.c @@ -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 }; diff --git a/rtmpgw.c b/rtmpgw.c index e8b16c7..705f4b5 100644 --- 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