mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
add srs ingest flv/rtmp base on srs-librtmp
This commit is contained in:
parent
038f907830
commit
608b28f223
4 changed files with 107 additions and 20 deletions
40
trunk/research/librtmp/Makefile
Executable file → Normal file
40
trunk/research/librtmp/Makefile
Executable file → Normal file
|
@ -5,15 +5,17 @@ GCC = gcc
|
|||
default: help
|
||||
|
||||
help:
|
||||
@echo "Usage: make <help>|<clean>|<srs_publish_nossl>|<srs_play_nossl>|<srs_publish_ssl>|<srs_play_ssl>"
|
||||
@echo "Usage: make <help>|<clean>|<srs_publish_nossl>|<srs_play_nossl>|<srs_publish_ssl>|<srs_play_ssl>|<srs_ingest_flv>|<srs_ingest_rtmp>"
|
||||
@echo " help display this help"
|
||||
@echo " clean cleanup build"
|
||||
@echo " ssl srs_publish_ssl, srs_play_ssl"
|
||||
@echo " nossl srs_publish_nossl, srs_play_nossl"
|
||||
@echo " nossl srs_publish_nossl, srs_play_nossl, srs_ingest_flv, srs_ingest_rtmp"
|
||||
@echo " srs_publish_nossl publish program using srs-librtmp, without ssl(simple handshake)"
|
||||
@echo " srs_play_nossl play program using srs-librtmp, without ssl(simple handshake)"
|
||||
@echo " srs_publish_ssl publish program using srs-librtmp, with ssl(complex handshake)"
|
||||
@echo " srs_play_ssl play program using srs-librtmp, with ssl(complex handshake)"
|
||||
@echo " srs_ingest_flv ingest flv file and publish to RTMP server. (simple handshake)"
|
||||
@echo " srs_ingest_rtmp ingest RTMP and publish to RTMP server. (simple handshake)"
|
||||
@echo "Remark: about simple/complex handshake, see: http://blog.csdn.net/win_lin/article/details/13006803"
|
||||
@echo "Remark: srs Makefile will auto invoke this by --with/without-ssl, "
|
||||
@echo " that is, if user specified ssl(by --with-ssl), srs will make this by 'make ssl'"
|
||||
|
@ -22,7 +24,7 @@ help:
|
|||
@echo "Remark: before make this sample, user must make the srs, with/without ssl"
|
||||
|
||||
clean:
|
||||
@rm -f srs_publish_nossl srs_play_nossl srs_publish_ssl srs_play_ssl
|
||||
@rm -f srs_publish_nossl srs_play_nossl srs_publish_ssl srs_play_ssl srs_ingest_flv srs_ingest_rtmp
|
||||
|
||||
# srs library root
|
||||
SRS_OBJS = ../../objs
|
||||
|
@ -34,32 +36,30 @@ SRS_LIBSSL_L = $(SRS_OBJS)/openssl/lib/libssl.a $(SRS_OBJS)/openssl/lib/libcrypt
|
|||
|
||||
# for x86/x64 platform
|
||||
ifeq ($(GCC), gcc)
|
||||
srs_publish_nossl: srs_publish.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) -g -O0 -lstdc++ -o srs_publish_nossl
|
||||
|
||||
srs_play_nossl: srs_play.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) -g -O0 -lstdc++ -o srs_play_nossl
|
||||
|
||||
srs_publish_ssl: srs_publish.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) -g -O0 -ldl -lstdc++ -o srs_publish_ssl
|
||||
|
||||
srs_play_ssl: srs_play.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) -g -O0 -ldl -lstdc++ -o srs_play_ssl
|
||||
EXTRA_CXX_FLAG = -g -O0 -ldl -lstdc++
|
||||
# for arm.
|
||||
else
|
||||
EXTRA_CXX_FLAG = -g -O0 -static -lstdc++
|
||||
endif
|
||||
|
||||
srs_publish_nossl: srs_publish.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) -g -O0 -static -lstdc++ -o srs_publish_nossl
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_publish_nossl
|
||||
|
||||
srs_play_nossl: srs_play.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) -g -O0 -static -lstdc++ -o srs_play_nossl
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_play_nossl
|
||||
|
||||
srs_ingest_flv: srs_ingest_flv.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_ingest_flv.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_ingest_flv
|
||||
|
||||
srs_ingest_rtmp: srs_ingest_rtmp.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L)
|
||||
$(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp
|
||||
|
||||
srs_publish_ssl: srs_publish.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) -g -O0 -static -ldl -lstdc++ -o srs_publish_ssl
|
||||
$(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_publish_ssl
|
||||
|
||||
srs_play_ssl: srs_play.c Makefile $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L)
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) -g -O0 -static -ldl -lstdc++ -o srs_play_ssl
|
||||
endif
|
||||
$(GCC) srs_play.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_play_ssl
|
||||
|
||||
# alias for publish/play with/without ssl
|
||||
ssl: srs_publish_ssl srs_play_ssl
|
||||
nossl: srs_publish_nossl srs_play_nossl
|
||||
nossl: srs_publish_nossl srs_play_nossl srs_ingest_flv srs_ingest_rtmp
|
||||
|
|
36
trunk/research/librtmp/srs_ingest_flv.c
Normal file
36
trunk/research/librtmp/srs_ingest_flv.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
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_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_flv
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../objs/include/srs_librtmp.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
49
trunk/research/librtmp/srs_ingest_rtmp.c
Normal file
49
trunk/research/librtmp/srs_ingest_rtmp.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
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_ingest_rtmp.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_rtmp
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../objs/include/srs_librtmp.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc <= 2) {
|
||||
printf("ingest RTMP and publish to RTMP server\n"
|
||||
"Usage: %s <in_rtmp_url> <out_rtmp_url>\n"
|
||||
" in_rtmp_url input rtmp url, ingest from this url.\n"
|
||||
" out_rtmp_url output rtmp url, publish to this url.\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("ingest RTMP and publish to RTMP server like edge.\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());
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -99,6 +99,8 @@ file
|
|||
..\utest\srs_utest_handshake.hpp,
|
||||
..\utest\srs_utest_handshake.cpp,
|
||||
research readonly separator,
|
||||
..\..\research\librtmp\srs_ingest_flv.c,
|
||||
..\..\research\librtmp\srs_ingest_rtmp.c,
|
||||
..\..\research\librtmp\srs_play.c,
|
||||
..\..\research\librtmp\srs_publish.c,
|
||||
..\..\research\hls\ts_info.cc;
|
||||
|
|
Loading…
Reference in a new issue