1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

srs-librtmp: add make ssl/nossl support for sample

This commit is contained in:
winlin 2014-03-02 11:31:31 +08:00
parent b7a62ba131
commit f24f27deb9
8 changed files with 282 additions and 20 deletions

49
trunk/research/librtmp/Makefile Normal file → Executable file
View file

@ -1,12 +1,47 @@
.PHONY: default clean
.PHONY: default clean help ssl nossl
default: srs_publish srs_play
default: help
help:
@echo "Usage: make <help>|<clean>|<srs_publish_nossl>|<srs_play_nossl>|<srs_publish_ssl>|<srs_play_ssl>"
@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 " 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 "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'"
@echo " that is, if user not use ssl(by --without-ssl), use 'make nossl'"
@echo " see: https://github.com/winlinvip/simple-rtmp-server/wiki/Build"
@echo "Remark: before make this sample, user must make the srs, with/without ssl"
clean:
@rm -f srs_publish srs_play
@rm -f srs_publish_nossl srs_play_nossl srs_publish_ssl srs_play_ssl
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
# srs library root
SRS_OBJS = ../../objs
# srs-librtmp for publish/play, built by srs.
SRS_LIBRTMP_I = $(SRS_OBJS)/include/srs_librtmp.h
SRS_LIBRTMP_L = $(SRS_OBJS)/lib/srs_librtmp.a
# openssl for complex handshake, built by srs.
SRS_LIBSSL_L = $(SRS_OBJS)/openssl/lib/libssl.a $(SRS_OBJS)/openssl/lib/libcrypto.a
srs_play: srs_play.c Makefile ../../objs/include/srs_librtmp.h ../../objs/lib/srs_librtmp.a
gcc srs_play.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_play
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
# alias for publish/play with/without ssl
ssl: srs_publish_ssl srs_play_ssl
nossl: srs_publish_nossl srs_play_nossl

View file

@ -35,9 +35,10 @@ 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());
rtmp = srs_rtmp_create("rtmp://127.0.0.1/live/livestream");
rtmp = srs_rtmp_create("rtmp://127.0.0.1:1935/live/show?vhost=__defaultVhost__/livestream");
if (srs_simple_handshake(rtmp) != 0) {
//if (srs_simple_handshake(rtmp) != 0) {
if (srs_complex_handshake(rtmp) != 0) {
printf("simple handshake failed.\n");
goto rtmp_destroy;
}

View file

@ -35,7 +35,7 @@ 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());
rtmp = srs_rtmp_create("rtmp://127.0.0.1/live/livestream");
rtmp = srs_rtmp_create("rtmp://127.0.0.1:1936/live/livestream");
if (srs_simple_handshake(rtmp) != 0) {
printf("simple handshake failed.\n");