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-03-02 00:05:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fc9e3fd8901f01eb4dd89aec2ebd15ce3bc31fa2
fc9e3fd8
1 parent
44375b9e
srs-librtmp define interfaces
显示空白字符变更
内嵌
并排对比
正在显示
13 个修改的文件
包含
148 行增加
和
20 行删除
trunk/configure
trunk/research/librtmp/srs_play.c
trunk/research/librtmp/srs_publish.c
trunk/src/app/srs_core_client.hpp
trunk/src/app/srs_core_config.hpp
trunk/src/app/srs_core_pithy_print.cpp
trunk/src/kernel/srs_kernel_reload.cpp → trunk/src/app/srs_core_reload.cpp
trunk/src/kernel/srs_kernel_reload.hpp → trunk/src/app/srs_core_reload.hpp
trunk/src/app/srs_core_server.hpp
trunk/src/app/srs_core_source.hpp
trunk/src/libs/srs_librtmp.cpp
trunk/src/libs/srs_librtmp.hpp
trunk/src/srs/srs.upp
trunk/configure
查看文件 @
fc9e3fd
...
...
@@ -42,19 +42,21 @@ echo "" >> $SRS_AUTO_HEADERS_H
echo
"generate Makefile"
SRS_MAKEFILE
=
"Makefile"
cat
<< END > ${SRS_MAKEFILE}
.PHONY: default help clean server bandwidth librtmp _prepare_dir
default: server bandwidth librtmp
.PHONY: default help clean server bandwidth librtmp librtmp-sample _prepare_dir
default: server bandwidth librtmp librtmp-sample
help:
@echo "Usage: make <help>|<clean>|<server>|<bandwidth>|<librtmp>"
@echo "Usage: make <help>|<clean>|<server>|<bandwidth>|<librtmp>
|<librtmp-sample>
"
@echo " help display this help menu"
@echo " clean cleanup project"
@echo " server build the srs(simple rtmp server) over st(state-threads)"
@echo " bandwidth build the bandwidth test client tool."
@echo " librtmp build the client publish/play library."
@echo " librtmp-sample build the srs-librtmp sample"
clean:
(rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp src st_*_load research include lib)
(cd research/librtmp; make clean)
server: _prepare_dir
@echo "build the srs(simple rtmp server) over st(state-threads)"
...
...
@@ -68,6 +70,11 @@ librtmp: _prepare_dir
@echo "build the client publish/play library."
\$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} librtmp
librtmp-sample:
@echo "build the srs-librtmp sample"
(cd research/librtmp; make)
@echo "srs-librtmp sample build success"
# the ./configure will generate it.
_prepare_dir:
@mkdir -p ${SRS_OBJS}
...
...
@@ -140,8 +147,7 @@ CORE_OBJS="${MODULE_OBJS[@]}"
MODULE_ID
=
"KERNEL"
MODULE_DEPENDS
=(
"CORE"
)
ModuleLibIncs
=(
${
SRS_OBJS
}
)
MODULE_FILES
=(
"srs_kernel_error"
"srs_kernel_log"
"srs_kernel_reload"
"srs_kernel_stream"
"srs_kernel_buffer"
)
MODULE_FILES
=(
"srs_kernel_error"
"srs_kernel_log"
"srs_kernel_stream"
"srs_kernel_buffer"
)
MODULE_DIR
=
"src/kernel"
. auto/modules.sh
KERNEL_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
#
...
...
@@ -161,7 +167,7 @@ ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS})
MODULE_FILES
=(
"srs_core_server"
"srs_core_conn"
"srs_core_client"
"srs_core_socket"
"srs_core_source"
"srs_core_codec"
"srs_core_refer"
"srs_core_hls"
"srs_core_forward"
"srs_core_encoder"
"srs_core_http"
"srs_core_thread"
"srs_core_bandwidth"
"srs_core_st"
"srs_core_log"
"srs_core_config"
"srs_core_pithy_print"
)
"srs_core_config"
"srs_core_pithy_print"
"srs_core_reload"
)
MODULE_DIR
=
"src/app"
. auto/modules.sh
APP_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
#
...
...
trunk/research/librtmp/srs_play.c
查看文件 @
fc9e3fd
...
...
@@ -29,9 +29,33 @@ gcc srs_play.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_play
int
main
(
int
argc
,
char
**
argv
)
{
srs_rtmp_t
rtmp
;
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
());
rtmp
=
srs_rtmp_create
(
"rtmp://127.0.0.1/live/livestream"
);
if
(
srs_simple_handshake
(
rtmp
)
!=
0
)
{
printf
(
"simple handshake failed.
\n
"
);
return
-
1
;
}
printf
(
"simple handshake success
\n
"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
printf
(
"connect vhost/app failed.
\n
"
);
return
-
1
;
}
printf
(
"connect vhost/app success
\n
"
);
if
(
srs_play_stream
(
rtmp
)
!=
0
)
{
printf
(
"play stream failed.
\n
"
);
return
-
1
;
}
printf
(
"play stream success
\n
"
);
srs_rtmp_destroy
(
rtmp
);
return
0
;
}
...
...
trunk/research/librtmp/srs_publish.c
查看文件 @
fc9e3fd
...
...
@@ -29,9 +29,33 @@ gcc srs_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_publish
int
main
(
int
argc
,
char
**
argv
)
{
srs_rtmp_t
rtmp
;
printf
(
"publish rtmp stream to server like FMLE/FFMPEG/Encoder
\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
());
rtmp
=
srs_rtmp_create
(
"rtmp://127.0.0.1/live/livestream"
);
if
(
srs_simple_handshake
(
rtmp
)
!=
0
)
{
printf
(
"simple handshake failed.
\n
"
);
return
-
1
;
}
printf
(
"simple handshake success
\n
"
);
if
(
srs_connect_app
(
rtmp
)
!=
0
)
{
printf
(
"connect vhost/app failed.
\n
"
);
return
-
1
;
}
printf
(
"connect vhost/app success
\n
"
);
if
(
srs_publish_stream
(
rtmp
)
!=
0
)
{
printf
(
"publish stream failed.
\n
"
);
return
-
1
;
}
printf
(
"publish stream success
\n
"
);
srs_rtmp_destroy
(
rtmp
);
return
0
;
}
...
...
trunk/src/app/srs_core_client.hpp
查看文件 @
fc9e3fd
...
...
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_core_st.hpp>
#include <srs_core_conn.hpp>
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
class
SrsRtmp
;
class
SrsRequest
;
...
...
trunk/src/app/srs_core_config.hpp
查看文件 @
fc9e3fd
...
...
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <vector>
#include <string>
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
// default vhost for rtmp
#define RTMP_VHOST_DEFAULT "__defaultVhost__"
...
...
trunk/src/app/srs_core_pithy_print.cpp
查看文件 @
fc9e3fd
...
...
@@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_log.hpp>
#include <srs_core_config.hpp>
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
#include <srs_kernel_error.hpp>
#define SRS_STAGE_DEFAULT_INTERVAL_MS 1200
...
...
trunk/src/
kernel/srs_kernel
_reload.cpp → trunk/src/
app/srs_core
_reload.cpp
查看文件 @
fc9e3fd
...
...
@@ -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.
*/
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
using
namespace
std
;
...
...
trunk/src/
kernel/srs_kernel
_reload.hpp → trunk/src/
app/srs_core
_reload.hpp
查看文件 @
fc9e3fd
...
...
@@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_KERNEL_RELOAD_HPP
/*
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
*/
#include <srs_core.hpp>
...
...
trunk/src/app/srs_core_server.hpp
查看文件 @
fc9e3fd
...
...
@@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <vector>
#include <srs_core_st.hpp>
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
#include <srs_core_thread.hpp>
class
SrsServer
;
...
...
trunk/src/app/srs_core_source.hpp
查看文件 @
fc9e3fd
...
...
@@ -35,7 +35,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
#include <srs_core_st.hpp>
#include <srs_
kernel
_reload.hpp>
#include <srs_
core
_reload.hpp>
class
SrsSource
;
class
SrsCommonMessage
;
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
fc9e3fd
...
...
@@ -25,6 +25,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h>
#include <string>
using
namespace
std
;
#include <srs_kernel_error.hpp>
#include <srs_protocol_rtmp.hpp>
/**
...
...
@@ -49,6 +53,7 @@ public:
*/
struct
Context
{
std
::
string
url
;
SrsRtmpClient
*
rtmp
;
SimpleSocketStream
*
stream
;
int
stream_id
;
...
...
@@ -68,8 +73,9 @@ struct Context
extern
"C"
{
#endif
srs_rtmp_t
srs_rtmp_create
(){
srs_rtmp_t
srs_rtmp_create
(
const
char
*
url
){
Context
*
context
=
new
Context
();
context
->
url
=
url
;
return
context
;
}
...
...
@@ -79,6 +85,31 @@ void srs_rtmp_destroy(srs_rtmp_t rtmp){
srs_freep
(
context
);
}
int
srs_simple_handshake
(
srs_rtmp_t
rtmp
)
{
return
ERROR_SUCCESS
;
}
int
srs_complex_handshake
(
srs_rtmp_t
rtmp
)
{
return
ERROR_SUCCESS
;
}
int
srs_connect_app
(
srs_rtmp_t
rtmp
)
{
return
ERROR_SUCCESS
;
}
int
srs_play_stream
(
srs_rtmp_t
rtmp
)
{
return
ERROR_SUCCESS
;
}
int
srs_publish_stream
(
srs_rtmp_t
rtmp
)
{
return
ERROR_SUCCESS
;
}
int
srs_version_major
()
{
return
::
atoi
(
VERSION_MAJOR
);
...
...
trunk/src/libs/srs_librtmp.hpp
查看文件 @
fc9e3fd
...
...
@@ -36,15 +36,58 @@ extern "C"{
typedef
void
*
srs_rtmp_t
;
/**
* create a rtmp protocol stack.
* create/destroy a rtmp protocol stack.
* @url rtmp url, for example:
* rtmp://127.0.0.1/live/livestream
* @return a rtmp handler, or NULL if error occured.
*/
srs_rtmp_t
srs_rtmp_create
();
srs_rtmp_t
srs_rtmp_create
(
const
char
*
url
);
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
);
/**
* close a rtmp protocl stack.
* handshake with server
* category: publish/play
* previous: rtmp-create
* next: connect-app
* @return 0, success; otherwise, failed.
*/
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
);
/**
* simple handshake specifies in rtmp 1.0,
* not depends on ssl.
*/
int
srs_simple_handshake
(
srs_rtmp_t
rtmp
);
/**
* complex handshake is specified by adobe Flash player,
* depends on ssl, user must link libssl.a and libcrypt.a
*/
int
srs_complex_handshake
(
srs_rtmp_t
rtmp
);
/**
* connect to rtmp vhost/app
* category: publish/play
* previous: handshake
* next: publish or play
* @return 0, success; otherwise, failed.
*/
int
srs_connect_app
(
srs_rtmp_t
rtmp
);
/**
* play a live/vod stream.
* category: play
* previous: connect-app
* next: destroy
* @return 0, success; otherwise, failed.
*/
int
srs_play_stream
(
srs_rtmp_t
rtmp
);
/**
* publish a live stream.
* category: publish
* previous: connect-app
* next: destroy
* @return 0, success; otherwise, failed.
*/
int
srs_publish_stream
(
srs_rtmp_t
rtmp
);
/**
* get protocol stack version
...
...
trunk/src/srs/srs.upp
查看文件 @
fc9e3fd
...
...
@@ -19,8 +19,6 @@ file
..\kernel\srs_kernel_error.cpp,
..\kernel\srs_kernel_log.hpp,
..\kernel\srs_kernel_log.cpp,
..\kernel\srs_kernel_reload.hpp,
..\kernel\srs_kernel_reload.cpp,
..\kernel\srs_kernel_stream.hpp,
..\kernel\srs_kernel_stream.cpp,
rtmp-protocol readonly separator,
...
...
@@ -59,6 +57,8 @@ file
..\app\srs_core_log.cpp,
..\app\srs_core_refer.hpp,
..\app\srs_core_refer.cpp,
..\app\srs_core_reload.hpp,
..\app\srs_core_reload.cpp,
..\app\srs_core_pithy_print.hpp,
..\app\srs_core_pithy_print.cpp,
..\app\srs_core_thread.hpp,
...
...
请
注册
或
登录
后发表评论