[rtmpdump] r368 - in trunk: Makefile librtmp/Makefile librtmp/amf.c librtmp/dh.h librtmp/handshake.h librtmp/hashswf.c librtmp/http.h librtmp/log.c librtmp/log.h librtmp/parseurl.c librtmp/rtmp.c rtmpdump.c r...

hyc subversion at mplayerhq.hu
Thu Mar 18 21:56:25 CET 2010


Author: hyc
Date: Thu Mar 18 21:56:24 2010
New Revision: 368

Log:
Rename AMF_Log -> RTMP_Log, cleanup

Modified:
   trunk/Makefile
   trunk/librtmp/Makefile
   trunk/librtmp/amf.c
   trunk/librtmp/dh.h
   trunk/librtmp/handshake.h
   trunk/librtmp/hashswf.c
   trunk/librtmp/http.h
   trunk/librtmp/log.c
   trunk/librtmp/log.h
   trunk/librtmp/parseurl.c
   trunk/librtmp/rtmp.c
   trunk/rtmpdump.c
   trunk/rtmpgw.c
   trunk/rtmpsrv.c
   trunk/rtmpsuck.c
   trunk/thread.c

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/Makefile	Thu Mar 18 21:56:24 2010	(r368)
@@ -9,6 +9,7 @@ LIBS=-lssl -lcrypto -lz
 #LIBS=-lgnutls -lz
 THREADLIB=-lpthread
 LIBRTMP=librtmp/librtmp.a
+INCRTMP=librtmp/rtmp_sys.h librtmp/rtmp.h librtmp/log.h librtmp/amf.h
 SLIBS=$(THREADLIB) $(LIBS)
 
 EXT=
@@ -36,7 +37,9 @@ clean:
 	rm -f *.o rtmpdump$(EXT) rtmpgw$(EXT) rtmpsrv$(EXT) rtmpsuck$(EXT)
 	@$(MAKE) -C librtmp clean
 
-$(LIBRTMP):
+FORCE:
+
+$(LIBRTMP): FORCE
 	@$(MAKE) -C librtmp all CC="$(CC)" CFLAGS="$(CFLAGS)"
 
 rtmpdump: rtmpdump.o $(LIBRTMP)
@@ -51,7 +54,8 @@ rtmpsuck: rtmpsuck.o thread.o $(LIBRTMP)
 rtmpgw: rtmpgw.o thread.o $(LIBRTMP)
 	$(CC) $(LDFLAGS) $^ -o $@$(EXT) $(SLIBS)
 
-rtmpgw.o: rtmpgw.c librtmp/rtmp.h librtmp/log.h librtmp/amf.h Makefile
-rtmpdump.o: rtmpdump.c librtmp/rtmp.h librtmp/log.h librtmp/amf.h Makefile
-rtmpsrv.o: rtmpsrv.c librtmp/rtmp.h librtmp/log.h librtmp/amf.h Makefile
+rtmpgw.o: rtmpgw.c $(INCRTMP) Makefile
+rtmpdump.o: rtmpdump.c $(INCRTMP) Makefile
+rtmpsrv.o: rtmpsrv.c $(INCRTMP) Makefile
+rtmpsuck.o: rtmpsuck.c $(INCRTMP) Makefile
 thread.o: thread.c thread.h

Modified: trunk/librtmp/Makefile
==============================================================================
--- trunk/librtmp/Makefile	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/Makefile	Thu Mar 18 21:56:24 2010	(r368)
@@ -16,5 +16,5 @@ librtmp.a: rtmp.o log.o amf.o hashswf.o 
 log.o: log.c log.h Makefile
 rtmp.o: rtmp.c rtmp.h rtmp_sys.h handshake.h dh.h log.h amf.h Makefile
 amf.o: amf.c amf.h bytes.h log.h Makefile
-hashswf.o: hashswf.c http.h rtmp.h rtmp_sys.h
-parseurl.o: parseurl.c
+hashswf.o: hashswf.c http.h rtmp.h rtmp_sys.h Makefile
+parseurl.o: parseurl.c rtmp_sys.h log.h Makefile

Modified: trunk/librtmp/amf.c
==============================================================================
--- trunk/librtmp/amf.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/amf.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -55,24 +55,24 @@ AMF_DecodeInt24(const char *data)
 unsigned int
 AMF_DecodeInt32(const char *data)
 {
-  unsigned char *c = (unsigned char *) data;
+  unsigned char *c = (unsigned char *)data;
   unsigned int val;
   val = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
   return val;
 }
 
 void
-AMF_DecodeString(const char *data, AVal * bv)
+AMF_DecodeString(const char *data, AVal *bv)
 {
   bv->av_len = AMF_DecodeInt16(data);
-  bv->av_val = (bv->av_len > 0) ? (char *) data + 2 : NULL;
+  bv->av_val = (bv->av_len > 0) ? (char *)data + 2 : NULL;
 }
 
 void
-AMF_DecodeLongString(const char *data, AVal * bv)
+AMF_DecodeLongString(const char *data, AVal *bv)
 {
   bv->av_len = AMF_DecodeInt32(data);
-  bv->av_val = (bv->av_len > 0) ? (char *) data + 4 : NULL;
+  bv->av_val = (bv->av_len > 0) ? (char *)data + 4 : NULL;
 }
 
 double
@@ -84,8 +84,8 @@ AMF_DecodeNumber(const char *data)
   memcpy(&dVal, data, 8);
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
   unsigned char *ci, *co;
-  ci = (unsigned char *) data;
-  co = (unsigned char *) &dVal;
+  ci = (unsigned char *)data;
+  co = (unsigned char *)&dVal;
   co[0] = ci[7];
   co[1] = ci[6];
   co[2] = ci[5];
@@ -98,8 +98,8 @@ AMF_DecodeNumber(const char *data)
 #else
 #if __BYTE_ORDER == __LITTLE_ENDIAN	// __FLOAT_WORD_ORER == __BIG_ENDIAN
   unsigned char *ci, *co;
-  ci = (unsigned char *) data;
-  co = (unsigned char *) &dVal;
+  ci = (unsigned char *)data;
+  co = (unsigned char *)&dVal;
   co[0] = ci[3];
   co[1] = ci[2];
   co[2] = ci[1];
@@ -110,8 +110,8 @@ AMF_DecodeNumber(const char *data)
   co[7] = ci[4];
 #else // __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN
   unsigned char *ci, *co;
-  ci = (unsigned char *) data;
-  co = (unsigned char *) &dVal;
+  ci = (unsigned char *)data;
+  co = (unsigned char *)&dVal;
   co[0] = ci[4];
   co[1] = ci[5];
   co[2] = ci[6];
@@ -168,7 +168,7 @@ AMF_EncodeInt32(char *output, char *oute
 }
 
 char *
-AMF_EncodeString(char *output, char *outend, const AVal * bv)
+AMF_EncodeString(char *output, char *outend, const AVal *bv)
 {
   if ((bv->av_len < 65536 && output + 1 + 2 + bv->av_len > outend) ||
 	output + 1 + 4 + bv->av_len > outend)
@@ -206,8 +206,8 @@ AMF_EncodeNumber(char *output, char *out
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
   {
     unsigned char *ci, *co;
-    ci = (unsigned char *) &dVal;
-    co = (unsigned char *) output;
+    ci = (unsigned char *)&dVal;
+    co = (unsigned char *)output;
     co[0] = ci[7];
     co[1] = ci[6];
     co[2] = ci[5];
@@ -222,8 +222,8 @@ AMF_EncodeNumber(char *output, char *out
 #if __BYTE_ORDER == __LITTLE_ENDIAN	/* __FLOAT_WORD_ORER == __BIG_ENDIAN */
   {
     unsigned char *ci, *co;
-    ci = (unsigned char *) &dVal;
-    co = (unsigned char *) output;
+    ci = (unsigned char *)&dVal;
+    co = (unsigned char *)output;
     co[0] = ci[3];
     co[1] = ci[2];
     co[2] = ci[1];
@@ -236,8 +236,8 @@ AMF_EncodeNumber(char *output, char *out
 #else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */
   {
     unsigned char *ci, *co;
-    ci = (unsigned char *) &dVal;
-    co = (unsigned char *) output;
+    ci = (unsigned char *)&dVal;
+    co = (unsigned char *)output;
     co[0] = ci[4];
     co[1] = ci[5];
     co[2] = ci[6];
@@ -267,7 +267,7 @@ AMF_EncodeBoolean(char *output, char *ou
 }
 
 char *
-AMF_EncodeNamedString(char *output, char *outend, const AVal * strName, const AVal * strValue)
+AMF_EncodeNamedString(char *output, char *outend, const AVal *strName, const AVal *strValue)
 {
   if (output+2+strName->av_len > outend)
     return NULL;
@@ -280,7 +280,7 @@ AMF_EncodeNamedString(char *output, char
 }
 
 char *
-AMF_EncodeNamedNumber(char *output, char *outend, const AVal * strName, double dVal)
+AMF_EncodeNamedNumber(char *output, char *outend, const AVal *strName, double dVal)
 {
   if (output+2+strName->av_len > outend)
     return NULL;
@@ -293,7 +293,7 @@ AMF_EncodeNamedNumber(char *output, char
 }
 
 char *
-AMF_EncodeNamedBoolean(char *output, char *outend, const AVal * strName, bool bVal)
+AMF_EncodeNamedBoolean(char *output, char *outend, const AVal *strName, bool bVal)
 {
   if (output+2+strName->av_len > outend)
     return NULL;
@@ -306,55 +306,55 @@ AMF_EncodeNamedBoolean(char *output, cha
 }
 
 void
-AMFProp_GetName(AMFObjectProperty * prop, AVal * name)
+AMFProp_GetName(AMFObjectProperty *prop, AVal *name)
 {
   *name = prop->p_name;
 }
 
 void
-AMFProp_SetName(AMFObjectProperty * prop, AVal * name)
+AMFProp_SetName(AMFObjectProperty *prop, AVal *name)
 {
   prop->p_name = *name;
 }
 
 AMFDataType
-AMFProp_GetType(AMFObjectProperty * prop)
+AMFProp_GetType(AMFObjectProperty *prop)
 {
   return prop->p_type;
 }
 
 double
-AMFProp_GetNumber(AMFObjectProperty * prop)
+AMFProp_GetNumber(AMFObjectProperty *prop)
 {
   return prop->p_vu.p_number;
 }
 
 bool
-AMFProp_GetBoolean(AMFObjectProperty * prop)
+AMFProp_GetBoolean(AMFObjectProperty *prop)
 {
   return prop->p_vu.p_number != 0;
 }
 
 void
-AMFProp_GetString(AMFObjectProperty * prop, AVal * str)
+AMFProp_GetString(AMFObjectProperty *prop, AVal *str)
 {
   *str = prop->p_vu.p_aval;
 }
 
 void
-AMFProp_GetObject(AMFObjectProperty * prop, AMFObject * obj)
+AMFProp_GetObject(AMFObjectProperty *prop, AMFObject *obj)
 {
   *obj = prop->p_vu.p_object;
 }
 
 bool
-AMFProp_IsValid(AMFObjectProperty * prop)
+AMFProp_IsValid(AMFObjectProperty *prop)
 {
   return prop->p_type != AMF_INVALID;
 }
 
 char *
-AMFProp_Encode(AMFObjectProperty * prop, char *pBuffer, char *pBufEnd)
+AMFProp_Encode(AMFObjectProperty *prop, char *pBuffer, char *pBufEnd)
 {
   if (prop->p_type == AMF_INVALID)
     return NULL;
@@ -395,7 +395,7 @@ AMFProp_Encode(AMFObjectProperty * prop,
       break;
 
     default:
-      Log(LOGERROR, "%s, invalid type. %d", __FUNCTION__, prop->p_type);
+      RTMP_Log(RTMP_LOGERROR, "%s, invalid type. %d", __FUNCTION__, prop->p_type);
       pBuffer = NULL;
     };
 
@@ -406,7 +406,7 @@ AMFProp_Encode(AMFObjectProperty * prop,
 #define AMF3_INTEGER_MIN	-268435456
 
 int
-AMF3ReadInteger(const char *data, int32_t * valp)
+AMF3ReadInteger(const char *data, int32_t *valp)
 {
   int i = 0;
   int32_t val = 0;
@@ -446,7 +446,7 @@ AMF3ReadInteger(const char *data, int32_
 }
 
 int
-AMF3ReadString(const char *data, AVal * str)
+AMF3ReadString(const char *data, AVal *str)
 {
   assert(str != 0);
 
@@ -457,7 +457,7 @@ AMF3ReadString(const char *data, AVal * 
   if ((ref & 0x1) == 0)
     {				/* reference: 0xxx */
       uint32_t refIndex = (ref >> 1);
-      Log(LOGDEBUG,
+      RTMP_Log(RTMP_LOGDEBUG,
 	  "%s, string reference, index: %d, not supported, ignoring!",
 	  __FUNCTION__, refIndex);
       return len;
@@ -466,7 +466,7 @@ AMF3ReadString(const char *data, AVal * 
     {
       uint32_t nSize = (ref >> 1);
 
-      str->av_val = (char *) data;
+      str->av_val = (char *)data;
       str->av_len = nSize;
 
       return len + nSize;
@@ -475,7 +475,7 @@ AMF3ReadString(const char *data, AVal * 
 }
 
 int
-AMF3Prop_Decode(AMFObjectProperty * prop, const char *pBuffer, int nSize,
+AMF3Prop_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
 		bool bDecodeName)
 {
   int nOriginalSize = nSize;
@@ -486,7 +486,7 @@ AMF3Prop_Decode(AMFObjectProperty * prop
 
   if (nSize == 0 || !pBuffer)
     {
-      Log(LOGDEBUG, "empty buffer/no buffer pointer!");
+      RTMP_Log(RTMP_LOGDEBUG, "empty buffer/no buffer pointer!");
       return -1;
     }
 
@@ -526,7 +526,7 @@ AMF3Prop_Decode(AMFObjectProperty * prop
       {
 	int32_t res = 0;
 	int len = AMF3ReadInteger(pBuffer, &res);
-	prop->p_vu.p_number = (double) res;
+	prop->p_vu.p_number = (double)res;
 	prop->p_type = AMF_NUMBER;
 	nSize -= len;
 	break;
@@ -558,7 +558,7 @@ AMF3Prop_Decode(AMFObjectProperty * prop
 	if ((res & 0x1) == 0)
 	  {			/* reference */
 	    uint32_t nIndex = (res >> 1);
-	    Log(LOGDEBUG, "AMF3_DATE reference: %d, not supported!", nIndex);
+	    RTMP_Log(RTMP_LOGDEBUG, "AMF3_DATE reference: %d, not supported!", nIndex);
 	  }
 	else
 	  {
@@ -583,8 +583,8 @@ AMF3Prop_Decode(AMFObjectProperty * prop
     case AMF3_ARRAY:
     case AMF3_BYTE_ARRAY:
     default:
-      Log(LOGDEBUG, "%s - AMF3 unknown/unsupported datatype 0x%02x, @0x%08X",
-	  __FUNCTION__, (unsigned char) (*pBuffer), pBuffer);
+      RTMP_Log(RTMP_LOGDEBUG, "%s - AMF3 unknown/unsupported datatype 0x%02x, @0x%08X",
+	  __FUNCTION__, (unsigned char)(*pBuffer), pBuffer);
       return -1;
     }
 
@@ -592,7 +592,7 @@ AMF3Prop_Decode(AMFObjectProperty * prop
 }
 
 int
-AMFProp_Decode(AMFObjectProperty * prop, const char *pBuffer, int nSize,
+AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
 	       bool bDecodeName)
 {
   int nOriginalSize = nSize;
@@ -602,14 +602,14 @@ AMFProp_Decode(AMFObjectProperty * prop,
 
   if (nSize == 0 || !pBuffer)
     {
-      Log(LOGDEBUG, "%s: Empty buffer/no buffer pointer!", __FUNCTION__);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Empty buffer/no buffer pointer!", __FUNCTION__);
       return -1;
     }
 
   if (bDecodeName && nSize < 4)
     {				/* at least name (length + at least 1 byte) and 1 byte of data */
-      Log(LOGDEBUG,
-	  "%s: Not enough data for decoding with name, less then 4 bytes!",
+      RTMP_Log(RTMP_LOGDEBUG,
+	  "%s: Not enough data for decoding with name, less than 4 bytes!",
 	  __FUNCTION__);
       return -1;
     }
@@ -619,7 +619,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
       unsigned short nNameSize = AMF_DecodeInt16(pBuffer);
       if (nNameSize > nSize - 2)
 	{
-	  Log(LOGDEBUG,
+	  RTMP_Log(RTMP_LOGDEBUG,
 	      "%s: Name size out of range: namesize (%d) > len (%d) - 2",
 	      __FUNCTION__, nNameSize, nSize);
 	  return -1;
@@ -649,14 +649,14 @@ AMFProp_Decode(AMFObjectProperty * prop,
     case AMF_BOOLEAN:
       if (nSize < 1)
 	return -1;
-      prop->p_vu.p_number = (double) AMF_DecodeBoolean(pBuffer);
+      prop->p_vu.p_number = (double)AMF_DecodeBoolean(pBuffer);
       nSize--;
       break;
     case AMF_STRING:
       {
 	unsigned short nStringSize = AMF_DecodeInt16(pBuffer);
 
-	if (nSize < (long) nStringSize + 2)
+	if (nSize < (long)nStringSize + 2)
 	  return -1;
 	AMF_DecodeString(pBuffer, &prop->p_vu.p_aval);
 	nSize -= (2 + nStringSize);
@@ -672,7 +672,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
       }
     case AMF_MOVIECLIP:
       {
-	Log(LOGERROR, "AMF_MOVIECLIP reserved!");
+	RTMP_Log(RTMP_LOGERROR, "AMF_MOVIECLIP reserved!");
 	return -1;
 	break;
       }
@@ -683,7 +683,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
       break;
     case AMF_REFERENCE:
       {
-	Log(LOGERROR, "AMF_REFERENCE not supported!");
+	RTMP_Log(RTMP_LOGERROR, "AMF_REFERENCE not supported!");
 	return -1;
 	break;
       }
@@ -719,7 +719,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
       }
     case AMF_DATE:
       {
-	Log(LOGDEBUG, "AMF_DATE");
+	RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE");
 
 	if (nSize < 10)
 	  return -1;
@@ -733,7 +733,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
     case AMF_LONG_STRING:
       {
 	unsigned int nStringSize = AMF_DecodeInt32(pBuffer);
-	if (nSize < (long) nStringSize + 4)
+	if (nSize < (long)nStringSize + 4)
 	  return -1;
 	AMF_DecodeLongString(pBuffer, &prop->p_vu.p_aval);
 	nSize -= (4 + nStringSize);
@@ -742,19 +742,19 @@ AMFProp_Decode(AMFObjectProperty * prop,
       }
     case AMF_RECORDSET:
       {
-	Log(LOGERROR, "AMF_RECORDSET reserved!");
+	RTMP_Log(RTMP_LOGERROR, "AMF_RECORDSET reserved!");
 	return -1;
 	break;
       }
     case AMF_XML_DOC:
       {
-	Log(LOGERROR, "AMF_XML_DOC not supported!");
+	RTMP_Log(RTMP_LOGERROR, "AMF_XML_DOC not supported!");
 	return -1;
 	break;
       }
     case AMF_TYPED_OBJECT:
       {
-	Log(LOGERROR, "AMF_TYPED_OBJECT not supported!");
+	RTMP_Log(RTMP_LOGERROR, "AMF_TYPED_OBJECT not supported!");
 	return -1;
 	break;
       }
@@ -768,7 +768,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
 	break;
       }
     default:
-      Log(LOGDEBUG, "%s - unknown datatype 0x%02x, @0x%08X", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s - unknown datatype 0x%02x, @0x%08X", __FUNCTION__,
 	  prop->p_type, pBuffer - 1);
       return -1;
     }
@@ -777,7 +777,7 @@ AMFProp_Decode(AMFObjectProperty * prop,
 }
 
 void
-AMFProp_Dump(AMFObjectProperty * prop)
+AMFProp_Dump(AMFObjectProperty *prop)
 {
   char strRes[256];
   char str[256];
@@ -785,13 +785,13 @@ AMFProp_Dump(AMFObjectProperty * prop)
 
   if (prop->p_type == AMF_INVALID)
     {
-      Log(LOGDEBUG, "Property: INVALID");
+      RTMP_Log(RTMP_LOGDEBUG, "Property: INVALID");
       return;
     }
 
   if (prop->p_type == AMF_NULL)
     {
-      Log(LOGDEBUG, "Property: NULL");
+      RTMP_Log(RTMP_LOGDEBUG, "Property: NULL");
       return;
     }
 
@@ -811,7 +811,7 @@ AMFProp_Dump(AMFObjectProperty * prop)
 
   if (prop->p_type == AMF_OBJECT)
     {
-      Log(LOGDEBUG, "Property: <%sOBJECT>", strRes);
+      RTMP_Log(RTMP_LOGDEBUG, "Property: <%sOBJECT>", strRes);
       AMF_Dump(&prop->p_vu.p_object);
       return;
     }
@@ -834,14 +834,14 @@ AMFProp_Dump(AMFObjectProperty * prop)
 	       prop->p_vu.p_number, prop->p_UTCoffset);
       break;
     default:
-      snprintf(str, 255, "INVALID TYPE 0x%02x", (unsigned char) prop->p_type);
+      snprintf(str, 255, "INVALID TYPE 0x%02x", (unsigned char)prop->p_type);
     }
 
-  Log(LOGDEBUG, "Property: <%s%s>", strRes, str);
+  RTMP_Log(RTMP_LOGDEBUG, "Property: <%s%s>", strRes, str);
 }
 
 void
-AMFProp_Reset(AMFObjectProperty * prop)
+AMFProp_Reset(AMFObjectProperty *prop)
 {
   if (prop->p_type == AMF_OBJECT)
     AMF_Reset(&prop->p_vu.p_object);
@@ -856,7 +856,7 @@ AMFProp_Reset(AMFObjectProperty * prop)
 /* AMFObject */
 
 char *
-AMF_Encode(AMFObject * obj, char *pBuffer, char *pBufEnd)
+AMF_Encode(AMFObject *obj, char *pBuffer, char *pBufEnd)
 {
   int i;
 
@@ -870,7 +870,7 @@ AMF_Encode(AMFObject * obj, char *pBuffe
       char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd);
       if (res == NULL)
 	{
-	  Log(LOGERROR, "AMF_Encode - failed to encode property in index %d",
+	  RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d",
 	      i);
 	  break;
 	}
@@ -889,7 +889,7 @@ AMF_Encode(AMFObject * obj, char *pBuffe
 }
 
 int
-AMF_DecodeArray(AMFObject * obj, const char *pBuffer, int nSize,
+AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize,
 		int nArrayLen, bool bDecodeName)
 {
   int nOriginalSize = nSize;
@@ -919,7 +919,7 @@ AMF_DecodeArray(AMFObject * obj, const c
 }
 
 int
-AMF3_Decode(AMFObject * obj, const char *pBuffer, int nSize, bool bAMFData)
+AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bAMFData)
 {
   int nOriginalSize = nSize;
   int32_t ref;
@@ -930,7 +930,7 @@ AMF3_Decode(AMFObject * obj, const char 
   if (bAMFData)
     {
       if (*pBuffer != AMF3_OBJECT)
-	Log(LOGERROR,
+	RTMP_Log(RTMP_LOGERROR,
 	    "AMF3 Object encapsulated in AMF stream does not start with AMF3_OBJECT!");
       pBuffer++;
       nSize--;
@@ -945,7 +945,7 @@ AMF3_Decode(AMFObject * obj, const char 
     {				/* object reference, 0xxx */
       uint32_t objectIndex = (ref >> 1);
 
-      Log(LOGDEBUG, "Object reference, index: %d", objectIndex);
+      RTMP_Log(RTMP_LOGDEBUG, "Object reference, index: %d", objectIndex);
     }
   else				/* object instance */
     {
@@ -958,7 +958,7 @@ AMF3_Decode(AMFObject * obj, const char 
       if ((classRef & 0x1) == 0)
 	{			/* class reference */
 	  uint32_t classIndex = (classRef >> 1);
-	  Log(LOGDEBUG, "Class reference: %d", classIndex);
+	  RTMP_Log(RTMP_LOGDEBUG, "Class reference: %d", classIndex);
 	}
       else
 	{
@@ -978,7 +978,7 @@ AMF3_Decode(AMFObject * obj, const char 
 
 	  //std::string str = className;
 
-	  Log(LOGDEBUG,
+	  RTMP_Log(RTMP_LOGDEBUG,
 	      "Class name: %s, externalizable: %d, dynamic: %d, classMembers: %d",
 	      cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic,
 	      cd.cd_num);
@@ -987,7 +987,7 @@ AMF3_Decode(AMFObject * obj, const char 
 	    {
 	      AVal memberName;
 	      len = AMF3ReadString(pBuffer, &memberName);
-	      Log(LOGDEBUG, "Member: %s", memberName.av_val);
+	      RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val);
 	      AMF3CD_AddProp(&cd, &memberName);
 	      nSize -= len;
 	      pBuffer += len;
@@ -1001,11 +1001,11 @@ AMF3_Decode(AMFObject * obj, const char 
 	  int nRes;
 	  AVal name = AVC("DEFAULT_ATTRIBUTE");
 
-	  Log(LOGDEBUG, "Externalizable, TODO check");
+	  RTMP_Log(RTMP_LOGDEBUG, "Externalizable, TODO check");
 
 	  nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, false);
 	  if (nRes == -1)
-	    Log(LOGDEBUG, "%s, failed to decode AMF3 property!",
+	    RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!",
 		__FUNCTION__);
 	  else
 	    {
@@ -1023,7 +1023,7 @@ AMF3_Decode(AMFObject * obj, const char 
 	    {
 	      nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, false);
 	      if (nRes == -1)
-		Log(LOGDEBUG, "%s, failed to decode AMF3 property!",
+		RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!",
 		    __FUNCTION__);
 
 	      AMFProp_SetName(&prop, AMF3CD_GetProp(&cd, i));
@@ -1049,13 +1049,13 @@ AMF3_Decode(AMFObject * obj, const char 
 	      while (len > 0);
 	    }
 	}
-      Log(LOGDEBUG, "class object!");
+      RTMP_Log(RTMP_LOGDEBUG, "class object!");
     }
   return nOriginalSize - nSize;
 }
 
 int
-AMF_Decode(AMFObject * obj, const char *pBuffer, int nSize, bool bDecodeName)
+AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, bool bDecodeName)
 {
   int nOriginalSize = nSize;
   bool bError = false;		/* if there is an error while decoding - try to at least find the end mark AMF_OBJECT_END */
@@ -1076,7 +1076,7 @@ AMF_Decode(AMFObject * obj, const char *
 
       if (bError)
 	{
-	  Log(LOGERROR,
+	  RTMP_Log(RTMP_LOGERROR,
 	      "DECODING ERROR, IGNORING BYTES UNTIL NEXT KNOWN PATTERN!");
 	  nSize--;
 	  pBuffer++;
@@ -1101,7 +1101,7 @@ AMF_Decode(AMFObject * obj, const char *
 }
 
 void
-AMF_AddProp(AMFObject * obj, const AMFObjectProperty * prop)
+AMF_AddProp(AMFObject *obj, const AMFObjectProperty *prop)
 {
   if (!(obj->o_num & 0x0f))
     obj->o_props =
@@ -1110,13 +1110,13 @@ AMF_AddProp(AMFObject * obj, const AMFOb
 }
 
 int
-AMF_CountProp(AMFObject * obj)
+AMF_CountProp(AMFObject *obj)
 {
   return obj->o_num;
 }
 
 AMFObjectProperty *
-AMF_GetProp(AMFObject * obj, const AVal * name, int nIndex)
+AMF_GetProp(AMFObject *obj, const AVal *name, int nIndex)
 {
   if (nIndex >= 0)
     {
@@ -1133,23 +1133,23 @@ AMF_GetProp(AMFObject * obj, const AVal 
 	}
     }
 
-  return (AMFObjectProperty *) & AMFProp_Invalid;
+  return (AMFObjectProperty *)&AMFProp_Invalid;
 }
 
 void
-AMF_Dump(AMFObject * obj)
+AMF_Dump(AMFObject *obj)
 {
   int n;
-  Log(LOGDEBUG, "(object begin)");
+  RTMP_Log(RTMP_LOGDEBUG, "(object begin)");
   for (n = 0; n < obj->o_num; n++)
     {
       AMFProp_Dump(&obj->o_props[n]);
     }
-  Log(LOGDEBUG, "(object end)");
+  RTMP_Log(RTMP_LOGDEBUG, "(object end)");
 }
 
 void
-AMF_Reset(AMFObject * obj)
+AMF_Reset(AMFObject *obj)
 {
   int n;
   for (n = 0; n < obj->o_num; n++)
@@ -1165,7 +1165,7 @@ AMF_Reset(AMFObject * obj)
 /* AMF3ClassDefinition */
 
 void
-AMF3CD_AddProp(AMF3ClassDef * cd, AVal * prop)
+AMF3CD_AddProp(AMF3ClassDef *cd, AVal *prop)
 {
   if (!(cd->cd_num & 0x0f))
     cd->cd_props = realloc(cd->cd_props, (cd->cd_num + 16) * sizeof(AVal));
@@ -1173,9 +1173,9 @@ AMF3CD_AddProp(AMF3ClassDef * cd, AVal *
 }
 
 AVal *
-AMF3CD_GetProp(AMF3ClassDef * cd, int nIndex)
+AMF3CD_GetProp(AMF3ClassDef *cd, int nIndex)
 {
   if (nIndex >= cd->cd_num)
-    return (AVal *) & AV_empty;
+    return (AVal *)&AV_empty;
   return &cd->cd_props[nIndex];
 }

Modified: trunk/librtmp/dh.h
==============================================================================
--- trunk/librtmp/dh.h	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/dh.h	Thu Mar 18 21:56:24 2010	(r368)
@@ -135,7 +135,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
   MP_set_w(bn, 1);
   if (MP_cmp(y, bn) < 0)
     {
-      Log(LOGWARNING, "DH public key must be at least 2");
+      RTMP_Log(RTMP_LOGERROR, "DH public key must be at least 2");
       ret = false;
       goto failed;
     }
@@ -145,7 +145,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
   MP_sub_w(bn, 1);
   if (MP_cmp(y, bn) > 0)
     {
-      Log(LOGWARNING, "DH public key must be at most p-2");
+      RTMP_Log(RTMP_LOGERROR, "DH public key must be at most p-2");
       ret = false;
       goto failed;
     }
@@ -163,7 +163,7 @@ isValidPublicKey(MP_t y, MP_t p, MP_t q)
 
       if (MP_cmp_1(bn) != 0)
 	{
-	  Log(LOGWARNING, "DH public key does not fulfill y^q mod p = 1");
+	  RTMP_Log(RTMP_LOGWARNING, "DH public key does not fulfill y^q mod p = 1");
 	}
     }
 

Modified: trunk/librtmp/handshake.h
==============================================================================
--- trunk/librtmp/handshake.h	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/handshake.h	Thu Mar 18 21:56:24 2010	(r368)
@@ -99,8 +99,8 @@ static void InitRC4Encryption
   HMAC_crunch(ctx, pubKeyIn, 128);
   HMAC_finish(ctx, digest, digestLen);
 
-  Log(LOGDEBUG, "RC4 Out Key: ");
-  LogHex(LOGDEBUG, (char *) digest, 16);
+  RTMP_Log(RTMP_LOGDEBUG, "RC4 Out Key: ");
+  RTMP_LogHex(RTMP_LOGDEBUG, (char *) digest, 16);
 
   RC4_setkey(*rc4keyOut, 16, digest);
 
@@ -108,8 +108,8 @@ static void InitRC4Encryption
   HMAC_crunch(ctx, pubKeyOut, 128);
   HMAC_finish(ctx, digest, digestLen);
 
-  Log(LOGDEBUG, "RC4 In Key: ");
-  LogHex(LOGDEBUG, (char *) digest, 16);
+  RTMP_Log(RTMP_LOGDEBUG, "RC4 In Key: ");
+  RTMP_LogHex(RTMP_LOGDEBUG, (char *) digest, 16);
 
   RC4_setkey(*rc4keyIn, 16, digest);
 }
@@ -136,7 +136,7 @@ GetDHOffset2(char *handshake, unsigned i
 
   if (res + 128 > 767)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "%s: Couldn't calculate correct DH offset (got %d), exiting!\n",
 	  __FUNCTION__, res);
       exit(1);
@@ -162,7 +162,7 @@ GetDigestOffset2(char *handshake, unsign
 
   if (res + 32 > 1535)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "%s: Couldn't calculate correct digest offset (got %d), exiting\n",
 	  __FUNCTION__, res);
       exit(1);
@@ -190,7 +190,7 @@ GetDHOffset1(char *handshake, unsigned i
 
   if (res + 128 > 1531)
     {
-      Log(LOGERROR, "%s: Couldn't calculate DH offset (got %d), exiting!\n",
+      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't calculate DH offset (got %d), exiting!\n",
 	  __FUNCTION__, res);
       exit(1);
     }
@@ -218,7 +218,7 @@ GetDigestOffset1(char *handshake, unsign
 
   if (res + 32 > 771)
     {
-      Log(LOGDEBUG,
+      RTMP_Log(RTMP_LOGDEBUG,
 	  "%s: Couldn't calculate digest offset (got %d), exiting!\n",
 	  __FUNCTION__, res);
       exit(1);
@@ -380,7 +380,7 @@ HandShake(RTMP * r, bool FP9HandShake)
       clientsig[5] = 0;
       clientsig[7] = 2;
 
-      Log(LOGDEBUG, "%s: Client type: %02X\n", __FUNCTION__, clientsig[-1]);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Client type: %02X\n", __FUNCTION__, clientsig[-1]);
     }
   else
     {
@@ -405,17 +405,17 @@ HandShake(RTMP * r, bool FP9HandShake)
 	  r->Link.dh = DHInit(128);	/* 1024 */
 	  if (!r->Link.dh)
 	    {
-	      Log(LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!",
+	      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!",
 		  __FUNCTION__);
 	      return false;
 	    }
 
 	  dhposClient = getdh(clientsig, RTMP_SIG_SIZE);
-	  Log(LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposClient);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposClient);
 
 	  if (!DHGenerateKey(r->Link.dh))
 	    {
-	      Log(LOGERROR, "%s: Couldn't generate Diffie-Hellmann public key!",
+	      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't generate Diffie-Hellmann public key!",
 		  __FUNCTION__);
 	      return false;
 	    }
@@ -423,26 +423,26 @@ HandShake(RTMP * r, bool FP9HandShake)
 	  if (!DHGetPublicKey
 	      (r->Link.dh, (uint8_t *) &clientsig[dhposClient], 128))
 	    {
-	      Log(LOGERROR, "%s: Couldn't write public key!", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't write public key!", __FUNCTION__);
 	      return false;
 	    }
 	}
 
       digestPosClient = getdig(clientsig, RTMP_SIG_SIZE);	/* reuse this value in verification */
-      Log(LOGDEBUG, "%s: Client digest offset: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Client digest offset: %d", __FUNCTION__,
 	  digestPosClient);
 
       CalculateDigest(digestPosClient, clientsig, GenuineFPKey, 30,
 		      &clientsig[digestPosClient]);
 
-      Log(LOGDEBUG, "%s: Initial client digest: ", __FUNCTION__);
-      LogHex(LOGDEBUG, (char *) clientsig + digestPosClient,
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Initial client digest: ", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, (char *) clientsig + digestPosClient,
 	     SHA256_DIGEST_LENGTH);
     }
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "Clientsig: ");
-  LogHex(LOGDEBUG, clientsig, RTMP_SIG_SIZE);
+  RTMP_Log(RTMP_LOGDEBUG, "Clientsig: ");
+  RTMP_LogHex(RTMP_LOGDEBUG, clientsig, RTMP_SIG_SIZE);
 #endif
 
   if (!WriteN(r, clientsig-1, RTMP_SIG_SIZE + 1))
@@ -451,10 +451,10 @@ HandShake(RTMP * r, bool FP9HandShake)
   if (ReadN(r, &type, 1) != 1)	/* 0x03 or 0x06 */
     return false;
 
-  Log(LOGDEBUG, "%s: Type Answer   : %02X", __FUNCTION__, type);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Type Answer   : %02X", __FUNCTION__, type);
 
   if (type != clientsig[-1])
-    Log(LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d",
+    RTMP_Log(RTMP_LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d",
 	__FUNCTION__, clientsig[-1], type);
 
   if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
@@ -464,13 +464,13 @@ HandShake(RTMP * r, bool FP9HandShake)
   memcpy(&uptime, serversig, 4);
   uptime = ntohl(uptime);
 
-  Log(LOGDEBUG, "%s: Server Uptime : %d", __FUNCTION__, uptime);
-  Log(LOGDEBUG, "%s: FMS Version   : %d.%d.%d.%d", __FUNCTION__, serversig[4],
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Server Uptime : %d", __FUNCTION__, uptime);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version   : %d.%d.%d.%d", __FUNCTION__, serversig[4],
       serversig[5], serversig[6], serversig[7]);
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "Server signature:");
-  LogHex(LOGDEBUG, serversig, RTMP_SIG_SIZE);
+  RTMP_Log(RTMP_LOGDEBUG, "Server signature:");
+  RTMP_LogHex(RTMP_LOGDEBUG, serversig, RTMP_SIG_SIZE);
 #endif
 
   if (FP9HandShake)
@@ -482,12 +482,12 @@ HandShake(RTMP * r, bool FP9HandShake)
 
       if (!VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36))
 	{
-	  Log(LOGWARNING, "Trying different position for server digest!\n");
+	  RTMP_Log(RTMP_LOGWARNING, "Trying different position for server digest!\n");
 	  digestPosServer = GetDigestOffset1(serversig, RTMP_SIG_SIZE);
 
 	  if (!VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36))
 	    {
-	      Log(LOGERROR, "Couldn't verify the server digest\n");	/* continuing anyway will probably fail */
+	      RTMP_Log(RTMP_LOGERROR, "Couldn't verify the server digest\n");	/* continuing anyway will probably fail */
 	      return false;
 	    }
 	  dhposServer = GetDHOffset1(serversig, RTMP_SIG_SIZE);
@@ -497,7 +497,7 @@ HandShake(RTMP * r, bool FP9HandShake)
 	  dhposServer = GetDHOffset2(serversig, RTMP_SIG_SIZE);
         }
 
-      Log(LOGDEBUG, "%s: Server DH public key offset: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Server DH public key offset: %d", __FUNCTION__,
 	  dhposServer);
 
       /* generate SWFVerification token (SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake) */
@@ -526,12 +526,12 @@ HandShake(RTMP * r, bool FP9HandShake)
 				     secretKey);
 	  if (len < 0)
 	    {
-	      Log(LOGDEBUG, "%s: Wrong secret key position!", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGDEBUG, "%s: Wrong secret key position!", __FUNCTION__);
 	      return false;
 	    }
 
-	  Log(LOGDEBUG, "%s: Secret key: ", __FUNCTION__);
-	  LogHex(LOGDEBUG, (char *) secretKey, 128);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: Secret key: ", __FUNCTION__);
+	  RTMP_LogHex(RTMP_LOGDEBUG, (char *) secretKey, 128);
 
 	  InitRC4Encryption(secretKey,
 			    (uint8_t *) & serversig[dhposServer],
@@ -558,10 +558,10 @@ HandShake(RTMP * r, bool FP9HandShake)
 		 SHA256_DIGEST_LENGTH, signatureResp);
 
       /* some info output */
-      Log(LOGDEBUG,
+      RTMP_Log(RTMP_LOGDEBUG,
 	  "%s: Calculated digest key from secure key and server digest: ",
 	  __FUNCTION__);
-      LogHex(LOGDEBUG, digestResp, SHA256_DIGEST_LENGTH);
+      RTMP_LogHex(RTMP_LOGDEBUG, digestResp, SHA256_DIGEST_LENGTH);
 
 #ifdef FP10
       if (type == 8 )
@@ -583,8 +583,8 @@ HandShake(RTMP * r, bool FP9HandShake)
         }
 #endif
 #endif
-      Log(LOGDEBUG, "%s: Client signature calculated:", __FUNCTION__);
-      LogHex(LOGDEBUG, signatureResp, SHA256_DIGEST_LENGTH);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Client signature calculated:", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, signatureResp, SHA256_DIGEST_LENGTH);
     }
   else
     {
@@ -594,9 +594,9 @@ HandShake(RTMP * r, bool FP9HandShake)
     }
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "%s: Sending handshake response: ",
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Sending handshake response: ",
     __FUNCTION__);
-  LogHex(LOGDEBUG, reply, RTMP_SIG_SIZE);
+  RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE);
 #endif
   if (!WriteN(r, reply, RTMP_SIG_SIZE))
     return false;
@@ -606,8 +606,8 @@ HandShake(RTMP * r, bool FP9HandShake)
     return false;
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "%s: 2nd handshake: ", __FUNCTION__);
-  LogHex(LOGDEBUG, serversig, RTMP_SIG_SIZE);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: 2nd handshake: ", __FUNCTION__);
+  RTMP_LogHex(RTMP_LOGDEBUG, serversig, RTMP_SIG_SIZE);
 #endif
 
   if (FP9HandShake)
@@ -618,12 +618,12 @@ HandShake(RTMP * r, bool FP9HandShake)
       if (serversig[4] == 0 && serversig[5] == 0 && serversig[6] == 0
 	  && serversig[7] == 0)
 	{
-	  Log(LOGDEBUG,
+	  RTMP_Log(RTMP_LOGDEBUG,
 	      "%s: Wait, did the server just refuse signed authentication?",
 	      __FUNCTION__);
 	}
-      Log(LOGDEBUG, "%s: Server sent signature:", __FUNCTION__);
-      LogHex(LOGDEBUG, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Server sent signature:", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
 	     SHA256_DIGEST_LENGTH);
 
       /* verify server response */
@@ -633,8 +633,8 @@ HandShake(RTMP * r, bool FP9HandShake)
 		 SHA256_DIGEST_LENGTH, signature);
 
       /* show some information */
-      Log(LOGDEBUG, "%s: Digest key: ", __FUNCTION__);
-      LogHex(LOGDEBUG, digest, SHA256_DIGEST_LENGTH);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Digest key: ", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, digest, SHA256_DIGEST_LENGTH);
 
 #ifdef FP10
       if (type == 8 )
@@ -656,18 +656,18 @@ HandShake(RTMP * r, bool FP9HandShake)
         }
 #endif
 #endif
-      Log(LOGDEBUG, "%s: Signature calculated:", __FUNCTION__);
-      LogHex(LOGDEBUG, signature, SHA256_DIGEST_LENGTH);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Signature calculated:", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, signature, SHA256_DIGEST_LENGTH);
       if (memcmp
 	  (signature, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
 	   SHA256_DIGEST_LENGTH) != 0)
 	{
-	  Log(LOGWARNING, "%s: Server not genuine Adobe!", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGWARNING, "%s: Server not genuine Adobe!", __FUNCTION__);
 	  return false;
 	}
       else
 	{
-	  Log(LOGDEBUG, "%s: Genuine Adobe Flash Media Server", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: Genuine Adobe Flash Media Server", __FUNCTION__);
 	}
 
       if (encrypted)
@@ -694,12 +694,12 @@ HandShake(RTMP * r, bool FP9HandShake)
     {
       if (memcmp(serversig, clientsig, RTMP_SIG_SIZE) != 0)
 	{
-	  Log(LOGWARNING, "%s: client signature does not match!",
+	  RTMP_Log(RTMP_LOGWARNING, "%s: client signature does not match!",
 	      __FUNCTION__);
 	}
     }
 
-  Log(LOGDEBUG, "%s: Handshaking finished....", __FUNCTION__);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Handshaking finished....", __FUNCTION__);
   return true;
 }
 
@@ -724,7 +724,7 @@ SHandShake(RTMP * r)
   if (ReadN(r, &type, 1) != 1)	/* 0x03 or 0x06 */
     return false;
 
-  Log(LOGDEBUG, "%s: Type Requested : %02X", __FUNCTION__, type);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Type Requested : %02X", __FUNCTION__, type);
 
   if (type == 3)
     {
@@ -738,7 +738,7 @@ SHandShake(RTMP * r)
     }
   else
     {
-      Log(LOGERROR, "%s: Unknown version %02x",
+      RTMP_Log(RTMP_LOGERROR, "%s: Unknown version %02x",
 	  __FUNCTION__, type);
       return false;
     }
@@ -781,17 +781,17 @@ SHandShake(RTMP * r)
 	  r->Link.dh = DHInit(128);
 	  if (!r->Link.dh)
 	    {
-	      Log(LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!",
+	      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!",
 		  __FUNCTION__);
 	      return false;
 	    }
 
 	  dhposServer = GetDHOffset2(serversig, RTMP_SIG_SIZE);
-	  Log(LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposServer);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposServer);
 
 	  if (!DHGenerateKey(r->Link.dh))
 	    {
-	      Log(LOGERROR, "%s: Couldn't generate Diffie-Hellmann public key!",
+	      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't generate Diffie-Hellmann public key!",
 		  __FUNCTION__);
 	      return false;
 	    }
@@ -799,26 +799,26 @@ SHandShake(RTMP * r)
 	  if (!DHGetPublicKey
 	      (r->Link.dh, (uint8_t *) &serversig[dhposServer], 128))
 	    {
-	      Log(LOGERROR, "%s: Couldn't write public key!", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGERROR, "%s: Couldn't write public key!", __FUNCTION__);
 	      return false;
 	    }
 	}
 
       digestPosServer = GetDigestOffset2(serversig, RTMP_SIG_SIZE);	/* reuse this value in verification */
-      Log(LOGDEBUG, "%s: Client digest offset: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Client digest offset: %d", __FUNCTION__,
 	  digestPosServer);
 
       CalculateDigest(digestPosServer, serversig, GenuineFMSKey, 36,
 		      &serversig[digestPosServer]);
 
-      Log(LOGDEBUG, "%s: Initial server digest: ", __FUNCTION__);
-      LogHex(LOGDEBUG, (char *) serversig + digestPosServer,
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Initial server digest: ", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, (char *) serversig + digestPosServer,
 	     SHA256_DIGEST_LENGTH);
     }
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "Serversig: ");
-  LogHex(LOGDEBUG, serversig, RTMP_SIG_SIZE);
+  RTMP_Log(RTMP_LOGDEBUG, "Serversig: ");
+  RTMP_LogHex(RTMP_LOGDEBUG, serversig, RTMP_SIG_SIZE);
 #endif
 
   if (!WriteN(r, serversig-1, RTMP_SIG_SIZE + 1))
@@ -831,13 +831,13 @@ SHandShake(RTMP * r)
   memcpy(&uptime, clientsig, 4);
   uptime = ntohl(uptime);
 
-  Log(LOGDEBUG, "%s: Client Uptime : %d", __FUNCTION__, uptime);
-  Log(LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__, clientsig[4],
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Client Uptime : %d", __FUNCTION__, uptime);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__, clientsig[4],
       clientsig[5], clientsig[6], clientsig[7]);
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "Client signature:");
-  LogHex(LOGDEBUG, clientsig, RTMP_SIG_SIZE);
+  RTMP_Log(RTMP_LOGDEBUG, "Client signature:");
+  RTMP_LogHex(RTMP_LOGDEBUG, clientsig, RTMP_SIG_SIZE);
 #endif
 
   if (FP9HandShake)
@@ -847,12 +847,12 @@ SHandShake(RTMP * r)
 
       if (!VerifyDigest(digestPosClient, clientsig, GenuineFPKey, 30))
 	{
-	  Log(LOGWARNING, "Trying different position for client digest!\n");
+	  RTMP_Log(RTMP_LOGWARNING, "Trying different position for client digest!\n");
 	  digestPosClient = GetDigestOffset2(clientsig, RTMP_SIG_SIZE);
 
 	  if (!VerifyDigest(digestPosClient, clientsig, GenuineFPKey, 30))
 	    {
-	      Log(LOGERROR, "Couldn't verify the client digest\n");	/* continuing anyway will probably fail */
+	      RTMP_Log(RTMP_LOGERROR, "Couldn't verify the client digest\n");	/* continuing anyway will probably fail */
 	      return false;
 	    }
 	  dhposClient = GetDHOffset2(clientsig, RTMP_SIG_SIZE);
@@ -862,7 +862,7 @@ SHandShake(RTMP * r)
 	  dhposClient = GetDHOffset1(clientsig, RTMP_SIG_SIZE);
         }
 
-      Log(LOGDEBUG, "%s: Client DH public key offset: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Client DH public key offset: %d", __FUNCTION__,
 	  dhposClient);
 
       /* generate SWFVerification token (SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake) */
@@ -891,12 +891,12 @@ SHandShake(RTMP * r)
 				     secretKey);
 	  if (len < 0)
 	    {
-	      Log(LOGDEBUG, "%s: Wrong secret key position!", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGDEBUG, "%s: Wrong secret key position!", __FUNCTION__);
 	      return false;
 	    }
 
-	  Log(LOGDEBUG, "%s: Secret key: ", __FUNCTION__);
-	  LogHex(LOGDEBUG, (char *) secretKey, 128);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: Secret key: ", __FUNCTION__);
+	  RTMP_LogHex(RTMP_LOGDEBUG, (char *) secretKey, 128);
 
 	  InitRC4Encryption(secretKey,
 			    (uint8_t *) &clientsig[dhposClient],
@@ -915,13 +915,13 @@ SHandShake(RTMP * r)
 		 SHA256_DIGEST_LENGTH, signatureResp);
 
       /* some info output */
-      Log(LOGDEBUG,
+      RTMP_Log(RTMP_LOGDEBUG,
 	  "%s: Calculated digest key from secure key and server digest: ",
 	  __FUNCTION__);
-      LogHex(LOGDEBUG, digestResp, SHA256_DIGEST_LENGTH);
+      RTMP_LogHex(RTMP_LOGDEBUG, digestResp, SHA256_DIGEST_LENGTH);
 
-      Log(LOGDEBUG, "%s: Server signature calculated:", __FUNCTION__);
-      LogHex(LOGDEBUG, signatureResp, SHA256_DIGEST_LENGTH);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Server signature calculated:", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, signatureResp, SHA256_DIGEST_LENGTH);
     }
   else
     {
@@ -930,9 +930,9 @@ SHandShake(RTMP * r)
     }
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "%s: Sending handshake response: ",
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Sending handshake response: ",
     __FUNCTION__);
-  LogHex(LOGDEBUG, clientsig, RTMP_SIG_SIZE);
+  RTMP_LogHex(RTMP_LOGDEBUG, clientsig, RTMP_SIG_SIZE);
 #endif
   if (!WriteN(r, clientsig, RTMP_SIG_SIZE))
     return false;
@@ -942,8 +942,8 @@ SHandShake(RTMP * r)
     return false;
 
 #ifdef _DEBUG
-  Log(LOGDEBUG, "%s: 2nd handshake: ", __FUNCTION__);
-  LogHex(LOGDEBUG, clientsig, RTMP_SIG_SIZE);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: 2nd handshake: ", __FUNCTION__);
+  RTMP_LogHex(RTMP_LOGDEBUG, clientsig, RTMP_SIG_SIZE);
 #endif
 
   if (FP9HandShake)
@@ -951,8 +951,8 @@ SHandShake(RTMP * r)
       char signature[SHA256_DIGEST_LENGTH];
       char digest[SHA256_DIGEST_LENGTH];
 
-      Log(LOGDEBUG, "%s: Client sent signature:", __FUNCTION__);
-      LogHex(LOGDEBUG, &clientsig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Client sent signature:", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, &clientsig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
 	     SHA256_DIGEST_LENGTH);
 
       /* verify client response */
@@ -962,21 +962,21 @@ SHandShake(RTMP * r)
 		 SHA256_DIGEST_LENGTH, signature);
 
       /* show some information */
-      Log(LOGDEBUG, "%s: Digest key: ", __FUNCTION__);
-      LogHex(LOGDEBUG, digest, SHA256_DIGEST_LENGTH);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Digest key: ", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, digest, SHA256_DIGEST_LENGTH);
 
-      Log(LOGDEBUG, "%s: Signature calculated:", __FUNCTION__);
-      LogHex(LOGDEBUG, signature, SHA256_DIGEST_LENGTH);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Signature calculated:", __FUNCTION__);
+      RTMP_LogHex(RTMP_LOGDEBUG, signature, SHA256_DIGEST_LENGTH);
       if (memcmp
 	  (signature, &clientsig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH],
 	   SHA256_DIGEST_LENGTH) != 0)
 	{
-	  Log(LOGWARNING, "%s: Client not genuine Adobe!", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGWARNING, "%s: Client not genuine Adobe!", __FUNCTION__);
 	  return false;
 	}
       else
 	{
-	  Log(LOGDEBUG, "%s: Genuine Adobe Flash Player", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: Genuine Adobe Flash Player", __FUNCTION__);
 	}
 
       if (encrypted)
@@ -1003,11 +1003,11 @@ SHandShake(RTMP * r)
     {
       if (memcmp(serversig, clientsig, RTMP_SIG_SIZE) != 0)
 	{
-	  Log(LOGWARNING, "%s: client signature does not match!",
+	  RTMP_Log(RTMP_LOGWARNING, "%s: client signature does not match!",
 	      __FUNCTION__);
 	}
     }
 
-  Log(LOGDEBUG, "%s: Handshaking finished....", __FUNCTION__);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Handshaking finished....", __FUNCTION__);
   return true;
 }

Modified: trunk/librtmp/hashswf.c
==============================================================================
--- trunk/librtmp/hashswf.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/hashswf.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -194,7 +194,7 @@ HTTP_get(struct HTTP_ctx *http, const ch
       TLS_setfd(sb.sb_ssl, sb.sb_socket);
       if ((i = TLS_connect(sb.sb_ssl)) < 0)
 	{
-	  Log(LOGERROR, "%s, TLS_Connect failed", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGERROR, "%s, TLS_Connect failed", __FUNCTION__);
 	  ret = HTTPRES_LOST_CONNECTION;
 	  goto leave;
 	}
@@ -207,7 +207,7 @@ HTTP_get(struct HTTP_ctx *http, const ch
   if (setsockopt
       (sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
     {
-      Log(LOGERROR, "%s, Setting socket timeout to %ds failed!",
+      RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
 	  __FUNCTION__, HTTP_TIMEOUT);
     }
 
@@ -551,12 +551,12 @@ RTMP_HashSWF(const char *url, unsigned i
     {
       ret = -1;
       if (httpres == HTTPRES_LOST_CONNECTION)
-	Log(LOGERROR, "%s: connection lost while downloading swfurl %s",
+	RTMP_Log(RTMP_LOGERROR, "%s: connection lost while downloading swfurl %s",
 	    __FUNCTION__, url);
       else if (httpres == HTTPRES_NOT_FOUND)
-	Log(LOGERROR, "%s: swfurl %s not found", __FUNCTION__, url);
+	RTMP_Log(RTMP_LOGERROR, "%s: swfurl %s not found", __FUNCTION__, url);
       else
-	Log(LOGERROR, "%s: couldn't contact swfurl %s (HTTP error %d)",
+	RTMP_Log(RTMP_LOGERROR, "%s: couldn't contact swfurl %s (HTTP error %d)",
 	    __FUNCTION__, url, http.status);
     }
   else
@@ -571,7 +571,7 @@ RTMP_HashSWF(const char *url, unsigned i
 	  if (!f)
 	    {
 	      int err = errno;
-	      Log(LOGERROR,
+	      RTMP_Log(RTMP_LOGERROR,
 		  "%s: couldn't open %s for writing, errno %d (%s)",
 		  __FUNCTION__, path, err, strerror(err));
 	      ret = -1;

Modified: trunk/librtmp/http.h
==============================================================================
--- trunk/librtmp/http.h	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/http.h	Thu Mar 18 21:56:24 2010	(r368)
@@ -1,5 +1,5 @@
-#ifndef __HTTP_H__
-#define __HTTP_H__
+#ifndef __RTMP_HTTP_H__
+#define __RTMP_HTTP_H__
 /*
  *      Copyright (C) 2010 Howard Chu
  *      Copyright (C) 2010 Antti Ajanki

Modified: trunk/librtmp/log.c
==============================================================================
--- trunk/librtmp/log.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/log.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -30,7 +30,7 @@
 
 #define MAX_PRINT_LEN	2048
 
-AMF_LogLevel AMF_debuglevel = LOGERROR;
+RTMP_LogLevel RTMP_debuglevel = RTMP_LOGERROR;
 
 static int neednl;
 
@@ -41,12 +41,12 @@ static const char *levels[] = {
   "DEBUG", "DEBUG2"
 };
 
-void LogSetOutput(FILE *file)
+void RTMP_LogSetOutput(FILE *file)
 {
 	fmsg = file;
 }
 
-void LogPrintf(const char *format, ...)
+void RTMP_LogPrintf(const char *format, ...)
 {
 	char str[MAX_PRINT_LEN]="";
         int len;
@@ -55,7 +55,7 @@ void LogPrintf(const char *format, ...)
 	len = vsnprintf(str, MAX_PRINT_LEN-1, format, args);
 	va_end(args);
 
-	if ( AMF_debuglevel==LOGCRIT )
+	if ( RTMP_debuglevel==RTMP_LOGCRIT )
 		return;
 
 	if ( !fmsg ) fmsg = stderr;
@@ -72,7 +72,7 @@ void LogPrintf(const char *format, ...)
 	  fflush(fmsg);
 }
 
-void LogStatus(const char *format, ...)
+void RTMP_LogStatus(const char *format, ...)
 {
 	char str[MAX_PRINT_LEN]="";
 	va_list args;
@@ -80,7 +80,7 @@ void LogStatus(const char *format, ...)
 	vsnprintf(str, MAX_PRINT_LEN-1, format, args);
 	va_end(args);
 
-	if ( AMF_debuglevel==LOGCRIT )
+	if ( RTMP_debuglevel==RTMP_LOGCRIT )
 		return;
 
 	if ( !fmsg ) fmsg = stderr;
@@ -90,7 +90,7 @@ void LogStatus(const char *format, ...)
 	neednl = 1;
 }
 
-void Log(int level, const char *format, ...)
+void RTMP_Log(int level, const char *format, ...)
 {
 	char str[MAX_PRINT_LEN]="";
 	va_list args;
@@ -99,12 +99,12 @@ void Log(int level, const char *format, 
 	va_end(args);
 
 	// Filter out 'no-name'
-	if ( AMF_debuglevel<LOGALL && strstr(str, "no-name" ) != NULL )
+	if ( RTMP_debuglevel<RTMP_LOGALL && strstr(str, "no-name" ) != NULL )
 		return;
 
 	if ( !fmsg ) fmsg = stderr;
 
-	if ( level <= AMF_debuglevel ) {
+	if ( level <= RTMP_debuglevel ) {
 		if (neednl) {
 			putc('\n', fmsg);
 			neednl = 0;
@@ -116,18 +116,18 @@ void Log(int level, const char *format, 
 	}
 }
 
-void LogHex(int level, const char *data, unsigned long len)
+void RTMP_LogHex(int level, const char *data, unsigned long len)
 {
 	unsigned long i;
-	if ( level > AMF_debuglevel )
+	if ( level > RTMP_debuglevel )
 		return;
 	for(i=0; i<len; i++) {
-		LogPrintf("%02X ", (unsigned char)data[i]);
+		RTMP_LogPrintf("%02X ", (unsigned char)data[i]);
 	}
-	LogPrintf("\n");
+	RTMP_LogPrintf("\n");
 }
 
-void LogHexString(int level, const char *data, unsigned long len)
+void RTMP_LogHexString(int level, const char *data, unsigned long len)
 {
 	static const char hexdig[] = "0123456789abcdef";
 #define BP_OFFSET 9
@@ -136,7 +136,7 @@ void LogHexString(int level, const char 
 	char	line[BP_LEN];
 	unsigned long i;
 
-	if ( !data || level > AMF_debuglevel )
+	if ( !data || level > RTMP_debuglevel )
 		return;
 
 	/* in case len is zero */
@@ -148,7 +148,7 @@ void LogHexString(int level, const char 
 		unsigned off;
 
 		if( !n ) {
-			if( i ) LogPrintf( "%s", line );
+			if( i ) RTMP_LogPrintf( "%s", line );
 			memset( line, ' ', sizeof(line)-2 );
 			line[sizeof(line)-2] = '\n';
 			line[sizeof(line)-1] = '\0';
@@ -175,5 +175,5 @@ void LogHexString(int level, const char 
 		}
 	}
 
-	LogPrintf( "%s", line );
+	RTMP_LogPrintf( "%s", line );
 }

Modified: trunk/librtmp/log.h
==============================================================================
--- trunk/librtmp/log.h	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/log.h	Thu Mar 18 21:56:24 2010	(r368)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 2008-2009 Andrej Stepanchuk
- *  Copyright (C) 2009 Howard Chu
+ *  Copyright (C) 2009-2010 Howard Chu
  *
  *  This file is part of librtmp.
  *
@@ -20,8 +20,8 @@
  *  http://www.gnu.org/copyleft/lgpl.html
  */
 
-#ifndef __LOG_H__
-#define __LOG_H__
+#ifndef __RTMP_LOG_H__
+#define __RTMP_LOG_H__
 
 #include <stdio.h>
 
@@ -36,25 +36,18 @@ extern "C" {
 #endif
 
 typedef enum
-{ LOGCRIT=0, LOGERROR, LOGWARNING, LOGINFO,
-  LOGDEBUG, LOGDEBUG2, LOGALL
-} AMF_LogLevel;
-
-#define Log	AMF_Log
-#define LogHex	AMF_LogHex
-#define LogHexString	AMF_LogHexString
-#define LogPrintf	AMF_LogPrintf
-#define LogSetOutput	AMF_LogSetOutput
-#define LogStatus	AMF_LogStatus
+{ RTMP_LOGCRIT=0, RTMP_LOGERROR, RTMP_LOGWARNING, RTMP_LOGINFO,
+  RTMP_LOGDEBUG, RTMP_LOGDEBUG2, RTMP_LOGALL
+} RTMP_LogLevel;
 
-extern AMF_LogLevel AMF_debuglevel;
+extern RTMP_LogLevel RTMP_debuglevel;
 
-void LogSetOutput(FILE *file);
-void LogPrintf(const char *format, ...);
-void LogStatus(const char *format, ...);
-void Log(int level, const char *format, ...);
-void LogHex(int level, const char *data, unsigned long len);
-void LogHexString(int level, const char *data, unsigned long len);
+void RTMP_LogSetOutput(FILE *file);
+void RTMP_LogPrintf(const char *format, ...);
+void RTMP_LogStatus(const char *format, ...);
+void RTMP_Log(int level, const char *format, ...);
+void RTMP_LogHex(int level, const char *data, unsigned long len);
+void RTMP_LogHexString(int level, const char *data, unsigned long len);
 
 #ifdef __cplusplus
 }

Modified: trunk/librtmp/parseurl.c
==============================================================================
--- trunk/librtmp/parseurl.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/parseurl.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -34,7 +34,7 @@ bool RTMP_ParseURL(const char *url, int 
 {
 	char *p, *end, *col, *ques, *slash;
 
-	Log(LOGDEBUG, "Parsing...");
+	RTMP_Log(RTMP_LOGDEBUG, "Parsing...");
 
 	*protocol = RTMP_PROTOCOL_RTMP;
 	*port = 0;
@@ -48,7 +48,7 @@ bool RTMP_ParseURL(const char *url, int 
 	// look for usual :// pattern
 	p = strstr(url, "://");
 	if(!p) {
-		Log(LOGERROR, "RTMP URL: No :// in url!");
+		RTMP_Log(RTMP_LOGERROR, "RTMP URL: No :// in url!");
 		return false;
 	}
 	{
@@ -67,12 +67,12 @@ bool RTMP_ParseURL(const char *url, int 
 	else if(len == 6 && strncasecmp(url, "rtmpte", 6)==0)
 	        *protocol = RTMP_PROTOCOL_RTMPTE;
 	else {
-		Log(LOGWARNING, "Unknown protocol!\n");
+		RTMP_Log(RTMP_LOGWARNING, "Unknown protocol!\n");
 		goto parsehost;
 	}
 	}
 
-	Log(LOGDEBUG, "Parsed protocol: %d", *protocol);
+	RTMP_Log(RTMP_LOGDEBUG, "Parsed protocol: %d", *protocol);
 
 parsehost:
 	// lets get the hostname
@@ -80,7 +80,7 @@ parsehost:
 
 	// check for sudden death
 	if(*p==0) {
-		Log(LOGWARNING, "No hostname in URL!");
+		RTMP_Log(RTMP_LOGWARNING, "No hostname in URL!");
 		return false;
 	}
 
@@ -103,9 +103,9 @@ parsehost:
 		strncpy(*host, p, hostlen);
 		(*host)[hostlen]=0;
 
-		Log(LOGDEBUG, "Parsed host    : %s", *host);
+		RTMP_Log(RTMP_LOGDEBUG, "Parsed host    : %s", *host);
 	} else {
-		Log(LOGWARNING, "Hostname exceeds 255 characters!");
+		RTMP_Log(RTMP_LOGWARNING, "Hostname exceeds 255 characters!");
 	}
 
 	p+=hostlen;
@@ -116,14 +116,14 @@ parsehost:
 		p++;
 		unsigned int p2 = atoi(p);
 		if(p2 > 65535) {
-			Log(LOGWARNING, "Invalid port number!");
+			RTMP_Log(RTMP_LOGWARNING, "Invalid port number!");
 		} else {
 			*port = p2;
 		}
 	}
 
 	if(!slash) {
-		Log(LOGWARNING, "No application or playpath in URL!");
+		RTMP_Log(RTMP_LOGWARNING, "No application or playpath in URL!");
 		return true;
 	}
 	p = slash+1;
@@ -162,7 +162,7 @@ parsehost:
 
 	app->av_val = p;
 	app->av_len = applen;
-	Log(LOGDEBUG, "Parsed app     : %.*s", applen, p);
+	RTMP_Log(RTMP_LOGDEBUG, "Parsed app     : %.*s", applen, p);
 
 	p += appnamelen;
 	}

Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/librtmp/rtmp.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -174,7 +174,7 @@ RTMPPacket_Free(RTMPPacket *p)
 void
 RTMPPacket_Dump(RTMPPacket *p)
 {
-  Log(LOGDEBUG,
+  RTMP_Log(RTMP_LOGDEBUG,
       "RTMP PACKET: packet type: 0x%02x. channel: 0x%02x. info 1: %d info 2: %d. Body size: %lu. body: 0x%02x",
       p->m_packetType, p->m_nChannel, p->m_nInfoField1, p->m_nInfoField2,
       p->m_nBodySize, p->m_body ? (unsigned char)p->m_body[0] : 0);
@@ -292,41 +292,41 @@ RTMP_SetupStream(RTMP *r,
 		 double dTime,
 		 uint32_t dLength, bool bLiveStream, long int timeout)
 {
-  Log(LOGDEBUG, "Protocol : %s", RTMPProtocolStrings[protocol&7]);
-  Log(LOGDEBUG, "Hostname : %s", hostname);
-  Log(LOGDEBUG, "Port     : %d", port);
-  Log(LOGDEBUG, "Playpath : %s", playpath->av_val);
+  RTMP_Log(RTMP_LOGDEBUG, "Protocol : %s", RTMPProtocolStrings[protocol&7]);
+  RTMP_Log(RTMP_LOGDEBUG, "Hostname : %s", hostname);
+  RTMP_Log(RTMP_LOGDEBUG, "Port     : %d", port);
+  RTMP_Log(RTMP_LOGDEBUG, "Playpath : %s", playpath->av_val);
 
   if (tcUrl && tcUrl->av_val)
-    Log(LOGDEBUG, "tcUrl    : %s", tcUrl->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "tcUrl    : %s", tcUrl->av_val);
   if (swfUrl && swfUrl->av_val)
-    Log(LOGDEBUG, "swfUrl   : %s", swfUrl->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "swfUrl   : %s", swfUrl->av_val);
   if (pageUrl && pageUrl->av_val)
-    Log(LOGDEBUG, "pageUrl  : %s", pageUrl->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "pageUrl  : %s", pageUrl->av_val);
   if (app && app->av_val)
-    Log(LOGDEBUG, "app      : %.*s", app->av_len, app->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "app      : %.*s", app->av_len, app->av_val);
   if (auth && auth->av_val)
-    Log(LOGDEBUG, "auth     : %s", auth->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "auth     : %s", auth->av_val);
   if (subscribepath && subscribepath->av_val)
-    Log(LOGDEBUG, "subscribepath : %s", subscribepath->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "subscribepath : %s", subscribepath->av_val);
   if (flashVer && flashVer->av_val)
-    Log(LOGDEBUG, "flashVer : %s", flashVer->av_val);
+    RTMP_Log(RTMP_LOGDEBUG, "flashVer : %s", flashVer->av_val);
   if (dTime > 0)
-    Log(LOGDEBUG, "SeekTime      : %.3f sec", (double)dTime / 1000.0);
+    RTMP_Log(RTMP_LOGDEBUG, "SeekTime      : %.3f sec", (double)dTime / 1000.0);
   if (dLength > 0)
-    Log(LOGDEBUG, "playLength    : %.3f sec", (double)dLength / 1000.0);
+    RTMP_Log(RTMP_LOGDEBUG, "playLength    : %.3f sec", (double)dLength / 1000.0);
 
-  Log(LOGDEBUG, "live     : %s", bLiveStream ? "yes" : "no");
-  Log(LOGDEBUG, "timeout  : %d sec", timeout);
+  RTMP_Log(RTMP_LOGDEBUG, "live     : %s", bLiveStream ? "yes" : "no");
+  RTMP_Log(RTMP_LOGDEBUG, "timeout  : %d sec", timeout);
 
 #ifdef CRYPTO
   if (swfSHA256Hash != NULL && swfSize > 0)
     {
       r->Link.SWFHash = *swfSHA256Hash;
       r->Link.SWFSize = swfSize;
-      Log(LOGDEBUG, "SWFSHA256:");
-      LogHex(LOGDEBUG, r->Link.SWFHash.av_val, 32);
-      Log(LOGDEBUG, "SWFSize  : %lu", r->Link.SWFSize);
+      RTMP_Log(RTMP_LOGDEBUG, "SWFSHA256:");
+      RTMP_LogHex(RTMP_LOGDEBUG, r->Link.SWFHash.av_val, 32);
+      RTMP_Log(RTMP_LOGDEBUG, "SWFSize  : %lu", r->Link.SWFSize);
     }
   else
     {
@@ -346,7 +346,7 @@ RTMP_SetupStream(RTMP *r,
       r->Link.sockshost = hostname;
 
       r->Link.socksport = socksport ? atoi(socksport + 1) : 1080;
-      Log(LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost,
+      RTMP_Log(RTMP_LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost,
 	  r->Link.socksport);
     }
   else
@@ -401,7 +401,7 @@ add_addr_info(struct sockaddr_in *servic
       struct hostent *host = gethostbyname(hostname);
       if (host == NULL || host->h_addr == NULL)
 	{
-	  Log(LOGERROR, "Problem accessing the DNS. (addr: %s)", hostname);
+	  RTMP_Log(RTMP_LOGERROR, "Problem accessing the DNS. (addr: %s)", hostname);
 	  return false;
 	}
       service->sin_addr = *(struct in_addr *)host->h_addr;
@@ -427,7 +427,7 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
       if (connect(r->m_sb.sb_socket, service, sizeof(struct sockaddr)) < 0)
 	{
 	  int err = GetSockError();
-	  Log(LOGERROR, "%s, failed to connect socket. %d (%s)",
+	  RTMP_Log(RTMP_LOGERROR, "%s, failed to connect socket. %d (%s)",
 	      __FUNCTION__, err, strerror(err));
 	  RTMP_Close(r);
 	  return false;
@@ -435,10 +435,10 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
 
       if (r->Link.socksport)
 	{
-	  Log(LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__);
 	  if (!SocksNegotiate(r))
 	    {
-	      Log(LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__);
 	      RTMP_Close(r);
 	      return false;
 	    }
@@ -446,7 +446,7 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
     }
   else
     {
-      Log(LOGERROR, "%s, failed to create socket. Error: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGERROR, "%s, failed to create socket. Error: %d", __FUNCTION__,
 	  GetSockError());
       return false;
     }
@@ -456,7 +456,7 @@ RTMP_Connect0(RTMP *r, struct sockaddr *
   if (setsockopt
       (r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
     {
-      Log(LOGERROR, "%s, Setting socket timeout to %ds failed!",
+      RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!",
 	  __FUNCTION__, r->Link.timeout);
     }
 
@@ -475,7 +475,7 @@ RTMP_Connect1(RTMP *r, RTMPPacket *cp)
       TLS_setfd(r->m_sb.sb_ssl, r->m_sb.sb_socket);
       if (TLS_connect(r->m_sb.sb_ssl) < 0)
 	{
-	  Log(LOGERROR, "%s, TLS_Connect failed", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGERROR, "%s, TLS_Connect failed", __FUNCTION__);
 	  RTMP_Close(r);
 	  return false;
 	}
@@ -489,18 +489,18 @@ RTMP_Connect1(RTMP *r, RTMPPacket *cp)
       HTTP_read(r, 1);
       r->m_msgCounter = 0;
     }
-  Log(LOGDEBUG, "%s, ... connected, handshaking", __FUNCTION__);
+  RTMP_Log(RTMP_LOGDEBUG, "%s, ... connected, handshaking", __FUNCTION__);
   if (!HandShake(r, true))
     {
-      Log(LOGERROR, "%s, handshake failed.", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, handshake failed.", __FUNCTION__);
       RTMP_Close(r);
       return false;
     }
-  Log(LOGDEBUG, "%s, handshaked", __FUNCTION__);
+  RTMP_Log(RTMP_LOGDEBUG, "%s, handshaked", __FUNCTION__);
 
   if (!SendConnectPacket(r, cp))
     {
-      Log(LOGERROR, "%s, RTMP connect failed.", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, RTMP connect failed.", __FUNCTION__);
       RTMP_Close(r);
       return false;
     }
@@ -567,7 +567,7 @@ SocksNegotiate(RTMP *r)
     }
   else
     {
-      Log(LOGERROR, "%s, SOCKS returned error code %d", packet[1]);
+      RTMP_Log(RTMP_LOGERROR, "%s, SOCKS returned error code %d", packet[1]);
       return false;
     }
 }
@@ -594,7 +594,7 @@ RTMP_ConnectStream(RTMP *r, double seekT
 	      (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) ||
 	      (packet.m_packetType == RTMP_PACKET_TYPE_INFO))
 	    {
-	      Log(LOGWARNING, "Received FLV packet before play()! Ignoring.");
+	      RTMP_Log(RTMP_LOGWARNING, "Received FLV packet before play()! Ignoring.");
 	      RTMPPacket_Free(&packet);
 	      continue;
 	    }
@@ -675,7 +675,7 @@ RTMP_GetNextMediaPacket(RTMP *r, RTMPPac
 	    {
 	      bHasMediaPacket = 0;
 #ifdef _DEBUG
-	      Log(LOGDEBUG,
+	      RTMP_Log(RTMP_LOGDEBUG,
 		  "Skipped type: %02X, size: %d, TS: %d ms, abs TS: %d, pause: %d ms",
 		  packet->m_packetType, packet->m_nBodySize,
 		  packet->m_nTimeStamp, packet->m_hasAbsTimestamp,
@@ -708,7 +708,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
 
     case 0x03:
       // bytes read report
-      Log(LOGDEBUG, "%s, received: bytes read report", __FUNCTION__);
+      RTMP_Log(RTMP_LOGDEBUG, "%s, received: bytes read report", __FUNCTION__);
       break;
 
     case 0x04:
@@ -728,7 +728,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
 
     case 0x08:
       // audio data
-      //Log(LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
       HandleAudio(r, packet);
       bHasMediaPacket = 1;
       if (!r->m_mediaChannel)
@@ -739,7 +739,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
 
     case 0x09:
       // video data
-      //Log(LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
       HandleVideo(r, packet);
       bHasMediaPacket = 1;
       if (!r->m_mediaChannel)
@@ -749,29 +749,29 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
       break;
 
     case 0x0F:			// flex stream send
-      Log(LOGDEBUG,
+      RTMP_Log(RTMP_LOGDEBUG,
 	  "%s, flex stream send, size %lu bytes, not supported, ignoring",
 	  __FUNCTION__, packet->m_nBodySize);
       break;
 
     case 0x10:			// flex shared object
-      Log(LOGDEBUG,
+      RTMP_Log(RTMP_LOGDEBUG,
 	  "%s, flex shared object, size %lu bytes, not supported, ignoring",
 	  __FUNCTION__, packet->m_nBodySize);
       break;
 
     case 0x11:			// flex message
       {
-	Log(LOGDEBUG,
+	RTMP_Log(RTMP_LOGDEBUG,
 	    "%s, flex message, size %lu bytes, not fully supported",
 	    __FUNCTION__, packet->m_nBodySize);
-	//LogHex(packet.m_body, packet.m_nBodySize);
+	//RTMP_LogHex(packet.m_body, packet.m_nBodySize);
 
 	// some DEBUG code
 	/*RTMP_LIB_AMFObject obj;
 	   int nRes = obj.Decode(packet.m_body+1, packet.m_nBodySize-1);
 	   if(nRes < 0) {
-	   Log(LOGERROR, "%s, error decoding AMF3 packet", __FUNCTION__);
+	   RTMP_Log(RTMP_LOGERROR, "%s, error decoding AMF3 packet", __FUNCTION__);
 	   //return;
 	   }
 
@@ -783,22 +783,22 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
       }
     case 0x12:
       // metadata (notify)
-      Log(LOGDEBUG, "%s, received: notify %lu bytes", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, received: notify %lu bytes", __FUNCTION__,
 	  packet->m_nBodySize);
       if (HandleMetadata(r, packet->m_body, packet->m_nBodySize))
 	bHasMediaPacket = 1;
       break;
 
     case 0x13:
-      Log(LOGDEBUG, "%s, shared object, not supported, ignoring",
+      RTMP_Log(RTMP_LOGDEBUG, "%s, shared object, not supported, ignoring",
 	  __FUNCTION__);
       break;
 
     case 0x14:
       // invoke
-      Log(LOGDEBUG, "%s, received: invoke %lu bytes", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %lu bytes", __FUNCTION__,
 	  packet->m_nBodySize);
-      //LogHex(packet.m_body, packet.m_nBodySize);
+      //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
 
       if (HandleInvoke(r, packet->m_body, packet->m_nBodySize) == 1)
 	bHasMediaPacket = 2;
@@ -816,7 +816,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
 
 	    if (pos + 11 + dataSize + 4 > packet->m_nBodySize)
 	      {
-		Log(LOGWARNING, "Stream corrupt?!");
+		RTMP_Log(RTMP_LOGWARNING, "Stream corrupt?!");
 		break;
 	      }
 	    if (packet->m_body[pos] == 0x12)
@@ -834,15 +834,15 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *p
 	  r->m_mediaStamp = nTimeStamp;
 
 	// FLV tag(s)
-	//Log(LOGDEBUG, "%s, received: FLV tag(s) %lu bytes", __FUNCTION__, packet.m_nBodySize);
+	//RTMP_Log(RTMP_LOGDEBUG, "%s, received: FLV tag(s) %lu bytes", __FUNCTION__, packet.m_nBodySize);
 	bHasMediaPacket = 1;
 	break;
       }
     default:
-      Log(LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,
 	  packet->m_packetType);
 #ifdef _DEBUG
-      LogHex(LOGDEBUG, packet->m_body, packet->m_nBodySize);
+      RTMP_LogHex(RTMP_LOGDEBUG, packet->m_body, packet->m_nBodySize);
 #endif
     }
 
@@ -920,14 +920,14 @@ ReadN(RTMP *r, char *buffer, int n)
 	      && r->m_nBytesIn > r->m_nBytesInSent + r->m_nClientBW / 2)
 	    SendBytesReceived(r);
 	}
-      //Log(LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes);
 #ifdef _DEBUG
       fwrite(ptr, 1, nBytes, netstackdump_read);
 #endif
 
       if (nBytes == 0)
 	{
-	  Log(LOGDEBUG, "%s, RTMP socket closed by peer", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, RTMP socket closed by peer", __FUNCTION__);
 	  //goto again;
 	  RTMP_Close(r);
 	  break;
@@ -977,12 +977,12 @@ WriteN(RTMP *r, const char *buffer, int 
         nBytes = HTTP_Post(r, RTMPT_SEND, ptr, n);
       else
         nBytes = RTMPSockBuf_Send(&r->m_sb, ptr, n);
-      //Log(LOGDEBUG, "%s: %d\n", __FUNCTION__, nBytes);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s: %d\n", __FUNCTION__, nBytes);
 
       if (nBytes < 0)
 	{
 	  int sockerr = GetSockError();
-	  Log(LOGERROR, "%s, RTMP send error %d (%d bytes)", __FUNCTION__,
+	  RTMP_Log(RTMP_LOGERROR, "%s, RTMP send error %d (%d bytes)", __FUNCTION__,
 	      sockerr, n);
 
 	  if (sockerr == EINTR && !RTMP_ctrlC)
@@ -1210,7 +1210,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribe
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
 
-  Log(LOGDEBUG, "FCSubscribe: %s", subscribepath->av_val);
+  RTMP_Log(RTMP_LOGDEBUG, "FCSubscribe: %s", subscribepath->av_val);
   char *enc = packet.m_body;
   enc = AMF_EncodeString(enc, pend, &av_FCSubscribe);
   enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
@@ -1401,7 +1401,7 @@ RTMP_SendPause(RTMP *r, bool DoPause, do
 
   packet.m_nBodySize = enc - packet.m_body;
 
-  Log(LOGDEBUG, "%s, %d, pauseTime=%.2f", __FUNCTION__, DoPause, dTime);
+  RTMP_Log(RTMP_LOGDEBUG, "%s, %d, pauseTime=%.2f", __FUNCTION__, DoPause, dTime);
   return RTMP_SendPacket(r, &packet, true);
 }
 
@@ -1474,7 +1474,7 @@ SendBytesReceived(RTMP *r)
   AMF_EncodeInt32(packet.m_body, pend, r->m_nBytesIn);	// hard coded for now
   r->m_nBytesInSent = r->m_nBytesIn;
 
-  //Log(LOGDEBUG, "Send bytes report. 0x%x (%d bytes)", (unsigned int)m_nBytesIn, m_nBytesIn);
+  //RTMP_Log(RTMP_LOGDEBUG, "Send bytes report. 0x%x (%d bytes)", (unsigned int)m_nBytesIn, m_nBytesIn);
   return RTMP_SendPacket(r, &packet, false);
 }
 
@@ -1553,7 +1553,7 @@ SendPlay(RTMP *r)
   enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
   *enc++ = AMF_NULL;
 
-  Log(LOGDEBUG, "%s, seekTime=%.2f, dLength=%d, sending play: %s",
+  RTMP_Log(RTMP_LOGDEBUG, "%s, seekTime=%.2f, dLength=%d, sending play: %s",
       __FUNCTION__, r->Link.seekTime, r->Link.length,
       r->Link.playpath.av_val);
   enc = AMF_EncodeString(enc, pend, &r->Link.playpath);
@@ -1641,7 +1641,7 @@ The type of Ping packet is 0x4 and conta
 bool
 RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
 {
-  Log(LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType);
+  RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType);
 
   RTMPPacket packet;
   char pbuf[256], *pend = pbuf + sizeof(pbuf);
@@ -1667,8 +1667,8 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
     {
 #ifdef CRYPTO
       memcpy(buf, r->Link.SWFVerificationResponse, 42);
-      Log(LOGDEBUG, "Sending SWFVerification response: ");
-      LogHex(LOGDEBUG, packet.m_body, packet.m_nBodySize);
+      RTMP_Log(RTMP_LOGDEBUG, "Sending SWFVerification response: ");
+      RTMP_LogHex(RTMP_LOGDEBUG, packet.m_body, packet.m_nBodySize);
 #endif
     }
   else
@@ -1757,7 +1757,7 @@ HandleInvoke(RTMP *r, const char *body, 
   int ret = 0, nRes;
   if (body[0] != 0x02)		// make sure it is a string method name we start with
     {
-      Log(LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
+      RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
 	  __FUNCTION__);
       return 0;
     }
@@ -1766,7 +1766,7 @@ HandleInvoke(RTMP *r, const char *body, 
   nRes = AMF_Decode(&obj, body, nBodySize, false);
   if (nRes < 0)
     {
-      Log(LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
       return 0;
     }
 
@@ -1774,14 +1774,14 @@ HandleInvoke(RTMP *r, const char *body, 
   AVal method;
   AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &method);
   double txn = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
-  Log(LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val);
+  RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val);
 
   if (AVMATCH(&method, &av__result))
     {
       AVal methodInvoked = r->m_methodCalls[0];
       AV_erase(r->m_methodCalls, &r->m_numCalls, 0, false);
 
-      Log(LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__,
 	  methodInvoked.av_val);
 
       if (AVMATCH(&methodInvoked, &av_connect))
@@ -1866,11 +1866,11 @@ HandleInvoke(RTMP *r, const char *body, 
     }
   else if (AVMATCH(&method, &av__error))
     {
-      Log(LOGERROR, "rtmp server sent error");
+      RTMP_Log(RTMP_LOGERROR, "rtmp server sent error");
     }
   else if (AVMATCH(&method, &av_close))
     {
-      Log(LOGERROR, "rtmp server requested close");
+      RTMP_Log(RTMP_LOGERROR, "rtmp server requested close");
       RTMP_Close(r);
     }
   else if (AVMATCH(&method, &av_onStatus))
@@ -1881,7 +1881,7 @@ HandleInvoke(RTMP *r, const char *body, 
       AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code);
       AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level);
 
-      Log(LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val);
+      RTMP_Log(RTMP_LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val);
       if (AVMATCH(&code, &av_NetStream_Failed)
 	  || AVMATCH(&code, &av_NetStream_Play_Failed)
 	  || AVMATCH(&code, &av_NetStream_Play_StreamNotFound)
@@ -1889,7 +1889,7 @@ HandleInvoke(RTMP *r, const char *body, 
 	{
 	  r->m_stream_id = -1;
 	  RTMP_Close(r);
-	  Log(LOGERROR, "Closing connection: %s", code.av_val);
+	  RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val);
 	}
 
       else if (AVMATCH(&code, &av_NetStream_Play_Start))
@@ -2012,14 +2012,14 @@ DumpMetaData(AMFObject *obj)
 	      // chomp
 	      if (strlen(str) >= 1 && str[strlen(str) - 1] == '\n')
 		str[strlen(str) - 1] = '\0';
-	      LogPrintf("  %-22.*s%s\n", prop->p_name.av_len,
+	      RTMP_LogPrintf("  %-22.*s%s\n", prop->p_name.av_len,
 			prop->p_name.av_val, str);
 	    }
 	}
       else
 	{
 	  if (prop->p_name.av_len)
-	    LogPrintf("%.*s:\n", prop->p_name.av_len, prop->p_name.av_val);
+	    RTMP_LogPrintf("%.*s:\n", prop->p_name.av_len, prop->p_name.av_val);
 	  DumpMetaData(&prop->p_vu.p_object);
 	}
     }
@@ -2042,7 +2042,7 @@ HandleMetadata(RTMP *r, char *body, unsi
   int nRes = AMF_Decode(&obj, body, len, false);
   if (nRes < 0)
     {
-      Log(LOGERROR, "%s, error decoding meta data packet", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, error decoding meta data packet", __FUNCTION__);
       return false;
     }
 
@@ -2053,12 +2053,12 @@ HandleMetadata(RTMP *r, char *body, unsi
     {
       AMFObjectProperty prop;
       // Show metadata
-      LogPrintf("Metadata:\n");
+      RTMP_LogPrintf("Metadata:\n");
       DumpMetaData(&obj);
       if (RTMP_FindFirstMatchingProperty(&obj, &av_duration, &prop))
 	{
 	  r->m_fDuration = prop.p_vu.p_number;
-	  //Log(LOGDEBUG, "Set duration: %.2f", m_fDuration);
+	  //RTMP_Log(RTMP_LOGDEBUG, "Set duration: %.2f", m_fDuration);
 	}
       ret = true;
     }
@@ -2072,7 +2072,7 @@ HandleChangeChunkSize(RTMP *r, const RTM
   if (packet->m_nBodySize >= 4)
     {
       r->m_inChunkSize = AMF_DecodeInt32(packet->m_body);
-      Log(LOGDEBUG, "%s, received: chunk size change to %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, received: chunk size change to %d", __FUNCTION__,
 	  r->m_inChunkSize);
     }
 }
@@ -2094,9 +2094,9 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
   unsigned int tmp;
   if (packet->m_body && packet->m_nBodySize >= 2)
     nType = AMF_DecodeInt16(packet->m_body);
-  Log(LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType,
+  RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType,
       packet->m_nBodySize);
-  //LogHex(packet.m_body, packet.m_nBodySize);
+  //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
 
   if (packet->m_nBodySize >= 6)
     {
@@ -2104,35 +2104,35 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
 	{
 	case 0:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream Begin %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream Begin %d", __FUNCTION__, tmp);
 	  break;
 
 	case 1:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream EOF %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream EOF %d", __FUNCTION__, tmp);
 	  if (r->m_pausing == 1)
 	    r->m_pausing = 2;
 	  break;
 
 	case 2:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream Dry %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream Dry %d", __FUNCTION__, tmp);
 	  break;
 
 	case 4:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream IsRecorded %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream IsRecorded %d", __FUNCTION__, tmp);
 	  break;
 
 	case 6:		// server ping. reply with pong.
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Ping %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Ping %d", __FUNCTION__, tmp);
 	  RTMP_SendCtrl(r, 0x07, tmp, 0);
 	  break;
 
 	case 31:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream BufferEmpty %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream BufferEmpty %d", __FUNCTION__, tmp);
 	  if (r->Link.bLiveStream || (r->Link.protocol & RTMP_FEATURE_HTTP))
 	    break;
 	  if (!r->m_pausing)
@@ -2150,12 +2150,12 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
 
 	case 32:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream BufferReady %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream BufferReady %d", __FUNCTION__, tmp);
 	  break;
 
 	default:
 	  tmp = AMF_DecodeInt32(packet->m_body + 2);
-	  Log(LOGDEBUG, "%s, Stream xx %d", __FUNCTION__, tmp);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, Stream xx %d", __FUNCTION__, tmp);
 	  break;
 	}
 
@@ -2163,9 +2163,9 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
 
   if (nType == 0x1A)
     {
-      Log(LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__);
+      RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__);
 #ifdef CRYPTO
-      //LogHex(packet.m_body, packet.m_nBodySize);
+      //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
 
       // respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied
       if (r->Link.SWFHash.av_len)
@@ -2174,12 +2174,12 @@ HandleCtrl(RTMP *r, const RTMPPacket *pa
 	}
       else
 	{
-	  Log(LOGERROR,
+	  RTMP_Log(RTMP_LOGERROR,
 	      "%s: Ignoring SWFVerification request, use --swfVfy!",
 	      __FUNCTION__);
 	}
 #else
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "%s: Ignoring SWFVerification request, no CRYPTO support!",
 	  __FUNCTION__);
 #endif
@@ -2190,7 +2190,7 @@ static void
 HandleServerBW(RTMP *r, const RTMPPacket *packet)
 {
   r->m_nServerBW = AMF_DecodeInt32(packet->m_body);
-  Log(LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r->m_nServerBW);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r->m_nServerBW);
 }
 
 static void
@@ -2201,7 +2201,7 @@ HandleClientBW(RTMP *r, const RTMPPacket
     r->m_nClientBW2 = packet->m_body[4];
   else
     r->m_nClientBW2 = -1;
-  Log(LOGDEBUG, "%s: client BW = %d %d", __FUNCTION__, r->m_nClientBW,
+  RTMP_Log(RTMP_LOGDEBUG, "%s: client BW = %d %d", __FUNCTION__, r->m_nClientBW,
       r->m_nClientBW2);
 }
 
@@ -2233,11 +2233,11 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
 {
   char hbuf[RTMP_MAX_HEADER_SIZE] = { 0 }, *header = hbuf;
 
-  Log(LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket);
+  RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket);
 
   if (ReadN(r, hbuf, 1) == 0)
     {
-      Log(LOGERROR, "%s, failed to read RTMP packet header", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header", __FUNCTION__);
       return false;
     }
 
@@ -2248,7 +2248,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
     {
       if (ReadN(r, &hbuf[1], 1) != 1)
 	{
-	  Log(LOGERROR, "%s, failed to read RTMP packet header 2nd byte",
+	  RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header 2nd byte",
 	      __FUNCTION__);
 	  return false;
 	}
@@ -2261,13 +2261,13 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
       int tmp;
       if (ReadN(r, &hbuf[1], 2) != 2)
 	{
-	  Log(LOGERROR, "%s, failed to read RTMP packet header 3nd byte",
+	  RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header 3nd byte",
 	      __FUNCTION__);
 	  return false;
 	}
       tmp = (((unsigned)hbuf[2]) << 8) + (unsigned)hbuf[1];
       packet->m_nChannel = tmp + 64;
-      Log(LOGDEBUG, "%s, m_nChannel: %0x", __FUNCTION__, packet->m_nChannel);
+      RTMP_Log(RTMP_LOGDEBUG, "%s, m_nChannel: %0x", __FUNCTION__, packet->m_nChannel);
       header += 2;
     }
 
@@ -2287,7 +2287,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
 
   if (nSize > 0 && ReadN(r, header, nSize) != nSize)
     {
-      Log(LOGERROR, "%s, failed to read RTMP packet header. type: %x",
+      RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header. type: %x",
 	  __FUNCTION__, (unsigned int)hbuf[0]);
       return false;
     }
@@ -2298,7 +2298,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
     {
       packet->m_nInfoField1 = AMF_DecodeInt24(header);
 
-      //Log(LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nInfoField1, packet.m_hasAbsTimestamp);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nInfoField1, packet.m_hasAbsTimestamp);
 
       if (nSize >= 6)
 	{
@@ -2318,7 +2318,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
 	{
 	  if (ReadN(r, header + nSize, 4) != 4)
 	    {
-	      Log(LOGERROR, "%s, failed to read extended timestamp",
+	      RTMP_Log(RTMP_LOGERROR, "%s, failed to read extended timestamp",
 		  __FUNCTION__);
 	      return false;
 	    }
@@ -2327,14 +2327,14 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
 	}
     }
 
-  LogHexString(LOGDEBUG2, hbuf, hSize);
+  RTMP_LogHexString(RTMP_LOGDEBUG2, hbuf, hSize);
 
   bool didAlloc = false;
   if (packet->m_nBodySize > 0 && packet->m_body == NULL)
     {
       if (!RTMPPacket_Alloc(packet, packet->m_nBodySize))
 	{
-	  Log(LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__);
 	  return false;
 	}
       didAlloc = true;
@@ -2357,12 +2357,12 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *pac
 
   if (ReadN(r, packet->m_body + packet->m_nBytesRead, nChunk) != nChunk)
     {
-      Log(LOGERROR, "%s, failed to read RTMP packet body. len: %lu",
+      RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet body. len: %lu",
 	  __FUNCTION__, packet->m_nBodySize);
       return false;
     }
 
-  LogHexString(LOGDEBUG2, packet->m_body + packet->m_nBytesRead, nChunk);
+  RTMP_LogHexString(RTMP_LOGDEBUG2, packet->m_body + packet->m_nBytesRead, nChunk);
 
   packet->m_nBytesRead += nChunk;
 
@@ -2425,10 +2425,10 @@ HandShake(RTMP *r, bool FP9HandShake)
   if (ReadN(r, &type, 1) != 1)	// 0x03 or 0x06
     return false;
 
-  Log(LOGDEBUG, "%s: Type Answer   : %02X", __FUNCTION__, type);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Type Answer   : %02X", __FUNCTION__, type);
 
   if (type != clientbuf[0])
-    Log(LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d",
+    RTMP_Log(RTMP_LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d",
 	__FUNCTION__, clientbuf[0], type);
 
   if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
@@ -2440,8 +2440,8 @@ HandShake(RTMP *r, bool FP9HandShake)
   memcpy(&suptime, serversig, 4);
   suptime = ntohl(suptime);
 
-  Log(LOGDEBUG, "%s: Server Uptime : %d", __FUNCTION__, suptime);
-  Log(LOGDEBUG, "%s: FMS Version   : %d.%d.%d.%d", __FUNCTION__,
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Server Uptime : %d", __FUNCTION__, suptime);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version   : %d.%d.%d.%d", __FUNCTION__,
       serversig[4], serversig[5], serversig[6], serversig[7]);
 
   // 2nd part of handshake
@@ -2454,7 +2454,7 @@ HandShake(RTMP *r, bool FP9HandShake)
   bool bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0);
   if (!bMatch)
     {
-      Log(LOGWARNING, "%s, client signature does not match!", __FUNCTION__);
+      RTMP_Log(RTMP_LOGWARNING, "%s, client signature does not match!", __FUNCTION__);
     }
   return true;
 }
@@ -2470,11 +2470,11 @@ SHandShake(RTMP *r)
   if (ReadN(r, serverbuf, 1) != 1)	// 0x03 or 0x06
     return false;
 
-  Log(LOGDEBUG, "%s: Type Request  : %02X", __FUNCTION__, serverbuf[0]);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Type Request  : %02X", __FUNCTION__, serverbuf[0]);
 
   if (serverbuf[0] != 3)
     {
-      Log(LOGERROR, "%s: Type unknown: client sent %02X",
+      RTMP_Log(RTMP_LOGERROR, "%s: Type unknown: client sent %02X",
 	  __FUNCTION__, serverbuf[0]);
       return false;
     }
@@ -2502,8 +2502,8 @@ SHandShake(RTMP *r)
   memcpy(&uptime, clientsig, 4);
   uptime = ntohl(uptime);
 
-  Log(LOGDEBUG, "%s: Client Uptime : %d", __FUNCTION__, uptime);
-  Log(LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__,
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Client Uptime : %d", __FUNCTION__, uptime);
+  RTMP_Log(RTMP_LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__,
       clientsig[4], clientsig[5], clientsig[6], clientsig[7]);
 
   // 2nd part of handshake
@@ -2516,7 +2516,7 @@ SHandShake(RTMP *r)
   bool bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0);
   if (!bMatch)
     {
-      Log(LOGWARNING, "%s, client signature does not match!", __FUNCTION__);
+      RTMP_Log(RTMP_LOGWARNING, "%s, client signature does not match!", __FUNCTION__);
     }
   return true;
 }
@@ -2528,13 +2528,13 @@ RTMP_SendChunk(RTMP *r, RTMPChunk *chunk
   bool wrote;
   char hbuf[RTMP_MAX_HEADER_SIZE];
 
-  Log(LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket,
+  RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket,
       chunk->c_chunkSize);
-  LogHexString(LOGDEBUG2, chunk->c_header, chunk->c_headerSize);
+  RTMP_LogHexString(RTMP_LOGDEBUG2, chunk->c_header, chunk->c_headerSize);
   if (chunk->c_chunkSize)
     {
       char *ptr = chunk->c_chunk - chunk->c_headerSize;
-      LogHexString(LOGDEBUG2, chunk->c_chunk, chunk->c_chunkSize);
+      RTMP_LogHexString(RTMP_LOGDEBUG2, chunk->c_chunk, chunk->c_chunkSize);
       /* save header bytes we're about to overwrite */
       memcpy(hbuf, ptr, chunk->c_headerSize);
       memcpy(ptr, chunk->c_header, chunk->c_headerSize);
@@ -2567,7 +2567,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
 
   if (packet->m_headerType > 3)	// sanity
     {
-      Log(LOGERROR, "sanity failed!! trying to send header of type: 0x%02x.",
+      RTMP_Log(RTMP_LOGERROR, "sanity failed!! trying to send header of type: 0x%02x.",
 	  (unsigned char)packet->m_headerType);
       return false;
     }
@@ -2648,7 +2648,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
   int nChunkSize = r->m_outChunkSize;
   int tlen;
 
-  Log(LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket,
+  RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket,
       nSize);
   /* send all chunks in one HTTP request */
   if (r->Link.protocol & RTMP_FEATURE_HTTP)
@@ -2670,8 +2670,8 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
       if (nSize < nChunkSize)
 	nChunkSize = nSize;
 
-      LogHexString(LOGDEBUG2, header, hSize);
-      LogHexString(LOGDEBUG2, buffer, nChunkSize);
+      RTMP_LogHexString(RTMP_LOGDEBUG2, header, hSize);
+      RTMP_LogHexString(RTMP_LOGDEBUG2, buffer, nChunkSize);
       if (tbuf)
         {
 	  memcpy(toff, header, nChunkSize + hSize);
@@ -2720,7 +2720,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *pac
     {
       AVal method;
       AMF_DecodeString(packet->m_body + 1, &method);
-      Log(LOGDEBUG, "Invoking %s", method.av_val);
+      RTMP_Log(RTMP_LOGDEBUG, "Invoking %s", method.av_val);
       /* keep it in call queue till result arrives */
       if (queue)
 	AV_queue(&r->m_methodCalls, &r->m_numCalls, &method);
@@ -2854,7 +2854,7 @@ RTMPSockBuf_Fill(RTMPSockBuf *sb)
       else
 	{
 	  int sockerr = GetSockError();
-	  Log(LOGDEBUG, "%s, recv returned %d. GetSockError(): %d (%s)",
+	  RTMP_Log(RTMP_LOGDEBUG, "%s, recv returned %d. GetSockError(): %d (%s)",
 	      __FUNCTION__, nBytes, sockerr, strerror(sockerr));
 	  if (sockerr == EINTR && !RTMP_ctrlC)
 	    continue;
@@ -3065,7 +3065,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
        */
       if (rtnGetNextMediaPacket == 2)
 	{
-	  Log(LOGDEBUG,
+	  RTMP_Log(RTMP_LOGDEBUG,
 	      "Got Play.Complete or Play.Stop from server. "
 	      "Assuming stream is complete");
 	  ret = RTMP_READ_COMPLETE;
@@ -3077,14 +3077,14 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 
       if (packet.m_packetType == 0x09 && nPacketLen <= 5)
 	{
-	  Log(LOGWARNING, "ignoring too small video packet: size: %d",
+	  RTMP_Log(RTMP_LOGWARNING, "ignoring too small video packet: size: %d",
 	      nPacketLen);
 	  ret = RTMP_READ_IGNORE;
 	  break;
 	}
       if (packet.m_packetType == 0x08 && nPacketLen <= 1)
 	{
-	  Log(LOGWARNING, "ignoring too small audio packet: size: %d",
+	  RTMP_Log(RTMP_LOGWARNING, "ignoring too small audio packet: size: %d",
 	      nPacketLen);
 	  ret = RTMP_READ_IGNORE;
 	  break;
@@ -3096,11 +3096,11 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 	  break;
 	}
 #ifdef _DEBUG
-      Log(LOGDEBUG, "type: %02X, size: %d, TS: %d ms, abs TS: %d",
+      RTMP_Log(RTMP_LOGDEBUG, "type: %02X, size: %d, TS: %d ms, abs TS: %d",
 	  packet.m_packetType, nPacketLen, packet.m_nTimeStamp,
 	  packet.m_hasAbsTimestamp);
       if (packet.m_packetType == 0x09)
-	Log(LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0));
+	RTMP_Log(RTMP_LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0));
 #endif
 
       if (r->m_read.flags & RTMP_READ_RESUME)
@@ -3155,7 +3155,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 			  (r->m_read.initialFrame, packetBody,
 			   r->m_read.nInitialFrameSize) == 0)
 			{
-			  Log(LOGDEBUG, "Checked keyframe successfully!");
+			  RTMP_Log(RTMP_LOGDEBUG, "Checked keyframe successfully!");
 			  r->m_read.flags |= RTMP_READ_GOTKF;
 			  /* ignore it! (what about audio data after it? it is
 			   * handled by ignoring all 0ms frames, see below)
@@ -3187,7 +3187,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 			  ts |= (packetBody[pos + 7] << 24);
 
 #ifdef _DEBUG
-			  Log(LOGDEBUG,
+			  RTMP_Log(RTMP_LOGDEBUG,
 			      "keyframe search: FLV Packet: type %02X, dataSize: %d, timeStamp: %d ms",
 			      packetBody[pos], dataSize, ts);
 #endif
@@ -3200,7 +3200,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 			    {
 			      if (ts == r->m_read.nResumeTS)
 				{
-				  Log(LOGDEBUG,
+				  RTMP_Log(RTMP_LOGDEBUG,
 				      "Found keyframe with resume-keyframe timestamp!");
 				  if (r->m_read.nInitialFrameSize != dataSize
 				      || memcmp(r->m_read.initialFrame,
@@ -3208,7 +3208,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 						r->m_read.
 						nInitialFrameSize) != 0)
 				    {
-				      Log(LOGERROR,
+				      RTMP_Log(RTMP_LOGERROR,
 					  "FLV Stream: Keyframe doesn't match!");
 				      ret = RTMP_READ_ERROR;
 				      break;
@@ -3220,7 +3220,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 				   */
 				  if (pos + 11 + dataSize + 4 > nPacketLen)
 				    {
-				      Log(LOGWARNING,
+				      RTMP_Log(RTMP_LOGWARNING,
 					  "Non skipable packet since it doesn't end with chunk, stream corrupt!");
 				      ret = RTMP_READ_ERROR;
 				      break;
@@ -3243,7 +3243,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 			}
 		      if (ts < r->m_read.nResumeTS)
 			{
-			  Log(LOGERROR,
+			  RTMP_Log(RTMP_LOGERROR,
 			      "First packet does not contain keyframe, all "
 			      "timestamps are smaller than the keyframe "
 			      "timestamp; probably the resume seek failed?");
@@ -3252,7 +3252,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 		      ;
 		      if (!(r->m_read.flags & RTMP_READ_GOTFLVK))
 			{
-			  Log(LOGERROR,
+			  RTMP_Log(RTMP_LOGERROR,
 			      "Couldn't find the seeked keyframe in this chunk!");
 			  ret = RTMP_READ_IGNORE;
 			  break;
@@ -3284,7 +3284,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 	  if (!(r->m_read.flags & RTMP_READ_GOTKF) &&
 	  	packet.m_packetType != 0x16)
 	    {
-	      Log(LOGWARNING,
+	      RTMP_Log(RTMP_LOGWARNING,
 		  "Stream does not start with requested frame, ignoring data... ");
 	      r->m_read.nIgnoredFrameCounter++;
 	      if (r->m_read.nIgnoredFrameCounter > MAX_IGNORED_FRAMES)
@@ -3297,7 +3297,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 	  if (!(r->m_read.flags & RTMP_READ_GOTFLVK) &&
 	  	packet.m_packetType == 0x16)
 	    {
-	      Log(LOGWARNING,
+	      RTMP_Log(RTMP_LOGWARNING,
 		  "Stream does not start with requested FLV frame, ignoring data... ");
 	      r->m_read.nIgnoredFlvFrameCounter++;
 	      if (r->m_read.nIgnoredFlvFrameCounter > MAX_IGNORED_FRAMES)
@@ -3344,7 +3344,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 	  r->m_read.buf = malloc(size + 4);
 	  if (r->m_read.buf == 0)
 	    {
-	      Log(LOGERROR, "Couldn't allocate memory!");
+	      RTMP_Log(RTMP_LOGERROR, "Couldn't allocate memory!");
 	      ret = RTMP_READ_ERROR;		// fatal error
 	      break;
 	    }
@@ -3380,13 +3380,13 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 
 	     uint32_t ts = AMF_DecodeInt24(packetBody+2); // composition time
 	     int32_t cts = (ts+0xff800000)^0xff800000;
-	     Log(LOGDEBUG, "cts  : %d\n", cts);
+	     RTMP_Log(RTMP_LOGDEBUG, "cts  : %d\n", cts);
 
 	     nTimeStamp -= cts;
 	     // get rid of the composition time
 	     CRTMP::EncodeInt24(packetBody+2, 0);
 	     }
-	     Log(LOGDEBUG, "VIDEO: nTimeStamp: 0x%08X (%d)\n", nTimeStamp, nTimeStamp);
+	     RTMP_Log(RTMP_LOGDEBUG, "VIDEO: nTimeStamp: 0x%08X (%d)\n", nTimeStamp, nTimeStamp);
 	     } */
 
 	  ptr = AMF_EncodeInt24(ptr, pend, nTimeStamp);
@@ -3424,13 +3424,13 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 		{
 		  if (pos + 11 + dataSize > nPacketLen)
 		    {
-		      Log(LOGERROR,
+		      RTMP_Log(RTMP_LOGERROR,
 			  "Wrong data size (%lu), stream corrupted, aborting!",
 			  dataSize);
 		      ret = RTMP_READ_ERROR;
 		      break;
 		    }
-		  Log(LOGWARNING, "No tagSize found, appending!");
+		  RTMP_Log(RTMP_LOGWARNING, "No tagSize found, appending!");
 
 		  /* we have to append a last tagSize! */
 		  prevTagSize = dataSize + 11;
@@ -3445,7 +3445,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 		    AMF_DecodeInt32(packetBody + pos + 11 + dataSize);
 
 #ifdef _DEBUG
-		  Log(LOGDEBUG,
+		  RTMP_Log(RTMP_LOGDEBUG,
 		      "FLV Packet: type %02X, dataSize: %lu, tagSize: %lu, timeStamp: %lu ms",
 		      (unsigned char)packetBody[pos], dataSize, prevTagSize,
 		      nTimeStamp);
@@ -3454,7 +3454,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
 		  if (prevTagSize != (dataSize + 11))
 		    {
 #ifdef _DEBUG
-		      Log(LOGWARNING,
+		      RTMP_Log(RTMP_LOGWARNING,
 			  "Tag and data size are not consitent, writing tag size according to dataSize+11: %d",
 			  dataSize + 11);
 #endif
@@ -3480,7 +3480,7 @@ Read_1_Packet(RTMP *r, char *buf, int bu
        * Update ext timestamp with this absolute offset in non-live mode
        * otherwise report the relative one
        */
-      // LogPrintf("\nDEBUG: type: %02X, size: %d, pktTS: %dms, TS: %dms, bLiveStream: %d", packet.m_packetType, nPacketLen, packet.m_nTimeStamp, nTimeStamp, bLiveStream);
+      // RTMP_LogPrintf("\nDEBUG: type: %02X, size: %d, pktTS: %dms, TS: %dms, bLiveStream: %d", packet.m_packetType, nPacketLen, packet.m_nTimeStamp, nTimeStamp, bLiveStream);
       r->m_read.timestamp = r->Link.bLiveStream ? packet.m_nTimeStamp : nTimeStamp;
 
       ret = size;
@@ -3646,7 +3646,7 @@ RTMP_Write(RTMP *r, char *buf, int size)
 
 	  if (!RTMPPacket_Alloc(pkt, pkt->m_nBodySize))
 	    {
-	      Log(LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__);
 	      return false;
 	    }
 	  enc = pkt->m_body;

Modified: trunk/rtmpdump.c
==============================================================================
--- trunk/rtmpdump.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/rtmpdump.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -87,7 +87,7 @@ void
 sigIntHandler(int sig)
 {
   RTMP_ctrlC = true;
-  LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
+  RTMP_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);
   signal(SIGTERM, SIG_IGN);
@@ -150,19 +150,19 @@ OpenResumeFile(const char *flvFile,	// f
       // check we've got a valid FLV file to continue!
       if (fread(hbuf, 1, 13, *file) != 13)
 	{
-	  Log(LOGERROR, "Couldn't read FLV file header!");
+	  RTMP_Log(RTMP_LOGERROR, "Couldn't read FLV file header!");
 	  return RD_FAILED;
 	}
       if (hbuf[0] != 'F' || hbuf[1] != 'L' || hbuf[2] != 'V'
 	  || hbuf[3] != 0x01)
 	{
-	  Log(LOGERROR, "Invalid FLV file!");
+	  RTMP_Log(RTMP_LOGERROR, "Invalid FLV file!");
 	  return RD_FAILED;
 	}
 
       if ((hbuf[4] & 0x05) == 0)
 	{
-	  Log(LOGERROR,
+	  RTMP_Log(RTMP_LOGERROR,
 	      "FLV file contains neither video nor audio, aborting!");
 	  return RD_FAILED;
 	}
@@ -172,13 +172,13 @@ OpenResumeFile(const char *flvFile,	// f
 
       if (fread(hbuf, 1, 4, *file) != 4)
 	{
-	  Log(LOGERROR, "Invalid FLV file: missing first prevTagSize!");
+	  RTMP_Log(RTMP_LOGERROR, "Invalid FLV file: missing first prevTagSize!");
 	  return RD_FAILED;
 	}
       prevTagSize = AMF_DecodeInt32(hbuf);
       if (prevTagSize != 0)
 	{
-	  Log(LOGWARNING,
+	  RTMP_Log(RTMP_LOGWARNING,
 	      "First prevTagSize is not zero: prevTagSize = 0x%08X",
 	      prevTagSize);
 	}
@@ -216,7 +216,7 @@ OpenResumeFile(const char *flvFile,	// f
 	      int nRes = AMF_Decode(&metaObj, buffer, dataSize, false);
 	      if (nRes < 0)
 		{
-		  Log(LOGERROR, "%s, error decoding meta data packet",
+		  RTMP_Log(RTMP_LOGERROR, "%s, error decoding meta data packet",
 		      __FUNCTION__);
 		  break;
 		}
@@ -240,7 +240,7 @@ OpenResumeFile(const char *flvFile,	// f
 		      (&metaObj, &av_duration, &prop))
 		    {
 		      *duration = AMFProp_GetNumber(&prop);
-		      Log(LOGDEBUG, "File has duration: %f", *duration);
+		      RTMP_Log(RTMP_LOGDEBUG, "File has duration: %f", *duration);
 		    }
 
 		  bFoundMetaHeader = true;
@@ -254,7 +254,7 @@ OpenResumeFile(const char *flvFile,	// f
 
       free(buffer);
       if (!bFoundMetaHeader)
-	Log(LOGWARNING, "Couldn't locate meta data!");
+	RTMP_Log(RTMP_LOGWARNING, "Couldn't locate meta data!");
     }
 
   return RD_SUCCESS;
@@ -283,7 +283,7 @@ GetLastKeyframe(FILE * file,	// output f
 
   bAudioOnly = (dataType & 0x4) && !(dataType & 0x1);
 
-  Log(LOGDEBUG, "bAudioOnly: %d, size: %llu", bAudioOnly,
+  RTMP_Log(RTMP_LOGDEBUG, "bAudioOnly: %d, size: %llu", bAudioOnly,
       (unsigned long long) size);
 
   // ok, we have to get the timestamp of the last keyframe (only keyframes are seekable) / last audio frame (audio only streams)
@@ -301,7 +301,7 @@ GetLastKeyframe(FILE * file,	// output f
     skipkeyframe:
       if (size - tsize < 13)
 	{
-	  Log(LOGERROR,
+	  RTMP_Log(RTMP_LOGERROR,
 	      "Unexpected start of file, error in tag sizes, couldn't arrive at prevTagSize=0");
 	  return RD_FAILED;
 	}
@@ -309,22 +309,22 @@ GetLastKeyframe(FILE * file,	// output f
       xread = fread(buffer, 1, 4, file);
       if (xread != 4)
 	{
-	  Log(LOGERROR, "Couldn't read prevTagSize from file!");
+	  RTMP_Log(RTMP_LOGERROR, "Couldn't read prevTagSize from file!");
 	  return RD_FAILED;
 	}
 
       prevTagSize = AMF_DecodeInt32(buffer);
-      //Log(LOGDEBUG, "Last packet: prevTagSize: %d", prevTagSize);
+      //RTMP_Log(RTMP_LOGDEBUG, "Last packet: prevTagSize: %d", prevTagSize);
 
       if (prevTagSize == 0)
 	{
-	  Log(LOGERROR, "Couldn't find keyframe to resume from!");
+	  RTMP_Log(RTMP_LOGERROR, "Couldn't find keyframe to resume from!");
 	  return RD_FAILED;
 	}
 
       if (prevTagSize < 0 || prevTagSize > size - 4 - 13)
 	{
-	  Log(LOGERROR,
+	  RTMP_Log(RTMP_LOGERROR,
 	      "Last tag size must be greater/equal zero (prevTagSize=%d) and smaller then filesize, corrupt file!",
 	      prevTagSize);
 	  return RD_FAILED;
@@ -335,14 +335,14 @@ GetLastKeyframe(FILE * file,	// output f
       fseeko(file, size - tsize, SEEK_SET);
       if (fread(buffer, 1, 12, file) != 12)
 	{
-	  Log(LOGERROR, "Couldn't read header!");
+	  RTMP_Log(RTMP_LOGERROR, "Couldn't read header!");
 	  return RD_FAILED;
 	}
       //*
 #ifdef _DEBUG
       uint32_t ts = AMF_DecodeInt24(buffer + 4);
       ts |= (buffer[7] << 24);
-      Log(LOGDEBUG, "%02X: TS: %d ms", buffer[0], ts);
+      RTMP_Log(RTMP_LOGDEBUG, "%02X: TS: %d ms", buffer[0], ts);
 #endif //*/
 
       // this just continues the loop whenever the number of skipped frames is > 0,
@@ -356,7 +356,7 @@ GetLastKeyframe(FILE * file,	// output f
 	       && (buffer[0] != 0x09 || (buffer[11] & 0xf0) != 0x10)))
 	{
 #ifdef _DEBUG
-	  Log(LOGDEBUG,
+	  RTMP_Log(RTMP_LOGDEBUG,
 	      "xxxxxxxxxxxxxxxxxxxxxxxx Well, lets go one more back!");
 #endif
 	  nSkipKeyFrames--;
@@ -374,7 +374,7 @@ GetLastKeyframe(FILE * file,	// output f
   fseeko(file, size - tsize + 11, SEEK_SET);
   if (fread(*initialFrame, 1, *nInitialFrameSize, file) != *nInitialFrameSize)
     {
-      Log(LOGERROR, "Couldn't read last keyframe, aborting!");
+      RTMP_Log(RTMP_LOGERROR, "Couldn't read last keyframe, aborting!");
       return RD_FAILED;
     }
 
@@ -387,30 +387,30 @@ GetLastKeyframe(FILE * file,	// output f
 
   if (*dSeek < 0)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "Last keyframe timestamp is negative, aborting, your file is corrupt!");
       return RD_FAILED;
     }
-  Log(LOGDEBUG, "Last keyframe found at: %d ms, size: %d, type: %02X", *dSeek,
+  RTMP_Log(RTMP_LOGDEBUG, "Last keyframe found at: %d ms, size: %d, type: %02X", *dSeek,
       *nInitialFrameSize, *initialFrameType);
 
   /*
      // now read the timestamp of the frame before the seekable keyframe:
      fseeko(file, size-tsize-4, SEEK_SET);
      if(fread(buffer, 1, 4, file) != 4) {
-     Log(LOGERROR, "Couldn't read prevTagSize from file!");
+     RTMP_Log(RTMP_LOGERROR, "Couldn't read prevTagSize from file!");
      goto start;
      }
      uint32_t prevTagSize = RTMP_LIB::AMF_DecodeInt32(buffer);
      fseeko(file, size-tsize-4-prevTagSize+4, SEEK_SET);
      if(fread(buffer, 1, 4, file) != 4) {
-     Log(LOGERROR, "Couldn't read previous timestamp!");
+     RTMP_Log(RTMP_LOGERROR, "Couldn't read previous timestamp!");
      goto start;
      }
      uint32_t timestamp = RTMP_LIB::AMF_DecodeInt24(buffer);
      timestamp |= (buffer[3]<<24);
 
-     Log(LOGDEBUG, "Previous timestamp: %d ms", timestamp);
+     RTMP_Log(RTMP_LOGDEBUG, "Previous timestamp: %d ms", timestamp);
    */
 
   if (*dSeek != 0)
@@ -446,12 +446,12 @@ Download(RTMP * rtmp,		// connected RTMP
 
   if (rtmp->m_read.timestamp)
     {
-      Log(LOGDEBUG, "Continuing at TS: %d ms\n", rtmp->m_read.timestamp);
+      RTMP_Log(RTMP_LOGDEBUG, "Continuing at TS: %d ms\n", rtmp->m_read.timestamp);
     }
 
   if (bLiveStream)
     {
-      LogPrintf("Starting Live Stream\n");
+      RTMP_LogPrintf("Starting Live Stream\n");
     }
   else
     {
@@ -461,7 +461,7 @@ Download(RTMP * rtmp,		// connected RTMP
 	{
 	  if ((double) rtmp->m_read.timestamp >= (double) duration * 999.0)
 	    {
-	      LogPrintf("Already Completed at: %.3f sec Duration=%.3f sec\n",
+	      RTMP_LogPrintf("Already Completed at: %.3f sec Duration=%.3f sec\n",
 			(double) rtmp->m_read.timestamp / 1000.0,
 			(double) duration / 1000.0);
 	      return RD_SUCCESS;
@@ -470,7 +470,7 @@ Download(RTMP * rtmp,		// connected RTMP
 	    {
 	      *percent = ((double) rtmp->m_read.timestamp) / (duration * 1000.0) * 100.0;
 	      *percent = ((double) (int) (*percent * 10.0)) / 10.0;
-	      LogPrintf("%s download at: %.3f kB / %.3f sec (%.1f%%)\n",
+	      RTMP_LogPrintf("%s download at: %.3f kB / %.3f sec (%.1f%%)\n",
 			bResume ? "Resuming" : "Starting",
 			(double) size / 1024.0, (double) rtmp->m_read.timestamp / 1000.0,
 			*percent);
@@ -478,14 +478,14 @@ Download(RTMP * rtmp,		// connected RTMP
 	}
       else
 	{
-	  LogPrintf("%s download at: %.3f kB\n",
+	  RTMP_LogPrintf("%s download at: %.3f kB\n",
 		    bResume ? "Resuming" : "Starting",
 		    (double) size / 1024.0);
 	}
     }
 
   if (dLength > 0)
-    LogPrintf("For duration: %.3f sec\n", (double) dLength / 1000.0);
+    RTMP_LogPrintf("For duration: %.3f sec\n", (double) dLength / 1000.0);
 
   if (bResume && nInitialFrameSize > 0)
     rtmp->m_read.flags |= RTMP_READ_RESUME;
@@ -501,19 +501,19 @@ Download(RTMP * rtmp,		// connected RTMP
   do
     {
       nRead = RTMP_Read(rtmp, buffer, bufferSize);
-      //LogPrintf("nRead: %d\n", nRead);
+      //RTMP_LogPrintf("nRead: %d\n", nRead);
       if (nRead > 0)
 	{
 	  if (fwrite(buffer, sizeof(unsigned char), nRead, file) !=
 	      (size_t) nRead)
 	    {
-	      Log(LOGERROR, "%s: Failed writing, exiting!", __FUNCTION__);
+	      RTMP_Log(RTMP_LOGERROR, "%s: Failed writing, exiting!", __FUNCTION__);
 	      free(buffer);
 	      return RD_FAILED;
 	    }
 	  size += nRead;
 
-	  //LogPrintf("write %dbytes (%.1f kB)\n", nRead, nRead/1024.0);
+	  //RTMP_LogPrintf("write %dbytes (%.1f kB)\n", nRead, nRead/1024.0);
 	  if (duration <= 0)	// if duration unknown try to get it from the stream (onMetaData)
 	    duration = RTMP_GetDuration(rtmp);
 
@@ -524,7 +524,7 @@ Download(RTMP * rtmp,		// connected RTMP
 		{
 		  bufferTime = (uint32_t) (duration * 1000.0) + 5000;	// extra 5sec to make sure we've got enough
 
-		  Log(LOGDEBUG,
+		  RTMP_Log(RTMP_LOGDEBUG,
 		      "Detected that buffer time is less than duration, resetting to: %dms",
 		      bufferTime);
 		  RTMP_SetBufferMS(rtmp, bufferTime);
@@ -536,7 +536,7 @@ Download(RTMP * rtmp,		// connected RTMP
 		{
 		  if (lastPercent + 1 <= *percent)
 		    {
-		      LogStatus("#");
+		      RTMP_LogStatus("#");
 		      lastPercent = (unsigned long) *percent;
 		    }
 		}
@@ -545,7 +545,7 @@ Download(RTMP * rtmp,		// connected RTMP
 		  now = RTMP_GetTime();
 		  if (abs(now - lastUpdate) > 200)
 		    {
-		      LogStatus("\r%.3f kB / %.2f sec (%.1f%%)",
+		      RTMP_LogStatus("\r%.3f kB / %.2f sec (%.1f%%)",
 				(double) size / 1024.0,
 				(double) (rtmp->m_read.timestamp) / 1000.0, *percent);
 		      lastUpdate = now;
@@ -558,9 +558,9 @@ Download(RTMP * rtmp,		// connected RTMP
 	      if (abs(now - lastUpdate) > 200)
 		{
 		  if (bHashes)
-		    LogStatus("#");
+		    RTMP_LogStatus("#");
 		  else
-		    LogStatus("\r%.3f kB / %.2f sec", (double) size / 1024.0,
+		    RTMP_LogStatus("\r%.3f kB / %.2f sec", (double) size / 1024.0,
 			      (double) (rtmp->m_read.timestamp) / 1000.0);
 		  lastUpdate = now;
 		}
@@ -569,7 +569,7 @@ Download(RTMP * rtmp,		// connected RTMP
 #ifdef _DEBUG
       else
 	{
-	  Log(LOGDEBUG, "zero read!");
+	  RTMP_Log(RTMP_LOGDEBUG, "zero read!");
 	}
 #endif
 
@@ -586,22 +586,22 @@ Download(RTMP * rtmp,		// connected RTMP
 	{
 	  *percent = ((double) rtmp->m_read.timestamp) / (duration * 1000.0) * 100.0;
 	  *percent = ((double) (int) (*percent * 10.0)) / 10.0;
-	  LogStatus("\r%.3f kB / %.2f sec (%.1f%%)",
+	  RTMP_LogStatus("\r%.3f kB / %.2f sec (%.1f%%)",
 	    (double) size / 1024.0,
 	    (double) (rtmp->m_read.timestamp) / 1000.0, *percent);
 	}
       else
 	{
-	  LogStatus("\r%.3f kB / %.2f sec", (double) size / 1024.0,
+	  RTMP_LogStatus("\r%.3f kB / %.2f sec", (double) size / 1024.0,
 	    (double) (rtmp->m_read.timestamp) / 1000.0);
 	}
     }
 
-  Log(LOGDEBUG, "RTMP_Read returned: %d", nRead);
+  RTMP_Log(RTMP_LOGDEBUG, "RTMP_Read returned: %d", nRead);
 
   if (bResume && nRead == -2)
     {
-      LogPrintf("Couldn't resume FLV file, try --skip %d\n\n",
+      RTMP_LogPrintf("Couldn't resume FLV file, try --skip %d\n\n",
 		nSkipKeyFrames + 1);
       return RD_FAILED;
     }
@@ -788,17 +788,17 @@ main(int argc, char **argv)
     {
       if (strcmp(argv[index], "--quiet") == 0
 	  || strcmp(argv[index], "-q") == 0)
-	AMF_debuglevel = LOGCRIT;
+	RTMP_debuglevel = RTMP_LOGCRIT;
       index++;
     }
 
-  LogPrintf("RTMPDump %s\n", RTMPDUMP_VERSION);
-  LogPrintf
+  RTMP_LogPrintf("RTMPDump %s\n", RTMPDUMP_VERSION);
+  RTMP_LogPrintf
     ("(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL\n");
 
   if (!InitSockets())
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "Couldn't load sockets support on your platform, exiting!");
       return RD_FAILED;
     }
@@ -852,79 +852,79 @@ main(int argc, char **argv)
       switch (opt)
 	{
 	case 'h':
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("\nThis program dumps the media content streamed over RTMP.\n\n");
-	  LogPrintf("--help|-h               Prints this help screen.\n");
-	  LogPrintf
+	  RTMP_LogPrintf("--help|-h               Prints this help screen.\n");
+	  RTMP_LogPrintf
 	    ("--rtmp|-r url           URL (e.g. rtmp//host[:port]/path)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--host|-n hostname      Overrides the hostname in the rtmp url\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--port|-c port          Overrides the port in the rtmp url\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--socks|-S host:port    Use the specified SOCKS proxy\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--protocol|-l           Overrides the protocol in the rtmp url (0 - RTMP, 2 - RTMPE)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--playpath|-y           Overrides the playpath parsed from rtmp url\n");
-	  LogPrintf("--swfUrl|-s url         URL to player swf file\n");
-	  LogPrintf
+	  RTMP_LogPrintf("--swfUrl|-s url         URL to player swf file\n");
+	  RTMP_LogPrintf
 	    ("--tcUrl|-t url          URL to played stream (default: \"rtmp://host[:port]/app\")\n");
-	  LogPrintf("--pageUrl|-p url        Web URL of played programme\n");
-	  LogPrintf("--app|-a app            Name of target app on server\n");
+	  RTMP_LogPrintf("--pageUrl|-p url        Web URL of played programme\n");
+	  RTMP_LogPrintf("--app|-a app            Name of target app on server\n");
 #ifdef CRYPTO
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfhash|-w hexstring  SHA256 hash of the decompressed SWF file (32 bytes)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfsize|-x num        Size of the decompressed SWF file, required for SWFVerification\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfVfy|-W url         URL to player swf file, compute hash/size automatically\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfAge|-X days        Number of days to use cached SWF hash before refreshing\n");
 #endif
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--auth|-u string        Authentication string to be appended to the connect string\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--conn|-C type:data     Arbitrary AMF data to be appended to the connect string\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("                        B:boolean(0|1), S:string, N:number, O:object-flag(0|1),\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("                        Z:(null), NB:name:boolean, NS:name:string, NN:name:number\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--flashVer|-f string    Flash version string (default: \"%s\")\n",
 	     RTMP_DefaultFlashVer.av_val);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--live|-v               Save a live stream, no --resume (seeking) of live streams possible\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--subscribe|-d string   Stream name to subscribe to (otherwise defaults to playpath if live is specifed)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--flv|-o string         FLV output file name, if the file name is - print stream to stdout\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--resume|-e             Resume a partial RTMP download\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--timeout|-m num        Timeout connection num seconds (default: %lu)\n",
 	     timeout);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--start|-A num          Start at num seconds into stream (not valid when using --live)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--stop|-B num           Stop at num seconds into stream\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--token|-T key          Key for SecureToken response\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--hashes|-#             Display progress with hashes, not with the byte counter\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--buffer|-b             Buffer time in milliseconds (default: %lu), this option makes only sense in stdout mode (-o -)\n",
 	     bufferTime);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--skip|-k num           Skip num keyframes when looking for last keyframe to resume from. Useful if resume fails (default: %d)\n\n",
 	     nSkipKeyFrames);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--quiet|-q              Suppresses all command output.\n");
-	  LogPrintf("--verbose|-V            Verbose command output.\n");
-	  LogPrintf("--debug|-z              Debug level command output.\n");
-	  LogPrintf
+	  RTMP_LogPrintf("--verbose|-V            Verbose command output.\n");
+	  RTMP_LogPrintf("--debug|-z              Debug level command output.\n");
+	  RTMP_LogPrintf
 	    ("If you don't pass parameters for swfUrl, pageUrl, or auth these properties will not be included in the connect ");
-	  LogPrintf("packet.\n\n");
+	  RTMP_LogPrintf("packet.\n\n");
 	  return RD_SUCCESS;
 #ifdef CRYPTO
 	case 'w':
@@ -933,7 +933,7 @@ main(int argc, char **argv)
 	    if (res != HASHLEN)
 	      {
 		swfHash.av_val = NULL;
-		Log(LOGWARNING,
+		RTMP_Log(RTMP_LOGWARNING,
 		    "Couldn't parse swf hash hex string, not hexstring or not %d bytes, ignoring!", HASHLEN);
 	      }
 	    swfHash.av_len = HASHLEN;
@@ -944,7 +944,7 @@ main(int argc, char **argv)
 	    int size = atoi(optarg);
 	    if (size <= 0)
 	      {
-		Log(LOGERROR, "SWF Size must be at least 1, ignoring\n");
+		RTMP_Log(RTMP_LOGERROR, "SWF Size must be at least 1, ignoring\n");
 	      }
 	    else
 	      {
@@ -961,7 +961,7 @@ main(int argc, char **argv)
 	    int num = atoi(optarg);
 	    if (num < 0)
 	      {
-		Log(LOGERROR, "SWF Age must be non-negative, ignoring\n");
+		RTMP_Log(RTMP_LOGERROR, "SWF Age must be non-negative, ignoring\n");
 	      }
 	    else
 	      {
@@ -974,13 +974,13 @@ main(int argc, char **argv)
 	  nSkipKeyFrames = atoi(optarg);
 	  if (nSkipKeyFrames < 0)
 	    {
-	      Log(LOGERROR,
+	      RTMP_Log(RTMP_LOGERROR,
 		  "Number of keyframes skipped must be greater or equal zero, using zero!");
 	      nSkipKeyFrames = 0;
 	    }
 	  else
 	    {
-	      Log(LOGDEBUG, "Number of skipped key frames for resume: %d",
+	      RTMP_Log(RTMP_LOGDEBUG, "Number of skipped key frames for resume: %d",
 		  nSkipKeyFrames);
 	    }
 	  break;
@@ -989,7 +989,7 @@ main(int argc, char **argv)
 	    int32_t bt = atol(optarg);
 	    if (bt < 0)
 	      {
-		Log(LOGERROR,
+		RTMP_Log(RTMP_LOGERROR,
 		    "Buffer time must be greater than zero, ignoring the specified value %d!",
 		    bt);
 	      }
@@ -1017,7 +1017,7 @@ main(int argc, char **argv)
 	  if (protocol != RTMP_PROTOCOL_RTMP
 	      && protocol != RTMP_PROTOCOL_RTMPE)
 	    {
-	      Log(LOGERROR, "Unknown protocol specified: %d", protocol);
+	      RTMP_Log(RTMP_LOGERROR, "Unknown protocol specified: %d", protocol);
 	      return RD_FAILED;
 	    }
 	  break;
@@ -1037,7 +1037,7 @@ main(int argc, char **argv)
 		(rtmpurl, &parsedProtocol, &parsedHost, &parsedPort,
 		 &parsedPlaypath, &parsedApp))
 	      {
-		Log(LOGWARNING, "Couldn't parse the specified url (%s)!",
+		RTMP_Log(RTMP_LOGWARNING, "Couldn't parse the specified url (%s)!",
 		    optarg);
 	      }
 	    else
@@ -1089,7 +1089,7 @@ main(int argc, char **argv)
         case 'C':
           if (parseAMF(&extras, optarg, &edepth))
             {
-              Log(LOGERROR, "Invalid AMF parameter: %s", optarg);
+              RTMP_Log(RTMP_LOGERROR, "Invalid AMF parameter: %s", optarg);
               return RD_FAILED;
             }
           break;
@@ -1109,45 +1109,45 @@ main(int argc, char **argv)
 	  bHashes = true;
 	  break;
 	case 'q':
-	  AMF_debuglevel = LOGCRIT;
+	  RTMP_debuglevel = RTMP_LOGCRIT;
 	  break;
 	case 'V':
-	  AMF_debuglevel = LOGDEBUG;
+	  RTMP_debuglevel = RTMP_LOGDEBUG;
 	  break;
 	case 'z':
-	  AMF_debuglevel = LOGALL;
+	  RTMP_debuglevel = RTMP_LOGALL;
 	  break;
 	case 'S':
 	  sockshost = optarg;
 	  break;
 	default:
-	  LogPrintf("unknown option: %c\n", opt);
+	  RTMP_LogPrintf("unknown option: %c\n", opt);
 	  break;
 	}
     }
 
   if (hostname == 0)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "You must specify a hostname (--host) or url (-r \"rtmp://host[:port]/playpath\") containing a hostname");
       return RD_FAILED;
     }
   if (playpath.av_len == 0)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "You must specify a playpath (--playpath) or url (-r \"rtmp://host[:port]/playpath\") containing a playpath");
       return RD_FAILED;
     }
 
   if (protocol == RTMP_PROTOCOL_UNDEFINED)
     {
-      Log(LOGWARNING,
+      RTMP_Log(RTMP_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,
+      RTMP_Log(RTMP_LOGWARNING,
 	  "You haven't specified a port (--port) or rtmp url (-r), using default port 1935");
       port = 0;
     }
@@ -1163,21 +1163,21 @@ main(int argc, char **argv)
 
   if (flvFile == 0)
     {
-      Log(LOGWARNING,
+      RTMP_Log(RTMP_LOGWARNING,
 	  "You haven't specified an output file (-o filename), using stdout");
       bStdoutMode = true;
     }
 
   if (bStdoutMode && bResume)
     {
-      Log(LOGWARNING,
+      RTMP_Log(RTMP_LOGWARNING,
 	  "Can't resume in stdout mode, ignoring --resume option");
       bResume = false;
     }
 
   if (bLiveStream && bResume)
     {
-      Log(LOGWARNING, "Can't resume live stream, ignoring --resume option");
+      RTMP_Log(RTMP_LOGWARNING, "Can't resume live stream, ignoring --resume option");
       bResume = false;
     }
 
@@ -1193,14 +1193,14 @@ main(int argc, char **argv)
 
   if (swfHash.av_len == 0 && swfSize > 0)
     {
-      Log(LOGWARNING,
+      RTMP_Log(RTMP_LOGWARNING,
 	  "Ignoring SWF size, supply also the hash with --swfhash");
       swfSize = 0;
     }
 
   if (swfHash.av_len != 0 && swfSize == 0)
     {
-      Log(LOGWARNING,
+      RTMP_Log(RTMP_LOGWARNING,
 	  "Ignoring SWF hash, supply also the swf size  with --swfsize");
       swfHash.av_len = 0;
       swfHash.av_val = NULL;
@@ -1225,7 +1225,7 @@ main(int argc, char **argv)
       // Live stream
       if (bLiveStream)
 	{
-	  Log(LOGWARNING,
+	  RTMP_Log(RTMP_LOGWARNING,
 	      "Can't seek in a live stream, ignoring --start option");
 	  dStartOffset = 0;
 	}
@@ -1266,13 +1266,13 @@ main(int argc, char **argv)
 				    &initialFrameType, &nInitialFrameSize);
 	  if (nStatus == RD_FAILED)
 	    {
-	      Log(LOGDEBUG, "Failed to get last keyframe.");
+	      RTMP_Log(RTMP_LOGDEBUG, "Failed to get last keyframe.");
 	      goto clean;
 	    }
 
 	  if (dSeek == 0)
 	    {
-	      Log(LOGDEBUG,
+	      RTMP_Log(RTMP_LOGDEBUG,
 		  "Last keyframe is first frame in stream, switching from resume to normal mode!");
 	      bResume = false;
 	    }
@@ -1291,7 +1291,7 @@ main(int argc, char **argv)
 	  file = fopen(flvFile, "w+b");
 	  if (file == 0)
 	    {
-	      LogPrintf("Failed to open file! %s\n", flvFile);
+	      RTMP_LogPrintf("Failed to open file! %s\n", flvFile);
 	      return RD_FAILED;
 	    }
 	}
@@ -1304,13 +1304,13 @@ main(int argc, char **argv)
 
   while (!RTMP_ctrlC)
     {
-      Log(LOGDEBUG, "Setting buffer time to: %dms", bufferTime);
+      RTMP_Log(RTMP_LOGDEBUG, "Setting buffer time to: %dms", bufferTime);
       RTMP_SetBufferMS(&rtmp, bufferTime);
 
       if (first)
 	{
 	  first = 0;
-	  LogPrintf("Connecting ...\n");
+	  RTMP_LogPrintf("Connecting ...\n");
 
 	  if (!RTMP_Connect(&rtmp, NULL))
 	    {
@@ -1318,7 +1318,7 @@ main(int argc, char **argv)
 	      break;
 	    }
 
-	  Log(LOGINFO, "Connected...");
+	  RTMP_Log(RTMP_LOGINFO, "Connected...");
 
 	  // User defined seek offset
 	  if (dStartOffset > 0)
@@ -1326,7 +1326,7 @@ main(int argc, char **argv)
 	      // Don't need the start offset if resuming an existing file
 	      if (bResume)
 		{
-		  Log(LOGWARNING,
+		  RTMP_Log(RTMP_LOGWARNING,
 		      "Can't seek a resumed stream, ignoring --start option");
 		  dStartOffset = 0;
 		}
@@ -1344,7 +1344,7 @@ main(int argc, char **argv)
 	      // Quit if start seek is past required stop offset
 	      if (dLength <= 0)
 		{
-		  LogPrintf("Already Completed\n");
+		  RTMP_LogPrintf("Already Completed\n");
 		  nStatus = RD_SUCCESS;
 		  break;
 		}
@@ -1362,14 +1362,14 @@ main(int argc, char **argv)
 
           if (retries)
             {
-	      Log(LOGERROR, "Failed to resume the stream\n\n");
+	      RTMP_Log(RTMP_LOGERROR, "Failed to resume the stream\n\n");
 	      if (!RTMP_IsTimedout(&rtmp))
 	        nStatus = RD_FAILED;
 	      else
 	        nStatus = RD_INCOMPLETE;
 	      break;
             }
-	  Log(LOGINFO, "Connection timed out, trying to resume.\n\n");
+	  RTMP_Log(RTMP_LOGINFO, "Connection timed out, trying to resume.\n\n");
           /* Did we already try pausing, and it still didn't work? */
           if (rtmp.m_pausing == 3)
             {
@@ -1381,14 +1381,14 @@ main(int argc, char **argv)
                   dLength = dStopOffset - dSeek;
                   if (dLength <= 0)
                     {
-                      LogPrintf("Already Completed\n");
+                      RTMP_LogPrintf("Already Completed\n");
 		      nStatus = RD_SUCCESS;
 		      break;
                     }
                 }
               if (!RTMP_ReconnectStream(&rtmp, bufferTime, dSeek, dLength))
                 {
-	          Log(LOGERROR, "Failed to resume the stream\n\n");
+	          RTMP_Log(RTMP_LOGERROR, "Failed to resume the stream\n\n");
 	          if (!RTMP_IsTimedout(&rtmp))
 		    nStatus = RD_FAILED;
 	          else
@@ -1398,7 +1398,7 @@ main(int argc, char **argv)
             }
 	  else if (!RTMP_ToggleStream(&rtmp))
 	    {
-	      Log(LOGERROR, "Failed to resume the stream\n\n");
+	      RTMP_Log(RTMP_LOGERROR, "Failed to resume the stream\n\n");
 	      if (!RTMP_IsTimedout(&rtmp))
 		nStatus = RD_FAILED;
 	      else
@@ -1424,17 +1424,17 @@ main(int argc, char **argv)
 
   if (nStatus == RD_SUCCESS)
     {
-      LogPrintf("Download complete\n");
+      RTMP_LogPrintf("Download complete\n");
     }
   else if (nStatus == RD_INCOMPLETE)
     {
-      LogPrintf
+      RTMP_LogPrintf
 	("Download may be incomplete (downloaded about %.2f%%), try resuming\n",
 	 percent);
     }
 
 clean:
-  Log(LOGDEBUG, "Closing connection.\n");
+  RTMP_Log(RTMP_LOGDEBUG, "Closing connection.\n");
   RTMP_Close(&rtmp);
 
   if (file != 0)

Modified: trunk/rtmpgw.c
==============================================================================
--- trunk/rtmpgw.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/rtmpgw.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -273,12 +273,12 @@ controlServerThread(void *unused)
       switch (ich)
 	{
 	case 'q':
-	  LogPrintf("Exiting\n");
+	  RTMP_LogPrintf("Exiting\n");
 	  stopStreaming(httpServer);
 	  exit(0);
 	  break;
 	default:
-	  LogPrintf("Unknown command \'%c\', ignoring\n", ich);
+	  RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich);
 	}
     }
   TFRET();
@@ -361,7 +361,7 @@ void processTCPrequest(STREAMING_SERVER 
 
   if (select(sockfd + 1, &fds, NULL, NULL, &tv) <= 0)
     {
-      Log(LOGERROR, "Request timeout/select failed, ignoring request");
+      RTMP_Log(RTMP_LOGERROR, "Request timeout/select failed, ignoring request");
       goto quit;
     }
   else
@@ -369,12 +369,12 @@ void processTCPrequest(STREAMING_SERVER 
       nRead = recv(sockfd, header, 2047, 0);
       header[2047] = '\0';
 
-      Log(LOGDEBUG, "%s: header: %s", __FUNCTION__, header);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: header: %s", __FUNCTION__, header);
 
       if (strstr(header, "Range: bytes=") != 0)
 	{
 	  // TODO check range starts from 0 and asking till the end.
-	  LogPrintf("%s, Range request not supported\n", __FUNCTION__);
+	  RTMP_LogPrintf("%s, Range request not supported\n", __FUNCTION__);
 	  len = sprintf(buf, "HTTP/1.0 416 Requested Range Not Satisfiable%s\r\n",
 		  srvhead);
 	  send(sockfd, buf, len, 0);
@@ -403,7 +403,7 @@ void processTCPrequest(STREAMING_SERVER 
   // if we got a filename from the GET method
   if (filename != NULL)
     {
-      Log(LOGDEBUG, "%s: Request header: %s", __FUNCTION__, filename);
+      RTMP_Log(RTMP_LOGDEBUG, "%s: Request header: %s", __FUNCTION__, filename);
       if (filename[0] == '/')
 	{			// if its not empty, is it /?
 	  ptr = filename + 1;
@@ -437,10 +437,10 @@ void processTCPrequest(STREAMING_SERVER 
 		  memcpy(arg, ptr, nArgLen * sizeof(char));
 		  arg[nArgLen] = '\0';
 
-		  //Log(LOGDEBUG, "%s: unescaping parameter: %s", __FUNCTION__, arg);
+		  //RTMP_Log(RTMP_LOGDEBUG, "%s: unescaping parameter: %s", __FUNCTION__, arg);
 		  http_unescape(arg);
 
-		  Log(LOGDEBUG, "%s: parameter: %c, arg: %s", __FUNCTION__,
+		  RTMP_Log(RTMP_LOGDEBUG, "%s: parameter: %c, arg: %s", __FUNCTION__,
 		      ich, arg);
 
 		  ptr += nArgLen + 1;
@@ -457,21 +457,21 @@ void processTCPrequest(STREAMING_SERVER 
     }
   else
     {
-      LogPrintf("%s: No request header received/unsupported method\n",
+      RTMP_LogPrintf("%s: No request header received/unsupported method\n",
 		__FUNCTION__);
     }
 
   // do necessary checks right here to make sure the combined request of default values and GET parameters is correct
   if (req.hostname == 0)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "You must specify a hostname (--host) or url (-r \"rtmp://host[:port]/playpath\") containing a hostname");
       status = "400 Missing Hostname";
       goto filenotfound;
     }
   if (req.playpath.av_len == 0)
     {
-      Log(LOGERROR,
+      RTMP_Log(RTMP_LOGERROR,
 	  "You must specify a playpath (--playpath) or url (-r \"rtmp://host[:port]/playpath\") containing a playpath");
       status = "400 Missing Playpath";
       goto filenotfound;;
@@ -479,13 +479,13 @@ void processTCPrequest(STREAMING_SERVER 
 
   if (req.protocol == RTMP_PROTOCOL_UNDEFINED)
     {
-      Log(LOGWARNING,
+      RTMP_Log(RTMP_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,
+      RTMP_Log(RTMP_LOGWARNING,
 	  "You haven't specified a port (--port) or rtmp url (-r), using default port");
       req.rtmpport = 0;
     }
@@ -529,7 +529,7 @@ void processTCPrequest(STREAMING_SERVER 
   if (req.dStartOffset > 0)
     {
       if (req.bLiveStream)
-	Log(LOGWARNING,
+	RTMP_Log(RTMP_LOGWARNING,
 	    "Can't seek in a live stream, ignoring --seek option");
       else
 	dSeek += req.dStartOffset;
@@ -537,7 +537,7 @@ void processTCPrequest(STREAMING_SERVER 
 
   if (dSeek != 0)
     {
-      LogPrintf("Starting at TS: %d ms\n", dSeek);
+      RTMP_LogPrintf("Starting at TS: %d ms\n", dSeek);
     }
 
   if (req.dStopOffset > 0)
@@ -545,7 +545,7 @@ void processTCPrequest(STREAMING_SERVER 
       dLength = req.dStopOffset - dSeek;
     }
 
-  Log(LOGDEBUG, "Setting buffer time to: %dms", req.bufferTime);
+  RTMP_Log(RTMP_LOGDEBUG, "Setting buffer time to: %dms", req.bufferTime);
   RTMP_Init(&rtmp);
   RTMP_SetBufferMS(&rtmp, req.bufferTime);
   RTMP_SetupStream(&rtmp, req.protocol, req.hostname, req.rtmpport, req.sockshost,
@@ -559,10 +559,10 @@ void processTCPrequest(STREAMING_SERVER 
   rtmp.Link.token = req.token;
   rtmp.m_read.timestamp = dSeek;
 
-  LogPrintf("Connecting ... port: %d, app: %s\n", req.rtmpport, req.app);
+  RTMP_LogPrintf("Connecting ... port: %d, app: %s\n", req.rtmpport, req.app);
   if (!RTMP_Connect(&rtmp, NULL))
     {
-      LogPrintf("%s, failed to connect!\n", __FUNCTION__);
+      RTMP_LogPrintf("%s, failed to connect!\n", __FUNCTION__);
     }
   else
     {
@@ -581,14 +581,14 @@ void processTCPrequest(STREAMING_SERVER 
 	    {
 	      if ((nWritten = send(sockfd, buffer, nRead, 0)) < 0)
 		{
-		  Log(LOGERROR, "%s, sending failed, error: %d", __FUNCTION__,
+		  RTMP_Log(RTMP_LOGERROR, "%s, sending failed, error: %d", __FUNCTION__,
 		      GetSockError());
 		  goto cleanup;	// we are in STREAMING_IN_PROGRESS, so we'll go to STREAMING_ACCEPTING
 		}
 
 	      size += nRead;
 
-	      //LogPrintf("write %dbytes (%.1f KB)\n", nRead, nRead/1024.0);
+	      //RTMP_LogPrintf("write %dbytes (%.1f KB)\n", nRead, nRead/1024.0);
 	      if (duration <= 0)	// if duration unknown try to get it from the stream (onMetaData)
 		duration = RTMP_GetDuration(&rtmp);
 
@@ -598,20 +598,20 @@ void processTCPrequest(STREAMING_SERVER 
 		    ((double) (dSeek + rtmp.m_read.timestamp)) / (duration *
 							   1000.0) * 100.0;
 		  percent = ((double) (int) (percent * 10.0)) / 10.0;
-		  LogStatus("\r%.3f KB / %.2f sec (%.1f%%)",
+		  RTMP_LogStatus("\r%.3f KB / %.2f sec (%.1f%%)",
 			    (double) size / 1024.0,
 			    (double) (rtmp.m_read.timestamp) / 1000.0, percent);
 		}
 	      else
 		{
-		  LogStatus("\r%.3f KB / %.2f sec", (double) size / 1024.0,
+		  RTMP_LogStatus("\r%.3f KB / %.2f sec", (double) size / 1024.0,
 			    (double) (rtmp.m_read.timestamp) / 1000.0);
 		}
 	    }
 #ifdef _DEBUG
 	  else
 	    {
-	      Log(LOGDEBUG, "zero read!");
+	      RTMP_Log(RTMP_LOGDEBUG, "zero read!");
 	    }
 #endif
 	}
@@ -619,9 +619,9 @@ void processTCPrequest(STREAMING_SERVER 
 	     && RTMP_IsConnected(&rtmp) && nWritten >= 0);
     }
 cleanup:
-  LogPrintf("Closing connection... ");
+  RTMP_LogPrintf("Closing connection... ");
   RTMP_Close(&rtmp);
-  LogPrintf("done!\n\n");
+  RTMP_LogPrintf("done!\n\n");
 
 quit:
   if (buffer)
@@ -639,7 +639,7 @@ quit:
   return;
 
 filenotfound:
-  LogPrintf("%s, %s, %s\n", __FUNCTION__, status, filename);
+  RTMP_LogPrintf("%s, %s, %s\n", __FUNCTION__, status, filename);
   len = sprintf(buf, "HTTP/1.0 %s%s\r\n", status, srvhead);
   send(sockfd, buf, len, 0);
   goto quit;
@@ -661,14 +661,14 @@ serverThread(void *arg)
       if (sockfd > 0)
 	{
 	  // Create a new process and transfer the control to that
-	  Log(LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__,
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__,
 	      inet_ntoa(addr.sin_addr));
 	  processTCPrequest(server, sockfd);
-	  Log(LOGDEBUG, "%s: processed request\n", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: processed request\n", __FUNCTION__);
 	}
       else
 	{
-	  Log(LOGERROR, "%s: accept failed", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGERROR, "%s: accept failed", __FUNCTION__);
 	}
     }
   server->state = STREAMING_STOPPED;
@@ -685,7 +685,7 @@ startStreaming(const char *address, int 
   sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
   if (sockfd == -1)
     {
-      Log(LOGERROR, "%s, couldn't create socket", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, couldn't create socket", __FUNCTION__);
       return 0;
     }
 
@@ -696,14 +696,14 @@ startStreaming(const char *address, int 
   if (bind(sockfd, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) ==
       -1)
     {
-      Log(LOGERROR, "%s, TCP bind failed for port number: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGERROR, "%s, TCP bind failed for port number: %d", __FUNCTION__,
 	  port);
       return 0;
     }
 
   if (listen(sockfd, 10) == -1)
     {
-      Log(LOGERROR, "%s, listen failed", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, listen failed", __FUNCTION__);
       closesocket(sockfd);
       return 0;
     }
@@ -733,7 +733,7 @@ stopStreaming(STREAMING_SERVER * server)
 	}
 
       if (closesocket(server->socket))
-	Log(LOGERROR, "%s: Failed to close listening socket, error %d",
+	RTMP_Log(RTMP_LOGERROR, "%s: Failed to close listening socket, error %d",
 	    GetSockError());
 
       server->state = STREAMING_STOPPED;
@@ -745,7 +745,7 @@ void
 sigIntHandler(int sig)
 {
   RTMP_ctrlC = true;
-  LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
+  RTMP_LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
   if (httpServer)
     stopStreaming(httpServer);
   signal(SIGINT, SIG_DFL);
@@ -787,7 +787,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 	if (!res || res != HASHLEN)
 	  {
 	    req->swfHash.av_val = NULL;
-	    Log(LOGWARNING,
+	    RTMP_Log(RTMP_LOGWARNING,
 		"Couldn't parse swf hash hex string, not hexstring or not %d bytes, ignoring!", HASHLEN);
 	  }
 	req->swfHash.av_len = HASHLEN;
@@ -798,7 +798,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 	int size = atoi(arg);
 	if (size <= 0)
 	  {
-	    Log(LOGERROR, "SWF Size must be at least 1, ignoring\n");
+	    RTMP_Log(RTMP_LOGERROR, "SWF Size must be at least 1, ignoring\n");
 	  }
 	else
 	  {
@@ -817,7 +817,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 	int num = atoi(arg);
 	if (num < 0)
 	  {
-	    Log(LOGERROR, "SWF Age must be non-negative, ignoring\n");
+	    RTMP_Log(RTMP_LOGERROR, "SWF Age must be non-negative, ignoring\n");
 	  }
 	else
 	  {
@@ -831,7 +831,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 	int32_t bt = atol(arg);
 	if (bt < 0)
 	  {
-	    Log(LOGERROR,
+	    RTMP_Log(RTMP_LOGERROR,
 		"Buffer time must be greater than zero, ignoring the specified value %d!",
 		bt);
 	  }
@@ -858,7 +858,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 	int protocol = atoi(arg);
 	if (protocol != RTMP_PROTOCOL_RTMP && protocol != RTMP_PROTOCOL_RTMPE)
 	  {
-	    Log(LOGERROR, "Unknown protocol specified: %d, using default",
+	    RTMP_Log(RTMP_LOGERROR, "Unknown protocol specified: %d, using default",
 		protocol);
 	    return false;
 	  }
@@ -884,7 +884,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 	    (req->rtmpurl, &parsedProtocol, &parsedHost, &parsedPort,
 	     &parsedPlaypath, &parsedApp))
 	  {
-	    Log(LOGWARNING, "Couldn't parse the specified url (%s)!", arg);
+	    RTMP_Log(RTMP_LOGWARNING, "Couldn't parse the specified url (%s)!", arg);
 	  }
 	else
 	  {
@@ -943,16 +943,16 @@ ParseOption(char opt, char *arg, RTMP_RE
     case 'S':
 	  req->sockshost = arg;
     case 'q':
-      AMF_debuglevel = LOGCRIT;
+      RTMP_debuglevel = RTMP_LOGCRIT;
       break;
     case 'V':
-      AMF_debuglevel = LOGDEBUG;
+      RTMP_debuglevel = RTMP_LOGDEBUG;
       break;
     case 'z':
-      AMF_debuglevel = LOGALL;
+      RTMP_debuglevel = RTMP_LOGALL;
       break;
     default:
-      LogPrintf("unknown option: %c, arg: %s\n", opt, arg);
+      RTMP_LogPrintf("unknown option: %c, arg: %s\n", opt, arg);
       break;
     }
   return true;
@@ -969,8 +969,8 @@ main(int argc, char **argv)
   char *httpStreamingDevice = DEFAULT_HTTP_STREAMING_DEVICE;	// streaming device, default 0.0.0.0
   int nHttpStreamingPort = 80;	// port
 
-  LogPrintf("HTTP-RTMP Stream Gateway %s\n", RTMPDUMP_VERSION);
-  LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
+  RTMP_LogPrintf("HTTP-RTMP Stream Gateway %s\n", RTMPDUMP_VERSION);
+  RTMP_LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
 
   // init request
   memset(&defaultRTMPRequest, 0, sizeof(RTMP_REQUEST));
@@ -1039,84 +1039,84 @@ main(int argc, char **argv)
       switch (opt)
 	{
 	case 'h':
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("\nThis program serves media content streamed from RTMP onto HTTP.\n\n");
-	  LogPrintf("--help|-h               Prints this help screen.\n");
-	  LogPrintf
+	  RTMP_LogPrintf("--help|-h               Prints this help screen.\n");
+	  RTMP_LogPrintf
 	    ("--rtmp|-r url           URL (e.g. rtmp//host[:port]/path)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--host|-n hostname      Overrides the hostname in the rtmp url\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--port|-c port          Overrides the port in the rtmp url\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--socks|-S host:port    Use the specified SOCKS proxy\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--protocol|-l           Overrides the protocol in the rtmp url (0 - RTMP, 2 - RTMPE)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--playpath|-y           Overrides the playpath parsed from rtmp url\n");
-	  LogPrintf("--swfUrl|-s url         URL to player swf file\n");
-	  LogPrintf
+	  RTMP_LogPrintf("--swfUrl|-s url         URL to player swf file\n");
+	  RTMP_LogPrintf
 	    ("--tcUrl|-t url          URL to played stream (default: \"rtmp://host[:port]/app\")\n");
-	  LogPrintf("--pageUrl|-p url        Web URL of played programme\n");
-	  LogPrintf("--app|-a app            Name of target app in server\n");
+	  RTMP_LogPrintf("--pageUrl|-p url        Web URL of played programme\n");
+	  RTMP_LogPrintf("--app|-a app            Name of target app in server\n");
 #ifdef CRYPTO
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfhash|-w hexstring  SHA256 hash of the decompressed SWF file (32 bytes)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfsize|-x num        Size of the decompressed SWF file, required for SWFVerification\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfVfy|-W url         URL to player swf file, compute hash/size automatically\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--swfAge|-X days        Number of days to use cached SWF hash before refreshing\n");
 #endif
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--auth|-u string        Authentication string to be appended to the connect string\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--conn|-C type:data     Arbitrary AMF data to be appended to the connect string\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("                        B:boolean(0|1), S:string, N:number, O:object-flag(0|1),\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("                        Z:(null), NB:name:boolean, NS:name:string, NN:name:number\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--flashVer|-f string    Flash version string (default: \"%s\")\n",
 	     RTMP_DefaultFlashVer.av_val);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--live|-v               Get a live stream, no --resume (seeking) of live streams possible\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--subscribe|-d string   Stream name to subscribe to (otherwise defaults to playpath if live is specifed)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--timeout|-m num        Timeout connection num seconds (default: %lu)\n",
 	     defaultRTMPRequest.timeout);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--start|-A num          Start at num seconds into stream (not valid when using --live)\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--stop|-B num           Stop at num seconds into stream\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--token|-T key          Key for SecureToken response\n");
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--buffer|-b             Buffer time in milliseconds (default: %lu)\n\n",
 	     defaultRTMPRequest.bufferTime);
 
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--device|-D             Streaming device ip address (default: %s)\n",
 	     DEFAULT_HTTP_STREAMING_DEVICE);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--sport|-g              Streaming port (default: %d)\n\n",
 	     nHttpStreamingPort);
-	  LogPrintf
+	  RTMP_LogPrintf
 	    ("--quiet|-q              Suppresses all command output.\n");
-	  LogPrintf("--verbose|-V            Verbose command output.\n");
-	  LogPrintf("--debug|-z              Debug level command output.\n");
-	  LogPrintf
+	  RTMP_LogPrintf("--verbose|-V            Verbose command output.\n");
+	  RTMP_LogPrintf("--debug|-z              Debug level command output.\n");
+	  RTMP_LogPrintf
 	    ("If you don't pass parameters for swfUrl, pageUrl, or auth these properties will not be included in the connect ");
-	  LogPrintf("packet.\n\n");
+	  RTMP_LogPrintf("packet.\n\n");
 	  return RD_SUCCESS;
 	  break;
 	  // streaming server specific options
 	case 'D':
 	  if (inet_addr(optarg) == INADDR_NONE)
 	    {
-	      Log(LOGERROR,
+	      RTMP_Log(RTMP_LOGERROR,
 		  "Invalid binding address (requested address %s), ignoring",
 		  optarg);
 	    }
@@ -1130,7 +1130,7 @@ main(int argc, char **argv)
 	    int port = atoi(optarg);
 	    if (port < 0 || port > 65535)
 	      {
-		Log(LOGERROR,
+		RTMP_Log(RTMP_LOGERROR,
 		    "Streaming port out of range (requested port %d), ignoring\n",
 		    port);
 	      }
@@ -1141,7 +1141,7 @@ main(int argc, char **argv)
 	    break;
 	  }
 	default:
-	  //LogPrintf("unknown option: %c\n", opt);
+	  //RTMP_LogPrintf("unknown option: %c\n", opt);
 	  ParseOption(opt, optarg, &defaultRTMPRequest);
 	  break;
 	}
@@ -1159,17 +1159,17 @@ main(int argc, char **argv)
   if ((httpServer =
        startStreaming(httpStreamingDevice, nHttpStreamingPort)) == 0)
     {
-      Log(LOGERROR, "Failed to start HTTP server, exiting!");
+      RTMP_Log(RTMP_LOGERROR, "Failed to start HTTP server, exiting!");
       return RD_FAILED;
     }
-  LogPrintf("Streaming on http://%s:%d\n", httpStreamingDevice,
+  RTMP_LogPrintf("Streaming on http://%s:%d\n", httpStreamingDevice,
 	    nHttpStreamingPort);
 
   while (httpServer->state != STREAMING_STOPPED)
     {
       sleep(1);
     }
-  Log(LOGDEBUG, "Done, exiting...");
+  RTMP_Log(RTMP_LOGDEBUG, "Done, exiting...");
 
   CleanupSockets();
 

Modified: trunk/rtmpsrv.c
==============================================================================
--- trunk/rtmpsrv.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/rtmpsrv.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -463,7 +463,7 @@ ServeInvoke(STREAMING_SERVER *server, RT
 
   if (body[0] != 0x02)		// make sure it is a string method name we start with
     {
-      Log(LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
+      RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
 	  __FUNCTION__);
       return 0;
     }
@@ -472,7 +472,7 @@ ServeInvoke(STREAMING_SERVER *server, RT
   nRes = AMF_Decode(&obj, body, nBodySize, false);
   if (nRes < 0)
     {
-      Log(LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
       return 0;
     }
 
@@ -480,7 +480,7 @@ ServeInvoke(STREAMING_SERVER *server, RT
   AVal method;
   AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &method);
   double txn = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
-  Log(LOGDEBUG, "%s, client invoking <%s>", __FUNCTION__, method.av_val);
+  RTMP_Log(RTMP_LOGDEBUG, "%s, client invoking <%s>", __FUNCTION__, method.av_val);
 
   if (AVMATCH(&method, &av_connect))
     {
@@ -708,7 +708,7 @@ ServePacket(STREAMING_SERVER *server, RT
 {
   int ret = 0;
 
-  Log(LOGDEBUG, "%s, received packet type %02X, size %lu bytes", __FUNCTION__,
+  RTMP_Log(RTMP_LOGDEBUG, "%s, received packet type %02X, size %lu bytes", __FUNCTION__,
     packet->m_packetType, packet->m_nBodySize);
 
   switch (packet->m_packetType)
@@ -739,12 +739,12 @@ ServePacket(STREAMING_SERVER *server, RT
 
     case 0x08:
       // audio data
-      //Log(LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
       break;
 
     case 0x09:
       // video data
-      //Log(LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
       break;
 
     case 0x0F:			// flex stream send
@@ -755,15 +755,15 @@ ServePacket(STREAMING_SERVER *server, RT
 
     case 0x11:			// flex message
       {
-	Log(LOGDEBUG, "%s, flex message, size %lu bytes, not fully supported",
+	RTMP_Log(RTMP_LOGDEBUG, "%s, flex message, size %lu bytes, not fully supported",
 	    __FUNCTION__, packet->m_nBodySize);
-	//LogHex(packet.m_body, packet.m_nBodySize);
+	//RTMP_LogHex(packet.m_body, packet.m_nBodySize);
 
 	// some DEBUG code
 	/*RTMP_LIB_AMFObject obj;
 	   int nRes = obj.Decode(packet.m_body+1, packet.m_nBodySize-1);
 	   if(nRes < 0) {
-	   Log(LOGERROR, "%s, error decoding AMF3 packet", __FUNCTION__);
+	   RTMP_Log(RTMP_LOGERROR, "%s, error decoding AMF3 packet", __FUNCTION__);
 	   //return;
 	   }
 
@@ -783,9 +783,9 @@ ServePacket(STREAMING_SERVER *server, RT
 
     case 0x14:
       // invoke
-      Log(LOGDEBUG, "%s, received: invoke %lu bytes", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %lu bytes", __FUNCTION__,
 	  packet->m_nBodySize);
-      //LogHex(packet.m_body, packet.m_nBodySize);
+      //RTMP_LogHex(packet.m_body, packet.m_nBodySize);
 
       if (ServeInvoke(server, r, packet, 0))
 	RTMP_Close(r);
@@ -795,10 +795,10 @@ ServePacket(STREAMING_SERVER *server, RT
       /* flv */
 	break;
     default:
-      Log(LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,
 	  packet->m_packetType);
 #ifdef _DEBUG
-      LogHex(LOGDEBUG, packet->m_body, packet->m_nBodySize);
+      RTMP_LogHex(RTMP_LOGDEBUG, packet->m_body, packet->m_nBodySize);
 #endif
     }
   return ret;
@@ -814,12 +814,12 @@ controlServerThread(void *unused)
       switch (ich)
 	{
 	case 'q':
-	  LogPrintf("Exiting\n");
+	  RTMP_LogPrintf("Exiting\n");
 	  stopStreaming(rtmpServer);
 	  exit(0);
 	  break;
 	default:
-	  LogPrintf("Unknown command \'%c\', ignoring\n", ich);
+	  RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich);
 	}
     }
   TFRET();
@@ -847,7 +847,7 @@ void doServe(STREAMING_SERVER * server,	
 
   if (select(sockfd + 1, &fds, NULL, NULL, &tv) <= 0)
     {
-      Log(LOGERROR, "Request timeout/select failed, ignoring request");
+      RTMP_Log(RTMP_LOGERROR, "Request timeout/select failed, ignoring request");
       goto quit;
     }
   else
@@ -856,7 +856,7 @@ void doServe(STREAMING_SERVER * server,	
       rtmp.m_sb.sb_socket = sockfd;
       if (!RTMP_Serve(&rtmp))
 	{
-	  Log(LOGERROR, "Handshake failed");
+	  RTMP_Log(RTMP_LOGERROR, "Handshake failed");
 	  goto cleanup;
 	}
     }
@@ -870,7 +870,7 @@ void doServe(STREAMING_SERVER * server,	
     }
 
 cleanup:
-  LogPrintf("Closing connection... ");
+  RTMP_LogPrintf("Closing connection... ");
   RTMP_Close(&rtmp);
   /* Should probably be done by RTMP_Close() ... */
   rtmp.Link.playpath.av_val = NULL;
@@ -879,7 +879,7 @@ cleanup:
   rtmp.Link.pageUrl.av_val = NULL;
   rtmp.Link.app.av_val = NULL;
   rtmp.Link.flashVer.av_val = NULL;
-  LogPrintf("done!\n\n");
+  RTMP_LogPrintf("done!\n\n");
 
 quit:
   if (server->state == STREAMING_IN_PROGRESS)
@@ -909,19 +909,19 @@ serverThread(void *arg)
 	  socklen_t destlen = sizeof(struct sockaddr_in);
 	  getsockopt(sockfd, SOL_IP, SO_ORIGINAL_DST, &dest, &destlen);
 	  strcpy(destch, inet_ntoa(dest.sin_addr));
-	  Log(LOGDEBUG, "%s: accepted connection from %s to %s\n", __FUNCTION__,
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: accepted connection from %s to %s\n", __FUNCTION__,
 	      inet_ntoa(addr.sin_addr), destch);
 #else
-	  Log(LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__,
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__,
 	      inet_ntoa(addr.sin_addr));
 #endif
 	  /* Create a new thread and transfer the control to that */
 	  doServe(server, sockfd);
-	  Log(LOGDEBUG, "%s: processed request\n", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: processed request\n", __FUNCTION__);
 	}
       else
 	{
-	  Log(LOGERROR, "%s: accept failed", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGERROR, "%s: accept failed", __FUNCTION__);
 	}
     }
   server->state = STREAMING_STOPPED;
@@ -938,7 +938,7 @@ startStreaming(const char *address, int 
   sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
   if (sockfd == -1)
     {
-      Log(LOGERROR, "%s, couldn't create socket", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, couldn't create socket", __FUNCTION__);
       return 0;
     }
 
@@ -953,14 +953,14 @@ startStreaming(const char *address, int 
   if (bind(sockfd, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) ==
       -1)
     {
-      Log(LOGERROR, "%s, TCP bind failed for port number: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGERROR, "%s, TCP bind failed for port number: %d", __FUNCTION__,
 	  port);
       return 0;
     }
 
   if (listen(sockfd, 10) == -1)
     {
-      Log(LOGERROR, "%s, listen failed", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, listen failed", __FUNCTION__);
       closesocket(sockfd);
       return 0;
     }
@@ -990,7 +990,7 @@ stopStreaming(STREAMING_SERVER * server)
 	}
 
       if (closesocket(server->socket))
-	Log(LOGERROR, "%s: Failed to close listening socket, error %d",
+	RTMP_Log(RTMP_LOGERROR, "%s: Failed to close listening socket, error %d",
 	    GetSockError());
 
       server->state = STREAMING_STOPPED;
@@ -1002,7 +1002,7 @@ void
 sigIntHandler(int sig)
 {
   RTMP_ctrlC = true;
-  LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
+  RTMP_LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
   if (rtmpServer)
     stopStreaming(rtmpServer);
   signal(SIGINT, SIG_DFL);
@@ -1019,13 +1019,13 @@ main(int argc, char **argv)
   char *rtmpStreamingDevice = DEFAULT_HTTP_STREAMING_DEVICE;	// streaming device, default 0.0.0.0
   int nRtmpStreamingPort = 1935;	// port
 
-  LogPrintf("RTMP Server %s\n", RTMPDUMP_VERSION);
-  LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
+  RTMP_LogPrintf("RTMP Server %s\n", RTMPDUMP_VERSION);
+  RTMP_LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
 
-  AMF_debuglevel = LOGINFO;
+  RTMP_debuglevel = RTMP_LOGINFO;
 
   if (argc > 1 && !strcmp(argv[1], "-z"))
-    AMF_debuglevel = LOGALL;
+    RTMP_debuglevel = RTMP_LOGALL;
 
   // init request
   memset(&defaultRTMPRequest, 0, sizeof(RTMP_REQUEST));
@@ -1057,17 +1057,17 @@ main(int argc, char **argv)
   if ((rtmpServer =
        startStreaming(rtmpStreamingDevice, nRtmpStreamingPort)) == 0)
     {
-      Log(LOGERROR, "Failed to start RTMP server, exiting!");
+      RTMP_Log(RTMP_LOGERROR, "Failed to start RTMP server, exiting!");
       return RD_FAILED;
     }
-  LogPrintf("Streaming on rtmp://%s:%d\n", rtmpStreamingDevice,
+  RTMP_LogPrintf("Streaming on rtmp://%s:%d\n", rtmpStreamingDevice,
 	    nRtmpStreamingPort);
 
   while (rtmpServer->state != STREAMING_STOPPED)
     {
       sleep(1);
     }
-  Log(LOGDEBUG, "Done, exiting...");
+  RTMP_Log(RTMP_LOGDEBUG, "Done, exiting...");
 
   CleanupSockets();
 

Modified: trunk/rtmpsuck.c
==============================================================================
--- trunk/rtmpsuck.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/rtmpsuck.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -167,7 +167,7 @@ ServeInvoke(STREAMING_SERVER *server, in
 
   if (body[0] != 0x02)		// make sure it is a string method name we start with
     {
-      Log(LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
+      RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
 	  __FUNCTION__);
       return 0;
     }
@@ -176,14 +176,14 @@ ServeInvoke(STREAMING_SERVER *server, in
   nRes = AMF_Decode(&obj, body, nBodySize, false);
   if (nRes < 0)
     {
-      Log(LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
       return 0;
     }
 
   AMF_Dump(&obj);
   AVal method;
   AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &method);
-  Log(LOGDEBUG, "%s, %s invoking <%s>", __FUNCTION__, cst[which], method.av_val);
+  RTMP_Log(RTMP_LOGDEBUG, "%s, %s invoking <%s>", __FUNCTION__, cst[which], method.av_val);
 
   if (AVMATCH(&method, &av_connect))
     {
@@ -191,7 +191,7 @@ ServeInvoke(STREAMING_SERVER *server, in
       AVal pname, pval;
       int i;
       AMFProp_GetObject(AMF_GetProp(&obj, NULL, 2), &cobj);
-      LogPrintf("Processing connect\n");
+      RTMP_LogPrintf("Processing connect\n");
       for (i=0; i<cobj.o_num; i++)
         {
           pname = cobj.o_props[i].p_name;
@@ -200,7 +200,7 @@ ServeInvoke(STREAMING_SERVER *server, in
           if (cobj.o_props[i].p_type == AMF_STRING)
             {
               pval = cobj.o_props[i].p_vu.p_aval;
-              LogPrintf("%.*s: %.*s\n", pname.av_len, pname.av_val, pval.av_len, pval.av_val);
+              RTMP_LogPrintf("%.*s: %.*s\n", pname.av_len, pname.av_val, pval.av_len, pval.av_val);
             }
           if (AVMATCH(&pname, &av_app))
             {
@@ -360,7 +360,7 @@ ServeInvoke(STREAMING_SERVER *server, in
       for (p=file; *p; p++)
         if (*p == ':')
           *p = '_';
-      LogPrintf("Playpath: %.*s\nSaving as: %s\n",
+      RTMP_LogPrintf("Playpath: %.*s\nSaving as: %s\n",
         server->rc.Link.playpath.av_len, server->rc.Link.playpath.av_val,
         file);
       out = fopen(file, "wb");
@@ -393,7 +393,7 @@ ServeInvoke(STREAMING_SERVER *server, in
       AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code);
       AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level);
 
-      Log(LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val);
+      RTMP_Log(RTMP_LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val);
       if (AVMATCH(&code, &av_NetStream_Failed)
 	  || AVMATCH(&code, &av_NetStream_Play_Failed)
 	  || AVMATCH(&code, &av_NetStream_Play_StreamNotFound)
@@ -444,7 +444,7 @@ ServePacket(STREAMING_SERVER *server, in
 {
   int ret = 0;
 
-  Log(LOGDEBUG, "%s, %s sent packet type %02X, size %lu bytes", __FUNCTION__,
+  RTMP_Log(RTMP_LOGDEBUG, "%s, %s sent packet type %02X, size %lu bytes", __FUNCTION__,
     cst[which], packet->m_packetType, packet->m_nBodySize);
 
   switch (packet->m_packetType)
@@ -475,12 +475,12 @@ ServePacket(STREAMING_SERVER *server, in
 
     case 0x08:
       // audio data
-      //Log(LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize);
       break;
 
     case 0x09:
       // video data
-      //Log(LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize);
       break;
 
     case 0x0F:			// flex stream send
@@ -511,10 +511,10 @@ ServePacket(STREAMING_SERVER *server, in
       /* flv */
 	break;
     default:
-      Log(LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,
+      RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,
 	  packet->m_packetType);
 #ifdef _DEBUG
-      LogHex(LOGDEBUG, packet->m_body, packet->m_nBodySize);
+      RTMP_LogHex(RTMP_LOGDEBUG, packet->m_body, packet->m_nBodySize);
 #endif
     }
   return ret;
@@ -544,23 +544,23 @@ WriteStream(char **buf,	// target pointe
 
       if (packet->m_packetType == 0x09 && nPacketLen <= 5)
 	{
-	  Log(LOGWARNING, "ignoring too small video packet: size: %d",
+	  RTMP_Log(RTMP_LOGWARNING, "ignoring too small video packet: size: %d",
 	      nPacketLen);
 	  ret = 0;
 	  break;
 	}
       if (packet->m_packetType == 0x08 && nPacketLen <= 1)
 	{
-	  Log(LOGWARNING, "ignoring too small audio packet: size: %d",
+	  RTMP_Log(RTMP_LOGWARNING, "ignoring too small audio packet: size: %d",
 	      nPacketLen);
 	  ret = 0;
 	  break;
 	}
 #ifdef _DEBUG
-      Log(LOGDEBUG, "type: %02X, size: %d, TS: %d ms", packet->m_packetType,
+      RTMP_Log(RTMP_LOGDEBUG, "type: %02X, size: %d, TS: %d ms", packet->m_packetType,
 	  nPacketLen, packet->m_nTimeStamp);
       if (packet->m_packetType == 0x09)
-	Log(LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0));
+	RTMP_Log(RTMP_LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0));
 #endif
 
       // calculate packet size and reallocate buffer if necessary
@@ -575,7 +575,7 @@ WriteStream(char **buf,	// target pointe
 	  *buf = (char *) realloc(*buf, size + 4);
 	  if (*buf == 0)
 	    {
-	      Log(LOGERROR, "Couldn't reallocate memory!");
+	      RTMP_Log(RTMP_LOGERROR, "Couldn't reallocate memory!");
 	      ret = -1;		// fatal error
 	      break;
 	    }
@@ -624,13 +624,13 @@ WriteStream(char **buf,	// target pointe
 		{
 		  if (pos + 11 + dataSize > nPacketLen)
 		    {
-		      Log(LOGERROR,
+		      RTMP_Log(RTMP_LOGERROR,
 			  "Wrong data size (%lu), stream corrupted, aborting!",
 			  dataSize);
 		      ret = -2;
 		      break;
 		    }
-		  Log(LOGWARNING, "No tagSize found, appending!");
+		  RTMP_Log(RTMP_LOGWARNING, "No tagSize found, appending!");
 
 		  // we have to append a last tagSize!
 		  prevTagSize = dataSize + 11;
@@ -644,7 +644,7 @@ WriteStream(char **buf,	// target pointe
 		    AMF_DecodeInt32(packetBody + pos + 11 + dataSize);
 
 #ifdef _DEBUG
-		  Log(LOGDEBUG,
+		  RTMP_Log(RTMP_LOGDEBUG,
 		      "FLV Packet: type %02X, dataSize: %lu, tagSize: %lu, timeStamp: %lu ms",
 		      (unsigned char) packetBody[pos], dataSize, prevTagSize,
 		      *nTimeStamp);
@@ -653,7 +653,7 @@ WriteStream(char **buf,	// target pointe
 		  if (prevTagSize != (dataSize + 11))
 		    {
 #ifdef _DEBUG
-		      Log(LOGWARNING,
+		      RTMP_Log(RTMP_LOGWARNING,
 			  "Tag and data size are not consitent, writing tag size according to dataSize+11: %d",
 			  dataSize + 11);
 #endif
@@ -694,13 +694,13 @@ controlServerThread(void *unused)
       switch (ich)
 	{
 	case 'q':
-	  LogPrintf("Exiting\n");
+	  RTMP_LogPrintf("Exiting\n");
 	  stopStreaming(rtmpServer);
           free(rtmpServer);
 	  exit(0);
 	  break;
 	default:
-	  LogPrintf("Unknown command \'%c\', ignoring\n", ich);
+	  RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich);
 	}
     }
   TFRET();
@@ -730,7 +730,7 @@ void doServe(STREAMING_SERVER * server,	
 
   if (select(sockfd + 1, &rfds, NULL, NULL, &tv) <= 0)
     {
-      Log(LOGERROR, "Request timeout/select failed, ignoring request");
+      RTMP_Log(RTMP_LOGERROR, "Request timeout/select failed, ignoring request");
       goto quit;
     }
   else
@@ -740,7 +740,7 @@ void doServe(STREAMING_SERVER * server,	
       server->rs.m_sb.sb_socket = sockfd;
       if (!RTMP_Serve(&server->rs))
         {
-          Log(LOGERROR, "Handshake failed");
+          RTMP_Log(RTMP_LOGERROR, "Handshake failed");
           goto cleanup;
         }
     }
@@ -800,7 +800,7 @@ void doServe(STREAMING_SERVER * server,	
                       continue;
                     }
                 }
-	      Log(LOGERROR, "Request timeout/select failed, ignoring request");
+	      RTMP_Log(RTMP_LOGERROR, "Request timeout/select failed, ignoring request");
 	      goto cleanup;
 	    }
           if (FD_ISSET(server->rs.m_sb.sb_socket, &rfds))
@@ -819,7 +819,7 @@ void doServe(STREAMING_SERVER * server,	
                     if (ps.m_nBodySize >= 4)
                       {
                         server->rs.m_inChunkSize = AMF_DecodeInt32(ps.m_body);
-                        Log(LOGDEBUG, "%s, client: chunk size change to %d", __FUNCTION__,
+                        RTMP_Log(RTMP_LOGDEBUG, "%s, client: chunk size change to %d", __FUNCTION__,
                             server->rs.m_inChunkSize);
                         server->rc.m_outChunkSize = server->rs.m_inChunkSize;
                       }
@@ -830,7 +830,7 @@ void doServe(STREAMING_SERVER * server,	
                     if (ps.m_nBodySize >= 4)
                       {
                         int count = AMF_DecodeInt32(ps.m_body);
-                        Log(LOGDEBUG, "%s, client: bytes received = %d", __FUNCTION__,
+                        RTMP_Log(RTMP_LOGDEBUG, "%s, client: bytes received = %d", __FUNCTION__,
                             count);
                       }
                   }
@@ -856,7 +856,7 @@ void doServe(STREAMING_SERVER * server,	
                                 AMF_EncodeInt32(ptr+4, ptr+8, BUFFERTIME);
                               }
 #endif
-                            Log(LOGDEBUG, "%s, client: BufferTime change in stream %d to %d", __FUNCTION__,
+                            RTMP_Log(RTMP_LOGDEBUG, "%s, client: BufferTime change in stream %d to %d", __FUNCTION__,
                                 id, len);
                           }
                       }
@@ -893,7 +893,7 @@ void doServe(STREAMING_SERVER * server,	
                       if (pc.m_nBodySize >= 4)
                         {
                           server->rc.m_inChunkSize = AMF_DecodeInt32(pc.m_body);
-                          Log(LOGDEBUG, "%s, server: chunk size change to %d", __FUNCTION__,
+                          RTMP_Log(RTMP_LOGDEBUG, "%s, server: chunk size change to %d", __FUNCTION__,
                               server->rc.m_inChunkSize);
                           server->rs.m_outChunkSize = server->rc.m_inChunkSize;
                         }
@@ -911,7 +911,7 @@ void doServe(STREAMING_SERVER * server,	
                         }
   #else
                         /* The session will certainly fail right after this */
-                        Log(LOGERROR, "%s, server requested SWF verification, need CRYPTO support! ", __FUNCTION__);
+                        RTMP_Log(RTMP_LOGERROR, "%s, server requested SWF verification, need CRYPTO support! ", __FUNCTION__);
   #endif
                     }
                   else if (server->f_cur && (
@@ -948,7 +948,7 @@ void doServe(STREAMING_SERVER * server,	
     }
 
 cleanup:
-  LogPrintf("Closing connection... ");
+  RTMP_LogPrintf("Closing connection... ");
   RTMP_Close(&server->rs);
   RTMP_Close(&server->rc);
   while (server->f_head)
@@ -974,7 +974,7 @@ cleanup:
 #ifdef CRYPTO
   server->rc.Link.SWFHash.av_val = NULL;
 #endif
-  LogPrintf("done!\n\n");
+  RTMP_LogPrintf("done!\n\n");
 
 quit:
   if (server->state == STREAMING_IN_PROGRESS)
@@ -1004,19 +1004,19 @@ serverThread(void *arg)
           socklen_t destlen = sizeof(struct sockaddr_in);
 	  getsockopt(sockfd, SOL_IP, SO_ORIGINAL_DST, &dest, &destlen);
           strcpy(destch, inet_ntoa(dest.sin_addr));
-	  Log(LOGDEBUG, "%s: accepted connection from %s to %s\n", __FUNCTION__,
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: accepted connection from %s to %s\n", __FUNCTION__,
 	      inet_ntoa(addr.sin_addr), destch);
 #else
-	  Log(LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__,
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: accepted connection from %s\n", __FUNCTION__,
 	      inet_ntoa(addr.sin_addr));
 #endif
 	  /* Create a new thread and transfer the control to that */
 	  doServe(server, sockfd);
-	  Log(LOGDEBUG, "%s: processed request\n", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGDEBUG, "%s: processed request\n", __FUNCTION__);
 	}
       else
 	{
-	  Log(LOGERROR, "%s: accept failed", __FUNCTION__);
+	  RTMP_Log(RTMP_LOGERROR, "%s: accept failed", __FUNCTION__);
 	}
     }
   server->state = STREAMING_STOPPED;
@@ -1033,7 +1033,7 @@ startStreaming(const char *address, int 
   sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
   if (sockfd == -1)
     {
-      Log(LOGERROR, "%s, couldn't create socket", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, couldn't create socket", __FUNCTION__);
       return 0;
     }
 
@@ -1048,14 +1048,14 @@ startStreaming(const char *address, int 
   if (bind(sockfd, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) ==
       -1)
     {
-      Log(LOGERROR, "%s, TCP bind failed for port number: %d", __FUNCTION__,
+      RTMP_Log(RTMP_LOGERROR, "%s, TCP bind failed for port number: %d", __FUNCTION__,
 	  port);
       return 0;
     }
 
   if (listen(sockfd, 10) == -1)
     {
-      Log(LOGERROR, "%s, listen failed", __FUNCTION__);
+      RTMP_Log(RTMP_LOGERROR, "%s, listen failed", __FUNCTION__);
       closesocket(sockfd);
       return 0;
     }
@@ -1087,7 +1087,7 @@ stopStreaming(STREAMING_SERVER * server)
 	}
 
       if (fd && closesocket(fd))
-	Log(LOGERROR, "%s: Failed to close listening socket, error %d",
+	RTMP_Log(RTMP_LOGERROR, "%s: Failed to close listening socket, error %d",
 	    GetSockError());
 
       server->state = STREAMING_STOPPED;
@@ -1099,7 +1099,7 @@ void
 sigIntHandler(int sig)
 {
   RTMP_ctrlC = true;
-  LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
+  RTMP_LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
   if (rtmpServer)
     stopStreaming(rtmpServer);
   signal(SIGINT, SIG_DFL);
@@ -1116,13 +1116,13 @@ main(int argc, char **argv)
   char *rtmpStreamingDevice = DEFAULT_RTMP_STREAMING_DEVICE;	// streaming device, default 0.0.0.0
   int nRtmpStreamingPort = 1935;	// port
 
-  LogPrintf("RTMP Proxy Server %s\n", RTMPDUMP_VERSION);
-  LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
+  RTMP_LogPrintf("RTMP Proxy Server %s\n", RTMPDUMP_VERSION);
+  RTMP_LogPrintf("(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL\n\n");
 
-  AMF_debuglevel = LOGINFO;
+  RTMP_debuglevel = RTMP_LOGINFO;
 
   if (argc > 1 && !strcmp(argv[1], "-z"))
-    AMF_debuglevel = LOGALL;
+    RTMP_debuglevel = RTMP_LOGALL;
 
   signal(SIGINT, sigIntHandler);
 #ifndef WIN32
@@ -1143,17 +1143,17 @@ main(int argc, char **argv)
   if ((rtmpServer =
        startStreaming(rtmpStreamingDevice, nRtmpStreamingPort)) == 0)
     {
-      Log(LOGERROR, "Failed to start RTMP server, exiting!");
+      RTMP_Log(RTMP_LOGERROR, "Failed to start RTMP server, exiting!");
       return RD_FAILED;
     }
-  LogPrintf("Streaming on rtmp://%s:%d\n", rtmpStreamingDevice,
+  RTMP_LogPrintf("Streaming on rtmp://%s:%d\n", rtmpStreamingDevice,
 	    nRtmpStreamingPort);
 
   while (rtmpServer->state != STREAMING_STOPPED)
     {
       sleep(1);
     }
-  Log(LOGDEBUG, "Done, exiting...");
+  RTMP_Log(RTMP_LOGDEBUG, "Done, exiting...");
 
   free(rtmpServer);
 

Modified: trunk/thread.c
==============================================================================
--- trunk/thread.c	Thu Mar 18 10:09:26 2010	(r367)
+++ trunk/thread.c	Thu Mar 18 21:56:24 2010	(r368)
@@ -32,7 +32,7 @@ ThreadCreate(thrfunc *routine, void *arg
 
   thd = (HANDLE) _beginthread(routine, 0, args);
   if (thd == -1L)
-    LogPrintf("%s, _beginthread failed with %d\n", __FUNCTION__, errno);
+    RTMP_LogPrintf("%s, _beginthread failed with %d\n", __FUNCTION__, errno);
 
   return thd;
 }
@@ -50,7 +50,7 @@ ThreadCreate(thrfunc *routine, void *arg
   ret =
     pthread_create(&id, &attributes, routine, args);
   if (ret != 0)
-    LogPrintf("%s, pthread_create failed with %d\n", __FUNCTION__, ret);
+    RTMP_LogPrintf("%s, pthread_create failed with %d\n", __FUNCTION__, ret);
 
   return id;
 }


More information about the rtmpdump mailing list