From 15ae4745f47857e78de44e4704c750fc3d3499b2 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 2 Dec 2014 13:21:26 +0800 Subject: [PATCH] add macro to disable log. --- trunk/src/libs/srs_librtmp.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/trunk/src/libs/srs_librtmp.hpp b/trunk/src/libs/srs_librtmp.hpp index 272c2e85d..8e5e75250 100644 --- a/trunk/src/libs/srs_librtmp.hpp +++ b/trunk/src/libs/srs_librtmp.hpp @@ -926,8 +926,12 @@ extern int srs_human_print_rtmp_packet(char type, u_int32_t timestamp, char* dat // log to console, for use srs-librtmp application. extern const char* srs_human_format_time(); -// when hijack the log, user will defines this macros. -#ifndef SRS_HIJACK_LOG +// when disabled log, donot compile it. +#ifdef SRS_DISABLE_LOG + #define srs_human_trace(msg, ...) (void)0 + #define srs_human_verbose(msg, ...) (void)0 + #define srs_human_raw(msg, ...) (void)0 +#else #define srs_human_trace(msg, ...) printf("[%s] ", srs_human_format_time());printf(msg, ##__VA_ARGS__);printf("\n") #define srs_human_verbose(msg, ...) printf("[%s] ", srs_human_format_time());printf(msg, ##__VA_ARGS__);printf("\n") #define srs_human_raw(msg, ...) printf(msg, ##__VA_ARGS__) @@ -944,6 +948,10 @@ typedef void* srs_hijack_io_t; // the example @see https://github.com/winlinvip/st-load // which use librtmp but use its own io(use st also). #ifdef SRS_HIJACK_IO + #ifndef _WIN32 + // for iovec. + #include + #endif /** * create hijack. * @return NULL for error; otherwise, ok.