Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-08 13:41:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6de83db76e61a1161574d517b42d73d9239e3999
6de83db7
1 parent
f92303c7
refine srs-librtmp log macro
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
21 行增加
和
18 行删除
trunk/research/librtmp/srs_flv_injecter.c
trunk/research/librtmp/srs_play.c
trunk/src/libs/srs_librtmp.cpp
trunk/src/libs/srs_librtmp.hpp
trunk/research/librtmp/srs_flv_injecter.c
查看文件 @
6de83db
...
...
@@ -26,6 +26,7 @@ gcc srs_flv_injecter.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_flv_i
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
...
...
trunk/research/librtmp/srs_play.c
查看文件 @
6de83db
...
...
@@ -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
,
&
timestamp
,
&
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
);
}
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
6de83db
...
...
@@ -30,6 +30,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sstream>
using
namespace
std
;
// undefine the log of librtmp for the srs use its log.
#undef srs_trace
#undef srs_verbose
#include <srs_kernel_error.hpp>
#include <srs_protocol_rtmp.hpp>
#include <srs_lib_simple_socket.hpp>
...
...
trunk/src/libs/srs_librtmp.hpp
查看文件 @
6de83db
...
...
@@ -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")
/*************************************************************
**************************************************************
...
...
请
注册
或
登录
后发表评论