[rtmpdump] r81 - in trunk: Makefile log.c log.h rtmp.c rtmp.h rtmpdump.c

hyc subversion at mplayerhq.hu
Thu Dec 17 02:39:52 CET 2009


Author: hyc
Date: Thu Dec 17 02:39:51 2009
New Revision: 81

Log:
More namespace cleanup

Modified:
   trunk/Makefile
   trunk/log.c
   trunk/log.h
   trunk/rtmp.c
   trunk/rtmp.h
   trunk/rtmpdump.c

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Thu Dec 17 02:12:49 2009	(r80)
+++ trunk/Makefile	Thu Dec 17 02:39:51 2009	(r81)
@@ -47,5 +47,5 @@ log.o: log.c log.h Makefile
 parseurl.o: parseurl.c parseurl.h log.h Makefile
 streams.o: streams.cpp rtmp.h log.h Makefile
 rtmp.o: rtmp.c rtmp.h handshake.h dh.h log.h amf.h Makefile
-amf.o: amf.c amf.h bytes.h Makefile
+amf.o: amf.c amf.h bytes.h log.h Makefile
 rtmpdump.o: rtmpdump.c rtmp.h log.h amf.h Makefile

Modified: trunk/log.c
==============================================================================
--- trunk/log.c	Thu Dec 17 02:12:49 2009	(r80)
+++ trunk/log.c	Thu Dec 17 02:39:51 2009	(r81)
@@ -27,11 +27,11 @@
 
 #define MAX_PRINT_LEN	2048
 
-extern int debuglevel;
+int debuglevel = LOGERROR;
 
 static int neednl;
 
-FILE *fmsg;
+static FILE *fmsg;
 
 void LogSetOutput(FILE *file)
 {

Modified: trunk/log.h
==============================================================================
--- trunk/log.h	Thu Dec 17 02:12:49 2009	(r80)
+++ trunk/log.h	Thu Dec 17 02:39:51 2009	(r81)
@@ -27,8 +27,8 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-// Enable this to get full debugging output
-//#define _DEBUG
+/* Enable this to get full debugging output */
+/* #define _DEBUG	*/
 #define CRYPTO
 
 #ifdef _DEBUG
@@ -42,6 +42,16 @@ extern "C" {
 #define LOGDEBUG		4
 #define LOGALL		5
 
+#define Log	AMF_Log
+#define LogHex	AMF_LogHex
+#define LogHexString	AMF_LogHexString
+#define LogPrintf	AMF_LogPrintf
+#define LogSetOutput	AMF_LogSetOutput
+#define LogStatus	AMF_LogStatus
+#define debuglevel	AMF_debuglevel
+
+extern int debuglevel;
+
 void LogSetOutput(FILE *file);
 void LogPrintf(const char *format, ...);
 void LogStatus(const char *format, ...);

Modified: trunk/rtmp.c
==============================================================================
--- trunk/rtmp.c	Thu Dec 17 02:12:49 2009	(r80)
+++ trunk/rtmp.c	Thu Dec 17 02:39:51 2009	(r81)
@@ -57,9 +57,9 @@ static const int packetSize[] = { 12, 8,
 #define RTMP_PACKET_SIZE_SMALL    2
 #define RTMP_PACKET_SIZE_MINIMUM  3
 
-extern bool bCtrlC;
+bool RTMP_ctrlC;
 
-char RTMPProtocolStrings[][7] = {
+const char RTMPProtocolStrings[][7] = {
   "RTMP",
   "RTMPT",
   "RTMPS",
@@ -68,7 +68,7 @@ char RTMPProtocolStrings[][7] = {
   "RTMFP"
 };
 
-char RTMPProtocolStringsLower[][7] = {
+const char RTMPProtocolStringsLower[][7] = {
   "rtmp",
   "rtmpt",
   "rtmps",
@@ -841,7 +841,7 @@ WriteN(RTMP * r, const char *buffer, int
 	  Log(LOGERROR, "%s, RTMP send error %d (%d bytes)", __FUNCTION__,
 	      sockerr, n);
 
-	  if (sockerr == EINTR && !bCtrlC)
+	  if (sockerr == EINTR && !RTMP_ctrlC)
 	    continue;
 
 	  RTMP_Close(r);
@@ -2188,7 +2188,7 @@ again:
       int sockerr = GetSockError();
       Log(LOGDEBUG, "%s, recv returned %d. GetSockError(): %d (%s)",
 	  __FUNCTION__, nBytes, sockerr, strerror(sockerr));
-      if (sockerr == EINTR && !bCtrlC)
+      if (sockerr == EINTR && !RTMP_ctrlC)
 	goto again;
 
       if (sockerr == EWOULDBLOCK || sockerr == EAGAIN)

Modified: trunk/rtmp.h
==============================================================================
--- trunk/rtmp.h	Thu Dec 17 02:12:49 2009	(r80)
+++ trunk/rtmp.h	Thu Dec 17 02:39:51 2009	(r81)
@@ -56,7 +56,8 @@
 
 #define	RTMP_CHANNELS	65600
 
-extern char RTMPProtocolStringsLower[][7];
+extern const char RTMPProtocolStringsLower[][7];
+extern bool RTMP_ctrlC;
 
 int32_t RTMP_GetTime();
 

Modified: trunk/rtmpdump.c
==============================================================================
--- trunk/rtmpdump.c	Thu Dec 17 02:12:49 2009	(r80)
+++ trunk/rtmpdump.c	Thu Dec 17 02:39:51 2009	(r81)
@@ -45,8 +45,6 @@
 #include "log.h"
 #include "parseurl.h"
 
-int debuglevel = 1;
-
 #define RTMPDUMP_VERSION	"v2.0"
 
 #define RD_SUCCESS		0
@@ -89,12 +87,11 @@ uint32_t nIgnoredFrameCounter = 0;
 #define MAX_IGNORED_FRAMES	50
 
 FILE *file = 0;
-bool bCtrlC = false;
 
 void
 sigIntHandler(int sig)
 {
-  bCtrlC = true;
+  RTMP_ctrlC = true;
   LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
   // ignore all these signals now and let the connection close
   signal(SIGINT, SIG_IGN);
@@ -1015,7 +1012,7 @@ Download(RTMP * rtmp,		// connected RTMP
 #endif
 
     }
-  while (!bCtrlC && nRead > -1 && RTMP_IsConnected(rtmp));
+  while (!RTMP_ctrlC && nRead > -1 && RTMP_IsConnected(rtmp));
   free(buffer);
 
   Log(LOGDEBUG, "WriteStream returned: %d", nRead);
@@ -1038,7 +1035,7 @@ Download(RTMP * rtmp,		// connected RTMP
   if (nRead == -3)
     return RD_SUCCESS;
 
-  if ((duration > 0 && *percent < 99.9) || bCtrlC || nRead < 0
+  if ((duration > 0 && *percent < 99.9) || RTMP_ctrlC || nRead < 0
       || RTMP_IsTimedout(rtmp))
     {
       return RD_INCOMPLETE;
@@ -1580,7 +1577,7 @@ main(int argc, char **argv)
   netstackdump_read = fopen("netstackdump_read", "wb");
 #endif
 
-  while (!bCtrlC)
+  while (!RTMP_ctrlC)
     {
       Log(LOGDEBUG, "Setting buffer time to: %dms", bufferTime);
       RTMP_SetBufferMS(&rtmp, bufferTime);


More information about the rtmpdump mailing list