parseurl.o: parseurl.c parseurl.h log.h Makefile
streams.o: streams.cpp rtmp.h log.h Makefile
rtmp.o: rtmp.c rtmp.h handshake.h dh.h log.h amf.h Makefile
-amf.o: amf.c amf.h bytes.h Makefile
+amf.o: amf.c amf.h bytes.h log.h Makefile
rtmpdump.o: rtmpdump.c rtmp.h log.h amf.h Makefile
#define MAX_PRINT_LEN 2048
-extern int debuglevel;
+int debuglevel = LOGERROR;
static int neednl;
-FILE *fmsg;
+static FILE *fmsg;
void LogSetOutput(FILE *file)
{
#ifdef __cplusplus
extern "C" {
#endif
-// Enable this to get full debugging output
-//#define _DEBUG
+/* Enable this to get full debugging output */
+/* #define _DEBUG */
#define CRYPTO
#ifdef _DEBUG
#define LOGDEBUG 4
#define LOGALL 5
+#define Log AMF_Log
+#define LogHex AMF_LogHex
+#define LogHexString AMF_LogHexString
+#define LogPrintf AMF_LogPrintf
+#define LogSetOutput AMF_LogSetOutput
+#define LogStatus AMF_LogStatus
+#define debuglevel AMF_debuglevel
+
+extern int debuglevel;
+
void LogSetOutput(FILE *file);
void LogPrintf(const char *format, ...);
void LogStatus(const char *format, ...);
#define RTMP_PACKET_SIZE_SMALL 2
#define RTMP_PACKET_SIZE_MINIMUM 3
-extern bool bCtrlC;
+bool RTMP_ctrlC;
-char RTMPProtocolStrings[][7] = {
+const char RTMPProtocolStrings[][7] = {
"RTMP",
"RTMPT",
"RTMPS",
"RTMFP"
};
-char RTMPProtocolStringsLower[][7] = {
+const char RTMPProtocolStringsLower[][7] = {
"rtmp",
"rtmpt",
"rtmps",
Log(LOGERROR, "%s, RTMP send error %d (%d bytes)", __FUNCTION__,
sockerr, n);
- if (sockerr == EINTR && !bCtrlC)
+ if (sockerr == EINTR && !RTMP_ctrlC)
continue;
RTMP_Close(r);
int sockerr = GetSockError();
Log(LOGDEBUG, "%s, recv returned %d. GetSockError(): %d (%s)",
__FUNCTION__, nBytes, sockerr, strerror(sockerr));
- if (sockerr == EINTR && !bCtrlC)
+ if (sockerr == EINTR && !RTMP_ctrlC)
goto again;
if (sockerr == EWOULDBLOCK || sockerr == EAGAIN)
#define RTMP_CHANNELS 65600
-extern char RTMPProtocolStringsLower[][7];
+extern const char RTMPProtocolStringsLower[][7];
+extern bool RTMP_ctrlC;
int32_t RTMP_GetTime();
#include "log.h"
#include "parseurl.h"
-int debuglevel = 1;
-
#define RTMPDUMP_VERSION "v2.0"
#define RD_SUCCESS 0
#define MAX_IGNORED_FRAMES 50
FILE *file = 0;
-bool bCtrlC = false;
void
sigIntHandler(int sig)
{
- bCtrlC = true;
+ RTMP_ctrlC = true;
LogPrintf("Caught signal: %d, cleaning up, just a second...\n", sig);
// ignore all these signals now and let the connection close
signal(SIGINT, SIG_IGN);
#endif
}
- while (!bCtrlC && nRead > -1 && RTMP_IsConnected(rtmp));
+ while (!RTMP_ctrlC && nRead > -1 && RTMP_IsConnected(rtmp));
free(buffer);
Log(LOGDEBUG, "WriteStream returned: %d", nRead);
if (nRead == -3)
return RD_SUCCESS;
- if ((duration > 0 && *percent < 99.9) || bCtrlC || nRead < 0
+ if ((duration > 0 && *percent < 99.9) || RTMP_ctrlC || nRead < 0
|| RTMP_IsTimedout(rtmp))
{
return RD_INCOMPLETE;
netstackdump_read = fopen("netstackdump_read", "wb");
#endif
- while (!bCtrlC)
+ while (!RTMP_ctrlC)
{
Log(LOGDEBUG, "Setting buffer time to: %dms", bufferTime);
RTMP_SetBufferMS(&rtmp, bufferTime);