Skip to content

Commit dfec546

Browse files
Make it not require untether
1 parent d282f6b commit dfec546

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,12 @@ if(NOT ZM_NO_CURL)
343343
endif()
344344
endif()
345345

346-
include_directories(/opt/untether/speedai/include/)
347-
list(APPEND ZM_BIN_LIBS untether)
348-
link_directories(/opt/untether/speedai/lib)
346+
find_file(HAVE_UNTETHER_H uai_untether.h)
347+
if(HAVE_UNTETHER_H)
348+
include_directories(/opt/untether/speedai/include/)
349+
list(APPEND ZM_BIN_LIBS untether)
350+
link_directories(/opt/untether/speedai/lib)
351+
endif()
349352

350353
list(APPEND ZM_BIN_LIBS xcoder)
351354

src/zm_monitor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ Monitor::Monitor() :
332332
Janus_Manager(nullptr),
333333
Amcrest_Manager(nullptr),
334334
onvif(nullptr),
335+
#ifdef HAVE_UNTETHER_H
335336
speedai(nullptr),
337+
#endif
336338
quadra(nullptr),
337339
quadra_yolo(nullptr),
338340
red_val(0),
@@ -1214,12 +1216,14 @@ bool Monitor::connect() {
12141216
Debug(1, "Not Starting ONVIF");
12151217
} //End ONVIF Setup
12161218

1219+
#ifdef HAVE_UNTETHER_H
12171220
if (objectdetection == OBJECT_DETECTION_SPEEDAI) {
12181221
speedai = new SpeedAI(this);
12191222
if (!speedai->setup()) {
12201223
delete speedai;
12211224
}
12221225
}
1226+
#endif
12231227

12241228
#if MOSQUITTOPP_FOUND
12251229
if (mqtt_enabled) {
@@ -1323,7 +1327,9 @@ Monitor::~Monitor() {
13231327
analysis_it = nullptr;
13241328
decoder_it = nullptr;
13251329

1330+
#ifdef HAVE_UNTETHER_H
13261331
delete speedai;
1332+
#endif
13271333
delete storage;
13281334
delete linked_monitors;
13291335
linked_monitors = nullptr;
@@ -2162,13 +2168,15 @@ bool Monitor::Analyse() {
21622168
}
21632169
}
21642170

2171+
#ifdef HAVE_UNTETHER_H
21652172
if (speedai) {
21662173
if ((analysis_image == ANALYSISIMAGE_YCHANNEL) && packet->y_image) {
21672174
speedai->detect(*(packet->y_image));
21682175
} else {
21692176
speedai->detect(*(packet->y_image));
21702177
}
21712178
}
2179+
#endif
21722180

21732181
// Ready means that we have captured the warmup # of frames
21742182
if ((shared_data->analysing > ANALYSING_NONE) && Ready()) {

src/zm_monitor.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@
4747
#include <openssl/err.h>
4848
#endif
4949

50+
#ifdef HAVE_UNTETHER_H
5051
// Untether runtime API header
5152
#include "uai_untether.h"
53+
#endif
54+
5255
extern "C" {
5356
#include <ni_device_api.h>
5457
#include <ni_av_codec.h>
@@ -340,6 +343,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
340343
};
341344
protected:
342345

346+
#ifdef HAVE_UNTETHER_H
343347
class SpeedAI {
344348
private:
345349
Monitor *monitor;
@@ -356,6 +360,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
356360
bool setup();
357361
bool detect(const Image &image);
358362
};
363+
#endif
359364

360365
class Quadra {
361366
public:
@@ -712,7 +717,9 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
712717
JanusManager *Janus_Manager;
713718
AmcrestAPI *Amcrest_Manager;
714719
ONVIF *onvif;
720+
#ifdef HAVE_UNTETHER_H
715721
SpeedAI *speedai;
722+
#endif
716723
Quadra *quadra;
717724
Quadra_Yolo *quadra_yolo;
718725

src/zm_monitor_speedai.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1818
//
1919

20+
#ifdef HAVE_UNTETHER_H
2021
#include "zm_monitor.h"
2122
// Untether runtime API header
2223
#include "uai_untether.h"
@@ -101,3 +102,4 @@ bool Monitor::SpeedAI::detect(const Image &image) {
101102
}
102103
return true;
103104
}
105+
#endif

zoneminder-config.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#cmakedefine SOLARIS 1
99
#cmakedefine HAVE_LINUX_VIDEODEV2_H 1
1010
#cmakedefine HAVE_EXECINFO_H 1
11+
#cmakedefine HAVE_UNTETHER_H 1
1112
#cmakedefine HAVE_UCONTEXT_H 1
1213
#cmakedefine HAVE_SYS_SENDFILE_H 1
1314
#cmakedefine HAVE_SYS_SYSCALL_H 1

0 commit comments

Comments
 (0)