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-01 23:24:53 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
713b05541b5053b8b845ece3f3fc572745b8a50b
713b0554
1 parent
aa5d28ed
add librtmp demo srs_publish
显示空白字符变更
内嵌
并排对比
正在显示
12 个修改的文件
包含
172 行增加
和
34 行删除
trunk/auto/generate_header.sh
trunk/auto/libs.sh
trunk/configure
trunk/research/librtmp/Makefile
trunk/research/librtmp/srs_publish.c
trunk/src/app/srs_core_forward.cpp
trunk/src/core/srs_core.hpp
trunk/src/libs/srs_librtmp.cpp
trunk/src/libs/srs_librtmp.hpp
trunk/src/rtmp/srs_protocol_rtmp.cpp
trunk/src/rtmp/srs_protocol_utility.hpp
trunk/src/srs/srs.upp
trunk/auto/generate_header.sh
查看文件 @
713b055
...
...
@@ -2,3 +2,7 @@
# genereate the library header file.
objs
=
$1
rm -f
$objs
/include/srs_librtmp.h
&&
cp
$objs
/../src/libs/srs_librtmp.hpp
$objs
/include/srs_librtmp.h
echo
"genereate srs-librtmp headers success"
...
...
trunk/auto/libs.sh
查看文件 @
713b055
...
...
@@ -7,22 +7,20 @@
# $BUILD_KEY a string indicates the build key for Makefile. ie. dump
# $LIB_NAME the app name to output. ie. smart_server
# $MODULE_OBJS array, the objects to compile the app.
# $LINK_OPTIONS the linker options to generate the so(shared library).
FILE
=
${
SRS_OBJS
}
/
${
SRS_MAKEFILE
}
LIB_TARGET
=
"
${
SRS_OBJS
}
/
${
LIB_NAME
}
"
LIB_TAGET_STATIC
=
"
${
LIB_TARGET
}
.a"
LIB_TAGET_SHARED
=
"
${
LIB_TARGET
}
.so"
echo
"generate lib
${
LIB_NAME
}
depends..."
echo
""
>>
${
FILE
}
echo
"# archive library
${
LIB_TAGET_STATIC
}
"
>>
${
FILE
}
echo
"
${
BUILD_KEY
}
:
${
LIB_TAGET_S
HARED
}
"
>>
${
FILE
}
echo
"
${
BUILD_KEY
}
:
${
LIB_TAGET_S
TATIC
}
"
>>
${
FILE
}
# build depends
echo
-n
"
${
LIB_TAGET_S
HARED
}
: "
>>
${
FILE
}
echo
-n
"
${
LIB_TAGET_S
TATIC
}
: "
>>
${
FILE
}
for
item
in
${
MODULE_OBJS
[*]
}
;
do
FILE_NAME
=
`
basename
$item
`
FILE_NAME
=
${
FILE_NAME
%.*
}
...
...
@@ -57,23 +55,4 @@ for item in ${MODULE_OBJS[*]}; do
done
echo
""
>>
${
FILE
}
echo
"generate lib
${
LIB_NAME
}
link..."
;
# archive librtmp.so
echo
-n
"
\$
(GCC) -shared -o
${
LIB_TAGET_SHARED
}
"
>>
${
FILE
}
for
item
in
${
MODULE_OBJS
[*]
}
;
do
FILE_NAME
=
`
basename
$item
`
FILE_NAME
=
${
FILE_NAME
%.*
}
if
[
! -f
${
item
}
]
;
then
continue
;
fi
OBJ_FILE
=
${
SRS_OBJS
}
/
$item
OBJ_FILE
=
"
${
OBJ_FILE
%.*
}
.o"
echo
-n
"
${
OBJ_FILE
}
"
>>
${
FILE
}
done
echo
-n
"
${
LINK_OPTIONS
}
"
>>
${
FILE
}
echo
""
>>
${
FILE
}
echo
-n
"generate lib
${
LIB_NAME
}
ok"
;
echo
'!'
;
...
...
trunk/configure
查看文件 @
713b055
...
...
@@ -54,7 +54,7 @@ help:
@echo " librtmp build the client publish/play library."
clean:
(rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp src st_*_load research)
(rm -f Makefile; cd ${SRS_OBJS}; rm -rf srs bandwidth Makefile *.hpp src st_*_load research
include lib
)
server: _prepare_dir
@echo "build the srs(simple rtmp server) over st(state-threads)"
...
...
@@ -83,8 +83,10 @@ GDBDebug="-g -O0"
WarnLevel
=
"-Wall"
# the compile standard.
CppStd
=
"-ansi"
# for library compile
LibraryCompile
=
"-fPIC"
# the cxx flag generated.
CXXFLAGS
=
"
${
CppStd
}
${
WarnLevel
}
${
GDBDebug
}
"
CXXFLAGS
=
"
${
CppStd
}
${
WarnLevel
}
${
GDBDebug
}
${
LibraryCompile
}
"
#CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}"
cat
<< END > ${SRS_OBJS}/${SRS_MAKEFILE}
CC ?= gcc
...
...
@@ -166,7 +168,7 @@ APP_OBJS="${MODULE_OBJS[@]}"
#LIBS Module, build libsrs.a for static link.
MODULE_ID
=
"LIBS"
MODULE_DEPENDS
=(
"CORE"
"KERNEL"
"RTMP"
)
ModuleLibIncs
=()
ModuleLibIncs
=(
${
SRS_OBJS
}
)
MODULE_FILES
=(
"srs_librtmp"
)
MODULE_DIR
=
"src/libs"
. auto/modules.sh
LIBS_OBJS
=
"
${
MODULE_OBJS
[@]
}
"
...
...
@@ -202,7 +204,7 @@ BUILD_KEY="bandwidth" APP_MAIN="srs_main_bandcheck" APP_NAME="bandwidth" . auto/
#
# srs librtmp
MODULE_OBJS
=
"
${
CORE_OBJS
[@]
}
${
KERNEL_OBJS
[@]
}
${
RTMP_OBJS
[@]
}
${
LIBS_OBJS
[@]
}
"
BUILD_KEY
=
"librtmp"
LIB_NAME
=
"
srs_librtmp"
LINK_OPTIONS
=
"
"
. auto/libs.sh
BUILD_KEY
=
"librtmp"
LIB_NAME
=
"
lib/srs_librtmp
"
. auto/libs.sh
echo
'configure ok! '
...
...
@@ -211,6 +213,9 @@ echo 'configure ok! '
#####################################################################################
# create objs/logs for ffmpeg to write log.
mkdir -p
${
SRS_OBJS
}
/logs
# lib and include for library
mkdir -p
${
SRS_OBJS
}
/lib
mkdir -p
${
SRS_OBJS
}
/include
#####################################################################################
# configure summary
...
...
trunk/research/librtmp/Makefile
0 → 100755
查看文件 @
713b055
.PHONY
:
clean
srs_publish
:
srs_publish.c Makefile ../../objs/include/srs_librtmp.h ../../objs/lib/srs_librtmp.a
gcc srs_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_publish
clean
:
@
rm -f srs_publish
...
...
trunk/research/librtmp/srs_publish.c
0 → 100755
查看文件 @
713b055
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
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_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_publish
*/
#include <stdio.h>
#include "../../objs/include/srs_librtmp.h"
int
main
(
int
argc
,
char
**
argv
)
{
printf
(
"srs(simple-rtmp-server) client librtmp library.
\n
"
);
printf
(
"version: %d.%d.%d
\n
"
,
srs_version_major
(),
srs_version_minor
(),
srs_version_revision
());
return
0
;
}
...
...
trunk/src/app/srs_core_forward.cpp
查看文件 @
713b055
...
...
@@ -77,8 +77,8 @@ int SrsForwarder::on_publish(SrsRequest* req, std::string forward_server)
stream_name
=
req
->
stream
;
server
=
forward_server
;
std
::
string
s_port
=
RTMP_DEFAULT_PORTS
;
port
=
RTMP_DEFAULT_PORT
;
std
::
string
s_port
=
RTMP_DEFAULT_PORT
;
port
=
::
atoi
(
RTMP_DEFAULT_PORT
);
size_t
pos
=
forward_server
.
find
(
":"
);
if
(
pos
!=
std
::
string
::
npos
)
{
...
...
trunk/src/core/srs_core.hpp
查看文件 @
713b055
...
...
@@ -29,7 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// current release version
#define RTMP_SIG_SRS_VERSION "0.9.8"
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "8"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
#define RTMP_SIG_SRS_ROLE "origin server"
...
...
trunk/src/libs/srs_librtmp.cpp
查看文件 @
713b055
...
...
@@ -22,3 +22,78 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_librtmp.hpp>
#include <stdlib.h>
#include <srs_protocol_rtmp.hpp>
/**
* the stream over epoll: never wait for data coming, that is async mode.
*/
class
SimpleSocketStream
{
private
:
int
sock
;
public
:
SimpleSocketStream
(
int
fd
){
sock
=
fd
;
}
virtual
~
SimpleSocketStream
()
{
::
close
(
sock
);
}
public
:
};
/**
* export runtime context.
*/
struct
Context
{
SrsRtmpClient
*
rtmp
;
SimpleSocketStream
*
stream
;
int
stream_id
;
Context
()
{
rtmp
=
NULL
;
stream
=
NULL
;
stream_id
=
0
;
}
virtual
~
Context
()
{
srs_freep
(
rtmp
);
srs_freep
(
stream
);
}
};
#ifdef __cplusplus
extern
"C"
{
#endif
srs_rtmp_t
srs_rtmp_create
(){
Context
*
context
=
new
Context
();
return
context
;
}
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
){
srs_assert
(
rtmp
!=
NULL
);
Context
*
context
=
(
Context
*
)
rtmp
;
srs_freep
(
context
);
}
int
srs_version_major
()
{
return
::
atoi
(
VERSION_MAJOR
);
}
int
srs_version_minor
()
{
return
::
atoi
(
VERSION_MINOR
);
}
int
srs_version_revision
()
{
return
::
atoi
(
VERSION_REVISION
);
}
#ifdef __cplusplus
}
#endif
...
...
trunk/src/libs/srs_librtmp.hpp
查看文件 @
713b055
...
...
@@ -25,7 +25,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SRS_LIB_RTMP_HPP
/*
#include <srs_librtmp.h
pp
>
#include <srs_librtmp.h>
*/
#ifdef __cplusplus
extern
"C"
{
#endif
// the output handler.
typedef
void
*
srs_rtmp_t
;
/**
* create a rtmp protocol stack.
* @return a rtmp handler, or NULL if error occured.
*/
srs_rtmp_t
srs_rtmp_create
();
/**
* close a rtmp protocl stack.
*/
void
srs_rtmp_destroy
(
srs_rtmp_t
rtmp
);
/**
* get protocol stack version
*/
int
srs_version_major
();
int
srs_version_minor
();
int
srs_version_revision
();
#ifdef __cplusplus
}
#endif
#endif
...
...
trunk/src/rtmp/srs_protocol_rtmp.cpp
查看文件 @
713b055
...
...
@@ -116,7 +116,7 @@ int SrsRequest::discovery_app()
srs_verbose
(
"discovery vhost=%s"
,
vhost
.
c_str
());
}
port
=
RTMP_DEFAULT_PORT
S
;
port
=
RTMP_DEFAULT_PORT
;
if
((
pos
=
vhost
.
find
(
":"
))
!=
std
::
string
::
npos
)
{
port
=
vhost
.
substr
(
pos
+
1
);
vhost
=
vhost
.
substr
(
0
,
pos
);
...
...
trunk/src/rtmp/srs_protocol_utility.hpp
查看文件 @
713b055
...
...
@@ -29,8 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#define RTMP_DEFAULT_PORT 1935
#define RTMP_DEFAULT_PORTS "1935"
#define RTMP_DEFAULT_PORT "1935"
// the default chunk size for system.
#define SRS_CONF_DEFAULT_CHUNK_SIZE 60000
...
...
trunk/src/srs/srs.upp
查看文件 @
713b055
...
...
@@ -72,6 +72,7 @@ file
..\app\srs_core_source.hpp,
..\app\srs_core_source.cpp,
research readonly separator,
..\..\research\librtmp\srs_publish.c,
..\..\research\hls\ts_info.cc;
mainconfig
...
...
请
注册
或
登录
后发表评论