diff --git a/trunk/research/librtmp/srs_flv_injecter.c b/trunk/research/librtmp/srs_flv_injecter.c index c9912ed06..5b6d866c3 100644 --- a/trunk/research/librtmp/srs_flv_injecter.c +++ b/trunk/research/librtmp/srs_flv_injecter.c @@ -26,6 +26,7 @@ gcc srs_flv_injecter.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_flv_i #include #include +#include #include #include diff --git a/trunk/research/librtmp/srs_play.c b/trunk/research/librtmp/srs_play.c index e0710a433..960523a3b 100644 --- a/trunk/research/librtmp/srs_play.c +++ b/trunk/research/librtmp/srs_play.c @@ -52,34 +52,35 @@ int main(int argc, char** argv) rtmp = srs_rtmp_create(argv[1]); - printf("suck rtmp stream like rtmpdump\n"); - printf("srs(simple-rtmp-server) client librtmp library.\n"); - printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); - printf("rtmp url: %s\n", argv[1]); + srs_trace("suck rtmp stream like rtmpdump"); + srs_trace("srs(simple-rtmp-server) client librtmp library."); + srs_trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); + srs_trace("rtmp url: %s", argv[1]); if (srs_simple_handshake(rtmp) != 0) { - printf("simple handshake failed.\n"); + srs_trace("simple handshake failed."); goto rtmp_destroy; } - printf("simple handshake success\n"); + srs_trace("simple handshake success"); if (srs_connect_app(rtmp) != 0) { - printf("connect vhost/app failed.\n"); + srs_trace("connect vhost/app failed."); goto rtmp_destroy; } - printf("connect vhost/app success\n"); + srs_trace("connect vhost/app success"); if (srs_play_stream(rtmp) != 0) { - printf("play stream failed.\n"); + srs_trace("play stream failed."); goto rtmp_destroy; } - printf("play stream success\n"); + srs_trace("play stream success"); for (;;) { if (srs_read_packet(rtmp, &type, ×tamp, &data, &size) != 0) { goto rtmp_destroy; } - printf("got packet: type=%s, time=%d, size=%d\n", srs_type2string(type), timestamp, size); + srs_trace("got packet: type=%s, time=%d, size=%d", + srs_type2string(type), timestamp, size); free(data); } diff --git a/trunk/src/libs/srs_librtmp.cpp b/trunk/src/libs/srs_librtmp.cpp index f0f4da313..6b59bacf0 100644 --- a/trunk/src/libs/srs_librtmp.cpp +++ b/trunk/src/libs/srs_librtmp.cpp @@ -30,6 +30,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include using namespace std; +// undefine the log of librtmp for the srs use its log. +#undef srs_trace +#undef srs_verbose + #include #include #include diff --git a/trunk/src/libs/srs_librtmp.hpp b/trunk/src/libs/srs_librtmp.hpp index e4f4669b6..66b1e9087 100644 --- a/trunk/src/libs/srs_librtmp.hpp +++ b/trunk/src/libs/srs_librtmp.hpp @@ -234,14 +234,11 @@ extern int srs_version_revision(); extern int64_t srs_get_time_ms(); extern int64_t srs_get_nsend_bytes(srs_rtmp_t rtmp); extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp); -// log to console. + +// log to console, for use srs-librtmp application. extern const char* srs_format_time(); -#ifndef srs_trace - #define srs_trace(msg, ...) printf("[%s]", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") -#endif -#ifndef srs_verbose - #define srs_verbose(msg, ...) printf("[%s]", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") -#endif +#define srs_trace(msg, ...) printf("[%s]", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") +#define srs_verbose(msg, ...) printf("[%s]", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") /************************************************************* **************************************************************