Misc: Merge ZM_HAS_V4L with ZM_HAS_V4L2
This commit is contained in:
parent
0ac060fb78
commit
6e96cbe14a
|
@ -527,15 +527,11 @@ if((NOT HAVE_LIBJWT) AND (NOT HAVE_LIBOPENSSL))
|
||||||
message(FATAL_ERROR "Using the jwt-cpp backend requires OpenSSL as crypto backend.")
|
message(FATAL_ERROR "Using the jwt-cpp backend requires OpenSSL as crypto backend.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Check for V4L header files and enable ZM_HAS_V4L, ZM_HAS_V4L2 accordingly
|
|
||||||
# Setting to zeros first is required because ZM uses #define for these
|
|
||||||
find_package(V4L2)
|
find_package(V4L2)
|
||||||
set(ZM_HAS_V4L 0)
|
|
||||||
set(ZM_HAS_V4L2 0)
|
|
||||||
if(TARGET V4L2::videodev2)
|
if(TARGET V4L2::videodev2)
|
||||||
set(ZM_HAS_V4L 1)
|
|
||||||
set(ZM_HAS_V4L2 1)
|
set(ZM_HAS_V4L2 1)
|
||||||
else()
|
else()
|
||||||
|
set(ZM_HAS_V4L2 0)
|
||||||
message(AUTHOR_WARNING "Video 4 Linux headers weren't found - Analog and USB camera support will not be available")
|
message(AUTHOR_WARNING "Video 4 Linux headers weren't found - Analog and USB camera support will not be available")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
|
|
||||||
/* Workaround for GNU/kFreeBSD and FreeBSD */
|
/* Workaround for GNU/kFreeBSD and FreeBSD */
|
||||||
#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
|
#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
|
||||||
|
@ -1483,4 +1483,4 @@ int LocalCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
|
||||||
int LocalCamera::PostCapture() {
|
int LocalCamera::PostCapture() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "zm_camera.h"
|
#include "zm_camera.h"
|
||||||
|
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
|
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
|
@ -126,6 +126,6 @@ public:
|
||||||
static bool GetCurrentSettings(const std::string &device, char *output, int version, bool verbose);
|
static bool GetCurrentSettings(const std::string &device, char *output, int version, bool verbose);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
|
|
||||||
#endif // ZM_LOCAL_CAMERA_H
|
#endif // ZM_LOCAL_CAMERA_H
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
#include "zm_utils.h"
|
#include "zm_utils.h"
|
||||||
#include "zm_zone.h"
|
#include "zm_zone.h"
|
||||||
|
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
#include "zm_local_camera.h"
|
#include "zm_local_camera.h"
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
|
|
||||||
#if HAVE_LIBVLC
|
#if HAVE_LIBVLC
|
||||||
#include "zm_libvlc_camera.h"
|
#include "zm_libvlc_camera.h"
|
||||||
|
@ -684,7 +684,7 @@ void Monitor::LoadCamera() {
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LOCAL: {
|
case LOCAL: {
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
int extras = (deinterlacing >> 24) & 0xff;
|
int extras = (deinterlacing >> 24) & 0xff;
|
||||||
|
|
||||||
camera = zm::make_unique<LocalCamera>(this,
|
camera = zm::make_unique<LocalCamera>(this,
|
||||||
|
@ -2416,7 +2416,7 @@ std::vector<std::shared_ptr<Monitor>> Monitor::LoadMonitors(const std::string &w
|
||||||
return monitors;
|
return monitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
std::vector<std::shared_ptr<Monitor>> Monitor::LoadLocalMonitors
|
std::vector<std::shared_ptr<Monitor>> Monitor::LoadLocalMonitors
|
||||||
(const char *device, Purpose purpose) {
|
(const char *device, Purpose purpose) {
|
||||||
|
|
||||||
|
@ -2428,7 +2428,7 @@ std::vector<std::shared_ptr<Monitor>> Monitor::LoadLocalMonitors
|
||||||
where += stringtf(" AND `ServerId`=%d", staticConfig.SERVER_ID);
|
where += stringtf(" AND `ServerId`=%d", staticConfig.SERVER_ID);
|
||||||
return LoadMonitors(where, purpose);
|
return LoadMonitors(where, purpose);
|
||||||
}
|
}
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Monitor>> Monitor::LoadRemoteMonitors
|
std::vector<std::shared_ptr<Monitor>> Monitor::LoadRemoteMonitors
|
||||||
(const char *protocol, const char *host, const char *port, const char *path, Purpose purpose) {
|
(const char *protocol, const char *host, const char *port, const char *path, Purpose purpose) {
|
||||||
|
@ -2947,14 +2947,14 @@ bool Monitor::DumpSettings(char *output, bool verbose) {
|
||||||
sprintf( output+strlen(output), "Id : %u\n", id );
|
sprintf( output+strlen(output), "Id : %u\n", id );
|
||||||
sprintf( output+strlen(output), "Name : %s\n", name.c_str() );
|
sprintf( output+strlen(output), "Name : %s\n", name.c_str() );
|
||||||
sprintf( output+strlen(output), "Type : %s\n", camera->IsLocal()?"Local":(camera->IsRemote()?"Remote":"File") );
|
sprintf( output+strlen(output), "Type : %s\n", camera->IsLocal()?"Local":(camera->IsRemote()?"Remote":"File") );
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
if ( camera->IsLocal() ) {
|
if ( camera->IsLocal() ) {
|
||||||
LocalCamera* cam = static_cast<LocalCamera*>(camera.get());
|
LocalCamera* cam = static_cast<LocalCamera*>(camera.get());
|
||||||
sprintf( output+strlen(output), "Device : %s\n", cam->Device().c_str() );
|
sprintf( output+strlen(output), "Device : %s\n", cam->Device().c_str() );
|
||||||
sprintf( output+strlen(output), "Channel : %d\n", cam->Channel() );
|
sprintf( output+strlen(output), "Channel : %d\n", cam->Channel() );
|
||||||
sprintf( output+strlen(output), "Standard : %d\n", cam->Standard() );
|
sprintf( output+strlen(output), "Standard : %d\n", cam->Standard() );
|
||||||
} else
|
} else
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
if ( camera->IsRemote() ) {
|
if ( camera->IsRemote() ) {
|
||||||
RemoteCamera* cam = static_cast<RemoteCamera*>(camera.get());
|
RemoteCamera* cam = static_cast<RemoteCamera*>(camera.get());
|
||||||
sprintf( output+strlen(output), "Protocol : %s\n", cam->Protocol().c_str() );
|
sprintf( output+strlen(output), "Protocol : %s\n", cam->Protocol().c_str() );
|
||||||
|
@ -2971,12 +2971,12 @@ bool Monitor::DumpSettings(char *output, bool verbose) {
|
||||||
}
|
}
|
||||||
sprintf( output+strlen(output), "Width : %u\n", camera->Width() );
|
sprintf( output+strlen(output), "Width : %u\n", camera->Width() );
|
||||||
sprintf( output+strlen(output), "Height : %u\n", camera->Height() );
|
sprintf( output+strlen(output), "Height : %u\n", camera->Height() );
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
if ( camera->IsLocal() ) {
|
if ( camera->IsLocal() ) {
|
||||||
LocalCamera* cam = static_cast<LocalCamera*>(camera.get());
|
LocalCamera* cam = static_cast<LocalCamera*>(camera.get());
|
||||||
sprintf( output+strlen(output), "Palette : %d\n", cam->Palette() );
|
sprintf( output+strlen(output), "Palette : %d\n", cam->Palette() );
|
||||||
}
|
}
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
sprintf(output+strlen(output), "Colours : %u\n", camera->Colours() );
|
sprintf(output+strlen(output), "Colours : %u\n", camera->Colours() );
|
||||||
sprintf(output+strlen(output), "Subpixel Order : %u\n", camera->SubpixelOrder() );
|
sprintf(output+strlen(output), "Subpixel Order : %u\n", camera->SubpixelOrder() );
|
||||||
sprintf(output+strlen(output), "Event Prefix : %s\n", event_prefix.c_str() );
|
sprintf(output+strlen(output), "Event Prefix : %s\n", event_prefix.c_str() );
|
||||||
|
|
|
@ -600,9 +600,9 @@ public:
|
||||||
StringVector GroupNames();
|
StringVector GroupNames();
|
||||||
|
|
||||||
static std::vector<std::shared_ptr<Monitor>> LoadMonitors(const std::string &sql, Purpose purpose); // Returns # of Monitors loaded, 0 on failure.
|
static std::vector<std::shared_ptr<Monitor>> LoadMonitors(const std::string &sql, Purpose purpose); // Returns # of Monitors loaded, 0 on failure.
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
static std::vector<std::shared_ptr<Monitor>> LoadLocalMonitors(const char *device, Purpose purpose);
|
static std::vector<std::shared_ptr<Monitor>> LoadLocalMonitors(const char *device, Purpose purpose);
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
static std::vector<std::shared_ptr<Monitor>> LoadRemoteMonitors(const char *protocol, const char *host, const char*port, const char*path, Purpose purpose);
|
static std::vector<std::shared_ptr<Monitor>> LoadRemoteMonitors(const char *protocol, const char *host, const char*port, const char*path, Purpose purpose);
|
||||||
static std::vector<std::shared_ptr<Monitor>> LoadFileMonitors(const char *file, Purpose purpose);
|
static std::vector<std::shared_ptr<Monitor>> LoadFileMonitors(const char *file, Purpose purpose);
|
||||||
static std::vector<std::shared_ptr<Monitor>> LoadFfmpegMonitors(const char *file, Purpose purpose);
|
static std::vector<std::shared_ptr<Monitor>> LoadFfmpegMonitors(const char *file, Purpose purpose);
|
||||||
|
|
|
@ -190,11 +190,11 @@ int main(int argc, char *argv[]) {
|
||||||
HwCapsDetect();
|
HwCapsDetect();
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Monitor>> monitors;
|
std::vector<std::shared_ptr<Monitor>> monitors;
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
if ( device[0] ) {
|
if ( device[0] ) {
|
||||||
monitors = Monitor::LoadLocalMonitors(device, Monitor::CAPTURE);
|
monitors = Monitor::LoadLocalMonitors(device, Monitor::CAPTURE);
|
||||||
} else
|
} else
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
if ( host[0] ) {
|
if ( host[0] ) {
|
||||||
if ( !port )
|
if ( !port )
|
||||||
port = "80";
|
port = "80";
|
||||||
|
|
14
src/zmu.cpp
14
src/zmu.cpp
|
@ -265,9 +265,9 @@ int main(int argc, char *argv[]) {
|
||||||
char *password = nullptr;
|
char *password = nullptr;
|
||||||
char *auth = nullptr;
|
char *auth = nullptr;
|
||||||
std::string jwt_token_str = "";
|
std::string jwt_token_str = "";
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
int v4lVersion = 2;
|
int v4lVersion = 2;
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
while (1) {
|
while (1) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
|
||||||
|
@ -379,11 +379,11 @@ int main(int argc, char *argv[]) {
|
||||||
case 'T':
|
case 'T':
|
||||||
jwt_token_str = std::string(optarg);
|
jwt_token_str = std::string(optarg);
|
||||||
break;
|
break;
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
case 'V':
|
case 'V':
|
||||||
v4lVersion = (atoi(optarg)==1)?1:2;
|
v4lVersion = (atoi(optarg)==1)?1:2;
|
||||||
break;
|
break;
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
Usage(0);
|
Usage(0);
|
||||||
|
@ -719,15 +719,15 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
} else { // non monitor functions
|
} else { // non monitor functions
|
||||||
if ( function & ZMU_QUERY ) {
|
if ( function & ZMU_QUERY ) {
|
||||||
#if ZM_HAS_V4L
|
#if ZM_HAS_V4L2
|
||||||
char vidString[0x10000] = "";
|
char vidString[0x10000] = "";
|
||||||
bool ok = LocalCamera::GetCurrentSettings(device, vidString, v4lVersion, verbose);
|
bool ok = LocalCamera::GetCurrentSettings(device, vidString, v4lVersion, verbose);
|
||||||
printf("%s", vidString);
|
printf("%s", vidString);
|
||||||
exit_zmu(ok ? 0 : -1);
|
exit_zmu(ok ? 0 : -1);
|
||||||
#else // ZM_HAS_V4L
|
#else // ZM_HAS_V4L2
|
||||||
Error("Video4linux is required for device querying");
|
Error("Video4linux is required for device querying");
|
||||||
exit_zmu(-1);
|
exit_zmu(-1);
|
||||||
#endif // ZM_HAS_V4L
|
#endif // ZM_HAS_V4L2
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( function & ZMU_LIST ) {
|
if ( function & ZMU_LIST ) {
|
||||||
|
|
|
@ -73,7 +73,6 @@ define('ZMU_PATH', ZM_PATH_BIN.'/zmu'); // Local path to the ZoneM
|
||||||
// If setup supports Video 4 Linux v2
|
// If setup supports Video 4 Linux v2
|
||||||
//
|
//
|
||||||
define('ZM_HAS_V4L2', '@ZM_HAS_V4L2@'); // V4L2 support enabled
|
define('ZM_HAS_V4L2', '@ZM_HAS_V4L2@'); // V4L2 support enabled
|
||||||
define('ZM_HAS_V4L', '@ZM_HAS_V4L@'); // V4L support enabled
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If ONVIF support has been built in
|
// If ONVIF support has been built in
|
||||||
|
|
|
@ -107,7 +107,7 @@ if ( !empty($_REQUEST['probe']) ) {
|
||||||
$monitor->$name = urldecode($value);
|
$monitor->$name = urldecode($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ZM_HAS_V4L && $monitor->Type() == 'Local' ) {
|
if ( ZM_HAS_V4L2 && $monitor->Type() == 'Local' ) {
|
||||||
$monitor->Palette( fourCC( substr($monitor->Palette,0,1), substr($monitor->Palette,1,1), substr($monitor->Palette,2,1), substr($monitor->Palette,3,1) ) );
|
$monitor->Palette( fourCC( substr($monitor->Palette,0,1), substr($monitor->Palette,1,1), substr($monitor->Palette,2,1), substr($monitor->Palette,3,1) ) );
|
||||||
if ( $monitor->Format() == 'PAL' )
|
if ( $monitor->Format() == 'PAL' )
|
||||||
$monitor->Format( 0x000000ff );
|
$monitor->Format( 0x000000ff );
|
||||||
|
@ -127,7 +127,7 @@ $sourceTypes = array(
|
||||||
'NVSocket' => translate('NVSocket'),
|
'NVSocket' => translate('NVSocket'),
|
||||||
'VNC' => translate('VNC'),
|
'VNC' => translate('VNC'),
|
||||||
);
|
);
|
||||||
if ( !ZM_HAS_V4L )
|
if ( !ZM_HAS_V4L2 )
|
||||||
unset($sourceTypes['Local']);
|
unset($sourceTypes['Local']);
|
||||||
|
|
||||||
$localMethods = array(
|
$localMethods = array(
|
||||||
|
@ -641,7 +641,7 @@ switch ( $name ) {
|
||||||
}
|
}
|
||||||
case 'source' :
|
case 'source' :
|
||||||
{
|
{
|
||||||
if ( ZM_HAS_V4L && $monitor->Type() == 'Local' ) {
|
if ( ZM_HAS_V4L2 && $monitor->Type() == 'Local' ) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-right pr-3"><?php echo translate('DevicePath') ?></td>
|
<td class="text-right pr-3"><?php echo translate('DevicePath') ?></td>
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
|
|
||||||
/* Few ZM options that are needed by the source code */
|
/* Few ZM options that are needed by the source code */
|
||||||
#cmakedefine ZM_MEM_MAPPED 1
|
#cmakedefine ZM_MEM_MAPPED 1
|
||||||
#cmakedefine ZM_HAS_V4L 1
|
|
||||||
#cmakedefine ZM_HAS_V4L2 1
|
#cmakedefine ZM_HAS_V4L2 1
|
||||||
|
|
||||||
/* Its safe to assume that signal return type is void. This is a fix for zm_signal.h */
|
/* Its safe to assume that signal return type is void. This is a fix for zm_signal.h */
|
||||||
|
|
Loading…
Reference in New Issue