Refine code, add mp4 parser module

pull/823/head
winlin 8 years ago
parent c648fd27bf
commit 62b7204514

@ -203,7 +203,7 @@ Experts:
--memory-watch enable memory watch to detect memory leaking(hurts performance).
--export-librtmp-project=<path> export srs-librtmp to specified project in path.
--export-librtmp-single=<path> export srs-librtmp to a single file(.h+.cpp) in path.
--no-valgrind donot support valgrind for memory check.
--without-valgrind donot support valgrind for memory check.
Workflow:
1. apply "Presets". if not specified, use default preset.
@ -293,7 +293,7 @@ function parse_user_option() {
--memory-watch) SRS_MEM_WATCH=YES ;;
--export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
--export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
--no-valgrind) SRS_VALGRIND=NO ;;
--without-valgrind) SRS_VALGRIND=NO ;;
--with-http-callback) SRS_HTTP_CALLBACK=YES ;;
--with-http-api) SRS_HTTP_API=YES ;;

@ -99,6 +99,7 @@
3C663F181AB0155100286D8B /* srs_play.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F0B1AB0155100286D8B /* srs_play.c */; };
3C663F191AB0155100286D8B /* srs_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F0C1AB0155100286D8B /* srs_publish.c */; };
3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F0D1AB0155100286D8B /* srs_rtmp_dump.c */; };
3C6F2D751E8653BF003D0805 /* srs_main_mp4_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C6F2D741E8653BF003D0805 /* srs_main_mp4_parser.cpp */; };
3C82802C1BAFF8CC004A1794 /* srs_kafka_stack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C82802A1BAFF8CC004A1794 /* srs_kafka_stack.cpp */; };
3C8CE01E1C3F482100548CC6 /* srs_app_hourglass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C8CE01D1C3F482100548CC6 /* srs_app_hourglass.cpp */; };
3C9F82221E4ECA8200F5B2D2 /* srs_app_dash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C9F82201E4ECA8200F5B2D2 /* srs_app_dash.cpp */; };
@ -373,6 +374,8 @@
3C663F0D1AB0155100286D8B /* srs_rtmp_dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_rtmp_dump.c; path = ../../../research/librtmp/srs_rtmp_dump.c; sourceTree = "<group>"; };
3C6673CF1DF7B93200A6DF57 /* readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = readme.txt; path = ../../../modules/readme.txt; sourceTree = "<group>"; };
3C6673D11DF7B95E00A6DF57 /* config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config; path = "../../../modules/hls-ingester/config"; sourceTree = "<group>"; };
3C6F2D731E86536B003D0805 /* config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = config; path = "../../../modules/mp4-parser/config"; sourceTree = "<group>"; };
3C6F2D741E8653BF003D0805 /* srs_main_mp4_parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_main_mp4_parser.cpp; path = ../../../src/main/srs_main_mp4_parser.cpp; sourceTree = "<group>"; };
3C8280241BAFF896004A1794 /* compatible.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = compatible.conf; path = ../../../conf/compatible.conf; sourceTree = "<group>"; };
3C8280251BAFF896004A1794 /* full.one.vhost.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = full.one.vhost.conf; path = ../../../conf/full.one.vhost.conf; sourceTree = "<group>"; };
3C8280261BAFF896004A1794 /* http.flv.live.edge1.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = http.flv.live.edge1.conf; path = ../../../conf/http.flv.live.edge1.conf; sourceTree = "<group>"; };
@ -508,6 +511,7 @@
isa = PBXGroup;
children = (
3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */,
3C6F2D741E8653BF003D0805 /* srs_main_mp4_parser.cpp */,
3C1232051AAE812C00CE8F6C /* srs_main_server.cpp */,
);
name = main;
@ -850,6 +854,14 @@
name = "hls-ingester";
sourceTree = "<group>";
};
3C6F2D721E86535D003D0805 /* mp4-parser */ = {
isa = PBXGroup;
children = (
3C6F2D731E86536B003D0805 /* config */,
);
name = "mp4-parser";
sourceTree = "<group>";
};
3C7175A61E1DEA0500E8C49F /* st */ = {
isa = PBXGroup;
children = (
@ -872,6 +884,7 @@
isa = PBXGroup;
children = (
3C6673D01DF7B95000A6DF57 /* hls-ingester */,
3C6F2D721E86535D003D0805 /* mp4-parser */,
3C6673CF1DF7B93200A6DF57 /* readme.txt */,
);
name = modules;
@ -1042,6 +1055,7 @@
3C036B551B2D0AC10078E2E0 /* srs_app_http_static.cpp in Sources */,
3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */,
3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */,
3C6F2D751E8653BF003D0805 /* srs_main_mp4_parser.cpp in Sources */,
3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */,
3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
3C036B561B2D0AC10078E2E0 /* srs_app_http_stream.cpp in Sources */,

@ -1,6 +1,6 @@
# The module to ingest hls to replace ffmpeg with better behavior.
SRS_MODULE_NAME=("hls-ingester")
SRS_MODULE_NAME=("srs_hls_ingester")
SRS_MODULE_MAIN=("srs_main_ingest_hls")
SRS_MODULE_APP=()
SRS_MODULE_DEFINES=""

@ -0,0 +1,7 @@
# The module to ingest hls to replace ffmpeg with better behavior.
SRS_MODULE_NAME=("srs_mp4_parser")
SRS_MODULE_MAIN=("srs_main_mp4_parser")
SRS_MODULE_APP=()
SRS_MODULE_DEFINES=""
SRS_MODULE_MAKEFILE=""

@ -1,27 +1,27 @@
SRS模块规则:
1. 一个模块一个目录
2. 目录下放一个config文件
3. 所有的configure中的变量模块中可以使用
SRS Module Ruler(SRS模块规则)
1. Each module in its seperate home directory(一个模块一个目录).
2. There is a config file in home(目录下放一个config文件).
3. All variables in configure are available(所有的configure中的变量模块中可以使用).
模块中需要定义变量,例如:
1. SRS_MODULE_NAME模块名称用来做Makefile的phony以及执行binary文件名。模块的二进制输出。为空时没有独立的二进制。
2. SRS_MODULE_MAIN模块的main函数所在的cpp文件在src/main目录。模块在main的文件。可以为空。
3. SRS_MODULE_APP模块在src/app目录的源文件列表。模块在app的文件。可以为空。
4. SRS_MODULE_DEFINES: 模块编译时的额外宏定义。在app和main模块加入。可以为空。
5. SRS_MODULE_MAKEFILE: 模块的Makefile。在make时会执行这个Makefile。可以为空。
The Variables in config(模块中需要定义变量,例如):
1. SRS_MODULE_NAMEThe application binary name, optional. (模块名称用来做Makefile的phony以及执行binary文件名。模块的二进制输出。为空时没有独立的二进制。)
2. SRS_MODULE_MAINThe source file in src/main directory, optional. (模块的main函数所在的cpp文件在src/main目录。模块在main的文件。可以为空。)
3. SRS_MODULE_APPThe source file in src/app directory, optional. (模块在src/app目录的源文件列表。模块在app的文件。可以为空。)
4. SRS_MODULE_DEFINES: The extra defined macros, optional. (模块编译时的额外宏定义。在app和main模块加入。可以为空。)
5. SRS_MODULE_MAKEFILE: The specified Makefile, optional. (模块的Makefile。在make时会执行这个Makefile。可以为空。)
下面是一个实例:
SRS_MODULE_NAME=("rtmfpd")
SRS_MODULE_MAIN=("srs_main_rtmfpd")
SRS_MODULE_APP=("srs_app_rtfmpd")
SRS_MODULE_DEFINES="-DRTMFPD"
SRS_MODULE_MAKEFILE="research/rtmfpd/Makefile"
注意,在配置开头必须清空这些变量:
Reset all Variables at the beginning(在配置开头必须清空这些变量):
SRS_MODULE_NAME=()
SRS_MODULE_MAIN=()
SRS_MODULE_APP=()
SRS_MODULE_DEFINES=""
SRS_MODULE_MAKEFILE=""
For example(下面是一个实例):
SRS_MODULE_NAME=("srs_rtmfpd")
SRS_MODULE_MAIN=("srs_main_rtmfpd")
SRS_MODULE_APP=("srs_app_rtfmpd")
SRS_MODULE_DEFINES="-DRTMFPD"
SRS_MODULE_MAKEFILE="modules/rtmfpd/Makefile"
winlin, 2015.3

@ -0,0 +1,42 @@
/*
The MIT License (MIT)
Copyright (c) 2013-2017 SRS(ossrs)
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.
*/
#include <srs_core.hpp>
#include <srs_kernel_error.hpp>
#include <srs_app_config.hpp>
#include <srs_app_log.hpp>
// @global log and context.
ISrsLog* _srs_log = new SrsFastLog();
ISrsThreadContext* _srs_context = new ISrsThreadContext();
// @global config object for app module.
SrsConfig* _srs_config = NULL;
/**
* main entrance.
*/
int main(int argc, char** argv)
{
return 0;
}
Loading…
Cancel
Save