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-12-02 14:02:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b28dc7364e850896a6ffd10fccdde7c0ea6623c5
b28dc736
1 parent
a94dbecd
refine the srs-librtmp, add hijack get the object.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
38 行增加
和
5 行删除
trunk/src/libs/srs_lib_simple_socket.cpp
trunk/src/libs/srs_lib_simple_socket.hpp
trunk/src/libs/srs_librtmp.cpp
trunk/src/libs/srs_librtmp.hpp
trunk/src/libs/srs_lib_simple_socket.cpp
查看文件 @
b28dc73
...
...
@@ -290,6 +290,11 @@ SimpleSocketStream::~SimpleSocketStream()
}
}
srs_hijack_io_t
SimpleSocketStream
::
hijack_io
()
{
return
io
;
}
int
SimpleSocketStream
::
create_socket
()
{
srs_assert
(
io
);
...
...
trunk/src/libs/srs_lib_simple_socket.hpp
查看文件 @
b28dc73
...
...
@@ -50,6 +50,7 @@ public:
SimpleSocketStream
();
virtual
~
SimpleSocketStream
();
public
:
virtual
srs_hijack_io_t
hijack_io
();
virtual
int
create_socket
();
virtual
int
connect
(
const
char
*
server
,
int
port
);
// ISrsBufferReader
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
b28dc73
...
...
@@ -534,7 +534,10 @@ srs_rtmp_t srs_rtmp_create2(const char* url)
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
)
{
srs_assert
(
rtmp
!=
NULL
);
if
(
!
rtmp
)
{
return
;
}
Context
*
context
=
(
Context
*
)
rtmp
;
srs_freep
(
context
);
...
...
@@ -2424,6 +2427,23 @@ const char* srs_human_format_time()
return
buf
;
}
#ifdef SRS_HIJACK_IO
srs_hijack_io_t
srs_hijack_io_get
(
srs_rtmp_t
rtmp
)
{
if
(
!
rtmp
)
{
return
NULL
;
}
Context
*
context
=
(
Context
*
)
rtmp
;
if
(
!
context
->
skt
)
{
return
NULL
;
}
return
context
->
skt
->
hijack_io
();
}
#endif
#ifdef __cplusplus
}
#endif
...
...
trunk/src/libs/srs_librtmp.hpp
查看文件 @
b28dc73
...
...
@@ -107,7 +107,7 @@ extern srs_rtmp_t srs_rtmp_create(const char* url);
extern
srs_rtmp_t
srs_rtmp_create2
(
const
char
*
url
);
/**
* close and destroy the rtmp stack.
* @remark, user should use the rtmp again.
* @remark, user should
never
use the rtmp again.
*/
extern
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
);
...
...
@@ -895,15 +895,22 @@ extern const char* srs_human_format_time();
*************************************************************/
// the void* will convert to your handler for io hijack.
typedef
void
*
srs_hijack_io_t
;
// define the following macro and functions in your module to hijack the io.
// 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 <sys/uio.h>
#endif
/**
* get the hijack io object in rtmp protocol sdk.
* @remark, user should never provides this method, srs-librtmp provides it.
*/
extern
srs_hijack_io_t
srs_hijack_io_get
(
srs_rtmp_t
rtmp
);
#endif
// define the following macro and functions in your module to hijack the io.
// the example @see https://github.com/winlinvip/st-load
// which use librtmp but use its own io(use st also).
#ifdef SRS_HIJACK_IO
/**
* create hijack.
* @return NULL for error; otherwise, ok.
*/
...
...
请
注册
或
登录
后发表评论