Skip to content

Commit 72e6469

Browse files
committed
examples/hls2rtp: add OpenSSL support
1 parent 4a8e82b commit 72e6469

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

examples/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ UPIPEOSX_LIBS = $(top_builddir)/lib/upipe-osx/libupipe_osx.la
1919
UPIPEDVBCSA_LIBS = $(top_builddir)/lib/upipe-dvbcsa/libupipe_dvbcsa.la
2020
UPIPEDVB_LIBS = $(top_builddir)/lib/upipe-dvb/libupipe_dvb.la
2121
UPIPEBEARSSL_LIBS = $(top_builddir)/lib/upipe-bearssl/libupipe_bearssl.la
22+
UPIPEOPENSSL_LIBS = $(top_builddir)/lib/upipe-openssl/libupipe_openssl.la
2223

2324
noinst_PROGRAMS =
2425

@@ -29,6 +30,9 @@ rist_tx_LDADD = $(LDADD) $(UPUMPEV_LIBS) $(UPIPEMODULES_LIBS) $(UPIPEFILTERS_LIB
2930
udpmulticat_LDADD = $(LDADD) $(UPUMPEV_LIBS) $(UPIPEMODULES_LIBS)
3031
multicatudp_LDADD = $(LDADD) $(UPUMPEV_LIBS) $(UPIPEMODULES_LIBS) $(UPIPEPTHREAD_LIBS) -lpthread
3132
hls2rtp_LDADD= $(LDADD) $(UPUMPEV_LIBS) $(UPIPEMODULES_LIBS) $(UPIPEFRAMERS_LIBS) $(UPIPETS_LIBS) $(UPIPEHLS_LIBS) $(UPIPEPTHREAD_LIBS) -lpthread
33+
if HAVE_OPENSSL
34+
hls2rtp_LDADD += $(UPIPEOPENSSL_LIBS)
35+
endif
3236
if HAVE_BEARSSL
3337
hls2rtp_LDADD += $(UPIPEBEARSSL_LIBS)
3438
endif

examples/hls2rtp.c

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
#include "upipe-pthread/uprobe_pthread_upump_mgr.h"
8282
#include "upipe-pthread/upipe_pthread_transfer.h"
8383
#include "upipe-pthread/umutex_pthread.h"
84+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
85+
#include "upipe-openssl/uprobe_https_openssl.h"
86+
#endif
8487
#ifdef UPIPE_HAVE_BEARSSL_H
8588
#include "upipe-bearssl/uprobe_https_bearssl.h"
8689
#endif
@@ -1284,6 +1287,12 @@ enum opt {
12841287
OPT_DELAY,
12851288
OPT_QUIT_TIMEOUT,
12861289
OPT_USER_AGENT,
1290+
#ifdef UPIPE_HAVE_BEARSSL_H
1291+
OPT_USE_BEARSSL,
1292+
#endif
1293+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
1294+
OPT_USE_OPENSSL,
1295+
#endif
12871296
};
12881297

12891298
static struct option options[] = {
@@ -1314,6 +1323,12 @@ static struct option options[] = {
13141323
{ "delay", required_argument, NULL, OPT_DELAY },
13151324
{ "quit-timeout", required_argument, NULL, OPT_QUIT_TIMEOUT },
13161325
{ "user-agent", required_argument, NULL, OPT_USER_AGENT },
1326+
#ifdef UPIPE_HAVE_BEARSSL_H
1327+
{ "use-bearssl", no_argument, NULL, OPT_USE_BEARSSL },
1328+
#endif
1329+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
1330+
{ "use-openssl", no_argument, NULL, OPT_USE_OPENSSL },
1331+
#endif
13171332
{ 0, 0, 0, 0 },
13181333
};
13191334

@@ -1354,6 +1369,14 @@ int main(int argc, char **argv)
13541369
enum upipe_ts_conformance conformance = UPIPE_TS_CONFORMANCE_AUTO;
13551370
bool no_stdin = false;
13561371

1372+
#ifdef UPIPE_HAVE_BEARSSL_H
1373+
bool use_bearssl = true;
1374+
#endif
1375+
1376+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
1377+
bool use_openssl = true;
1378+
#endif
1379+
13571380
/*
13581381
* parse options
13591382
*/
@@ -1458,6 +1481,24 @@ int main(int argc, char **argv)
14581481

14591482
case OPT_MISSING_ARG:
14601483
return usage(argv[0], "missing argument");
1484+
1485+
#ifdef UPIPE_HAVE_BEARSSL_H
1486+
case OPT_USE_BEARSSL:
1487+
use_bearssl = true;
1488+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
1489+
use_openssl = false;
1490+
#endif
1491+
break;
1492+
#endif
1493+
1494+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
1495+
case OPT_USE_OPENSSL:
1496+
use_openssl = true;
1497+
#ifdef UPIPE_HAVE_BEARSSL_H
1498+
use_bearssl = false;
1499+
#endif
1500+
break;
1501+
#endif
14611502
}
14621503
}
14631504

@@ -1751,9 +1792,17 @@ int main(int argc, char **argv)
17511792
uprobe_init(&probe_src, catch_src, uprobe_use(main_probe));
17521793
uprobe_release(main_probe);
17531794
main_probe = &probe_src;
1795+
1796+
#ifdef UPIPE_HAVE_OPENSSL_SSL_H
1797+
if (use_openssl)
1798+
main_probe = uprobe_https_openssl_alloc(main_probe);
1799+
#endif
1800+
17541801
#ifdef UPIPE_HAVE_BEARSSL_H
1755-
main_probe = uprobe_https_bearssl_alloc(main_probe);
1802+
if (use_bearssl)
1803+
main_probe = uprobe_https_bearssl_alloc(main_probe);
17561804
#endif
1805+
17571806
{
17581807
struct upipe_mgr *upipe_auto_src_mgr = upipe_auto_src_mgr_alloc();
17591808
assert(upipe_auto_src_mgr);

0 commit comments

Comments
 (0)