winlin

refine the macro SRS_FFMPEG to SRS_FFMPEG_STUB, SRS_FFMPEG_TOOL to build ffmpeg tool

... ... @@ -487,7 +487,7 @@ fi
#####################################################################################
# live transcoding, ffmpeg-2.1, x264-core138, lame-3.99.5, libaacplus-2.0.2.
#####################################################################################
if [ $SRS_FFMPEG = YES ]; then
if [ $SRS_FFMPEG_TOOL = YES ]; then
if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
echo "ffmpeg-2.1 is ok.";
else
... ... @@ -506,13 +506,13 @@ fi
# whatever the FFMPEG tools, if transcode and ingest specified,
# srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
__SRS_FFMPEG=NO
if [ $SRS_TRANSCODE = YES ]; then __SRS_FFMPEG=YES; fi
if [ $SRS_INGEST = YES ]; then __SRS_FFMPEG=YES; fi
if [ $__SRS_FFMPEG = YES ]; then
echo "#define SRS_FFMPEG" >> $SRS_AUTO_HEADERS_H
__SRS_FFMPEG_STUB=NO
if [ $SRS_TRANSCODE = YES ]; then __SRS_FFMPEG_STUB=YES; fi
if [ $SRS_INGEST = YES ]; then __SRS_FFMPEG_STUB=YES; fi
if [ $__SRS_FFMPEG_STUB = YES ]; then
echo "#define SRS_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
else
echo "#undef SRS_FFMPEG" >> $SRS_AUTO_HEADERS_H
echo "#undef SRS_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
fi
if [ $SRS_TRANSCODE = YES ]; then
... ...
... ... @@ -16,7 +16,7 @@ help=no
SRS_HLS=RESERVED
SRS_NGINX=RESERVED
SRS_SSL=RESERVED
SRS_FFMPEG=RESERVED
SRS_FFMPEG_TOOL=RESERVED
SRS_TRANSCODE=RESERVED
SRS_INGEST=RESERVED
SRS_HTTP_PARSER=RESERVED
... ... @@ -75,7 +75,7 @@ do
--with-ssl) SRS_SSL=YES ;;
--with-hls) SRS_HLS=YES ;;
--with-nginx) SRS_NGINX=YES ;;
--with-ffmpeg) SRS_FFMPEG=YES ;;
--with-ffmpeg) SRS_FFMPEG_TOOL=YES ;;
--with-transcode) SRS_TRANSCODE=YES ;;
--with-ingest) SRS_INGEST=YES ;;
--with-http-callback) SRS_HTTP_CALLBACK=YES ;;
... ... @@ -95,7 +95,7 @@ do
--without-ssl) SRS_SSL=NO ;;
--without-hls) SRS_HLS=NO ;;
--without-nginx) SRS_NGINX=NO ;;
--without-ffmpeg) SRS_FFMPEG=NO ;;
--without-ffmpeg) SRS_FFMPEG_TOOL=NO ;;
--without-transcode) SRS_TRANSCODE=NO ;;
--without-ingest) SRS_INGEST=NO ;;
--without-http-callback) SRS_HTTP_CALLBACK=NO ;;
... ... @@ -136,15 +136,15 @@ if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi
if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi
# if transcode specified, try ffmpeg if possible.
if [ $SRS_TRANSCODE = YES ]; then if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=YES; fi fi
if [ $SRS_INGEST = YES ]; then if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=YES; fi fi
if [ $SRS_TRANSCODE = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=YES; fi fi
if [ $SRS_INGEST = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=YES; fi fi
# if arm specified, set some default to disabled.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi
SRS_NGINX=NO
if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi
SRS_FFMPEG=NO
SRS_FFMPEG_TOOL=NO
if [ $SRS_TRANSCODE = RESERVED ]; then SRS_TRANSCODE=YES; fi
if [ $SRS_INGEST = RESERVED ]; then SRS_INGEST=YES; fi
if [ $SRS_HTTP_PARSER = RESERVED ]; then SRS_HTTP_PARSER=YES; fi
... ... @@ -169,7 +169,7 @@ else
if [ $SRS_HLS = RESERVED ]; then SRS_HLS=YES; fi
if [ $SRS_NGINX = RESERVED ]; then SRS_NGINX=NO; fi
if [ $SRS_SSL = RESERVED ]; then SRS_SSL=YES; fi
if [ $SRS_FFMPEG = RESERVED ]; then SRS_FFMPEG=NO; fi
if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=NO; fi
if [ $SRS_TRANSCODE = RESERVED ]; then SRS_TRANSCODE=NO; fi
if [ $SRS_INGEST = RESERVED ]; then SRS_INGEST=NO; fi
if [ $SRS_HTTP_PARSER = RESERVED ]; then SRS_HTTP_PARSER=YES; fi
... ... @@ -196,7 +196,7 @@ if [ $SRS_DEV = YES ]; then
SRS_HLS=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG=YES
SRS_FFMPEG_TOOL=YES
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_HTTP_PARSER=YES
... ... @@ -222,7 +222,7 @@ if [ $SRS_PI = YES ]; then
SRS_HLS=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG=NO
SRS_FFMPEG_TOOL=NO
SRS_TRANSCODE=YES
SRS_INGEST=YES
SRS_HTTP_PARSER=YES
... ... @@ -348,7 +348,7 @@ fi fi
# check arm, if arm enabled, only allow st/ssl/librtmp,
# user should disable all other features
if [ $SRS_ARM_UBUNTU12 = YES ]; then
if [ $SRS_FFMPEG = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_GPERF = YES ]; then echo "gperf for arm is not available, see: ./configure --help"; __check_ok=NO; fi
... ... @@ -362,7 +362,7 @@ fi
if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_FFMPEG = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi
... ... @@ -388,7 +388,7 @@ if [ $SRS_PI = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --pi"; fi
if [ $SRS_HLS = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-hls"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-hls"; fi
if [ $SRS_NGINX = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-nginx"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-nginx"; fi
if [ $SRS_SSL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ssl"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ssl"; fi
if [ $SRS_FFMPEG = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ffmpeg"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ffmpeg"; fi
if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ffmpeg"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ffmpeg"; fi
if [ $SRS_TRANSCODE = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-transcode"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-transcode"; fi
if [ $SRS_INGEST = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-ingest"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-ingest"; fi
if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_CONFIGURE="${SRS_CONFIGURE} --with-http-callback"; else SRS_CONFIGURE="${SRS_CONFIGURE} --without-http-callback"; fi
... ...
... ... @@ -16,7 +16,7 @@ BLACK="\\e[0m"
#####################################################################################
# parse user options, set the variables like:
# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG/SRS_HTTP_CALLBACK/......
# srs features: SRS_SSL/SRS_HLS/SRS_NGINX/SRS_FFMPEG_TOOL/SRS_HTTP_CALLBACK/......
# build options: SRS_JOBS
#####################################################################################
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
... ... @@ -84,7 +84,7 @@ if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS}/utest; \$(MAKE)
SrsHlsSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HLS = YES ]; then SrsHlsSummaryColor="\${GREEN}"; fi
SrsNginxSummaryColor="\${GREEN}{disabled} "; if [ $SRS_NGINX = YES ]; then SrsNginxSummaryColor="\${GREEN}"; fi
SrsSslSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_SSL = YES ]; then SrsSslSummaryColor="\${GREEN}"; fi
SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi
SrsFfmpegSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_FFMPEG_TOOL = YES ]; then SrsFfmpegSummaryColor="\${GREEN}"; fi
SrsTranscodeSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_TRANSCODE = YES ]; then SrsTranscodeSummaryColor="\${GREEN}"; fi
SrsIngestSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_INGEST = YES ]; then SrsIngestSummaryColor="\${GREEN}"; fi
SrsHttpCallbackSummaryColor="\${YELLOW}{disabled} "; if [ $SRS_HTTP_CALLBACK = YES ]; then SrsHttpCallbackSummaryColor="\${GREEN}"; fi
... ... @@ -520,7 +520,7 @@ if [ $SRS_SSL = YES ]; then
else
echo -e "${YELLOW}warning: without rtmp complex handshake support, donot support h264/aac to adobe flash player${BLACK}"
fi
if [ $SRS_FFMPEG = YES ]; then
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo -e "${GREEN}transcode/mux/ingest tool FFMPEG is enabled${BLACK}"
else
echo -e "${YELLOW}warning: without transcode/mux/ingest tool FFMPEG support${BLACK}"
... ... @@ -613,7 +613,7 @@ if [ $SRS_NGINX = YES ]; then
echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
echo "\" http://$ip \" rtmp players(OSMF/JWPlayer)"
fi
if [ $SRS_FFMPEG = YES ]; then
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo -e "\" ./objs/ffmpeg/bin/ffmpeg \" is used for live stream transcoding"
fi
if [ $SRS_HTTP_CALLBACK = YES ]; then
... ...
... ... @@ -289,7 +289,7 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir
// write ffmpeg info to log file.
log_file = _srs_config->get_ffmpeg_log_dir();
log_file += "/";
log_file += "encoder";
log_file += "ffmpeg-encoder";
log_file += "-";
log_file += req->vhost;
log_file += "-";
... ...
... ... @@ -39,7 +39,7 @@ using namespace std;
#include <srs_app_pithy_print.hpp>
#include <srs_protocol_rtmp_stack.hpp>
#ifdef SRS_FFMPEG
#ifdef SRS_FFMPEG_STUB
#define SRS_ENCODER_COPY "copy"
#define SRS_ENCODER_NO_VIDEO "vn"
... ...
... ... @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core.hpp>
#ifdef SRS_FFMPEG
#ifdef SRS_FFMPEG_STUB
#include <string>
#include <vector>
... ...
... ... @@ -246,7 +246,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
// write ffmpeg info to log file.
log_file = _srs_config->get_ffmpeg_log_dir();
log_file += "/";
log_file += "ingest";
log_file += "ffmpeg-ingest";
log_file += "-";
log_file += vhost->arg0();
log_file += "-";
... ... @@ -305,6 +305,7 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
std::string vcodec = _srs_config->get_engine_vcodec(engine);
std::string acodec = _srs_config->get_engine_acodec(engine);
// whatever the engine config, use copy as default.
if (!engine || !_srs_config->get_engine_enabled(engine) || vcodec.empty() || acodec.empty()) {
if ((ret = ffmpeg->initialize_copy()) != ERROR_SUCCESS) {
return ret;
... ...
... ... @@ -163,6 +163,9 @@ SrsServer::SrsServer()
srs_assert(_srs_config);
_srs_config->subscribe(this);
// donot new object in constructor,
// for some global instance is not ready now,
// new these objects in initialize instead.
#ifdef SRS_HTTP_API
http_api_handler = NULL;
#endif
... ...