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
@@ -1261,7 +1264,7 @@ enum opt {
12611264 OPT_MTU = 'M' ,
12621265 OPT_CONFORMANCE = 'K' ,
12631266
1264- OPT_ID = 0x100 ,
1267+ OPT_ID = 0x100 ,
12651268 OPT_ADDR ,
12661269 OPT_TS ,
12671270 OPT_VIDEO_PORT ,
@@ -1284,37 +1287,49 @@ 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
12891298static struct option options [] = {
1290- { "id" , required_argument , NULL , OPT_ID },
1291- { "addr" , required_argument , NULL , OPT_ADDR },
1292- { "ts" , no_argument , NULL , OPT_TS },
1293- { "video-port" , required_argument , NULL , OPT_VIDEO_PORT },
1294- { "audio-port" , required_argument , NULL , OPT_AUDIO_PORT },
1295- { "no-video" , no_argument , NULL , OPT_NO_VIDEO },
1296- { "no-audio" , no_argument , NULL , OPT_NO_AUDIO },
1297- { "no-color" , no_argument , NULL , OPT_NO_COLOR },
1298- { "rewrite-date" , no_argument , NULL , OPT_REWRITE_DATE },
1299- { "verbose" , no_argument , NULL , OPT_VERBOSE },
1300- { "seek" , required_argument , NULL , OPT_SEEK },
1301- { "sequence" , required_argument , NULL , OPT_SEQUENCE },
1302- { "bandwidth" , required_argument , NULL , OPT_BANDWIDTH },
1303- { "time-limit" , required_argument , NULL , OPT_TIME_LIMIT },
1304- { "rt-priority" , required_argument , NULL , OPT_RT_PRIORITY },
1305- { "syslog-tag" , required_argument , NULL , OPT_SYSLOG_TAG },
1306- { "mtu" , required_argument , NULL , OPT_MTU },
1307- { "udp" , no_argument , NULL , OPT_UDP },
1308- { "conformance" , required_argument , NULL , OPT_CONFORMANCE },
1309- { "no-stdin" , no_argument , NULL , OPT_NO_STDIN },
1310- { "dump" , required_argument , NULL , OPT_DUMP },
1311- { "help" , no_argument , NULL , OPT_HELP },
1312- { "mux-max-delay" , required_argument , NULL , OPT_MUX_MAX_DELAY },
1313- { "min-deviation" , required_argument , NULL , OPT_MIN_DEVIATION },
1314- { "delay" , required_argument , NULL , OPT_DELAY },
1315- { "quit-timeout" , required_argument , NULL , OPT_QUIT_TIMEOUT },
1316- { "user-agent" , required_argument , NULL , OPT_USER_AGENT },
1317- { 0 , 0 , 0 , 0 },
1299+ {"id" , required_argument , NULL , OPT_ID },
1300+ {"addr" , required_argument , NULL , OPT_ADDR },
1301+ {"ts" , no_argument , NULL , OPT_TS },
1302+ {"video-port" , required_argument , NULL , OPT_VIDEO_PORT },
1303+ {"audio-port" , required_argument , NULL , OPT_AUDIO_PORT },
1304+ {"no-video" , no_argument , NULL , OPT_NO_VIDEO },
1305+ {"no-audio" , no_argument , NULL , OPT_NO_AUDIO },
1306+ {"no-color" , no_argument , NULL , OPT_NO_COLOR },
1307+ {"rewrite-date" , no_argument , NULL , OPT_REWRITE_DATE },
1308+ {"verbose" , no_argument , NULL , OPT_VERBOSE },
1309+ {"seek" , required_argument , NULL , OPT_SEEK },
1310+ {"sequence" , required_argument , NULL , OPT_SEQUENCE },
1311+ {"bandwidth" , required_argument , NULL , OPT_BANDWIDTH },
1312+ {"time-limit" , required_argument , NULL , OPT_TIME_LIMIT },
1313+ {"rt-priority" , required_argument , NULL , OPT_RT_PRIORITY },
1314+ {"syslog-tag" , required_argument , NULL , OPT_SYSLOG_TAG },
1315+ {"mtu" , required_argument , NULL , OPT_MTU },
1316+ {"udp" , no_argument , NULL , OPT_UDP },
1317+ {"conformance" , required_argument , NULL , OPT_CONFORMANCE },
1318+ {"no-stdin" , no_argument , NULL , OPT_NO_STDIN },
1319+ {"dump" , required_argument , NULL , OPT_DUMP },
1320+ {"help" , no_argument , NULL , OPT_HELP },
1321+ {"mux-max-delay" , required_argument , NULL , OPT_MUX_MAX_DELAY },
1322+ {"min-deviation" , required_argument , NULL , OPT_MIN_DEVIATION },
1323+ {"delay" , required_argument , NULL , OPT_DELAY },
1324+ {"quit-timeout" , required_argument , NULL , OPT_QUIT_TIMEOUT },
1325+ {"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
1332+ {0 , 0 , 0 , 0 },
13181333};
13191334
13201335UBASE_FMT_PRINTF (2 , 3 )
@@ -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,20 @@ 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+ use_openssl = false;
1489+ break ;
1490+ #endif
1491+
1492+ #ifdef UPIPE_HAVE_OPENSSL_SSL_H
1493+ case OPT_USE_OPENSSL :
1494+ use_bearssl = false;
1495+ use_openssl = true;
1496+ break ;
1497+ #endif
14611498 }
14621499 }
14631500
@@ -1751,9 +1788,17 @@ int main(int argc, char **argv)
17511788 uprobe_init (& probe_src , catch_src , uprobe_use (main_probe ));
17521789 uprobe_release (main_probe );
17531790 main_probe = & probe_src ;
1791+
1792+ #ifdef UPIPE_HAVE_OPENSSL_SSL_H
1793+ if (use_openssl )
1794+ main_probe = uprobe_https_openssl_alloc (main_probe );
1795+ #endif
1796+
17541797#ifdef UPIPE_HAVE_BEARSSL_H
1755- main_probe = uprobe_https_bearssl_alloc (main_probe );
1798+ if (use_bearssl )
1799+ main_probe = uprobe_https_bearssl_alloc (main_probe );
17561800#endif
1801+
17571802 {
17581803 struct upipe_mgr * upipe_auto_src_mgr = upipe_auto_src_mgr_alloc ();
17591804 assert (upipe_auto_src_mgr );
0 commit comments