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-21 14:18:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
aa69f6197a543194c9ff09ca8bb38013b2559399
aa69f619
1 parent
180106ce
srs-librtmp add rtmp prefix for rtmp apis. 2.0.29
隐藏空白字符变更
内嵌
并排对比
正在显示
13 个修改的文件
包含
95 行增加
和
95 行删除
README.md
trunk/research/librtmp/srs_audio_raw_publish.c
trunk/research/librtmp/srs_bandwidth_check.c
trunk/research/librtmp/srs_detect_rtmp.c
trunk/research/librtmp/srs_h264_raw_publish.c
trunk/research/librtmp/srs_ingest_flv.c
trunk/research/librtmp/srs_ingest_rtmp.c
trunk/research/librtmp/srs_play.c
trunk/research/librtmp/srs_publish.c
trunk/src/core/srs_core.hpp
trunk/src/libs/srs_librtmp.cpp
trunk/src/libs/srs_librtmp.hpp
trunk/src/srs/srs.upp
README.md
查看文件 @
aa69f61
...
...
@@ -482,6 +482,7 @@ Supported operating systems and hardware:
*
2013-10-17, Created.
<br/>
## History
*
v2.0, 2014-11-21, srs-librtmp add rtmp prefix for rtmp/utils/human apis. 2.0.29.
*
v2.0, 2014-11-21, refine examples of srs-librtmp, add srs_print_rtmp_packet. 2.0.28.
*
v2.0, 2014-11-20, fix
[
#212
](
https://github.com/winlinvip/simple-rtmp-server/issues/212
)
, support publish audio raw frames. 2.0.27
*
v2.0, 2014-11-19, fix
[
#213
](
https://github.com/winlinvip/simple-rtmp-server/issues/213
)
, support compile
[
srs-librtmp on windows
](
https://github.com/winlinvip/srs.librtmp
)
,
[
bug #213
](
https://github.com/winlinvip/simple-rtmp-server/issues/213
)
. 2.0.26
...
...
trunk/research/librtmp/srs_audio_raw_publish.c
查看文件 @
aa69f61
...
...
@@ -116,19 +116,19 @@ int main(int argc, char** argv)
// connect rtmp context
srs_rtmp_t
rtmp
=
srs_rtmp_create
(
rtmp_url
);
if
(
srs_
simple
_handshake
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp
_handshake
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"simple handshake failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"simple handshake success"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
connect_app
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
(
srs_publish_stream
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
publish_stream
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"publish stream failed."
);
goto
rtmp_destroy
;
}
...
...
trunk/research/librtmp/srs_bandwidth_check.c
查看文件 @
aa69f61
...
...
@@ -21,7 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
gcc srs_
bandwidth_check.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs
_bandwidth_check
gcc srs_
rtmp_bandwidth_check.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_rtmp
_bandwidth_check
*/
#include <stdio.h>
...
...
@@ -83,20 +83,20 @@ int main(int argc, char** argv)
srs_human_trace
(
"bandwidth check/test url: %s"
,
argv
[
1
]);
if
((
ret
=
srs_
simple
_handshake
(
rtmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp
_handshake
(
rtmp
))
!=
0
)
{
srs_human_trace
(
"simple handshake failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"simple handshake success"
);
if
((
ret
=
srs_connect_app2
(
rtmp
,
if
((
ret
=
srs_
rtmp_
connect_app2
(
rtmp
,
srs_server_ip
,
srs_server
,
srs_primary_authors
,
srs_version
,
&
srs_id
,
&
srs_pid
))
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
((
ret
=
srs_bandwidth_check
(
rtmp
,
if
((
ret
=
srs_
rtmp_
bandwidth_check
(
rtmp
,
&
start_time
,
&
end_time
,
&
play_kbps
,
&
publish_kbps
,
&
play_bytes
,
&
publish_bytes
,
&
play_duration
,
&
publish_duration
))
!=
0
)
{
...
...
trunk/research/librtmp/srs_detect_rtmp.c
查看文件 @
aa69f61
...
...
@@ -90,33 +90,33 @@ int main(int argc, char** argv)
rtmp
=
srs_rtmp_create
(
rtmp_url
);
if
((
ret
=
__srs_dns_resolve
(
rtmp
))
!=
0
)
{
if
((
ret
=
__srs_
rtmp_
dns_resolve
(
rtmp
))
!=
0
)
{
srs_human_trace
(
"dns resolve failed. ret=%d"
,
ret
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"dns resolve success"
);
time_dns_resolve
=
srs_utils_get_time_ms
();
if
((
ret
=
__srs_connect_server
(
rtmp
))
!=
0
)
{
if
((
ret
=
__srs_
rtmp_
connect_server
(
rtmp
))
!=
0
)
{
srs_human_trace
(
"socket connect failed. ret=%d"
,
ret
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"socket connect success"
);
time_socket_connect
=
srs_utils_get_time_ms
();
if
((
ret
=
__srs_do_simple_handshake
(
rtmp
))
!=
0
)
{
if
((
ret
=
__srs_
rtmp_
do_simple_handshake
(
rtmp
))
!=
0
)
{
srs_human_trace
(
"do simple handshake failed. ret=%d"
,
ret
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"do simple handshake success"
);
if
((
ret
=
srs_connect_app
(
rtmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
connect_app
(
rtmp
))
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed. ret=%d"
,
ret
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
((
ret
=
srs_play_stream
(
rtmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
play_stream
(
rtmp
))
!=
0
)
{
srs_human_trace
(
"play stream failed. ret=%d"
,
ret
);
goto
rtmp_destroy
;
}
...
...
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
time_play_stream
=
srs_utils_get_time_ms
();
for
(;;)
{
if
((
ret
=
srs_read_packet
(
rtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
))
!=
0
)
{
if
((
ret
=
srs_r
tmp_r
ead_packet
(
rtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
))
!=
0
)
{
srs_human_trace
(
"read packet failed. ret=%d"
,
ret
);
goto
rtmp_destroy
;
}
...
...
trunk/research/librtmp/srs_h264_raw_publish.c
查看文件 @
aa69f61
...
...
@@ -128,19 +128,19 @@ int main(int argc, char** argv)
// connect rtmp context
srs_rtmp_t
rtmp
=
srs_rtmp_create
(
rtmp_url
);
if
(
srs_
simple
_handshake
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp
_handshake
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"simple handshake failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"simple handshake success"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
connect_app
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
(
srs_publish_stream
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
publish_stream
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"publish stream failed."
);
goto
rtmp_destroy
;
}
...
...
trunk/research/librtmp/srs_ingest_flv.c
查看文件 @
aa69f61
...
...
@@ -148,7 +148,7 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, int32_t* pstarttime, u
return
ret
;
}
if
((
ret
=
srs_write_packet
(
ortmp
,
type
,
*
ptimestamp
,
data
,
size
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
write_packet
(
ortmp
,
type
,
*
ptimestamp
,
data
,
size
))
!=
0
)
{
srs_human_trace
(
"irtmp get packet failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -191,19 +191,19 @@ int connect_oc(srs_rtmp_t ortmp)
{
int
ret
=
0
;
if
((
ret
=
srs_
simple
_handshake
(
ortmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp
_handshake
(
ortmp
))
!=
0
)
{
srs_human_trace
(
"ortmp simple handshake failed. ret=%d"
,
ret
);
return
ret
;
}
srs_human_trace
(
"ortmp simple handshake success"
);
if
((
ret
=
srs_connect_app
(
ortmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
connect_app
(
ortmp
))
!=
0
)
{
srs_human_trace
(
"ortmp connect vhost/app failed. ret=%d"
,
ret
);
return
ret
;
}
srs_human_trace
(
"ortmp connect vhost/app success"
);
if
((
ret
=
srs_publish_stream
(
ortmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
publish_stream
(
ortmp
))
!=
0
)
{
srs_human_trace
(
"ortmp publish stream failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/research/librtmp/srs_ingest_rtmp.c
查看文件 @
aa69f61
...
...
@@ -108,7 +108,7 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
srs_human_trace
(
"start proxy RTMP stream"
);
for
(;;)
{
if
((
ret
=
srs_read_packet
(
irtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
))
!=
0
)
{
if
((
ret
=
srs_r
tmp_r
ead_packet
(
irtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
))
!=
0
)
{
srs_human_trace
(
"irtmp get packet failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -118,7 +118,7 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp)
return
ret
;
}
if
((
ret
=
srs_write_packet
(
ortmp
,
type
,
timestamp
,
data
,
size
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
write_packet
(
ortmp
,
type
,
timestamp
,
data
,
size
))
!=
0
)
{
srs_human_trace
(
"irtmp get packet failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -133,19 +133,19 @@ int connect_ic(srs_rtmp_t irtmp)
{
int
ret
=
0
;
if
((
ret
=
srs_
simple
_handshake
(
irtmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp
_handshake
(
irtmp
))
!=
0
)
{
srs_human_trace
(
"irtmp simple handshake failed. ret=%d"
,
ret
);
return
ret
;
}
srs_human_trace
(
"irtmp simple handshake success"
);
if
((
ret
=
srs_connect_app
(
irtmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
connect_app
(
irtmp
))
!=
0
)
{
srs_human_trace
(
"irtmp connect vhost/app failed. ret=%d"
,
ret
);
return
ret
;
}
srs_human_trace
(
"irtmp connect vhost/app success"
);
if
((
ret
=
srs_play_stream
(
irtmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
play_stream
(
irtmp
))
!=
0
)
{
srs_human_trace
(
"irtmp play stream failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -158,19 +158,19 @@ int connect_oc(srs_rtmp_t ortmp)
{
int
ret
=
0
;
if
((
ret
=
srs_
simple
_handshake
(
ortmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp
_handshake
(
ortmp
))
!=
0
)
{
srs_human_trace
(
"ortmp simple handshake failed. ret=%d"
,
ret
);
return
ret
;
}
srs_human_trace
(
"ortmp simple handshake success"
);
if
((
ret
=
srs_connect_app
(
ortmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
connect_app
(
ortmp
))
!=
0
)
{
srs_human_trace
(
"ortmp connect vhost/app failed. ret=%d"
,
ret
);
return
ret
;
}
srs_human_trace
(
"ortmp connect vhost/app success"
);
if
((
ret
=
srs_publish_stream
(
ortmp
))
!=
0
)
{
if
((
ret
=
srs_
rtmp_
publish_stream
(
ortmp
))
!=
0
)
{
srs_human_trace
(
"ortmp publish stream failed. ret=%d"
,
ret
);
return
ret
;
}
...
...
trunk/research/librtmp/srs_play.c
查看文件 @
aa69f61
...
...
@@ -47,19 +47,19 @@ int main(int argc, char** argv)
srs_human_trace
(
"rtmp url: %s"
,
argv
[
1
]);
srs_rtmp_t
rtmp
=
srs_rtmp_create
(
argv
[
1
]);
if
(
srs_
simple
_handshake
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp
_handshake
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"simple handshake failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"simple handshake success"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
connect_app
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
(
srs_play_stream
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
play_stream
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"play stream failed."
);
goto
rtmp_destroy
;
}
...
...
@@ -71,7 +71,7 @@ int main(int argc, char** argv)
char
*
data
;
u_int32_t
timestamp
;
if
(
srs_read_packet
(
rtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
)
!=
0
)
{
if
(
srs_r
tmp_r
ead_packet
(
rtmp
,
&
type
,
&
timestamp
,
&
data
,
&
size
)
!=
0
)
{
goto
rtmp_destroy
;
}
...
...
trunk/research/librtmp/srs_publish.c
查看文件 @
aa69f61
...
...
@@ -55,19 +55,19 @@ int main(int argc, char** argv)
srs_human_trace
(
"rtmp url: %s"
,
argv
[
1
]);
srs_rtmp_t
rtmp
=
srs_rtmp_create
(
argv
[
1
]);
if
(
srs_
simple
_handshake
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp
_handshake
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"simple handshake failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"simple handshake success"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
connect_app
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"connect vhost/app failed."
);
goto
rtmp_destroy
;
}
srs_human_trace
(
"connect vhost/app success"
);
if
(
srs_publish_stream
(
rtmp
)
!=
0
)
{
if
(
srs_
rtmp_
publish_stream
(
rtmp
)
!=
0
)
{
srs_human_trace
(
"publish stream failed."
);
goto
rtmp_destroy
;
}
...
...
@@ -81,7 +81,7 @@ int main(int argc, char** argv)
timestamp
+=
40
;
if
(
srs_write_packet
(
rtmp
,
type
,
timestamp
,
data
,
size
)
!=
0
)
{
if
(
srs_
rtmp_
write_packet
(
rtmp
,
type
,
timestamp
,
data
,
size
)
!=
0
)
{
goto
rtmp_destroy
;
}
srs_human_trace
(
"sent packet: type=%s, time=%d, size=%d"
,
...
...
trunk/src/core/srs_core.hpp
查看文件 @
aa69f61
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 2
8
#define VERSION_REVISION 2
9
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
aa69f61
...
...
@@ -514,6 +514,21 @@ int srs_librtmp_context_connect(Context* context)
extern
"C"
{
#endif
int
srs_version_major
()
{
return
VERSION_MAJOR
;
}
int
srs_version_minor
()
{
return
VERSION_MINOR
;
}
int
srs_version_revision
()
{
return
VERSION_REVISION
;
}
srs_rtmp_t
srs_rtmp_create
(
const
char
*
url
)
{
Context
*
context
=
new
Context
();
...
...
@@ -541,26 +556,26 @@ void srs_rtmp_destroy(srs_rtmp_t rtmp)
srs_freep
(
context
);
}
int
srs_
simple
_handshake
(
srs_rtmp_t
rtmp
)
int
srs_
rtmp
_handshake
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
if
((
ret
=
__srs_dns_resolve
(
rtmp
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
__srs_
rtmp_
dns_resolve
(
rtmp
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
__srs_connect_server
(
rtmp
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
__srs_
rtmp_
connect_server
(
rtmp
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
if
((
ret
=
__srs_do_simple_handshake
(
rtmp
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
__srs_
rtmp_
do_simple_handshake
(
rtmp
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
return
ret
;
}
int
__srs_dns_resolve
(
srs_rtmp_t
rtmp
)
int
__srs_
rtmp_
dns_resolve
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -579,7 +594,7 @@ int __srs_dns_resolve(srs_rtmp_t rtmp)
return
ret
;
}
int
__srs_connect_server
(
srs_rtmp_t
rtmp
)
int
__srs_
rtmp_
connect_server
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -593,7 +608,7 @@ int __srs_connect_server(srs_rtmp_t rtmp)
return
ret
;
}
int
__srs_do_simple_handshake
(
srs_rtmp_t
rtmp
)
int
__srs_
rtmp_
do_simple_handshake
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -613,7 +628,7 @@ int __srs_do_simple_handshake(srs_rtmp_t rtmp)
return
ret
;
}
int
srs_connect_app
(
srs_rtmp_t
rtmp
)
int
srs_
rtmp_
connect_app
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -634,7 +649,7 @@ int srs_connect_app(srs_rtmp_t rtmp)
return
ret
;
}
int
srs_connect_app2
(
srs_rtmp_t
rtmp
,
int
srs_
rtmp_
connect_app2
(
srs_rtmp_t
rtmp
,
char
srs_server_ip
[
128
],
char
srs_server
[
128
],
char
srs_primary_authors
[
128
],
char
srs_version
[
32
],
int
*
srs_id
,
int
*
srs_pid
)
{
...
...
@@ -670,7 +685,7 @@ int srs_connect_app2(srs_rtmp_t rtmp,
return
ret
;
}
int
srs_play_stream
(
srs_rtmp_t
rtmp
)
int
srs_
rtmp_
play_stream
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -687,7 +702,7 @@ int srs_play_stream(srs_rtmp_t rtmp)
return
ret
;
}
int
srs_publish_stream
(
srs_rtmp_t
rtmp
)
int
srs_
rtmp_
publish_stream
(
srs_rtmp_t
rtmp
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -701,7 +716,7 @@ int srs_publish_stream(srs_rtmp_t rtmp)
return
ret
;
}
int
srs_bandwidth_check
(
srs_rtmp_t
rtmp
,
int
srs_
rtmp_
bandwidth_check
(
srs_rtmp_t
rtmp
,
int64_t
*
start_time
,
int64_t
*
end_time
,
int
*
play_kbps
,
int
*
publish_kbps
,
int
*
play_bytes
,
int
*
publish_bytes
,
...
...
@@ -737,7 +752,7 @@ int srs_bandwidth_check(srs_rtmp_t rtmp,
return
ret
;
}
int
srs_read_packet
(
srs_rtmp_t
rtmp
,
char
*
type
,
u_int32_t
*
timestamp
,
char
**
data
,
int
*
size
)
int
srs_r
tmp_r
ead_packet
(
srs_rtmp_t
rtmp
,
char
*
type
,
u_int32_t
*
timestamp
,
char
**
data
,
int
*
size
)
{
*
type
=
0
;
*
timestamp
=
0
;
...
...
@@ -792,7 +807,7 @@ int srs_read_packet(srs_rtmp_t rtmp, char* type, u_int32_t* timestamp, char** da
return
ret
;
}
int
srs_write_packet
(
srs_rtmp_t
rtmp
,
char
type
,
u_int32_t
timestamp
,
char
*
data
,
int
size
)
int
srs_
rtmp_
write_packet
(
srs_rtmp_t
rtmp
,
char
type
,
u_int32_t
timestamp
,
char
*
data
,
int
size
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -843,21 +858,6 @@ int srs_write_packet(srs_rtmp_t rtmp, char type, u_int32_t timestamp, char* data
return
ret
;
}
int
srs_version_major
()
{
return
VERSION_MAJOR
;
}
int
srs_version_minor
()
{
return
VERSION_MINOR
;
}
int
srs_version_revision
()
{
return
VERSION_REVISION
;
}
struct
FlvContext
{
SrsFileReader
reader
;
...
...
@@ -1356,7 +1356,7 @@ int srs_audio_write_raw_frame(srs_rtmp_t rtmp,
memcpy
(
p
,
frame
,
frame_size
);
return
srs_write_packet
(
context
,
SRS_RTMP_TYPE_AUDIO
,
timestamp
,
data
,
size
);
return
srs_
rtmp_
write_packet
(
context
,
SRS_RTMP_TYPE_AUDIO
,
timestamp
,
data
,
size
);
}
/**
...
...
@@ -1403,7 +1403,7 @@ int __srs_write_h264_packet(Context* context,
// h.264 raw data.
memcpy
(
p
,
h264_raw_data
,
h264_raw_size
);
return
srs_write_packet
(
context
,
SRS_RTMP_TYPE_VIDEO
,
timestamp
,
data
,
size
);
return
srs_
rtmp_
write_packet
(
context
,
SRS_RTMP_TYPE_VIDEO
,
timestamp
,
data
,
size
);
}
/**
...
...
trunk/src/libs/srs_librtmp.hpp
查看文件 @
aa69f61
...
...
@@ -86,6 +86,15 @@ extern "C"{
/*************************************************************
**************************************************************
* srs-librtmp version
**************************************************************
*************************************************************/
extern
int
srs_version_major
();
extern
int
srs_version_minor
();
extern
int
srs_version_revision
();
/*************************************************************
**************************************************************
* RTMP protocol context
**************************************************************
*************************************************************/
...
...
@@ -134,19 +143,19 @@ extern void srs_rtmp_destroy(srs_rtmp_t rtmp);
* not depends on ssl.
*/
/**
* srs_simple_handshake equals to invoke:
* __srs_dns_resolve()
* __srs_connect_server()
* __srs_do_simple_handshake()
* srs_rtmp_handshake equals to invoke:
* __srs_rtmp_dns_resolve()
* __srs_rtmp_connect_server()
* __srs_rtmp_do_simple_handshake()
* user can use these functions if needed.
*/
extern
int
srs_
simple
_handshake
(
srs_rtmp_t
rtmp
);
extern
int
srs_
rtmp
_handshake
(
srs_rtmp_t
rtmp
);
// parse uri, create socket, resolve host
extern
int
__srs_dns_resolve
(
srs_rtmp_t
rtmp
);
extern
int
__srs_
rtmp_
dns_resolve
(
srs_rtmp_t
rtmp
);
// connect socket to server
extern
int
__srs_connect_server
(
srs_rtmp_t
rtmp
);
extern
int
__srs_
rtmp_
connect_server
(
srs_rtmp_t
rtmp
);
// do simple handshake over socket.
extern
int
__srs_do_simple_handshake
(
srs_rtmp_t
rtmp
);
extern
int
__srs_
rtmp_
do_simple_handshake
(
srs_rtmp_t
rtmp
);
/**
* connect to rtmp vhost/app
...
...
@@ -156,7 +165,7 @@ extern int __srs_do_simple_handshake(srs_rtmp_t rtmp);
*
* @return 0, success; otherswise, failed.
*/
extern
int
srs_connect_app
(
srs_rtmp_t
rtmp
);
extern
int
srs_
rtmp_
connect_app
(
srs_rtmp_t
rtmp
);
/**
* connect to server, get the debug srs info.
...
...
@@ -171,7 +180,7 @@ extern int srs_connect_app(srs_rtmp_t rtmp);
*
* @return 0, success; otherswise, failed.
*/
extern
int
srs_connect_app2
(
srs_rtmp_t
rtmp
,
extern
int
srs_
rtmp_
connect_app2
(
srs_rtmp_t
rtmp
,
char
srs_server_ip
[
128
],
char
srs_server
[
128
],
char
srs_primary_authors
[
128
],
char
srs_version
[
32
],
int
*
srs_id
,
int
*
srs_pid
);
...
...
@@ -183,7 +192,7 @@ extern int srs_connect_app2(srs_rtmp_t rtmp,
* next: destroy
* @return 0, success; otherwise, failed.
*/
extern
int
srs_play_stream
(
srs_rtmp_t
rtmp
);
extern
int
srs_
rtmp_
play_stream
(
srs_rtmp_t
rtmp
);
/**
* publish a live stream.
...
...
@@ -192,7 +201,7 @@ extern int srs_play_stream(srs_rtmp_t rtmp);
* next: destroy
* @return 0, success; otherwise, failed.
*/
extern
int
srs_publish_stream
(
srs_rtmp_t
rtmp
);
extern
int
srs_
rtmp_
publish_stream
(
srs_rtmp_t
rtmp
);
/**
* do bandwidth check with srs server.
...
...
@@ -209,7 +218,7 @@ extern int srs_publish_stream(srs_rtmp_t rtmp);
*
* @return 0, success; otherswise, failed.
*/
extern
int
srs_bandwidth_check
(
srs_rtmp_t
rtmp
,
extern
int
srs_
rtmp_
bandwidth_check
(
srs_rtmp_t
rtmp
,
int64_t
*
start_time
,
int64_t
*
end_time
,
int
*
play_kbps
,
int
*
publish_kbps
,
int
*
play_bytes
,
int
*
publish_bytes
,
...
...
@@ -246,25 +255,15 @@ extern int srs_bandwidth_check(srs_rtmp_t rtmp,
*
* @return 0, success; otherswise, failed.
*/
extern
int
srs_read_packet
(
srs_rtmp_t
rtmp
,
extern
int
srs_r
tmp_r
ead_packet
(
srs_rtmp_t
rtmp
,
char
*
type
,
u_int32_t
*
timestamp
,
char
**
data
,
int
*
size
);
extern
int
srs_write_packet
(
srs_rtmp_t
rtmp
,
extern
int
srs_
rtmp_
write_packet
(
srs_rtmp_t
rtmp
,
char
type
,
u_int32_t
timestamp
,
char
*
data
,
int
size
);
/*************************************************************
**************************************************************
* version apis
**************************************************************
*************************************************************/
// get protocol stack version
extern
int
srs_version_major
();
extern
int
srs_version_minor
();
extern
int
srs_version_revision
();
/*************************************************************
**************************************************************
* flv codec
* @example /trunk/research/librtmp/srs_flv_injecter.c
* @example /trunk/research/librtmp/srs_flv_parser.c
...
...
@@ -607,7 +606,7 @@ extern int64_t srs_utils_get_recv_bytes(srs_rtmp_t rtmp);
/**
* parse the dts and pts by time in header and data in tag,
* or to parse the RTMP packet by srs_read_packet().
* or to parse the RTMP packet by srs_r
tmp_r
ead_packet().
*
* @param time, the timestamp of tag, read by srs_flv_read_tag_header().
* @param type, the type of tag, read by srs_flv_read_tag_header().
...
...
trunk/src/srs/srs.upp
查看文件 @
aa69f61
...
...
@@ -129,7 +129,7 @@ file
..\utest\srs_utest_reload.cpp,
research readonly separator,
..\..\research\librtmp\srs_audio_raw_publish.c,
..\..\research\librtmp\srs_bandwidth_check.c,
..\..\research\librtmp\srs_
rtmp_
bandwidth_check.c,
..\..\research\librtmp\srs_detect_rtmp.c,
..\..\research\librtmp\srs_flv_injecter.c,
..\..\research\librtmp\srs_flv_parser.c,
...
...
请
注册
或
登录
后发表评论