Merge ../ZoneMinder-kfir into kfir-proper
Conflicts: configure src/Makefile.am src/Makefile.in
This commit is contained in:
commit
7cf5475542
|
@ -193,6 +193,9 @@
|
|||
/* Define to 1 if you have the <pcre/pcre.h> header file. */
|
||||
#undef HAVE_PCRE_PCRE_H
|
||||
|
||||
/* Define to 1 if you have the `posix_memalign' function. */
|
||||
#undef HAVE_POSIX_MEMALIGN
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#undef HAVE_PTHREAD_H
|
||||
|
||||
|
@ -202,6 +205,9 @@
|
|||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the `sendfile' function. */
|
||||
#undef HAVE_SENDFILE
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
|
@ -305,6 +311,9 @@
|
|||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/sendfile.h> header file. */
|
||||
#undef HAVE_SYS_SENDFILE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/shm.h> header file. */
|
||||
#undef HAVE_SYS_SHM_H
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ AC_ARG_WITH(ffmpeg,
|
|||
)
|
||||
AC_SUBST(FFMPEG_PREFIX)
|
||||
FFMPEG_LIBS="-L${FFMPEG_PREFIX}/${LIB_ARCH}"
|
||||
FFMPEG_CFLAGS="-I${FFMPEG_PREFIX}/include"
|
||||
FFMPEG_CFLAGS="-I${FFMPEG_PREFIX}/include -D__STDC_CONSTANT_MACROS"
|
||||
AC_SUBST(FFMPEG_LIBS)
|
||||
AC_SUBST(FFMPEG_CFLAGS)
|
||||
|
||||
|
@ -246,7 +246,7 @@ AC_FUNC_STAT
|
|||
AC_FUNC_STRFTIME
|
||||
AC_FUNC_STRTOD
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday memmove memset mkdir munmap putenv select socket sqrt strcasecmp strchr strcspn strerror strncasecmp strrchr strsignal strspn strstr strtol strtoull])
|
||||
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday memmove memset mkdir munmap posix_memalign putenv select sendfile socket sqrt strcasecmp strchr strcspn strerror strncasecmp strrchr strsignal strspn strstr strtol strtoull])
|
||||
AC_CHECK_FUNCS([syscall sleep usleep ioctl ioctlsocket sigaction])
|
||||
|
||||
# Other programs
|
||||
|
@ -282,7 +282,7 @@ AC_CHECK_LIB(x264,x264_predict_16x16_init)
|
|||
AC_CHECK_LIB(avutil,av_malloc,,AC_MSG_WARN(libavutil.a may be required for MPEG streaming))
|
||||
# Don't bother to warn about this one
|
||||
AC_CHECK_LIB(avcore,av_image_copy,,)
|
||||
AC_CHECK_LIB(avcodec,avcodec_init,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
|
||||
AC_CHECK_LIB(avcodec,avcodec_open,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
|
||||
AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming))
|
||||
AC_CHECK_LIB(avdevice,avdevice_register_all,,AC_MSG_WARN(libavdevice.a may be required for MPEG streaming))
|
||||
AC_CHECK_LIB(swscale,sws_scale,,,-lswscale)
|
||||
|
@ -293,7 +293,7 @@ AC_CHECK_LIB(z,compress,,)
|
|||
AC_FUNC_ALLOCA
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([fcntl.h limits.h memory.h stddef.h stdlib.h string.h strings.h sys/param.h sys/time.h syslog.h unistd.h values.h])
|
||||
AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h sys/ioctl.h sys/socket.h sys/un.h glob.h])
|
||||
AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h sys/ioctl.h sys/socket.h sys/un.h glob.h sys/sendfile.h])
|
||||
AC_CHECK_HEADERS(execinfo.h,,,)
|
||||
AC_CHECK_HEADERS(syscall.h,,,)
|
||||
AC_CHECK_HEADERS(pthread.h,,,)
|
||||
|
|
|
@ -329,8 +329,10 @@ CREATE TABLE `Monitors` (
|
|||
`Path` varchar(255) NOT NULL default '',
|
||||
`Width` smallint(5) unsigned NOT NULL default '0',
|
||||
`Height` smallint(5) unsigned NOT NULL default '0',
|
||||
`Colours` tinyint(3) unsigned NOT NULL default '1',
|
||||
`Palette` int(10) unsigned NOT NULL default '0',
|
||||
`Orientation` enum('0','90','180','270','hori','vert') NOT NULL default '0',
|
||||
`Deinterlacing` int(10) unsigned NOT NULL default '0',
|
||||
`Brightness` mediumint(7) NOT NULL default '-1',
|
||||
`Contrast` mediumint(7) NOT NULL default '-1',
|
||||
`Hue` mediumint(7) NOT NULL default '-1',
|
||||
|
|
|
@ -308,18 +308,10 @@ our @options =
|
|||
category => "config",
|
||||
},
|
||||
{
|
||||
name => "ZM_LOCAL_BGR_INVERT",
|
||||
name => "ZM_CPU_EXTENSIONS",
|
||||
default => "yes",
|
||||
description => "Invert BGR colours to RGB",
|
||||
help => "Some cameras or video cards capture images in BGR (Blue-Green-Red) order even when the palette says RGB. If you see strange colours casts on your images then it may be worth trying this option to see if that corrects the issue. Note this option will apply only to local cameras and not those over a network.",
|
||||
type => $types{boolean},
|
||||
category => "config",
|
||||
},
|
||||
{
|
||||
name => "ZM_Y_IMAGE_DELTAS",
|
||||
default => "yes",
|
||||
description => "Calculate image differences using Y channel",
|
||||
help => "When ZoneMinder tries to establish the differences between two colour images it generates a greyscale 'delta' image between the two sets of images. In order to do this it determines the differences found between the different RGB colour components and calculates a greyscale value representing this. If this option is set then a calculation will be made to convert each pixel of the image into a brightness value (Y from YUV) and then find the difference between the two. If this option is not set then the resulting difference is determined as the average of the differences of each colour which is a simple calculation. Using the Y value is likely to be more accurate and is up to 15% faster. Only switch this option off if Y based deltas do not work as well for you as RGB ones.",
|
||||
description => "Use advanced CPU extensions to increase performance",
|
||||
help => "When advanced processor extensions such as SSE2 or SSSE3 are available, ZoneMinder can use them, which should increase performance and reduce system load. Enabling this option on processors that do not support the advanced processors extensions used by ZoneMinder is harmless and will have no effect.",
|
||||
type => $types{boolean},
|
||||
category => "config",
|
||||
},
|
||||
|
@ -327,7 +319,7 @@ our @options =
|
|||
name => "ZM_FAST_IMAGE_BLENDS",
|
||||
default => "yes",
|
||||
description => "Use a fast algorithm to blend the reference image",
|
||||
help => "In most modes of operation ZoneMinder needs to blend the captured image with the stored reference image to update it for the next image. The reference blend percentage specified for the monitor controls how much the new image affects the reference image. There are two methods that are available for this. If this option is set then a basic calculation is applied which though fast and fairly accurate can (due to rounding) mean that the actual range of pixel values in the reference image may be reduced from that in the captured image, e.g. a pixel may only be able to achieve a maximum of 250 for example while the captured image is consistently at 255. If you also have a small minimum pixel difference threshold this can cause multiple bogus alarms. The alternative is to switch this option off which stores an additional set of temporary values which eliminate any significant rounding errors. This is more accurate though is somewhat slower and should not really be necessary unless you find problems with the default method.",
|
||||
help => "To detect alarms ZoneMinder needs to blend the captured image with the stored reference image to update it for comparison with the next image. The reference blend percentage specified for the monitor controls how much the new image affects the reference image. There are two methods that are available for this. If this option is set then fast calculation which does not use any multiplication or division is used. This calculation is extremely fast, however it limits the possible blend percentages to 50%, 25%, 12.5%, 6.25%, 3.25% and 1.5%. Any other blend percentage will be rounded to the nearest possible one. The alternative is to switch this option off and use standard blending instead, which is slower.",
|
||||
type => $types{boolean},
|
||||
category => "config",
|
||||
},
|
||||
|
@ -745,14 +737,6 @@ our @options =
|
|||
type => $types{boolean},
|
||||
category => "config",
|
||||
},
|
||||
{
|
||||
name => "ZM_V4L2_CAPTURE_FIELDS",
|
||||
default => "0",
|
||||
description => "Control interlacing and field handling in V4L2",
|
||||
help => "The Video4Linux2 standard allows finer control of interlacing than the previous version. This option allows finer control over how the system handle interlacing in general for V4L2 devices. The possible values are described at http://v4l2spec.bytesex.org/spec/x6386.htm#V4L2-FIELD and the default value of 0 allows the driver to decide for itself. This will often result in interlaced images.~~The most useful other values are 2 (top, or 3 for bottom) which prevent interlacing by only capturing one field (or set of scanlines), or 7 which captures both fields but in separate images. This latter option can increase frame rates but with the possibility that alternate frames are one scanline offset from each other so may appear to move up and down slightly.~~Note that preventing interlacing when capturing large image sizes may not actually increase the information content as often the maximum size of single field, non-interlaced, images may be fairly small and the image is just enlarged in the application.",
|
||||
type => $types{integer},
|
||||
category => "config",
|
||||
},
|
||||
{
|
||||
name => "ZM_SIGNAL_CHECK_POINTS",
|
||||
default => "10",
|
||||
|
|
|
@ -134,33 +134,38 @@ our $mem_seq = 0;
|
|||
our $mem_data =
|
||||
{
|
||||
"shared_data" => { "type"=>"SharedData", "seq"=>$mem_seq++, "contents"=> {
|
||||
"size" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"valid" => { "type"=>"bool1", "seq"=>$mem_seq++ },
|
||||
"active" => { "type"=>"bool1", "seq"=>$mem_seq++ },
|
||||
"signal" => { "type"=>"bool1", "seq"=>$mem_seq++ },
|
||||
"state" => { "type"=>"enum", "seq"=>$mem_seq++},
|
||||
"last_write_index" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"last_read_index" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"last_write_time" => { "type"=>"time_t", "seq"=>$mem_seq++ },
|
||||
"last_read_time" => { "type"=>"time_t", "seq"=>$mem_seq++ },
|
||||
"last_event" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"action" => { "type"=>"enum", "seq"=>$mem_seq++ },
|
||||
"brightness" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"hue" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"colour" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"contrast" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"alarm_x" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"alarm_y" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"control_state" => { "type"=>"uchar[256]", "seq"=>$mem_seq++ },
|
||||
"size" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"last_write_index" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"last_read_index" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"state" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"last_event" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"action" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"brightness" => { "type"=>"int32", "seq"=>$mem_seq++ },
|
||||
"hue" => { "type"=>"int32", "seq"=>$mem_seq++ },
|
||||
"colour" => { "type"=>"int32", "seq"=>$mem_seq++ },
|
||||
"contrast" => { "type"=>"int32", "seq"=>$mem_seq++ },
|
||||
"alarm_x" => { "type"=>"int32", "seq"=>$mem_seq++ },
|
||||
"alarm_y" => { "type"=>"int32", "seq"=>$mem_seq++ },
|
||||
"valid" => { "type"=>"uint8", "seq"=>$mem_seq++ },
|
||||
"active" => { "type"=>"uint8", "seq"=>$mem_seq++ },
|
||||
"signal" => { "type"=>"uint8", "seq"=>$mem_seq++ },
|
||||
"format" => { "type"=>"uint8", "seq"=>$mem_seq++ },
|
||||
"imagesize" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"epadding1" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"epadding2" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"last_write_time" => { "type"=>"time_t64", "seq"=>$mem_seq++ },
|
||||
"last_read_time" => { "type"=>"time_t64", "seq"=>$mem_seq++ },
|
||||
"control_state" => { "type"=>"uint8[256]", "seq"=>$mem_seq++ },
|
||||
}
|
||||
},
|
||||
"trigger_data" => { "type"=>"TriggerData", "seq"=>$mem_seq++, "contents"=> {
|
||||
"size" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"trigger_state" => { "type"=>"enum", "seq"=>$mem_seq++ },
|
||||
"trigger_score" => { "type"=>"int", "seq"=>$mem_seq++ },
|
||||
"trigger_cause" => { "type"=>"char[32]", "seq"=>$mem_seq++ },
|
||||
"trigger_text" => { "type"=>"char[256]", "seq"=>$mem_seq++ },
|
||||
"trigger_showtext" => { "type"=>"char[256]", "seq"=>$mem_seq++ },
|
||||
"size" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"trigger_state" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"trigger_score" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"padding" => { "type"=>"uint32", "seq"=>$mem_seq++ },
|
||||
"trigger_cause" => { "type"=>"int8[32]", "seq"=>$mem_seq++ },
|
||||
"trigger_text" => { "type"=>"int8[256]", "seq"=>$mem_seq++ },
|
||||
"trigger_showtext" => { "type"=>"int8[256]", "seq"=>$mem_seq++ },
|
||||
}
|
||||
},
|
||||
"end" => { "seq"=>$mem_seq++, "size"=> 0 }
|
||||
|
@ -176,7 +181,7 @@ sub zmMemInit
|
|||
foreach my $section_data ( sort { $a->{seq} <=> $b->{seq} } values( %$mem_data ) )
|
||||
{
|
||||
$section_data->{offset} = $offset;
|
||||
$section_data->{align} = 4;
|
||||
$section_data->{align} = 0;
|
||||
|
||||
if ( $section_data->{align} > 1 )
|
||||
{
|
||||
|
@ -188,23 +193,27 @@ sub zmMemInit
|
|||
}
|
||||
foreach my $member_data ( sort { $a->{seq} <=> $b->{seq} } values( %{$section_data->{contents}} ) )
|
||||
{
|
||||
if ( $member_data->{type} eq "long" || $member_data->{type} eq "time_t" || $member_data->{type} eq "size_t" || $member_data->{type} eq "bool8" )
|
||||
if ( $member_data->{type} eq "long" || $member_data->{type} eq "ulong" || $member_data->{type} eq "size_t")
|
||||
{
|
||||
$member_data->{size} = $member_data->{align} = $native;
|
||||
}
|
||||
elsif ( $member_data->{type} eq "int" || $member_data->{type} eq "enum" || $member_data->{type} eq "bool4" )
|
||||
elsif( $member_data->{type} eq "int64" || $member_data->{type} eq "uint64" || $member_data->{type} eq "time_t64")
|
||||
{
|
||||
$member_data->{size} = $member_data->{align} = 8;
|
||||
}
|
||||
elsif ( $member_data->{type} eq "int32" || $member_data->{type} eq "uint32" || $member_data->{type} eq "bool4" )
|
||||
{
|
||||
$member_data->{size} = $member_data->{align} = 4;
|
||||
}
|
||||
elsif ( $member_data->{type} eq "short" )
|
||||
elsif ($member_data->{type} eq "int16" || $member_data->{type} eq "uint16")
|
||||
{
|
||||
$member_data->{size} = $member_data->{align} = 2;
|
||||
}
|
||||
elsif ( $member_data->{type} =~ "/^u?char$/" || $member_data->{type} eq "bool1" )
|
||||
elsif ( $member_data->{type} eq "int8" || $member_data->{type} eq "uint8" || $member_data->{type} eq "bool1" )
|
||||
{
|
||||
$member_data->{size} = $member_data->{align} = 1;
|
||||
}
|
||||
elsif ( $member_data->{type} =~ /^u?char\[(\d+)\]$/ )
|
||||
elsif ( $member_data->{type} =~ /^u?int8\[(\d+)\]$/ )
|
||||
{
|
||||
$member_data->{size} = $1;
|
||||
$member_data->{align} = 1;
|
||||
|
@ -304,31 +313,53 @@ sub zmMemRead( $$;$ )
|
|||
return( undef );
|
||||
}
|
||||
my $value;
|
||||
if ( $type eq "long" || $type eq "time_t" || $type eq "size_t" || $type eq "bool8" )
|
||||
if ( $type eq "long" )
|
||||
{
|
||||
( $value ) = unpack( "l!", $data );
|
||||
}
|
||||
elsif ( $type eq "int" || $type eq "enum" || $type eq "bool4" )
|
||||
elsif ( $type eq "ulong" || $type eq "size_t" )
|
||||
{
|
||||
( $value ) = unpack( "L!", $data );
|
||||
}
|
||||
elsif ( $type eq "int64" || $type eq "time_t64" )
|
||||
{
|
||||
# The "q" type is only available on 64bit platforms, so use native.
|
||||
( $value ) = unpack( "l!", $data );
|
||||
}
|
||||
elsif ( $type eq "uint64" )
|
||||
{
|
||||
# The "q" type is only available on 64bit platforms, so use native.
|
||||
( $value ) = unpack( "L!", $data );
|
||||
}
|
||||
elsif ( $type eq "int32" )
|
||||
{
|
||||
( $value ) = unpack( "l", $data );
|
||||
}
|
||||
elsif ( $type eq "short" )
|
||||
elsif ( $type eq "uint32" || $type eq "bool4" )
|
||||
{
|
||||
( $value ) = unpack( "L", $data );
|
||||
}
|
||||
elsif ( $type eq "int16" )
|
||||
{
|
||||
( $value ) = unpack( "s", $data );
|
||||
}
|
||||
elsif ( $type eq "char" || $type eq "bool1" )
|
||||
elsif ( $type eq "uint16" )
|
||||
{
|
||||
( $value ) = unpack( "S", $data );
|
||||
}
|
||||
elsif ( $type eq "int8" )
|
||||
{
|
||||
( $value ) = unpack( "c", $data );
|
||||
}
|
||||
elsif ( $type eq "uchar" )
|
||||
elsif ( $type eq "uint8" || $type eq "bool1" )
|
||||
{
|
||||
( $value ) = unpack( "C", $data );
|
||||
}
|
||||
elsif ( $type =~ /^char\[\d+\]$/ )
|
||||
elsif ( $type =~ /^int8\[\d+\]$/ )
|
||||
{
|
||||
( $value ) = unpack( "Z".$size, $data );
|
||||
}
|
||||
elsif ( $type =~ /^uchar\[\d+\]$/ )
|
||||
elsif ( $type =~ /^uint8\[\d+\]$/ )
|
||||
{
|
||||
( $value ) = unpack( "C".$size, $data );
|
||||
}
|
||||
|
@ -382,34 +413,56 @@ sub zmMemWrite( $$;$ )
|
|||
my $size = $mem_data->{$section}->{contents}->{$element}->{size};
|
||||
|
||||
my $data;
|
||||
if ( $type eq "long" || $type eq "time_t" || $type eq "size_t" || $type eq "bool8" )
|
||||
if ( $type eq "long" )
|
||||
{
|
||||
$data = pack( "l!", $value );
|
||||
}
|
||||
elsif ( $type eq "int" || $type eq "enum" || $type eq "bool4" )
|
||||
elsif ( $type eq "ulong" || $type eq "size_t" )
|
||||
{
|
||||
$data = pack( "L!", $value );
|
||||
}
|
||||
elsif ( $type eq "int64" || $type eq "time_t64" )
|
||||
{
|
||||
# The "q" type is only available on 64bit platforms, so use native.
|
||||
$data = pack( "l!", $value );
|
||||
}
|
||||
elsif ( $type eq "uint64" )
|
||||
{
|
||||
# The "q" type is only available on 64bit platforms, so use native.
|
||||
$data = pack( "L!", $value );
|
||||
}
|
||||
elsif ( $type eq "int32" )
|
||||
{
|
||||
$data = pack( "l", $value );
|
||||
}
|
||||
elsif ( $type eq "short" )
|
||||
elsif ( $type eq "uint32" || $type eq "bool4" )
|
||||
{
|
||||
$data = pack( "L", $value );
|
||||
}
|
||||
elsif ( $type eq "int16" )
|
||||
{
|
||||
$data = pack( "s", $value );
|
||||
}
|
||||
elsif ( $type eq "char" || $type eq "bool1" )
|
||||
elsif ( $type eq "uint16" )
|
||||
{
|
||||
$data = pack( "S", $value );
|
||||
}
|
||||
elsif ( $type eq "int8" )
|
||||
{
|
||||
$data = pack( "c", $value );
|
||||
}
|
||||
elsif ( $type eq "uchar" )
|
||||
elsif ( $type eq "uint8" || $type eq "bool1" )
|
||||
{
|
||||
$data = pack( "C", $value );
|
||||
}
|
||||
elsif ( $type =~ /^char\[\d+\]$/ )
|
||||
elsif ( $type =~ /^int8\[\d+\]$/ )
|
||||
{
|
||||
$data = pack( "Z".$size, $value );
|
||||
}
|
||||
elsif ( $type =~ /^uchar\[\d+\]$/ )
|
||||
}
|
||||
elsif ( $type =~ /^uint8\[\d+\]$/ )
|
||||
{
|
||||
$data = pack( "C".$size, $value );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Fatal( "Unexpected type '".$type."' found for '".$field."'" );
|
||||
|
|
735
src/Makefile.in
735
src/Makefile.in
|
@ -1,735 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
bin_PROGRAMS = zmc$(EXEEXT) zma$(EXEEXT) zmu$(EXEEXT) zms$(EXEEXT) \
|
||||
zmf$(EXEEXT) zmstreamer$(EXEEXT) zmfix$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/zm_config.h.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = zm_config.h
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am__objects_1 = zm_box.$(OBJEXT) zm_buffer.$(OBJEXT) \
|
||||
zm_camera.$(OBJEXT) zm_comms.$(OBJEXT) zm_config.$(OBJEXT) \
|
||||
zm_coord.$(OBJEXT) zm.$(OBJEXT) zm_db.$(OBJEXT) \
|
||||
zm_logger.$(OBJEXT) zm_event.$(OBJEXT) zm_exception.$(OBJEXT) \
|
||||
zm_file_camera.$(OBJEXT) zm_ffmpeg_camera.$(OBJEXT) \
|
||||
zm_image.$(OBJEXT) zm_jpeg.$(OBJEXT) zm_local_camera.$(OBJEXT) \
|
||||
zm_monitor.$(OBJEXT) zm_ffmpeg.$(OBJEXT) zm_mpeg.$(OBJEXT) \
|
||||
zm_poly.$(OBJEXT) zm_regexp.$(OBJEXT) \
|
||||
zm_remote_camera.$(OBJEXT) zm_remote_camera_http.$(OBJEXT) \
|
||||
zm_remote_camera_rtsp.$(OBJEXT) zm_rtp.$(OBJEXT) \
|
||||
zm_rtp_ctrl.$(OBJEXT) zm_rtp_data.$(OBJEXT) \
|
||||
zm_rtp_source.$(OBJEXT) zm_rtsp.$(OBJEXT) zm_sdp.$(OBJEXT) \
|
||||
zm_signal.$(OBJEXT) zm_stream.$(OBJEXT) zm_thread.$(OBJEXT) \
|
||||
zm_time.$(OBJEXT) zm_timer.$(OBJEXT) zm_user.$(OBJEXT) \
|
||||
zm_utils.$(OBJEXT) zm_zone.$(OBJEXT)
|
||||
am_zma_OBJECTS = zma.$(OBJEXT) $(am__objects_1)
|
||||
zma_OBJECTS = $(am_zma_OBJECTS)
|
||||
zma_LDADD = $(LDADD)
|
||||
am_zmc_OBJECTS = zmc.$(OBJEXT) $(am__objects_1)
|
||||
zmc_OBJECTS = $(am_zmc_OBJECTS)
|
||||
zmc_LDADD = $(LDADD)
|
||||
am_zmf_OBJECTS = zmf.$(OBJEXT) $(am__objects_1)
|
||||
zmf_OBJECTS = $(am_zmf_OBJECTS)
|
||||
zmf_LDADD = $(LDADD)
|
||||
am_zmfix_OBJECTS = zmfix.$(OBJEXT) zm_config.$(OBJEXT) \
|
||||
zm_regexp.$(OBJEXT) zm_logger.$(OBJEXT) zm_utils.$(OBJEXT) \
|
||||
zm_db.$(OBJEXT) zm.$(OBJEXT)
|
||||
zmfix_OBJECTS = $(am_zmfix_OBJECTS)
|
||||
zmfix_LDADD = $(LDADD)
|
||||
am_zms_OBJECTS = zms.$(OBJEXT) $(am__objects_1)
|
||||
zms_OBJECTS = $(am_zms_OBJECTS)
|
||||
zms_LDADD = $(LDADD)
|
||||
am_zmstreamer_OBJECTS = zmstreamer.$(OBJEXT) $(am__objects_1)
|
||||
zmstreamer_OBJECTS = $(am_zmstreamer_OBJECTS)
|
||||
zmstreamer_LDADD = $(LDADD)
|
||||
am_zmu_OBJECTS = zmu.$(OBJEXT) $(am__objects_1)
|
||||
zmu_OBJECTS = $(am_zmu_OBJECTS)
|
||||
zmu_LDADD = $(LDADD)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
SOURCES = $(zma_SOURCES) $(zmc_SOURCES) $(zmf_SOURCES) \
|
||||
$(zmfix_SOURCES) $(zms_SOURCES) $(zmstreamer_SOURCES) \
|
||||
$(zmu_SOURCES)
|
||||
DIST_SOURCES = $(zma_SOURCES) $(zmc_SOURCES) $(zmf_SOURCES) \
|
||||
$(zmfix_SOURCES) $(zms_SOURCES) $(zmstreamer_SOURCES) \
|
||||
$(zmu_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BINDIR = @BINDIR@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CGI_PREFIX = @CGI_PREFIX@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
ENABLE_MMAP = @ENABLE_MMAP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRA_LIBS = @EXTRA_LIBS@
|
||||
EXTRA_PERL_LIB = @EXTRA_PERL_LIB@
|
||||
FFMPEG_CFLAGS = @FFMPEG_CFLAGS@
|
||||
FFMPEG_LIBS = @FFMPEG_LIBS@
|
||||
FFMPEG_PREFIX = @FFMPEG_PREFIX@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBDIR = @LIBDIR@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIB_ARCH = @LIB_ARCH@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MYSQL_CFLAGS = @MYSQL_CFLAGS@
|
||||
MYSQL_LIBS = @MYSQL_LIBS@
|
||||
MYSQL_PREFIX = @MYSQL_PREFIX@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPT_FFMPEG = @OPT_FFMPEG@
|
||||
OPT_NETPBM = @OPT_NETPBM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_BUILD = @PATH_BUILD@
|
||||
PATH_FFMPEG = @PATH_FFMPEG@
|
||||
PATH_NETPBM = @PATH_NETPBM@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PERL_MM_PARMS = @PERL_MM_PARMS@
|
||||
POW_LIB = @POW_LIB@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
SYSCONFDIR = @SYSCONFDIR@
|
||||
TIME_BUILD = @TIME_BUILD@
|
||||
VERSION = @VERSION@
|
||||
WEB_GROUP = @WEB_GROUP@
|
||||
WEB_HOST = @WEB_HOST@
|
||||
WEB_PREFIX = @WEB_PREFIX@
|
||||
WEB_USER = @WEB_USER@
|
||||
ZM_CONFIG = @ZM_CONFIG@
|
||||
ZM_DB_HOST = @ZM_DB_HOST@
|
||||
ZM_DB_NAME = @ZM_DB_NAME@
|
||||
ZM_DB_PASS = @ZM_DB_PASS@
|
||||
ZM_DB_USER = @ZM_DB_USER@
|
||||
ZM_HAS_GNUTLS = @ZM_HAS_GNUTLS@
|
||||
ZM_HAS_GNUTLS_OPENSSL = @ZM_HAS_GNUTLS_OPENSSL@
|
||||
ZM_HAS_V4L = @ZM_HAS_V4L@
|
||||
ZM_HAS_V4L1 = @ZM_HAS_V4L1@
|
||||
ZM_HAS_V4L2 = @ZM_HAS_V4L2@
|
||||
ZM_LOGDIR = @ZM_LOGDIR@
|
||||
ZM_MYSQL_ENGINE = @ZM_MYSQL_ENGINE@
|
||||
ZM_PCRE = @ZM_PCRE@
|
||||
ZM_PID = @ZM_PID@
|
||||
ZM_RUNDIR = @ZM_RUNDIR@
|
||||
ZM_SSL_LIB = @ZM_SSL_LIB@
|
||||
ZM_TMPDIR = @ZM_TMPDIR@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = gnu
|
||||
AM_CPPFLAGS = @MYSQL_CFLAGS@ @FFMPEG_CFLAGS@ -Wall -Wno-sign-compare
|
||||
#AM_CXXFLAGS = -frepo
|
||||
CLEANFILES = *.rpo
|
||||
|
||||
# This should be set to your CGI directory
|
||||
cgidir = @CGI_PREFIX@
|
||||
# And these to the user and group of your webserver
|
||||
webuser = @WEB_USER@
|
||||
webgroup = @WEB_GROUP@
|
||||
zm_SOURCES = \
|
||||
zm_box.cpp \
|
||||
zm_buffer.cpp \
|
||||
zm_camera.cpp \
|
||||
zm_comms.cpp \
|
||||
zm_config.cpp \
|
||||
zm_coord.cpp \
|
||||
zm.cpp \
|
||||
zm_db.cpp \
|
||||
zm_logger.cpp \
|
||||
zm_event.cpp \
|
||||
zm_exception.cpp \
|
||||
zm_file_camera.cpp \
|
||||
zm_ffmpeg_camera.cpp \
|
||||
zm_image.cpp \
|
||||
zm_jpeg.cpp \
|
||||
zm_local_camera.cpp \
|
||||
zm_monitor.cpp \
|
||||
zm_ffmpeg.cpp \
|
||||
zm_mpeg.cpp \
|
||||
zm_poly.cpp \
|
||||
zm_regexp.cpp \
|
||||
zm_remote_camera.cpp \
|
||||
zm_remote_camera_http.cpp \
|
||||
zm_remote_camera_rtsp.cpp \
|
||||
zm_rtp.cpp \
|
||||
zm_rtp_ctrl.cpp \
|
||||
zm_rtp_data.cpp \
|
||||
zm_rtp_source.cpp \
|
||||
zm_rtsp.cpp \
|
||||
zm_sdp.cpp \
|
||||
zm_signal.cpp \
|
||||
zm_stream.cpp \
|
||||
zm_thread.cpp \
|
||||
zm_time.cpp \
|
||||
zm_timer.cpp \
|
||||
zm_user.cpp \
|
||||
zm_utils.cpp \
|
||||
zm_zone.cpp
|
||||
|
||||
zmc_SOURCES = zmc.cpp $(zm_SOURCES)
|
||||
zma_SOURCES = zma.cpp $(zm_SOURCES)
|
||||
zms_SOURCES = zms.cpp $(zm_SOURCES)
|
||||
zmu_SOURCES = zmu.cpp $(zm_SOURCES)
|
||||
zmf_SOURCES = zmf.cpp $(zm_SOURCES)
|
||||
zmstreamer_SOURCES = zmstreamer.cpp $(zm_SOURCES)
|
||||
zmfix_SOURCES = zmfix.cpp zm_config.cpp zm_regexp.cpp zm_logger.cpp zm_utils.cpp zm_db.cpp zm.cpp
|
||||
noinst_HEADERS = \
|
||||
jinclude.h \
|
||||
zm_box.h \
|
||||
zm_buffer.h \
|
||||
zm_camera.h \
|
||||
zm_comms.h \
|
||||
zm_config_defines.h \
|
||||
zm_config.h \
|
||||
zm_coord.h \
|
||||
zm_db.h \
|
||||
zm_logger.h \
|
||||
zm_event.h \
|
||||
zm_exception.h \
|
||||
zmf.h \
|
||||
zm_file_camera.h \
|
||||
zm_ffmpeg_camera.h \
|
||||
zm_font.h \
|
||||
zm_font.h \
|
||||
zm.h \
|
||||
zm_image.h \
|
||||
zm_jpeg.h \
|
||||
zm_local_camera.h \
|
||||
zm_mem_utils.h \
|
||||
zm_monitor.h \
|
||||
zm_ffmpeg.h \
|
||||
zm_mpeg.h \
|
||||
zm_poly.h \
|
||||
zm_regexp.h \
|
||||
zm_remote_camera.h \
|
||||
zm_remote_camera_http.h \
|
||||
zm_remote_camera_rtsp.h \
|
||||
zm_rgb.h \
|
||||
zm_rtp_ctrl.h \
|
||||
zm_rtp_data.h \
|
||||
zm_rtp.h \
|
||||
zm_rtp_source.h \
|
||||
zm_rtsp.h \
|
||||
zm_sdp.h \
|
||||
zm_signal.h \
|
||||
zm_stream.h \
|
||||
zm_thread.h \
|
||||
zm_time.h \
|
||||
zm_timer.h \
|
||||
zm_user.h \
|
||||
zm_utils.h \
|
||||
zm_zone.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
zm_config.h.in \
|
||||
zm_threaddata.cpp
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
zm_config.h: $(top_builddir)/config.status $(srcdir)/zm_config.h.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
zma$(EXEEXT): $(zma_OBJECTS) $(zma_DEPENDENCIES)
|
||||
@rm -f zma$(EXEEXT)
|
||||
$(CXXLINK) $(zma_OBJECTS) $(zma_LDADD) $(LIBS)
|
||||
zmc$(EXEEXT): $(zmc_OBJECTS) $(zmc_DEPENDENCIES)
|
||||
@rm -f zmc$(EXEEXT)
|
||||
$(CXXLINK) $(zmc_OBJECTS) $(zmc_LDADD) $(LIBS)
|
||||
zmf$(EXEEXT): $(zmf_OBJECTS) $(zmf_DEPENDENCIES)
|
||||
@rm -f zmf$(EXEEXT)
|
||||
$(CXXLINK) $(zmf_OBJECTS) $(zmf_LDADD) $(LIBS)
|
||||
zmfix$(EXEEXT): $(zmfix_OBJECTS) $(zmfix_DEPENDENCIES)
|
||||
@rm -f zmfix$(EXEEXT)
|
||||
$(CXXLINK) $(zmfix_OBJECTS) $(zmfix_LDADD) $(LIBS)
|
||||
zms$(EXEEXT): $(zms_OBJECTS) $(zms_DEPENDENCIES)
|
||||
@rm -f zms$(EXEEXT)
|
||||
$(CXXLINK) $(zms_OBJECTS) $(zms_LDADD) $(LIBS)
|
||||
zmstreamer$(EXEEXT): $(zmstreamer_OBJECTS) $(zmstreamer_DEPENDENCIES)
|
||||
@rm -f zmstreamer$(EXEEXT)
|
||||
$(CXXLINK) $(zmstreamer_OBJECTS) $(zmstreamer_LDADD) $(LIBS)
|
||||
zmu$(EXEEXT): $(zmu_OBJECTS) $(zmu_DEPENDENCIES)
|
||||
@rm -f zmu$(EXEEXT)
|
||||
$(CXXLINK) $(zmu_OBJECTS) $(zmu_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_box.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_buffer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_camera.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_comms.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_config.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_coord.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_db.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_event.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_exception.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_ffmpeg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_ffmpeg_camera.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_file_camera.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_image.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_jpeg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_local_camera.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_logger.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_monitor.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_mpeg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_poly.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_regexp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_remote_camera.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_remote_camera_http.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_remote_camera_rtsp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_rtp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_rtp_ctrl.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_rtp_data.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_rtp_source.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_rtsp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_sdp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_signal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_stream.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_thread.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_time.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_timer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_user.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_utils.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_zone.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zma.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmfix.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zms.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmstreamer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmu.Po@am__quote@
|
||||
|
||||
.cpp.o:
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cpp.obj:
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
|
||||
.MAKE: install-am install-exec-am install-strip uninstall-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic ctags dist-hook distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-exec-hook install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-hook
|
||||
|
||||
|
||||
dist-hook:
|
||||
@( rm $(distdir)/zm_config.h )
|
||||
|
||||
# Yes, you are correct. This is a HACK!
|
||||
install-exec-hook:
|
||||
( cd $(DESTDIR)@bindir@; mkdir -p $(DESTDIR)$(cgidir); mv zms $(DESTDIR)$(cgidir) )
|
||||
( cd $(DESTDIR)$(cgidir); chown $(webuser):$(webgroup) zms; ln -f zms nph-zms )
|
||||
( cd $(DESTDIR)@bindir@; chmod u+s zmfix )
|
||||
|
||||
uninstall-hook:
|
||||
( cd $(DESTDIR)$(cgidir); rm -f zms nph-zms )
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -20,19 +20,30 @@
|
|||
#include "zm.h"
|
||||
#include "zm_camera.h"
|
||||
|
||||
Camera::Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
Camera::Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_colours, int p_subpixelorder, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
id( p_id ),
|
||||
type( p_type ),
|
||||
width( p_width),
|
||||
height( p_height ),
|
||||
colours( p_colours ),
|
||||
subpixelorder( p_subpixelorder ),
|
||||
brightness( p_brightness ),
|
||||
hue( p_hue ),
|
||||
colour( p_colour ),
|
||||
contrast( p_contrast ),
|
||||
capture( p_capture )
|
||||
{
|
||||
pixels = width * height * colours;
|
||||
pixels = width * height;
|
||||
imagesize = pixels * colours;
|
||||
|
||||
Debug(2,"New camera id: %d width: %d height: %d colours: %d subpixelorder: %d capture: %d",id,width,height,colours,subpixelorder,capture);
|
||||
|
||||
/* Because many loops are unrolled and work on 16 colours/time or 4 pixels/time, we have to meet requirements */
|
||||
if((colours == ZM_COLOUR_GRAY8 || colours == ZM_COLOUR_RGB32) && (imagesize % 16) != 0) {
|
||||
Fatal("Image size is not multiples of 16");
|
||||
} else if(colours == ZM_COLOUR_RGB24 && ((imagesize % 16) != 0 || (imagesize % 12) != 0)) {
|
||||
Fatal("Image size is not multiples of 12 and 16");
|
||||
}
|
||||
}
|
||||
|
||||
Camera::~Camera()
|
||||
|
|
|
@ -39,7 +39,9 @@ protected:
|
|||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int colours;
|
||||
unsigned int subpixelorder;
|
||||
unsigned int pixels;
|
||||
unsigned int imagesize;
|
||||
int brightness;
|
||||
int hue;
|
||||
int colour;
|
||||
|
@ -47,7 +49,7 @@ protected:
|
|||
bool capture;
|
||||
|
||||
public:
|
||||
Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_colours, int p_subpixelorder, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
virtual ~Camera();
|
||||
|
||||
int getId() const { return( id ); }
|
||||
|
@ -59,7 +61,9 @@ public:
|
|||
unsigned int Width() const { return( width ); }
|
||||
unsigned int Height() const { return( height ); }
|
||||
unsigned int Colours() const { return( colours ); }
|
||||
unsigned int ImageSize() const { return( pixels ); }
|
||||
unsigned int SubpixelOrder() const { return( subpixelorder ); }
|
||||
unsigned int Pixels() const { return( pixels ); }
|
||||
unsigned int ImageSize() const { return( imagesize ); }
|
||||
|
||||
virtual int Brightness( int/*p_brightness*/=-1 ) { return( -1 ); }
|
||||
virtual int Hue( int/*p_hue*/=-1 ) { return( -1 ); }
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define ZM_MAX_IMAGE_WIDTH 2048 // The largest image we imagine ever handling
|
||||
#define ZM_MAX_IMAGE_HEIGHT 1536 // The largest image we imagine ever handling
|
||||
#define ZM_MAX_IMAGE_COLOURS 3 // The largest image we imagine ever handling
|
||||
#define ZM_MAX_IMAGE_COLOURS 4 // The largest image we imagine ever handling
|
||||
#define ZM_MAX_IMAGE_DIM (ZM_MAX_IMAGE_WIDTH*ZM_MAX_IMAGE_HEIGHT)
|
||||
#define ZM_MAX_IMAGE_SIZE (ZM_MAX_IMAGE_DIM*ZM_MAX_IMAGE_COLOURS)
|
||||
|
||||
|
|
|
@ -27,201 +27,199 @@
|
|||
#define ZM_PATH_CAMBOZOLA 23
|
||||
#define ZM_RELOAD_CAMBOZOLA 24
|
||||
#define ZM_TIMESTAMP_ON_CAPTURE 25
|
||||
#define ZM_LOCAL_BGR_INVERT 26
|
||||
#define ZM_Y_IMAGE_DELTAS 27
|
||||
#define ZM_FAST_IMAGE_BLENDS 28
|
||||
#define ZM_OPT_ADAPTIVE_SKIP 29
|
||||
#define ZM_BLEND_ALARMED_IMAGES 30
|
||||
#define ZM_MAX_SUSPEND_TIME 31
|
||||
#define ZM_OPT_REMOTE_CAMERAS 32
|
||||
#define ZM_NETCAM_REGEXPS 33
|
||||
#define ZM_HTTP_VERSION 34
|
||||
#define ZM_HTTP_UA 35
|
||||
#define ZM_HTTP_TIMEOUT 36
|
||||
#define ZM_MIN_RTP_PORT 37
|
||||
#define ZM_MAX_RTP_PORT 38
|
||||
#define ZM_OPT_FFMPEG 39
|
||||
#define ZM_PATH_FFMPEG 40
|
||||
#define ZM_FFMPEG_INPUT_OPTIONS 41
|
||||
#define ZM_FFMPEG_OUTPUT_OPTIONS 42
|
||||
#define ZM_FFMPEG_FORMATS 43
|
||||
#define ZM_LOG_LEVEL_SYSLOG 44
|
||||
#define ZM_LOG_LEVEL_FILE 45
|
||||
#define ZM_LOG_LEVEL_WEBLOG 46
|
||||
#define ZM_LOG_LEVEL_DATABASE 47
|
||||
#define ZM_LOG_DATABASE_LIMIT 48
|
||||
#define ZM_LOG_DEBUG 49
|
||||
#define ZM_LOG_DEBUG_TARGET 50
|
||||
#define ZM_LOG_DEBUG_LEVEL 51
|
||||
#define ZM_LOG_DEBUG_FILE 52
|
||||
#define ZM_LOG_CHECK_PERIOD 53
|
||||
#define ZM_LOG_ALERT_WAR_COUNT 54
|
||||
#define ZM_LOG_ALERT_ERR_COUNT 55
|
||||
#define ZM_LOG_ALERT_FAT_COUNT 56
|
||||
#define ZM_LOG_ALARM_WAR_COUNT 57
|
||||
#define ZM_LOG_ALARM_ERR_COUNT 58
|
||||
#define ZM_LOG_ALARM_FAT_COUNT 59
|
||||
#define ZM_RECORD_EVENT_STATS 60
|
||||
#define ZM_RECORD_DIAG_IMAGES 61
|
||||
#define ZM_DUMP_CORES 62
|
||||
#define ZM_PATH_MAP 63
|
||||
#define ZM_PATH_SOCKS 64
|
||||
#define ZM_PATH_LOGS 65
|
||||
#define ZM_PATH_SWAP 66
|
||||
#define ZM_WEB_TITLE_PREFIX 67
|
||||
#define ZM_WEB_RESIZE_CONSOLE 68
|
||||
#define ZM_WEB_POPUP_ON_ALARM 69
|
||||
#define ZM_OPT_X10 70
|
||||
#define ZM_X10_DEVICE 71
|
||||
#define ZM_X10_HOUSE_CODE 72
|
||||
#define ZM_X10_DB_RELOAD_INTERVAL 73
|
||||
#define ZM_WEB_SOUND_ON_ALARM 74
|
||||
#define ZM_WEB_ALARM_SOUND 75
|
||||
#define ZM_WEB_COMPACT_MONTAGE 76
|
||||
#define ZM_OPT_FAST_DELETE 77
|
||||
#define ZM_STRICT_VIDEO_CONFIG 78
|
||||
#define ZM_V4L2_CAPTURE_FIELDS 79
|
||||
#define ZM_SIGNAL_CHECK_POINTS 80
|
||||
#define ZM_V4L_MULTI_BUFFER 81
|
||||
#define ZM_CAPTURES_PER_FRAME 82
|
||||
#define ZM_FILTER_RELOAD_DELAY 83
|
||||
#define ZM_FILTER_EXECUTE_INTERVAL 84
|
||||
#define ZM_OPT_UPLOAD 85
|
||||
#define ZM_UPLOAD_ARCH_FORMAT 86
|
||||
#define ZM_UPLOAD_ARCH_COMPRESS 87
|
||||
#define ZM_UPLOAD_ARCH_ANALYSE 88
|
||||
#define ZM_UPLOAD_PROTOCOL 89
|
||||
#define ZM_UPLOAD_FTP_HOST 90
|
||||
#define ZM_UPLOAD_HOST 91
|
||||
#define ZM_UPLOAD_PORT 92
|
||||
#define ZM_UPLOAD_FTP_USER 93
|
||||
#define ZM_UPLOAD_USER 94
|
||||
#define ZM_UPLOAD_FTP_PASS 95
|
||||
#define ZM_UPLOAD_PASS 96
|
||||
#define ZM_UPLOAD_FTP_LOC_DIR 97
|
||||
#define ZM_UPLOAD_LOC_DIR 98
|
||||
#define ZM_UPLOAD_FTP_REM_DIR 99
|
||||
#define ZM_UPLOAD_REM_DIR 100
|
||||
#define ZM_UPLOAD_FTP_TIMEOUT 101
|
||||
#define ZM_UPLOAD_TIMEOUT 102
|
||||
#define ZM_UPLOAD_FTP_PASSIVE 103
|
||||
#define ZM_UPLOAD_FTP_DEBUG 104
|
||||
#define ZM_UPLOAD_DEBUG 105
|
||||
#define ZM_OPT_EMAIL 106
|
||||
#define ZM_EMAIL_ADDRESS 107
|
||||
#define ZM_EMAIL_TEXT 108
|
||||
#define ZM_EMAIL_SUBJECT 109
|
||||
#define ZM_EMAIL_BODY 110
|
||||
#define ZM_OPT_MESSAGE 111
|
||||
#define ZM_MESSAGE_ADDRESS 112
|
||||
#define ZM_MESSAGE_TEXT 113
|
||||
#define ZM_MESSAGE_SUBJECT 114
|
||||
#define ZM_MESSAGE_BODY 115
|
||||
#define ZM_NEW_MAIL_MODULES 116
|
||||
#define ZM_EMAIL_HOST 117
|
||||
#define ZM_FROM_EMAIL 118
|
||||
#define ZM_URL 119
|
||||
#define ZM_MAX_RESTART_DELAY 120
|
||||
#define ZM_WATCH_CHECK_INTERVAL 121
|
||||
#define ZM_WATCH_MAX_DELAY 122
|
||||
#define ZM_RUN_AUDIT 123
|
||||
#define ZM_AUDIT_CHECK_INTERVAL 124
|
||||
#define ZM_FORCED_ALARM_SCORE 125
|
||||
#define ZM_BULK_FRAME_INTERVAL 126
|
||||
#define ZM_EVENT_CLOSE_MODE 127
|
||||
#define ZM_FORCE_CLOSE_EVENTS 128
|
||||
#define ZM_CREATE_ANALYSIS_IMAGES 129
|
||||
#define ZM_WEIGHTED_ALARM_CENTRES 130
|
||||
#define ZM_EVENT_IMAGE_DIGITS 131
|
||||
#define ZM_DEFAULT_ASPECT_RATIO 132
|
||||
#define ZM_USER_SELF_EDIT 133
|
||||
#define ZM_OPT_FRAME_SERVER 134
|
||||
#define ZM_FRAME_SOCKET_SIZE 135
|
||||
#define ZM_OPT_CONTROL 136
|
||||
#define ZM_OPT_TRIGGERS 137
|
||||
#define ZM_CHECK_FOR_UPDATES 138
|
||||
#define ZM_UPDATE_CHECK_PROXY 139
|
||||
#define ZM_SHM_KEY 140
|
||||
#define ZM_WEB_REFRESH_METHOD 141
|
||||
#define ZM_WEB_EVENT_SORT_FIELD 142
|
||||
#define ZM_WEB_EVENT_SORT_ORDER 143
|
||||
#define ZM_WEB_EVENTS_PER_PAGE 144
|
||||
#define ZM_WEB_LIST_THUMBS 145
|
||||
#define ZM_WEB_LIST_THUMB_WIDTH 146
|
||||
#define ZM_WEB_LIST_THUMB_HEIGHT 147
|
||||
#define ZM_WEB_USE_OBJECT_TAGS 148
|
||||
#define ZM_WEB_H_REFRESH_MAIN 149
|
||||
#define ZM_WEB_H_REFRESH_CYCLE 150
|
||||
#define ZM_WEB_H_REFRESH_IMAGE 151
|
||||
#define ZM_WEB_H_REFRESH_STATUS 152
|
||||
#define ZM_WEB_H_REFRESH_EVENTS 153
|
||||
#define ZM_WEB_H_CAN_STREAM 154
|
||||
#define ZM_WEB_H_STREAM_METHOD 155
|
||||
#define ZM_WEB_H_DEFAULT_SCALE 156
|
||||
#define ZM_WEB_H_DEFAULT_RATE 157
|
||||
#define ZM_WEB_H_VIDEO_BITRATE 158
|
||||
#define ZM_WEB_H_VIDEO_MAXFPS 159
|
||||
#define ZM_WEB_H_SCALE_THUMBS 160
|
||||
#define ZM_WEB_H_EVENTS_VIEW 161
|
||||
#define ZM_WEB_H_SHOW_PROGRESS 162
|
||||
#define ZM_WEB_H_AJAX_TIMEOUT 163
|
||||
#define ZM_WEB_M_REFRESH_MAIN 164
|
||||
#define ZM_WEB_M_REFRESH_CYCLE 165
|
||||
#define ZM_WEB_M_REFRESH_IMAGE 166
|
||||
#define ZM_WEB_M_REFRESH_STATUS 167
|
||||
#define ZM_WEB_M_REFRESH_EVENTS 168
|
||||
#define ZM_WEB_M_CAN_STREAM 169
|
||||
#define ZM_WEB_M_STREAM_METHOD 170
|
||||
#define ZM_WEB_M_DEFAULT_SCALE 171
|
||||
#define ZM_WEB_M_DEFAULT_RATE 172
|
||||
#define ZM_WEB_M_VIDEO_BITRATE 173
|
||||
#define ZM_WEB_M_VIDEO_MAXFPS 174
|
||||
#define ZM_WEB_M_SCALE_THUMBS 175
|
||||
#define ZM_WEB_M_EVENTS_VIEW 176
|
||||
#define ZM_WEB_M_SHOW_PROGRESS 177
|
||||
#define ZM_WEB_M_AJAX_TIMEOUT 178
|
||||
#define ZM_WEB_L_REFRESH_MAIN 179
|
||||
#define ZM_WEB_L_REFRESH_CYCLE 180
|
||||
#define ZM_WEB_L_REFRESH_IMAGE 181
|
||||
#define ZM_WEB_L_REFRESH_STATUS 182
|
||||
#define ZM_WEB_L_REFRESH_EVENTS 183
|
||||
#define ZM_WEB_L_CAN_STREAM 184
|
||||
#define ZM_WEB_L_STREAM_METHOD 185
|
||||
#define ZM_WEB_L_DEFAULT_SCALE 186
|
||||
#define ZM_WEB_L_DEFAULT_RATE 187
|
||||
#define ZM_WEB_L_VIDEO_BITRATE 188
|
||||
#define ZM_WEB_L_VIDEO_MAXFPS 189
|
||||
#define ZM_WEB_L_SCALE_THUMBS 190
|
||||
#define ZM_WEB_L_EVENTS_VIEW 191
|
||||
#define ZM_WEB_L_SHOW_PROGRESS 192
|
||||
#define ZM_WEB_L_AJAX_TIMEOUT 193
|
||||
#define ZM_WEB_P_CAN_STREAM 194
|
||||
#define ZM_WEB_P_STREAM_METHOD 195
|
||||
#define ZM_WEB_P_DEFAULT_SCALE 196
|
||||
#define ZM_WEB_P_DEFAULT_RATE 197
|
||||
#define ZM_WEB_P_VIDEO_BITRATE 198
|
||||
#define ZM_WEB_P_VIDEO_MAXFPS 199
|
||||
#define ZM_WEB_P_SCALE_THUMBS 200
|
||||
#define ZM_WEB_P_AJAX_TIMEOUT 201
|
||||
#define ZM_DYN_LAST_VERSION 202
|
||||
#define ZM_DYN_CURR_VERSION 203
|
||||
#define ZM_DYN_DB_VERSION 204
|
||||
#define ZM_DYN_LAST_CHECK 205
|
||||
#define ZM_DYN_NEXT_REMINDER 206
|
||||
#define ZM_DYN_DONATE_REMINDER_TIME 207
|
||||
#define ZM_DYN_SHOW_DONATE_REMINDER 208
|
||||
#define ZM_EYEZM_DEBUG 209
|
||||
#define ZM_EYEZM_LOG_TO_FILE 210
|
||||
#define ZM_EYEZM_LOG_FILE 211
|
||||
#define ZM_EYEZM_EVENT_VCODEC 212
|
||||
#define ZM_EYEZM_FEED_VCODEC 213
|
||||
#define ZM_EYEZM_H264_DEFAULT_BR 214
|
||||
#define ZM_EYEZM_H264_DEFAULT_EVBR 215
|
||||
#define ZM_EYEZM_H264_TIMEOUT 216
|
||||
#define ZM_EYEZM_SEG_DURATION 217
|
||||
#define ZM_CPU_EXTENSIONS 26
|
||||
#define ZM_FAST_IMAGE_BLENDS 27
|
||||
#define ZM_OPT_ADAPTIVE_SKIP 28
|
||||
#define ZM_BLEND_ALARMED_IMAGES 29
|
||||
#define ZM_MAX_SUSPEND_TIME 30
|
||||
#define ZM_OPT_REMOTE_CAMERAS 31
|
||||
#define ZM_NETCAM_REGEXPS 32
|
||||
#define ZM_HTTP_VERSION 33
|
||||
#define ZM_HTTP_UA 34
|
||||
#define ZM_HTTP_TIMEOUT 35
|
||||
#define ZM_MIN_RTP_PORT 36
|
||||
#define ZM_MAX_RTP_PORT 37
|
||||
#define ZM_OPT_FFMPEG 38
|
||||
#define ZM_PATH_FFMPEG 39
|
||||
#define ZM_FFMPEG_INPUT_OPTIONS 40
|
||||
#define ZM_FFMPEG_OUTPUT_OPTIONS 41
|
||||
#define ZM_FFMPEG_FORMATS 42
|
||||
#define ZM_LOG_LEVEL_SYSLOG 43
|
||||
#define ZM_LOG_LEVEL_FILE 44
|
||||
#define ZM_LOG_LEVEL_WEBLOG 45
|
||||
#define ZM_LOG_LEVEL_DATABASE 46
|
||||
#define ZM_LOG_DATABASE_LIMIT 47
|
||||
#define ZM_LOG_DEBUG 48
|
||||
#define ZM_LOG_DEBUG_TARGET 49
|
||||
#define ZM_LOG_DEBUG_LEVEL 50
|
||||
#define ZM_LOG_DEBUG_FILE 51
|
||||
#define ZM_LOG_CHECK_PERIOD 52
|
||||
#define ZM_LOG_ALERT_WAR_COUNT 53
|
||||
#define ZM_LOG_ALERT_ERR_COUNT 54
|
||||
#define ZM_LOG_ALERT_FAT_COUNT 55
|
||||
#define ZM_LOG_ALARM_WAR_COUNT 56
|
||||
#define ZM_LOG_ALARM_ERR_COUNT 57
|
||||
#define ZM_LOG_ALARM_FAT_COUNT 58
|
||||
#define ZM_RECORD_EVENT_STATS 59
|
||||
#define ZM_RECORD_DIAG_IMAGES 60
|
||||
#define ZM_DUMP_CORES 61
|
||||
#define ZM_PATH_MAP 62
|
||||
#define ZM_PATH_SOCKS 63
|
||||
#define ZM_PATH_LOGS 64
|
||||
#define ZM_PATH_SWAP 65
|
||||
#define ZM_WEB_TITLE_PREFIX 66
|
||||
#define ZM_WEB_RESIZE_CONSOLE 67
|
||||
#define ZM_WEB_POPUP_ON_ALARM 68
|
||||
#define ZM_OPT_X10 69
|
||||
#define ZM_X10_DEVICE 70
|
||||
#define ZM_X10_HOUSE_CODE 71
|
||||
#define ZM_X10_DB_RELOAD_INTERVAL 72
|
||||
#define ZM_WEB_SOUND_ON_ALARM 73
|
||||
#define ZM_WEB_ALARM_SOUND 74
|
||||
#define ZM_WEB_COMPACT_MONTAGE 75
|
||||
#define ZM_OPT_FAST_DELETE 76
|
||||
#define ZM_STRICT_VIDEO_CONFIG 77
|
||||
#define ZM_SIGNAL_CHECK_POINTS 78
|
||||
#define ZM_V4L_MULTI_BUFFER 79
|
||||
#define ZM_CAPTURES_PER_FRAME 80
|
||||
#define ZM_FILTER_RELOAD_DELAY 81
|
||||
#define ZM_FILTER_EXECUTE_INTERVAL 82
|
||||
#define ZM_OPT_UPLOAD 83
|
||||
#define ZM_UPLOAD_ARCH_FORMAT 84
|
||||
#define ZM_UPLOAD_ARCH_COMPRESS 85
|
||||
#define ZM_UPLOAD_ARCH_ANALYSE 86
|
||||
#define ZM_UPLOAD_PROTOCOL 87
|
||||
#define ZM_UPLOAD_FTP_HOST 88
|
||||
#define ZM_UPLOAD_HOST 89
|
||||
#define ZM_UPLOAD_PORT 90
|
||||
#define ZM_UPLOAD_FTP_USER 91
|
||||
#define ZM_UPLOAD_USER 92
|
||||
#define ZM_UPLOAD_FTP_PASS 93
|
||||
#define ZM_UPLOAD_PASS 94
|
||||
#define ZM_UPLOAD_FTP_LOC_DIR 95
|
||||
#define ZM_UPLOAD_LOC_DIR 96
|
||||
#define ZM_UPLOAD_FTP_REM_DIR 97
|
||||
#define ZM_UPLOAD_REM_DIR 98
|
||||
#define ZM_UPLOAD_FTP_TIMEOUT 99
|
||||
#define ZM_UPLOAD_TIMEOUT 100
|
||||
#define ZM_UPLOAD_FTP_PASSIVE 101
|
||||
#define ZM_UPLOAD_FTP_DEBUG 102
|
||||
#define ZM_UPLOAD_DEBUG 103
|
||||
#define ZM_OPT_EMAIL 104
|
||||
#define ZM_EMAIL_ADDRESS 105
|
||||
#define ZM_EMAIL_TEXT 106
|
||||
#define ZM_EMAIL_SUBJECT 107
|
||||
#define ZM_EMAIL_BODY 108
|
||||
#define ZM_OPT_MESSAGE 109
|
||||
#define ZM_MESSAGE_ADDRESS 110
|
||||
#define ZM_MESSAGE_TEXT 111
|
||||
#define ZM_MESSAGE_SUBJECT 112
|
||||
#define ZM_MESSAGE_BODY 113
|
||||
#define ZM_NEW_MAIL_MODULES 114
|
||||
#define ZM_EMAIL_HOST 115
|
||||
#define ZM_FROM_EMAIL 116
|
||||
#define ZM_URL 117
|
||||
#define ZM_MAX_RESTART_DELAY 118
|
||||
#define ZM_WATCH_CHECK_INTERVAL 119
|
||||
#define ZM_WATCH_MAX_DELAY 120
|
||||
#define ZM_RUN_AUDIT 121
|
||||
#define ZM_AUDIT_CHECK_INTERVAL 122
|
||||
#define ZM_FORCED_ALARM_SCORE 123
|
||||
#define ZM_BULK_FRAME_INTERVAL 124
|
||||
#define ZM_EVENT_CLOSE_MODE 125
|
||||
#define ZM_FORCE_CLOSE_EVENTS 126
|
||||
#define ZM_CREATE_ANALYSIS_IMAGES 127
|
||||
#define ZM_WEIGHTED_ALARM_CENTRES 128
|
||||
#define ZM_EVENT_IMAGE_DIGITS 129
|
||||
#define ZM_DEFAULT_ASPECT_RATIO 130
|
||||
#define ZM_USER_SELF_EDIT 131
|
||||
#define ZM_OPT_FRAME_SERVER 132
|
||||
#define ZM_FRAME_SOCKET_SIZE 133
|
||||
#define ZM_OPT_CONTROL 134
|
||||
#define ZM_OPT_TRIGGERS 135
|
||||
#define ZM_CHECK_FOR_UPDATES 136
|
||||
#define ZM_UPDATE_CHECK_PROXY 137
|
||||
#define ZM_SHM_KEY 138
|
||||
#define ZM_WEB_REFRESH_METHOD 139
|
||||
#define ZM_WEB_EVENT_SORT_FIELD 140
|
||||
#define ZM_WEB_EVENT_SORT_ORDER 141
|
||||
#define ZM_WEB_EVENTS_PER_PAGE 142
|
||||
#define ZM_WEB_LIST_THUMBS 143
|
||||
#define ZM_WEB_LIST_THUMB_WIDTH 144
|
||||
#define ZM_WEB_LIST_THUMB_HEIGHT 145
|
||||
#define ZM_WEB_USE_OBJECT_TAGS 146
|
||||
#define ZM_WEB_H_REFRESH_MAIN 147
|
||||
#define ZM_WEB_H_REFRESH_CYCLE 148
|
||||
#define ZM_WEB_H_REFRESH_IMAGE 149
|
||||
#define ZM_WEB_H_REFRESH_STATUS 150
|
||||
#define ZM_WEB_H_REFRESH_EVENTS 151
|
||||
#define ZM_WEB_H_CAN_STREAM 152
|
||||
#define ZM_WEB_H_STREAM_METHOD 153
|
||||
#define ZM_WEB_H_DEFAULT_SCALE 154
|
||||
#define ZM_WEB_H_DEFAULT_RATE 155
|
||||
#define ZM_WEB_H_VIDEO_BITRATE 156
|
||||
#define ZM_WEB_H_VIDEO_MAXFPS 157
|
||||
#define ZM_WEB_H_SCALE_THUMBS 158
|
||||
#define ZM_WEB_H_EVENTS_VIEW 159
|
||||
#define ZM_WEB_H_SHOW_PROGRESS 160
|
||||
#define ZM_WEB_H_AJAX_TIMEOUT 161
|
||||
#define ZM_WEB_M_REFRESH_MAIN 162
|
||||
#define ZM_WEB_M_REFRESH_CYCLE 163
|
||||
#define ZM_WEB_M_REFRESH_IMAGE 164
|
||||
#define ZM_WEB_M_REFRESH_STATUS 165
|
||||
#define ZM_WEB_M_REFRESH_EVENTS 166
|
||||
#define ZM_WEB_M_CAN_STREAM 167
|
||||
#define ZM_WEB_M_STREAM_METHOD 168
|
||||
#define ZM_WEB_M_DEFAULT_SCALE 169
|
||||
#define ZM_WEB_M_DEFAULT_RATE 170
|
||||
#define ZM_WEB_M_VIDEO_BITRATE 171
|
||||
#define ZM_WEB_M_VIDEO_MAXFPS 172
|
||||
#define ZM_WEB_M_SCALE_THUMBS 173
|
||||
#define ZM_WEB_M_EVENTS_VIEW 174
|
||||
#define ZM_WEB_M_SHOW_PROGRESS 175
|
||||
#define ZM_WEB_M_AJAX_TIMEOUT 176
|
||||
#define ZM_WEB_L_REFRESH_MAIN 177
|
||||
#define ZM_WEB_L_REFRESH_CYCLE 178
|
||||
#define ZM_WEB_L_REFRESH_IMAGE 179
|
||||
#define ZM_WEB_L_REFRESH_STATUS 180
|
||||
#define ZM_WEB_L_REFRESH_EVENTS 181
|
||||
#define ZM_WEB_L_CAN_STREAM 182
|
||||
#define ZM_WEB_L_STREAM_METHOD 183
|
||||
#define ZM_WEB_L_DEFAULT_SCALE 184
|
||||
#define ZM_WEB_L_DEFAULT_RATE 185
|
||||
#define ZM_WEB_L_VIDEO_BITRATE 186
|
||||
#define ZM_WEB_L_VIDEO_MAXFPS 187
|
||||
#define ZM_WEB_L_SCALE_THUMBS 188
|
||||
#define ZM_WEB_L_EVENTS_VIEW 189
|
||||
#define ZM_WEB_L_SHOW_PROGRESS 190
|
||||
#define ZM_WEB_L_AJAX_TIMEOUT 191
|
||||
#define ZM_WEB_P_CAN_STREAM 192
|
||||
#define ZM_WEB_P_STREAM_METHOD 193
|
||||
#define ZM_WEB_P_DEFAULT_SCALE 194
|
||||
#define ZM_WEB_P_DEFAULT_RATE 195
|
||||
#define ZM_WEB_P_VIDEO_BITRATE 196
|
||||
#define ZM_WEB_P_VIDEO_MAXFPS 197
|
||||
#define ZM_WEB_P_SCALE_THUMBS 198
|
||||
#define ZM_WEB_P_AJAX_TIMEOUT 199
|
||||
#define ZM_DYN_LAST_VERSION 200
|
||||
#define ZM_DYN_CURR_VERSION 201
|
||||
#define ZM_DYN_DB_VERSION 202
|
||||
#define ZM_DYN_LAST_CHECK 203
|
||||
#define ZM_DYN_NEXT_REMINDER 204
|
||||
#define ZM_DYN_DONATE_REMINDER_TIME 205
|
||||
#define ZM_DYN_SHOW_DONATE_REMINDER 206
|
||||
#define ZM_EYEZM_DEBUG 207
|
||||
#define ZM_EYEZM_LOG_TO_FILE 208
|
||||
#define ZM_EYEZM_LOG_FILE 209
|
||||
#define ZM_EYEZM_EVENT_VCODEC 210
|
||||
#define ZM_EYEZM_FEED_VCODEC 211
|
||||
#define ZM_EYEZM_H264_DEFAULT_BR 212
|
||||
#define ZM_EYEZM_H264_DEFAULT_EVBR 213
|
||||
#define ZM_EYEZM_H264_TIMEOUT 214
|
||||
#define ZM_EYEZM_SEG_DURATION 215
|
||||
|
||||
|
||||
#define ZM_MAX_CFG_ID 217
|
||||
#define ZM_MAX_CFG_ID 215
|
||||
|
||||
#define ZM_CFG_DECLARE_LIST \
|
||||
const char *lang_default;\
|
||||
|
@ -250,8 +248,7 @@
|
|||
const char *path_cambozola;\
|
||||
int reload_cambozola;\
|
||||
bool timestamp_on_capture;\
|
||||
bool local_bgr_invert;\
|
||||
bool y_image_deltas;\
|
||||
bool cpu_extensions;\
|
||||
bool fast_image_blends;\
|
||||
bool opt_adaptive_skip;\
|
||||
bool blend_alarmed_images;\
|
||||
|
@ -303,7 +300,6 @@
|
|||
bool web_compact_montage;\
|
||||
bool opt_fast_delete;\
|
||||
bool strict_video_config;\
|
||||
int v4l2_capture_fields;\
|
||||
int signal_check_points;\
|
||||
bool v4l_multi_buffer;\
|
||||
int captures_per_frame;\
|
||||
|
@ -471,8 +467,7 @@
|
|||
path_cambozola = (const char *)config.Item( ZM_PATH_CAMBOZOLA );\
|
||||
reload_cambozola = (int)config.Item( ZM_RELOAD_CAMBOZOLA );\
|
||||
timestamp_on_capture = (bool)config.Item( ZM_TIMESTAMP_ON_CAPTURE );\
|
||||
local_bgr_invert = (bool)config.Item( ZM_LOCAL_BGR_INVERT );\
|
||||
y_image_deltas = (bool)config.Item( ZM_Y_IMAGE_DELTAS );\
|
||||
cpu_extensions = (bool)config.Item( ZM_CPU_EXTENSIONS );\
|
||||
fast_image_blends = (bool)config.Item( ZM_FAST_IMAGE_BLENDS );\
|
||||
opt_adaptive_skip = (bool)config.Item( ZM_OPT_ADAPTIVE_SKIP );\
|
||||
blend_alarmed_images = (bool)config.Item( ZM_BLEND_ALARMED_IMAGES );\
|
||||
|
@ -524,7 +519,6 @@
|
|||
web_compact_montage = (bool)config.Item( ZM_WEB_COMPACT_MONTAGE );\
|
||||
opt_fast_delete = (bool)config.Item( ZM_OPT_FAST_DELETE );\
|
||||
strict_video_config = (bool)config.Item( ZM_STRICT_VIDEO_CONFIG );\
|
||||
v4l2_capture_fields = (int)config.Item( ZM_V4L2_CAPTURE_FIELDS );\
|
||||
signal_check_points = (int)config.Item( ZM_SIGNAL_CHECK_POINTS );\
|
||||
v4l_multi_buffer = (bool)config.Item( ZM_V4L_MULTI_BUFFER );\
|
||||
captures_per_frame = (int)config.Item( ZM_CAPTURES_PER_FRAME );\
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
|
||||
#include "zmf.h"
|
||||
|
||||
#if HAVE_SYS_SENDFILE_H
|
||||
#include <sys/sendfile.h>
|
||||
#endif
|
||||
|
||||
//#define USE_PREPARED_SQL 1
|
||||
|
||||
bool Event::initialised = false;
|
||||
|
@ -596,7 +600,8 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image *
|
|||
WriteFrameImage( alarm_image, timestamp, event_file, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This makes viewing the diagnostic images impossible because it keeps deleting them
|
||||
if ( config.record_diag_images )
|
||||
{
|
||||
char diag_glob[PATH_MAX] = "";
|
||||
|
@ -637,6 +642,7 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image *
|
|||
}
|
||||
globfree( &pglob );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool EventStream::loadInitialEventData( int monitor_id, time_t event_time )
|
||||
|
@ -751,7 +757,10 @@ bool EventStream::loadEventData( int event_id )
|
|||
if ( config.use_deep_storage )
|
||||
{
|
||||
struct tm *event_time = localtime( &event_data->start_time );
|
||||
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", staticConfig.PATH_WEB.c_str(), config.dir_events, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec );
|
||||
if ( config.dir_events[0] == '/' )
|
||||
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", config.dir_events, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec );
|
||||
else
|
||||
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", staticConfig.PATH_WEB.c_str(), config.dir_events, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1185,6 +1194,9 @@ bool EventStream::sendFrame( int delta_us )
|
|||
Debug( 2, "Sending frame %d", curr_frame_id );
|
||||
|
||||
static char filepath[PATH_MAX];
|
||||
static struct stat filestat;
|
||||
FILE *fdj = NULL;
|
||||
|
||||
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
||||
|
||||
#if HAVE_LIBAVCODEC
|
||||
|
@ -1196,7 +1208,7 @@ bool EventStream::sendFrame( int delta_us )
|
|||
|
||||
if ( !vid_stream )
|
||||
{
|
||||
vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, send_image->Colours(), send_image->Width(), send_image->Height() );
|
||||
vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, send_image->Colours(), send_image->SubpixelOrder(), send_image->Width(), send_image->Height() );
|
||||
fprintf( stdout, "Content-type: %s\r\n\r\n", vid_stream->MimeType() );
|
||||
vid_stream->OpenStream();
|
||||
}
|
||||
|
@ -1208,7 +1220,7 @@ bool EventStream::sendFrame( int delta_us )
|
|||
static unsigned char temp_img_buffer[ZM_MAX_IMAGE_SIZE];
|
||||
|
||||
int img_buffer_size = 0;
|
||||
unsigned char *img_buffer = temp_img_buffer;
|
||||
uint8_t *img_buffer = temp_img_buffer;
|
||||
|
||||
bool send_raw = ((scale>=ZM_SCALE_BASE)&&(zoom==ZM_SCALE_BASE));
|
||||
|
||||
|
@ -1219,14 +1231,20 @@ bool EventStream::sendFrame( int delta_us )
|
|||
|
||||
if ( send_raw )
|
||||
{
|
||||
FILE *fdj = fopen( filepath, "r" );
|
||||
fdj = fopen( filepath, "rb" );
|
||||
if ( !fdj )
|
||||
{
|
||||
Error( "Can't open %s: %s", filepath, strerror(errno) );
|
||||
return( false );
|
||||
}
|
||||
img_buffer_size = fread( img_buffer, 1, sizeof(temp_img_buffer), fdj );
|
||||
fclose( fdj );
|
||||
#if HAVE_SENDFILE
|
||||
if( fstat(fileno(fdj),&filestat) < 0 ) {
|
||||
Error( "Failed getting information about file %s: %s", filepath, strerror(errno) );
|
||||
return( false );
|
||||
}
|
||||
#else
|
||||
img_buffer_size = fread( img_buffer, 1, sizeof(temp_img_buffer), fdj );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1240,7 +1258,7 @@ bool EventStream::sendFrame( int delta_us )
|
|||
send_image->EncodeJpeg( img_buffer, &img_buffer_size );
|
||||
break;
|
||||
case STREAM_RAW :
|
||||
img_buffer = send_image->Buffer();
|
||||
img_buffer = (uint8_t*)(send_image->Buffer());
|
||||
img_buffer_size = send_image->Size();
|
||||
break;
|
||||
case STREAM_ZIP :
|
||||
|
@ -1269,12 +1287,36 @@ bool EventStream::sendFrame( int delta_us )
|
|||
Fatal( "Unexpected frame type %d", type );
|
||||
break;
|
||||
}
|
||||
fprintf( stdout, "Content-Length: %d\r\n\r\n", img_buffer_size );
|
||||
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 )
|
||||
{
|
||||
Error( "Unable to send stream frame: %s", strerror(errno) );
|
||||
return( false );
|
||||
}
|
||||
|
||||
|
||||
if(send_raw) {
|
||||
#if HAVE_SENDFILE
|
||||
fprintf( stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size );
|
||||
if(sendfile(fileno(stdout), fileno(fdj), 0, (int)filestat.st_size) != (int)filestat.st_size) {
|
||||
/* sendfile() failed, use standard way instead */
|
||||
img_buffer_size = fread( img_buffer, 1, sizeof(temp_img_buffer), fdj );
|
||||
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) {
|
||||
Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno));
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
#else
|
||||
fprintf( stdout, "Content-Length: %d\r\n\r\n", img_buffer_size );
|
||||
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) {
|
||||
Error("Unable to send raw frame %u: %s",curr_frame_id,strerror(errno));
|
||||
return( false );
|
||||
}
|
||||
#endif
|
||||
fclose(fdj); /* Close the file handle */
|
||||
} else {
|
||||
fprintf( stdout, "Content-Length: %d\r\n\r\n", img_buffer_size );
|
||||
if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 )
|
||||
{
|
||||
Error( "Unable to send stream frame: %s", strerror(errno) );
|
||||
return( false );
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( stdout, "\r\n\r\n" );
|
||||
fflush( stdout );
|
||||
}
|
||||
|
@ -1306,7 +1348,7 @@ void EventStream::runStream()
|
|||
{
|
||||
gettimeofday( &now, NULL );
|
||||
|
||||
checkCommandQueue();
|
||||
while(checkCommandQueue());
|
||||
|
||||
if ( step != 0 )
|
||||
curr_frame_id += step;
|
||||
|
@ -1403,7 +1445,7 @@ void EventStream::runStream()
|
|||
}
|
||||
else
|
||||
{
|
||||
usleep( STREAM_PAUSE_WAIT );
|
||||
usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) );
|
||||
}
|
||||
}
|
||||
#if HAVE_LIBAVCODEC
|
||||
|
|
|
@ -54,6 +54,11 @@ extern "C" {
|
|||
#else // FFMPEG_VERSION_INT
|
||||
#define ZM_FFMPEG_SVN 1
|
||||
#endif // FFMPEG_VERSION_INT
|
||||
|
||||
/* Fix for not having SWS_CPU_CAPS_SSE2 defined */
|
||||
#ifndef SWS_CPU_CAPS_SSE2
|
||||
#define SWS_CPU_CAPS_SSE2 0x02000000
|
||||
#endif
|
||||
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
|
||||
|
|
|
@ -24,21 +24,39 @@
|
|||
#include "zm_ffmpeg_camera.h"
|
||||
|
||||
FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
Camera( p_id, FFMPEG_SRC, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture ),
|
||||
Camera( p_id, FFMPEG_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture ),
|
||||
mPath( p_path )
|
||||
{
|
||||
if ( capture )
|
||||
{
|
||||
Initialise();
|
||||
}
|
||||
|
||||
mFormatContext = NULL;
|
||||
mVideoStreamId = -1;
|
||||
mCodecContext = NULL;
|
||||
mCodec = NULL;
|
||||
mConvertContext = NULL;
|
||||
mRawFrame = NULL;
|
||||
mFrame = NULL;
|
||||
|
||||
mFormatContext = NULL;
|
||||
mVideoStreamId = -1;
|
||||
mCodecContext = NULL;
|
||||
mCodec = NULL;
|
||||
mRawFrame = NULL;
|
||||
mFrame = NULL;
|
||||
frameCount = 0;
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
mConvertContext = NULL;
|
||||
#endif
|
||||
/* Has to be located inside the constructor so other components such as zma will receive correct colours and subpixel order */
|
||||
if(colours == ZM_COLOUR_RGB32) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_RGBA;
|
||||
imagePixFormat = PIX_FMT_RGBA;
|
||||
} else if(colours == ZM_COLOUR_RGB24) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_RGB;
|
||||
imagePixFormat = PIX_FMT_RGB24;
|
||||
} else if(colours == ZM_COLOUR_GRAY8) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_NONE;
|
||||
imagePixFormat = PIX_FMT_GRAY8;
|
||||
} else {
|
||||
Panic("Unexpected colours: %d",colours);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FfmpegCamera::~FfmpegCamera()
|
||||
|
@ -46,11 +64,14 @@ FfmpegCamera::~FfmpegCamera()
|
|||
av_freep( &mFrame );
|
||||
av_freep( &mRawFrame );
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
if ( mConvertContext )
|
||||
{
|
||||
sws_freeContext( mConvertContext );
|
||||
mConvertContext = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( mCodecContext )
|
||||
{
|
||||
avcodec_close( mCodecContext );
|
||||
|
@ -70,10 +91,6 @@ FfmpegCamera::~FfmpegCamera()
|
|||
|
||||
void FfmpegCamera::Initialise()
|
||||
{
|
||||
int max_size = width*height*colours;
|
||||
|
||||
mBuffer.size( max_size );
|
||||
|
||||
if ( logDebugging() )
|
||||
av_log_set_level( AV_LOG_DEBUG );
|
||||
else
|
||||
|
@ -130,16 +147,24 @@ int FfmpegCamera::PrimeCapture()
|
|||
|
||||
// Allocate space for the converted video frame
|
||||
mFrame = avcodec_alloc_frame();
|
||||
|
||||
// Determine required buffer size and allocate buffer
|
||||
int pictureSize = avpicture_get_size( PIX_FMT_RGB24, mCodecContext->width, mCodecContext->height );
|
||||
mBuffer.size( pictureSize );
|
||||
|
||||
avpicture_fill( (AVPicture *)mFrame, (unsigned char *)mBuffer, PIX_FMT_RGB24, mCodecContext->width, mCodecContext->height);
|
||||
|
||||
if(mRawFrame == NULL || mFrame == NULL)
|
||||
Fatal( "Unable to allocate frame for %s", mPath.c_str() );
|
||||
|
||||
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
||||
if( pSize != imagesize) {
|
||||
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
||||
}
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
if ( (mConvertContext = sws_getCachedContext( mConvertContext, mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL )) == NULL )
|
||||
Fatal( "Unable to create conversion context for %s", mPath.c_str() );
|
||||
if(!sws_isSupportedInput(mCodecContext->pix_fmt)) {
|
||||
Fatal("swscale does not support the codec format: %c%c%c%c",(mCodecContext->pix_fmt)&0xff,((mCodecContext->pix_fmt>>8)&0xff),((mCodecContext->pix_fmt>>16)&0xff),((mCodecContext->pix_fmt>>24)&0xff));
|
||||
}
|
||||
|
||||
if(!sws_isSupportedOutput(imagePixFormat)) {
|
||||
Fatal("swscale does not support the target format: %c%c%c%c",(imagePixFormat)&0xff,((imagePixFormat>>8)&0xff),((imagePixFormat>>16)&0xff),((imagePixFormat>>24)&0xff));
|
||||
}
|
||||
|
||||
#else // HAVE_LIBSWSCALE
|
||||
Fatal( "You must compile ffmpeg with the --enable-swscale option to use ffmpeg cameras" );
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
|
@ -155,8 +180,16 @@ int FfmpegCamera::PreCapture()
|
|||
|
||||
int FfmpegCamera::Capture( Image &image )
|
||||
{
|
||||
static int frameCount = 0;
|
||||
AVPacket packet;
|
||||
AVPacket packet;
|
||||
uint8_t* directbuffer;
|
||||
|
||||
/* Request a writeable buffer of the target image */
|
||||
directbuffer = image.WriteBuffer(width, height, colours, subpixelorder);
|
||||
if(directbuffer == NULL) {
|
||||
Error("Failed requesting writeable buffer for the captured image.");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int frameComplete = false;
|
||||
while ( !frameComplete )
|
||||
{
|
||||
|
@ -172,21 +205,31 @@ int FfmpegCamera::Capture( Image &image )
|
|||
if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 )
|
||||
Fatal( "Unable to decode frame at frame %d", frameCount );
|
||||
|
||||
Debug( 3, "Decoded video packet at frame %d", frameCount );
|
||||
Debug( 4, "Decoded video packet at frame %d", frameCount );
|
||||
|
||||
if ( frameComplete )
|
||||
{
|
||||
Debug( 1, "Got frame %d", frameCount );
|
||||
Debug( 3, "Got frame %d", frameCount );
|
||||
|
||||
avpicture_fill( (AVPicture *)mFrame, directbuffer, imagePixFormat, width, height);
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
if ( sws_scale( mConvertContext, mRawFrame->data, mRawFrame->linesize, 0, mCodecContext->height, mFrame->data, mFrame->linesize ) < 0 )
|
||||
Fatal( "Unable to convert raw format %d to RGB at frame %d", mCodecContext->pix_fmt, frameCount );
|
||||
if(mConvertContext == NULL) {
|
||||
if(config.cpu_extensions && sseversion >= 20) {
|
||||
mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC | SWS_CPU_CAPS_SSE2, NULL, NULL, NULL );
|
||||
} else {
|
||||
mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL );
|
||||
}
|
||||
if(mConvertContext == NULL)
|
||||
Fatal( "Unable to create conversion context for %s", mPath.c_str() );
|
||||
}
|
||||
|
||||
if ( sws_scale( mConvertContext, mRawFrame->data, mRawFrame->linesize, 0, mCodecContext->height, mFrame->data, mFrame->linesize ) < 0 )
|
||||
Fatal( "Unable to convert raw format %u to target format %u at frame %d", mCodecContext->pix_fmt, imagePixFormat, frameCount );
|
||||
#else // HAVE_LIBSWSCALE
|
||||
Fatal( "You must compile ffmpeg with the --enable-swscale option to use ffmpeg cameras" );
|
||||
Fatal( "You must compile ffmpeg with the --enable-swscale option to use ffmpeg cameras" );
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
|
||||
image.Assign( mCodecContext->width, mCodecContext->height, colours, (unsigned char *)mFrame->data[0] );
|
||||
|
||||
frameCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,17 +35,21 @@ class FfmpegCamera : public Camera
|
|||
protected:
|
||||
std::string mPath;
|
||||
|
||||
int frameCount;
|
||||
|
||||
#if HAVE_LIBAVFORMAT
|
||||
AVFormatContext *mFormatContext;
|
||||
int mVideoStreamId;
|
||||
AVCodecContext *mCodecContext;
|
||||
AVCodec *mCodec;
|
||||
struct SwsContext *mConvertContext;
|
||||
AVFrame *mRawFrame;
|
||||
AVFrame *mFrame;
|
||||
PixelFormat imagePixFormat;
|
||||
#endif // HAVE_LIBAVFORMAT
|
||||
|
||||
Buffer mBuffer;
|
||||
#if HAVE_LIBSWSCALE
|
||||
struct SwsContext *mConvertContext;
|
||||
#endif
|
||||
|
||||
public:
|
||||
FfmpegCamera( int p_id, const std::string &path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "zm.h"
|
||||
#include "zm_file_camera.h"
|
||||
|
||||
FileCamera::FileCamera( int p_id, const char *p_path, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( p_id, FILE_SRC, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture )
|
||||
FileCamera::FileCamera( int p_id, const char *p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) : Camera( p_id, FILE_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture )
|
||||
{
|
||||
strncpy( path, p_path, sizeof(path) );
|
||||
if ( capture )
|
||||
|
@ -82,7 +82,7 @@ int FileCamera::PreCapture()
|
|||
|
||||
int FileCamera::Capture( Image &image )
|
||||
{
|
||||
return( image.ReadJpeg( path )?0:-1 );
|
||||
return( image.ReadJpeg( path, colours, subpixelorder )?0:-1 );
|
||||
}
|
||||
|
||||
int FileCamera::PostCapture()
|
||||
|
|
|
@ -36,7 +36,7 @@ protected:
|
|||
char path[PATH_MAX];
|
||||
|
||||
public:
|
||||
FileCamera( int p_id, const char *p_path, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
FileCamera( int p_id, const char *p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
~FileCamera();
|
||||
|
||||
const char *Path() const { return( path ); }
|
||||
|
|
4731
src/zm_image.cpp
4731
src/zm_image.cpp
File diff suppressed because it is too large
Load Diff
184
src/zm_image.h
184
src/zm_image.h
|
@ -29,11 +29,53 @@ extern "C"
|
|||
#include "zm_coord.h"
|
||||
#include "zm_box.h"
|
||||
#include "zm_poly.h"
|
||||
#include "zm_mem_utils.h"
|
||||
#include "zm_utils.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_ZLIB_H
|
||||
#include <zlib.h>
|
||||
#endif // HAVE_ZLIB_H
|
||||
|
||||
#define ZM_BUFTYPE_DONTFREE 0
|
||||
#define ZM_BUFTYPE_MALLOC 1
|
||||
#define ZM_BUFTYPE_NEW 2
|
||||
#define ZM_BUFTYPE_AVMALLOC 3
|
||||
#define ZM_BUFTYPE_ZM 4
|
||||
|
||||
typedef void (*blend_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long, double);
|
||||
typedef void (*delta_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long);
|
||||
typedef void (*convert_fptr_t)(const uint8_t*, uint8_t*, unsigned long);
|
||||
typedef void (*deinterlace_4field_fptr_t)(uint8_t*, uint8_t*, unsigned int, unsigned int, unsigned int);
|
||||
typedef void* (*imgbufcpy_fptr_t)(void*, const void*, size_t);
|
||||
|
||||
extern imgbufcpy_fptr_t fptr_imgbufcpy;
|
||||
|
||||
/* Should be called from Image class functions */
|
||||
inline static uint8_t* AllocBuffer(size_t p_bufsize) {
|
||||
uint8_t* buffer = (uint8_t*)zm_mallocaligned(16,p_bufsize);
|
||||
if(buffer == NULL)
|
||||
Fatal("Memory allocation failed: %s",strerror(errno));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
inline static void DumpBuffer(uint8_t* buffer, int buffertype) {
|
||||
if (buffer && buffertype != ZM_BUFTYPE_DONTFREE) {
|
||||
if(buffertype == ZM_BUFTYPE_ZM)
|
||||
zm_freealigned(buffer);
|
||||
else if(buffertype == ZM_BUFTYPE_MALLOC)
|
||||
free(buffer);
|
||||
else if(buffertype == ZM_BUFTYPE_NEW)
|
||||
delete buffer;
|
||||
/*else if(buffertype == ZM_BUFTYPE_AVMALLOC)
|
||||
av_free(buffer);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This is image class, and represents a frame captured from a
|
||||
// camera in raw form.
|
||||
|
@ -41,8 +83,6 @@ extern "C"
|
|||
class Image
|
||||
{
|
||||
protected:
|
||||
typedef unsigned char BlendTable[256][256];
|
||||
typedef BlendTable *BlendTablePtr;
|
||||
|
||||
struct Edge
|
||||
{
|
||||
|
@ -65,10 +105,25 @@ protected:
|
|||
return( int(e1->min_x - e2->min_x) );
|
||||
}
|
||||
};
|
||||
|
||||
inline void DumpImgBuffer() {
|
||||
DumpBuffer(buffer,buffertype);
|
||||
buffer = NULL;
|
||||
allocation = 0;
|
||||
}
|
||||
|
||||
inline void AllocImgBuffer(size_t p_bufsize) {
|
||||
if(buffer)
|
||||
DumpImgBuffer();
|
||||
|
||||
buffer = AllocBuffer(p_bufsize);
|
||||
buffertype = ZM_BUFTYPE_ZM;
|
||||
allocation = p_bufsize;
|
||||
}
|
||||
|
||||
public:
|
||||
enum { CHAR_HEIGHT=11, CHAR_WIDTH=6 };
|
||||
enum { LINE_HEIGHT=CHAR_HEIGHT+0 };
|
||||
enum { LINE_HEIGHT=CHAR_HEIGHT+0 };
|
||||
|
||||
protected:
|
||||
static bool initialised;
|
||||
|
@ -76,33 +131,30 @@ protected:
|
|||
static unsigned char *y_r_table;
|
||||
static unsigned char *y_g_table;
|
||||
static unsigned char *y_b_table;
|
||||
static BlendTablePtr blend_tables[101];
|
||||
static jpeg_compress_struct *jpg_ccinfo[100];
|
||||
static jpeg_compress_struct *jpg_ccinfo[101];
|
||||
static jpeg_decompress_struct *jpg_dcinfo;
|
||||
static struct zm_error_mgr jpg_err;
|
||||
|
||||
protected:
|
||||
int width;
|
||||
int width;
|
||||
int height;
|
||||
int pixels;
|
||||
int colours;
|
||||
int size;
|
||||
int allocation;
|
||||
int subpixelorder;
|
||||
unsigned long allocation;
|
||||
uint8_t *buffer;
|
||||
bool our_buffer;
|
||||
int buffertype; /* 0=not ours, no need to call free(), 1=malloc() buffer, 2=new buffer */
|
||||
int holdbuffer; /* Hold the buffer instead of replacing it with new one */
|
||||
char text[1024];
|
||||
|
||||
protected:
|
||||
mutable uint16_t *blend_buffer;
|
||||
|
||||
protected:
|
||||
static void Initialise();
|
||||
static BlendTablePtr GetBlendTable( int );
|
||||
|
||||
public:
|
||||
Image();
|
||||
Image( const char *filename );
|
||||
Image( int p_width, int p_height, int p_colours, uint8_t *p_buffer=0 );
|
||||
Image( int p_width, int p_height, int p_colours, int p_subpixelorder, uint8_t *p_buffer=0);
|
||||
Image( const Image &p_image );
|
||||
~Image();
|
||||
|
||||
|
@ -110,34 +162,49 @@ public:
|
|||
inline int Height() const { return( height ); }
|
||||
inline int Pixels() const { return( pixels ); }
|
||||
inline int Colours() const { return( colours ); }
|
||||
inline int SubpixelOrder() const { return( subpixelorder ); }
|
||||
inline int Size() const { return( size ); }
|
||||
inline uint8_t *Buffer() const { return( buffer ); }
|
||||
inline uint8_t *Buffer( unsigned int x, unsigned int y= 0 ) const { return( &buffer[colours*((y*width)+x)] ); }
|
||||
|
||||
void Empty();
|
||||
void Assign( int p_width, int p_height, int p_colours, unsigned char *new_buffer );
|
||||
/* Internal buffer should not be modified from functions outside of this class */
|
||||
inline const uint8_t* Buffer() const { return( buffer ); }
|
||||
inline const uint8_t* Buffer( unsigned int x, unsigned int y= 0 ) const { return( &buffer[colours*((y*width)+x)] ); }
|
||||
/* Request writeable buffer */
|
||||
uint8_t* WriteBuffer(const int p_width, const int p_height, const int p_colours, const int p_subpixelorder);
|
||||
|
||||
inline int IsBufferHeld() const { return holdbuffer; }
|
||||
inline void HoldBuffer(int tohold) { holdbuffer = tohold; }
|
||||
|
||||
inline void Empty() {
|
||||
if(!holdbuffer)
|
||||
DumpImgBuffer();
|
||||
|
||||
width = height = colours = size = pixels = subpixelorder = 0;
|
||||
}
|
||||
|
||||
void Assign( int p_width, int p_height, int p_colours, int p_subpixelorder, const uint8_t* new_buffer, const size_t buffer_size);
|
||||
void Assign( const Image &image );
|
||||
void AssignDirect( const int p_width, const int p_height, const int p_colours, const int p_subpixelorder, uint8_t *new_buffer, const size_t buffer_size, const int p_buffertype);
|
||||
|
||||
inline void CopyBuffer( const Image &image )
|
||||
{
|
||||
if ( image.size != size )
|
||||
{
|
||||
Panic( "Attempt to copy different size image buffers, expected %d, got %d", size, image.size );
|
||||
Panic( "Attempt to copy different size image buffers, expected %d, got %d", size, image.size );
|
||||
}
|
||||
memcpy( buffer, image.buffer, size );
|
||||
(*fptr_imgbufcpy)(buffer, image.buffer, size);
|
||||
}
|
||||
inline Image &operator=( const unsigned char *new_buffer )
|
||||
{
|
||||
memcpy( buffer, new_buffer, size );
|
||||
(*fptr_imgbufcpy)(buffer, new_buffer, size);
|
||||
return( *this );
|
||||
}
|
||||
|
||||
bool ReadRaw( const char *filename );
|
||||
bool WriteRaw( const char *filename ) const;
|
||||
|
||||
bool ReadJpeg( const char *filename );
|
||||
bool ReadJpeg( const char *filename, int p_colours, int p_subpixelorder);
|
||||
bool WriteJpeg( const char *filename, int quality_override=0 ) const;
|
||||
bool DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size );
|
||||
bool DecodeJpeg( const JOCTET *inbuffer, int inbuffer_size, int p_colours, int p_subpixelorder);
|
||||
bool EncodeJpeg( JOCTET *outbuffer, int *outbuffer_size, int quality_override=0 ) const;
|
||||
|
||||
#if HAVE_ZLIB_H
|
||||
|
@ -150,18 +217,19 @@ public:
|
|||
|
||||
void Overlay( const Image &image );
|
||||
void Overlay( const Image &image, int x, int y );
|
||||
void Blend( const Image &image, int transparency=10 ) const;
|
||||
void Blend( const Image &image, int transparency=12 );
|
||||
static Image *Merge( int n_images, Image *images[] );
|
||||
static Image *Merge( int n_images, Image *images[], double weight );
|
||||
static Image *Highlight( int n_images, Image *images[], const Rgb threshold=RGB_BLACK, const Rgb ref_colour=RGB_RED );
|
||||
Image *Delta( const Image &image ) const;
|
||||
//Image *Delta( const Image &image ) const;
|
||||
void Delta( const Image &image, Image* targetimage) const;
|
||||
|
||||
const Coord centreCoord( const char *text );
|
||||
const Coord centreCoord( const char *text ) const;
|
||||
void Annotate( const char *p_text, const Coord &coord, const Rgb fg_colour=RGB_WHITE, const Rgb bg_colour=RGB_BLACK );
|
||||
Image *HighlightEdges( Rgb colour, const Box *limits=0 );
|
||||
Image *HighlightEdges( Rgb colour, int p_colours, int p_subpixelorder, const Box *limits=0 );
|
||||
//Image *HighlightEdges( Rgb colour, const Polygon &polygon );
|
||||
void Timestamp( const char *label, const time_t when, const Coord &coord );
|
||||
void Colourise();
|
||||
void Colourise(const int p_reqcolours, const int p_reqsubpixelorder);
|
||||
void DeColourise();
|
||||
|
||||
void Clear() { memset( buffer, 0, size ); }
|
||||
|
@ -173,8 +241,68 @@ public:
|
|||
|
||||
void Rotate( int angle );
|
||||
void Flip( bool leftright );
|
||||
|
||||
void Scale( unsigned int factor );
|
||||
|
||||
void Deinterlace_Discard();
|
||||
void Deinterlace_Linear();
|
||||
void Deinterlace_Blend();
|
||||
void Deinterlace_Blend_CustomRatio(int divider);
|
||||
void Deinterlace_4Field(const Image* next_image, unsigned int threshold);
|
||||
|
||||
};
|
||||
|
||||
#endif // ZM_IMAGE_H
|
||||
|
||||
/* Blend functions */
|
||||
void sse2_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
|
||||
void std_fastblend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
|
||||
void std_blend(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count, double blendpercent);
|
||||
|
||||
/* Delta functions */
|
||||
void std_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void std_delta8_rgb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void std_delta8_bgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void std_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void std_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void std_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void std_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void sse2_delta8_gray8(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void sse2_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void sse2_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void sse2_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void sse2_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void ssse3_delta8_rgba(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void ssse3_delta8_bgra(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void ssse3_delta8_argb(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
void ssse3_delta8_abgr(const uint8_t* col1, const uint8_t* col2, uint8_t* result, unsigned long count);
|
||||
|
||||
/* Convert functions */
|
||||
void std_convert_rgb_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void std_convert_bgr_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void std_convert_rgba_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void std_convert_bgra_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void std_convert_argb_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void std_convert_abgr_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void std_convert_yuyv_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void ssse3_convert_rgba_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void ssse3_convert_yuyv_gray8(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void zm_convert_yuyv_rgb(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void zm_convert_yuyv_rgba(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void zm_convert_rgb555_rgb(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void zm_convert_rgb555_rgba(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void zm_convert_rgb565_rgb(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
void zm_convert_rgb565_rgba(const uint8_t* col1, uint8_t* result, unsigned long count);
|
||||
|
||||
/* Deinterlace_4Field functions */
|
||||
void std_deinterlace_4field_gray8(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void std_deinterlace_4field_rgb(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void std_deinterlace_4field_bgr(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void std_deinterlace_4field_rgba(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void std_deinterlace_4field_bgra(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void std_deinterlace_4field_argb(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void std_deinterlace_4field_abgr(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void ssse3_deinterlace_4field_gray8(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void ssse3_deinterlace_4field_rgba(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void ssse3_deinterlace_4field_bgra(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void ssse3_deinterlace_4field_argb(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
void ssse3_deinterlace_4field_abgr(uint8_t* col1, uint8_t* col2, unsigned int threshold, unsigned int width, unsigned int height);
|
||||
|
|
|
@ -392,4 +392,75 @@ void zm_jpeg_mem_src( j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuff
|
|||
src->pub.next_input_byte = NULL; /* until buffer loaded */
|
||||
}
|
||||
|
||||
void zm_use_std_huff_tables( j_decompress_ptr cinfo ) {
|
||||
/* JPEG standard Huffman tables (cf. JPEG standard section K.3) */
|
||||
/* IMPORTANT: these are only valid for 8-bit data precision! */
|
||||
static const JHUFF_TBL dclumin = {
|
||||
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
|
||||
0
|
||||
};
|
||||
static const JHUFF_TBL dcchrome = {
|
||||
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
|
||||
0
|
||||
};
|
||||
static const JHUFF_TBL aclumin = {
|
||||
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d },
|
||||
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
|
||||
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
|
||||
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
|
||||
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
|
||||
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
|
||||
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
|
||||
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
|
||||
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
|
||||
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa },
|
||||
0
|
||||
};
|
||||
static const JHUFF_TBL acchrome = {
|
||||
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 },
|
||||
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
|
||||
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
|
||||
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
|
||||
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
|
||||
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
|
||||
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
|
||||
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa },
|
||||
0
|
||||
};
|
||||
|
||||
cinfo->dc_huff_tbl_ptrs[0] = (JHUFF_TBL*)&dclumin;
|
||||
cinfo->dc_huff_tbl_ptrs[1] = (JHUFF_TBL*)&dcchrome;
|
||||
cinfo->ac_huff_tbl_ptrs[0] = (JHUFF_TBL*)&aclumin;
|
||||
cinfo->ac_huff_tbl_ptrs[1] = (JHUFF_TBL*)&acchrome;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,4 +44,6 @@ void zm_jpeg_emit_message( j_common_ptr cinfo, int msg_level );
|
|||
// Prototypes for memory compress/decompression object */
|
||||
void zm_jpeg_mem_src(j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size );
|
||||
void zm_jpeg_mem_dest(j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size );
|
||||
|
||||
void zm_use_std_huff_tables( j_decompress_ptr cinfo );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "zm.h"
|
||||
#include "zm_camera.h"
|
||||
#include "zm_image.h"
|
||||
|
||||
#if ZM_HAS_V4L
|
||||
|
||||
|
@ -63,57 +64,55 @@ protected:
|
|||
#if ZM_HAS_V4L1
|
||||
struct V4L1Data
|
||||
{
|
||||
int active_frame;
|
||||
video_mbuf frames;
|
||||
video_mmap *buffers;
|
||||
unsigned char *bufptr;
|
||||
int active_frame;
|
||||
video_mbuf frames;
|
||||
video_mmap *buffers;
|
||||
unsigned char *bufptr;
|
||||
};
|
||||
#endif // ZM_HAS_V4L1
|
||||
|
||||
protected:
|
||||
std::string device;
|
||||
int channel;
|
||||
int standard;
|
||||
int palette;
|
||||
|
||||
bool device_prime;
|
||||
bool channel_prime;
|
||||
int channel_index;
|
||||
std::string device;
|
||||
int channel;
|
||||
int standard;
|
||||
int palette;
|
||||
bool device_prime;
|
||||
bool channel_prime;
|
||||
int channel_index;
|
||||
unsigned int extras;
|
||||
|
||||
unsigned int conversion_type; /* 0 = no conversion needed, 1 = use libswscale, 2 = zm internal conversion, 3 = jpeg decoding */
|
||||
convert_fptr_t conversion_fptr; /* Pointer to conversion function used */
|
||||
|
||||
uint32_t AutoSelectFormat(int p_colours);
|
||||
|
||||
protected:
|
||||
static int camera_count;
|
||||
static int channel_count;
|
||||
static int channels[VIDEO_MAX_FRAME];
|
||||
static int standards[VIDEO_MAX_FRAME];
|
||||
|
||||
static int vid_fd;
|
||||
|
||||
static int v4l_version;
|
||||
static int camera_count;
|
||||
static int channel_count;
|
||||
static int channels[VIDEO_MAX_FRAME];
|
||||
static int standards[VIDEO_MAX_FRAME];
|
||||
static int vid_fd;
|
||||
static int v4l_version;
|
||||
|
||||
#if ZM_HAS_V4L2
|
||||
static V4L2Data v4l2_data;
|
||||
static V4L2Data v4l2_data;
|
||||
#endif // ZM_HAS_V4L2
|
||||
#if ZM_HAS_V4L1
|
||||
static V4L1Data v4l1_data;
|
||||
static V4L1Data v4l1_data;
|
||||
#endif // ZM_HAS_V4L1
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
PixelFormat imagePixFormat;
|
||||
PixelFormat capturePixFormat;
|
||||
static AVFrame **capturePictures;
|
||||
static AVFrame **capturePictures;
|
||||
PixelFormat imagePixFormat;
|
||||
PixelFormat capturePixFormat;
|
||||
struct SwsContext *imgConversionContext;
|
||||
AVFrame *tmpPicture;
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
|
||||
static unsigned char *y_table;
|
||||
static signed char *uv_table;
|
||||
static short *r_v_table;
|
||||
static short *g_v_table;
|
||||
static short *g_u_table;
|
||||
static short *b_u_table;
|
||||
|
||||
static LocalCamera *last_camera;
|
||||
static LocalCamera *last_camera;
|
||||
|
||||
public:
|
||||
LocalCamera( int p_id, const std::string &device, int p_channel, int p_format, const std::string &p_method, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
LocalCamera( int p_id, const std::string &device, int p_channel, int p_format, const std::string &p_method, int p_width, int p_height, int p_colours, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture, unsigned int p_extras = 0);
|
||||
~LocalCamera();
|
||||
|
||||
void Initialise();
|
||||
|
@ -124,6 +123,7 @@ public:
|
|||
int Channel() const { return( channel ); }
|
||||
int Standard() const { return( standard ); }
|
||||
int Palette() const { return( palette ); }
|
||||
int Extras() const { return( extras ); }
|
||||
|
||||
int Brightness( int p_brightness=-1 );
|
||||
int Hue( int p_hue=-1 );
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef ZM_LOGGER_H
|
||||
#define ZM_LOGGER_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <mysql/mysql.h>
|
||||
|
|
|
@ -20,6 +20,44 @@
|
|||
#ifndef ZM_MEM_UTILS_H
|
||||
#define ZM_MEM_UTILS_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "zm.h"
|
||||
|
||||
inline void* zm_mallocaligned(unsigned int reqalignment, size_t reqsize) {
|
||||
uint8_t* retptr;
|
||||
#if HAVE_POSIX_MEMALIGN
|
||||
if(posix_memalign((void**)&retptr,reqalignment,reqsize) != 0)
|
||||
return NULL;
|
||||
|
||||
return retptr;
|
||||
#else
|
||||
uint8_t* alloc;
|
||||
retptr = (uint8_t*)malloc(reqsize+reqalignment+sizeof(void*));
|
||||
|
||||
if(retptr == NULL)
|
||||
return NULL;
|
||||
|
||||
alloc = retptr + sizeof(void*);
|
||||
|
||||
if(((long)alloc % reqalignment) != 0)
|
||||
alloc = alloc + (reqalignment - ((long)alloc % reqalignment));
|
||||
|
||||
/* Store a pointer before to the start of the block, just before returned aligned memory */
|
||||
*(void**)(alloc - sizeof(void*)) = retptr;
|
||||
|
||||
return alloc;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void zm_freealigned(void* ptr) {
|
||||
#if HAVE_POSIX_MEMALIGN
|
||||
free(ptr);
|
||||
#else
|
||||
/* Start of block is stored before the block if it was allocated by zm_mallocaligned */
|
||||
free(*(void**)((uint8_t*)ptr - sizeof(void*)));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline char *mempbrk( register const char *s, const char *accept, size_t limit )
|
||||
{
|
||||
if ( limit <= 0 || !s || !accept || !*accept )
|
||||
|
|
|
@ -224,7 +224,7 @@ bool Monitor::MonitorLink::inAlarm()
|
|||
|
||||
bool Monitor::MonitorLink::hasAlarmed()
|
||||
{
|
||||
if ( shared_data->state == ALARM || shared_data->state == ALERT )
|
||||
if ( shared_data->state == ALARM )
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
|
@ -244,6 +244,7 @@ Monitor::Monitor(
|
|||
const char *p_linked_monitors,
|
||||
Camera *p_camera,
|
||||
int p_orientation,
|
||||
unsigned int p_deinterlacing,
|
||||
const char *p_event_prefix,
|
||||
const char *p_label_format,
|
||||
const Coord &p_label_coord,
|
||||
|
@ -270,6 +271,7 @@ Monitor::Monitor(
|
|||
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
|
||||
height( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Width():p_camera->Height() ),
|
||||
orientation( (Orientation)p_orientation ),
|
||||
deinterlacing( p_deinterlacing ),
|
||||
label_coord( p_label_coord ),
|
||||
image_buffer_count( p_image_buffer_count ),
|
||||
warmup_count( p_warmup_count ),
|
||||
|
@ -285,8 +287,8 @@ Monitor::Monitor(
|
|||
ref_blend_perc( p_ref_blend_perc ),
|
||||
track_motion( p_track_motion ),
|
||||
signal_check_colour( p_signal_check_colour ),
|
||||
image( width, height, p_camera->Colours() ),
|
||||
ref_image( width, height, p_camera->Colours() ),
|
||||
delta_image( width, height, ZM_COLOUR_GRAY8, ZM_SUBPIX_ORDER_NONE ),
|
||||
ref_image( width, height, p_camera->Colours(), p_camera->SubpixelOrder() ),
|
||||
purpose( p_purpose ),
|
||||
camera( p_camera ),
|
||||
n_zones( p_n_zones ),
|
||||
|
@ -342,7 +344,8 @@ Monitor::Monitor(
|
|||
mem_size = sizeof(SharedData)
|
||||
+ sizeof(TriggerData)
|
||||
+ (image_buffer_count*sizeof(struct timeval))
|
||||
+ (image_buffer_count*camera->ImageSize());
|
||||
+ (image_buffer_count*camera->ImageSize())
|
||||
+ 64; /* Padding used to permit aligning the images buffer to 16 byte boundary */
|
||||
|
||||
Debug( 1, "mem.size=%d", mem_size );
|
||||
#if ZM_MEM_MAPPED
|
||||
|
@ -353,7 +356,7 @@ Monitor::Monitor(
|
|||
struct stat map_stat;
|
||||
if ( fstat( map_fd, &map_stat ) < 0 )
|
||||
Fatal( "Can't stat memory map file %s: %s", mem_file, strerror(errno) );
|
||||
if ( map_stat.st_size == 0 )
|
||||
if ( map_stat.st_size != mem_size && purpose == CAPTURE )
|
||||
{
|
||||
// Allocate the size
|
||||
if ( ftruncate( map_fd, mem_size ) < 0 )
|
||||
|
@ -392,12 +395,17 @@ Monitor::Monitor(
|
|||
trigger_data = (TriggerData *)((char *)shared_data + sizeof(SharedData));
|
||||
struct timeval *shared_timestamps = (struct timeval *)((char *)trigger_data + sizeof(TriggerData));
|
||||
unsigned char *shared_images = (unsigned char *)((char *)shared_timestamps + (image_buffer_count*sizeof(struct timeval)));
|
||||
|
||||
if(((unsigned long)shared_images % 16) != 0) {
|
||||
/* Align images buffer to nearest 16 byte boundary */
|
||||
Debug(3,"Aligning shared memory images to the next 16 byte boundary");
|
||||
shared_images = (uint8_t*)((unsigned long)shared_images + (16 - ((unsigned long)shared_images % 16)));
|
||||
}
|
||||
|
||||
if ( purpose == CAPTURE )
|
||||
{
|
||||
memset( mem_ptr, 0, mem_size );
|
||||
shared_data->size = sizeof(SharedData);
|
||||
shared_data->valid = true;
|
||||
shared_data->active = enabled;
|
||||
shared_data->signal = false;
|
||||
shared_data->state = IDLE;
|
||||
|
@ -412,12 +420,15 @@ Monitor::Monitor(
|
|||
shared_data->contrast = -1;
|
||||
shared_data->alarm_x = -1;
|
||||
shared_data->alarm_y = -1;
|
||||
shared_data->format = camera->SubpixelOrder();
|
||||
shared_data->imagesize = camera->ImageSize();
|
||||
trigger_data->size = sizeof(TriggerData);
|
||||
trigger_data->trigger_state = TRIGGER_CANCEL;
|
||||
trigger_data->trigger_score = 0;
|
||||
trigger_data->trigger_cause[0] = 0;
|
||||
trigger_data->trigger_text[0] = 0;
|
||||
trigger_data->trigger_showtext[0] = 0;
|
||||
shared_data->valid = true;
|
||||
}
|
||||
else if ( purpose == ANALYSIS )
|
||||
{
|
||||
|
@ -444,7 +455,15 @@ Monitor::Monitor(
|
|||
for ( int i = 0; i < image_buffer_count; i++ )
|
||||
{
|
||||
image_buffer[i].timestamp = &(shared_timestamps[i]);
|
||||
image_buffer[i].image = new Image( width, height, camera->Colours(), &(shared_images[i*camera->ImageSize()]) );
|
||||
image_buffer[i].image = new Image( width, height, camera->Colours(), camera->SubpixelOrder(), &(shared_images[i*camera->ImageSize()]) );
|
||||
image_buffer[i].image->HoldBuffer(true); /* Don't release the internal buffer or replace it with another */
|
||||
}
|
||||
if ( (deinterlacing & 0xff) == 4)
|
||||
{
|
||||
/* Four field motion adaptive deinterlacing in use */
|
||||
/* Allocate a buffer for the next image */
|
||||
next_buffer.image = new Image( width, height, camera->Colours(), camera->SubpixelOrder());
|
||||
next_buffer.timestamp = new struct timeval;
|
||||
}
|
||||
if ( !n_zones )
|
||||
{
|
||||
|
@ -498,12 +517,12 @@ Monitor::Monitor(
|
|||
Fatal( "Can't change to parent directory: %s", strerror(errno) );
|
||||
}
|
||||
|
||||
while( shared_data->last_write_index == image_buffer_count )
|
||||
while( shared_data->last_write_index == image_buffer_count && shared_data->last_write_time == 0)
|
||||
{
|
||||
Warning( "Waiting for capture daemon" );
|
||||
sleep( 1 );
|
||||
}
|
||||
ref_image.Assign( width, height, camera->Colours(), image_buffer[shared_data->last_write_index].image->Buffer() );
|
||||
ref_image.Assign( width, height, camera->Colours(), camera->SubpixelOrder(), image_buffer[shared_data->last_write_index].image->Buffer(), camera->ImageSize());
|
||||
|
||||
n_linked_monitors = 0;
|
||||
linked_monitors = 0;
|
||||
|
@ -517,6 +536,11 @@ Monitor::~Monitor()
|
|||
Info( "%s: %03d - Closing event %d, shutting down", name, image_count, event->Id() );
|
||||
closeEvent();
|
||||
|
||||
if ( (deinterlacing & 0xff) == 4)
|
||||
{
|
||||
delete next_buffer.image;
|
||||
delete next_buffer.timestamp;
|
||||
}
|
||||
for ( int i = 0; i < image_buffer_count; i++ )
|
||||
{
|
||||
delete image_buffer[i].image;
|
||||
|
@ -578,7 +602,7 @@ void Monitor::AddZones( int p_n_zones, Zone *p_zones[] )
|
|||
|
||||
Monitor::State Monitor::GetState() const
|
||||
{
|
||||
return( shared_data->state );
|
||||
return( (State)shared_data->state );
|
||||
}
|
||||
|
||||
int Monitor::GetImage( int index, int scale ) const
|
||||
|
@ -932,7 +956,10 @@ void Monitor::DumpZoneImage( const char *zone_string )
|
|||
Image *snap_image = snap->image;
|
||||
|
||||
Image zone_image( *snap_image );
|
||||
zone_image.Colourise();
|
||||
if(zone_image.Colours() == ZM_COLOUR_GRAY8) {
|
||||
zone_image.Colourise(ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB );
|
||||
}
|
||||
|
||||
for( int i = 0; i < n_zones; i++ )
|
||||
{
|
||||
if ( exclude_id && (!extra_colour || extra_zone.getNumCoords()) && zones[i]->Id() == exclude_id )
|
||||
|
@ -997,21 +1024,29 @@ void Monitor::DumpImage( Image *dump_image ) const
|
|||
bool Monitor::CheckSignal( const Image *image )
|
||||
{
|
||||
static bool static_undef = true;
|
||||
static unsigned char red_val;
|
||||
static unsigned char green_val;
|
||||
static unsigned char blue_val;
|
||||
/* RGB24 colors */
|
||||
static uint8_t red_val;
|
||||
static uint8_t green_val;
|
||||
static uint8_t blue_val;
|
||||
static uint8_t grayscale_val; /* 8bit grayscale color */
|
||||
static Rgb colour_val; /* RGB32 color */
|
||||
static int usedsubpixorder;
|
||||
|
||||
if ( config.signal_check_points > 0 )
|
||||
{
|
||||
if ( static_undef )
|
||||
{
|
||||
static_undef = false;
|
||||
red_val = RGB_RED_VAL(signal_check_colour);
|
||||
green_val = RGB_GREEN_VAL(signal_check_colour);
|
||||
blue_val = RGB_BLUE_VAL(signal_check_colour);
|
||||
usedsubpixorder = camera->SubpixelOrder();
|
||||
colour_val = rgb_convert(signal_check_colour, ZM_SUBPIX_ORDER_BGR); /* HTML colour code is actually BGR in memory, we want RGB */
|
||||
colour_val = rgb_convert(colour_val, usedsubpixorder);
|
||||
red_val = RED_VAL_BGRA(signal_check_colour);
|
||||
green_val = GREEN_VAL_BGRA(signal_check_colour);
|
||||
blue_val = BLUE_VAL_BGRA(signal_check_colour);
|
||||
grayscale_val = signal_check_colour & 0xff; /* Clear all bytes but lowest byte */
|
||||
}
|
||||
|
||||
const unsigned char *buffer = image->Buffer();
|
||||
const uint8_t *buffer = image->Buffer();
|
||||
int pixels = image->Pixels();
|
||||
int width = image->Width();
|
||||
int colours = image->Colours();
|
||||
|
@ -1028,11 +1063,34 @@ bool Monitor::CheckSignal( const Image *image )
|
|||
if ( index < (label_coord.Y()*width) || index >= (label_coord.Y()+Image::LINE_HEIGHT)*width )
|
||||
break;
|
||||
}
|
||||
const unsigned char *ptr = buffer+(index*colours);
|
||||
if ( (RED(ptr) != red_val) || (GREEN(ptr) != green_val) || (BLUE(ptr) != blue_val) )
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
|
||||
if(colours == ZM_COLOUR_GRAY8) {
|
||||
if ( *(buffer+index) != grayscale_val )
|
||||
return true;
|
||||
|
||||
} else if(colours == ZM_COLOUR_RGB24) {
|
||||
const uint8_t *ptr = buffer+(index*colours);
|
||||
|
||||
if ( usedsubpixorder == ZM_SUBPIX_ORDER_BGR) {
|
||||
if ( (RED_PTR_BGRA(ptr) != red_val) || (GREEN_PTR_BGRA(ptr) != green_val) || (BLUE_PTR_BGRA(ptr) != blue_val) )
|
||||
return true;
|
||||
} else {
|
||||
/* Assume RGB */
|
||||
if ( (RED_PTR_RGBA(ptr) != red_val) || (GREEN_PTR_RGBA(ptr) != green_val) || (BLUE_PTR_RGBA(ptr) != blue_val) )
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if(colours == ZM_COLOUR_RGB32) {
|
||||
if ( usedsubpixorder == ZM_SUBPIX_ORDER_ARGB || usedsubpixorder == ZM_SUBPIX_ORDER_ABGR) {
|
||||
if ( ARGB_ABGR_ZEROALPHA(*(((const Rgb*)buffer)+index)) != ARGB_ABGR_ZEROALPHA(colour_val) )
|
||||
return true;
|
||||
} else {
|
||||
/* Assume RGBA or BGRA */
|
||||
if ( RGBA_BGRA_ZEROALPHA(*(((const Rgb*)buffer)+index)) != RGBA_BGRA_ZEROALPHA(colour_val) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return( false );
|
||||
}
|
||||
|
@ -1192,7 +1250,6 @@ bool Monitor::Analyse()
|
|||
{
|
||||
Info( "%s: %03d - Closing event %d, signal loss", name, image_count, event->Id() );
|
||||
closeEvent();
|
||||
shared_data->state = state = IDLE;
|
||||
last_section_mod = 0;
|
||||
}
|
||||
if ( !event )
|
||||
|
@ -1204,10 +1261,11 @@ bool Monitor::Analyse()
|
|||
Event::StringSet noteSet;
|
||||
noteSet.insert( signalText );
|
||||
noteSetMap[SIGNAL_CAUSE] = noteSet;
|
||||
shared_data->state = state = IDLE;
|
||||
shared_data->active = signal;
|
||||
ref_image = *snap_image;
|
||||
}
|
||||
else if ( signal && Active() && function != RECORD && function != NODECT )
|
||||
else if ( signal && Active() && (function == MODECT || function == MOCORD) )
|
||||
{
|
||||
Event::StringSet zoneSet;
|
||||
int motion_score = DetectMotion( *snap_image, zoneSet );
|
||||
|
@ -1228,7 +1286,7 @@ bool Monitor::Analyse()
|
|||
}
|
||||
shared_data->active = signal;
|
||||
}
|
||||
if ( n_linked_monitors > 0 )
|
||||
if ( (!signal_change && signal) && n_linked_monitors > 0 )
|
||||
{
|
||||
bool first_link = true;
|
||||
Event::StringSet noteSet;
|
||||
|
@ -1269,8 +1327,11 @@ bool Monitor::Analyse()
|
|||
{
|
||||
if ( state == IDLE || state == TAPE || event_close_mode == CLOSE_TIME )
|
||||
{
|
||||
if ( state == IDLE || state == TAPE )
|
||||
if ( state == TAPE )
|
||||
{
|
||||
shared_data->state = state = IDLE;
|
||||
Info( "%s: %03d - Closing event %d, section end", name, image_count, event->Id() )
|
||||
}
|
||||
else
|
||||
Info( "%s: %03d - Closing event %d, section end forced ", name, image_count, event->Id() );
|
||||
closeEvent();
|
||||
|
@ -1284,7 +1345,6 @@ bool Monitor::Analyse()
|
|||
}
|
||||
if ( !event )
|
||||
{
|
||||
shared_data->state = state = TAPE;
|
||||
|
||||
// Create event
|
||||
event = new Event( this, *timestamp, "Continuous", noteSetMap );
|
||||
|
@ -1292,6 +1352,12 @@ bool Monitor::Analyse()
|
|||
|
||||
Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() );
|
||||
|
||||
/* To prevent cancelling out an existing alert\prealarm\alarm state */
|
||||
if ( state == IDLE )
|
||||
{
|
||||
shared_data->state = state = TAPE;
|
||||
}
|
||||
|
||||
//if ( config.overlap_timed_events )
|
||||
if ( false )
|
||||
{
|
||||
|
@ -1493,23 +1559,6 @@ bool Monitor::Analyse()
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( function == RECORD || function == MOCORD )
|
||||
{
|
||||
if ( state == IDLE || state == TAPE )
|
||||
{
|
||||
int section_mod = timestamp->tv_sec%section_length;
|
||||
if ( section_mod < last_section_mod )
|
||||
{
|
||||
Info( "%s: %03d - Closing event %d, section end2", name, image_count, event->Id() );
|
||||
closeEvent();
|
||||
last_section_mod = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
last_section_mod = section_mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1522,7 +1571,7 @@ bool Monitor::Analyse()
|
|||
shared_data->state = state = IDLE;
|
||||
last_section_mod = 0;
|
||||
}
|
||||
if ( signal && (function == MODECT || function == MOCORD) && (config.blend_alarmed_images || state != ALARM) )
|
||||
if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) && (config.blend_alarmed_images || state != ALARM) )
|
||||
{
|
||||
ref_image.Blend( *snap_image, ref_blend_perc );
|
||||
}
|
||||
|
@ -1665,7 +1714,7 @@ void Monitor::ReloadLinkedMonitors( const char *p_linked_monitors )
|
|||
{
|
||||
*dest_ptr = '\0';
|
||||
int link_id = atoi(link_id_str);
|
||||
if ( link_id > 0 )
|
||||
if ( link_id > 0 && link_id != id)
|
||||
{
|
||||
Debug( 3, "Found linked monitor id %d", link_id );
|
||||
int j;
|
||||
|
@ -1690,9 +1739,9 @@ void Monitor::ReloadLinkedMonitors( const char *p_linked_monitors )
|
|||
if ( n_link_ids > 0 )
|
||||
{
|
||||
Debug( 1, "Linking to %d monitors", n_link_ids );
|
||||
n_linked_monitors = n_link_ids;
|
||||
linked_monitors = new MonitorLink *[n_linked_monitors];
|
||||
for ( int i = 0; i < n_linked_monitors; i++ )
|
||||
linked_monitors = new MonitorLink *[n_link_ids];
|
||||
int count = 0;
|
||||
for ( int i = 0; i < n_link_ids; i++ )
|
||||
{
|
||||
Debug( 1, "Checking linked monitor %d", link_ids[i] );
|
||||
|
||||
|
@ -1715,14 +1764,15 @@ void Monitor::ReloadLinkedMonitors( const char *p_linked_monitors )
|
|||
{
|
||||
MYSQL_ROW dbrow = mysql_fetch_row( result );
|
||||
Debug( 1, "Linking to monitor %d", link_ids[i] );
|
||||
linked_monitors[i] = new MonitorLink( link_ids[i], dbrow[1] );
|
||||
linked_monitors[count++] = new MonitorLink( link_ids[i], dbrow[1] );
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug( 1, "Can't link to monitor %d, invalid id, function or not enabled", link_ids[i] );
|
||||
Warning( "Can't link to monitor %d, invalid id, function or not enabled", link_ids[i] );
|
||||
}
|
||||
mysql_free_result( result );
|
||||
}
|
||||
n_linked_monitors = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1733,11 +1783,11 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !device[0] )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -1772,8 +1822,10 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
int height = atoi(dbrow[col]); col++;
|
||||
int colours = atoi(dbrow[col]); col++;
|
||||
int palette = atoi(dbrow[col]); col++;
|
||||
Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
|
||||
unsigned int deinterlacing = atoi(dbrow[col]); col++;
|
||||
int brightness = atoi(dbrow[col]); col++;
|
||||
int contrast = atoi(dbrow[col]); col++;
|
||||
int hue = atoi(dbrow[col]); col++;
|
||||
|
@ -1808,6 +1860,8 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
||||
int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
|
||||
|
||||
int extras = (deinterlacing>>24)&0xff;
|
||||
|
||||
Camera *camera = new LocalCamera(
|
||||
id,
|
||||
device,
|
||||
|
@ -1816,12 +1870,14 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
method,
|
||||
cam_width,
|
||||
cam_height,
|
||||
colours,
|
||||
palette,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
colour,
|
||||
purpose==CAPTURE
|
||||
purpose==CAPTURE,
|
||||
extras
|
||||
);
|
||||
|
||||
monitors[i] = new Monitor(
|
||||
|
@ -1832,6 +1888,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
linked_monitors,
|
||||
camera,
|
||||
orientation,
|
||||
deinterlacing,
|
||||
event_prefix,
|
||||
label_format,
|
||||
Coord( label_x, label_y ),
|
||||
|
@ -1873,11 +1930,11 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !protocol )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -1913,8 +1970,10 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
int height = atoi(dbrow[col]); col++;
|
||||
int palette = atoi(dbrow[col]); col++;
|
||||
int colours = atoi(dbrow[col]); col++;
|
||||
/* int palette = atoi(dbrow[col]); */ col++;
|
||||
Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
|
||||
unsigned int deinterlacing = atoi(dbrow[col]); col++;
|
||||
int brightness = atoi(dbrow[col]); col++;
|
||||
int contrast = atoi(dbrow[col]); col++;
|
||||
int hue = atoi(dbrow[col]); col++;
|
||||
|
@ -1954,7 +2013,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
path, // Path
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -1973,7 +2032,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
path, // Path
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -1995,6 +2054,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
|||
linked_monitors,
|
||||
camera,
|
||||
orientation,
|
||||
deinterlacing,
|
||||
event_prefix.c_str(),
|
||||
label_format.c_str(),
|
||||
Coord( label_x, label_y ),
|
||||
|
@ -2035,11 +2095,11 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !file[0] )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -2071,8 +2131,10 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
int height = atoi(dbrow[col]); col++;
|
||||
int palette = atoi(dbrow[col]); col++;
|
||||
int colours = atoi(dbrow[col]); col++;
|
||||
/* int palette = atoi(dbrow[col]); */ col++;
|
||||
Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
|
||||
unsigned int deinterlacing = atoi(dbrow[col]); col++;
|
||||
int brightness = atoi(dbrow[col]); col++;
|
||||
int contrast = atoi(dbrow[col]); col++;
|
||||
int hue = atoi(dbrow[col]); col++;
|
||||
|
@ -2106,7 +2168,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
path, // File
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -2122,6 +2184,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
|||
linked_monitors,
|
||||
camera,
|
||||
orientation,
|
||||
deinterlacing,
|
||||
event_prefix,
|
||||
label_format,
|
||||
Coord( label_x, label_y ),
|
||||
|
@ -2163,11 +2226,11 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
if ( !file[0] )
|
||||
{
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
|
||||
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -2199,8 +2262,10 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
int height = atoi(dbrow[col]); col++;
|
||||
int palette = atoi(dbrow[col]); col++;
|
||||
int colours = atoi(dbrow[col]); col++;
|
||||
/* int palette = atoi(dbrow[col]); */ col++;
|
||||
Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
|
||||
unsigned int deinterlacing = atoi(dbrow[col]); col++;
|
||||
int brightness = atoi(dbrow[col]); col++;
|
||||
int contrast = atoi(dbrow[col]); col++;
|
||||
int hue = atoi(dbrow[col]); col++;
|
||||
|
@ -2234,7 +2299,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
path, // File
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -2250,6 +2315,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
linked_monitors,
|
||||
camera,
|
||||
orientation,
|
||||
deinterlacing,
|
||||
event_prefix,
|
||||
label_format,
|
||||
Coord( label_x, label_y ),
|
||||
|
@ -2289,7 +2355,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
|||
Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
||||
{
|
||||
static char sql[ZM_SQL_MED_BUFSIZ];
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id );
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
Error( "Can't run query: %s", mysql_error( &dbconn ) );
|
||||
|
@ -2328,8 +2394,10 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
int height = atoi(dbrow[col]); col++;
|
||||
int colours = atoi(dbrow[col]); col++;
|
||||
int palette = atoi(dbrow[col]); col++;
|
||||
Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
|
||||
unsigned int deinterlacing = atoi(dbrow[col]); col++;
|
||||
int brightness = atoi(dbrow[col]); col++;
|
||||
int contrast = atoi(dbrow[col]); col++;
|
||||
int hue = atoi(dbrow[col]); col++;
|
||||
|
@ -2363,6 +2431,8 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
||||
int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
|
||||
|
||||
int extras = (deinterlacing>>24)&0xff;
|
||||
|
||||
Camera *camera = 0;
|
||||
if ( type == "Local" )
|
||||
{
|
||||
|
@ -2375,12 +2445,14 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
method,
|
||||
cam_width,
|
||||
cam_height,
|
||||
colours,
|
||||
palette,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
colour,
|
||||
purpose==CAPTURE
|
||||
purpose==CAPTURE,
|
||||
extras
|
||||
);
|
||||
#else // ZM_HAS_V4L
|
||||
Fatal( "You must have video4linux libraries and headers installed to use local analog or USB cameras for monitor %d", id );
|
||||
|
@ -2398,7 +2470,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
path.c_str(),
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -2417,7 +2489,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
path.c_str(),
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -2440,7 +2512,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
path.c_str(),
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -2456,7 +2528,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
path.c_str(),
|
||||
cam_width,
|
||||
cam_height,
|
||||
palette,
|
||||
colours,
|
||||
brightness,
|
||||
contrast,
|
||||
hue,
|
||||
|
@ -2479,6 +2551,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
linked_monitors.c_str(),
|
||||
camera,
|
||||
orientation,
|
||||
deinterlacing,
|
||||
event_prefix.c_str(),
|
||||
label_format.c_str(),
|
||||
Coord( label_x, label_y ),
|
||||
|
@ -2521,16 +2594,58 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
|||
|
||||
int Monitor::Capture()
|
||||
{
|
||||
int captureResult = camera->Capture( image );
|
||||
if ( captureResult == 1 )
|
||||
static int FirstCapture = 1;
|
||||
int captureResult;
|
||||
|
||||
int index = image_count%image_buffer_count;
|
||||
Image* capture_image = image_buffer[index].image;
|
||||
|
||||
if ( (deinterlacing & 0xff) == 4) {
|
||||
if ( FirstCapture != 1 ) {
|
||||
/* Copy the next image into the shared memory */
|
||||
capture_image->CopyBuffer(*(next_buffer.image));
|
||||
}
|
||||
|
||||
/* Capture a new next image */
|
||||
captureResult = camera->Capture(*(next_buffer.image));
|
||||
|
||||
if ( FirstCapture ) {
|
||||
FirstCapture = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Capture directly into image buffer, avoiding the need to memcpy() */
|
||||
captureResult = camera->Capture(*capture_image);
|
||||
}
|
||||
|
||||
if ( captureResult != 0 )
|
||||
{
|
||||
// Unable to capture image for temporary reason
|
||||
// Fake a signal loss image
|
||||
image.Fill( signal_check_colour );
|
||||
capture_image->Fill( signal_check_colour );
|
||||
captureResult = 0;
|
||||
} else {
|
||||
captureResult = 1;
|
||||
}
|
||||
if ( captureResult == 0 )
|
||||
|
||||
if ( captureResult == 1 )
|
||||
{
|
||||
|
||||
/* Deinterlacing */
|
||||
if ( (deinterlacing & 0xff) == 1 ) {
|
||||
capture_image->Deinterlace_Discard();
|
||||
} else if ( (deinterlacing & 0xff) == 2 ) {
|
||||
capture_image->Deinterlace_Linear();
|
||||
} else if ( (deinterlacing & 0xff) == 3 ) {
|
||||
capture_image->Deinterlace_Blend();
|
||||
} else if ( (deinterlacing & 0xff) == 4 ) {
|
||||
capture_image->Deinterlace_4Field( next_buffer.image, (deinterlacing>>8)&0xff );
|
||||
} else if ( (deinterlacing & 0xff) == 5 ) {
|
||||
capture_image->Deinterlace_Blend_CustomRatio( (deinterlacing>>8)&0xff );
|
||||
}
|
||||
|
||||
|
||||
if ( orientation != ROTATE_0 )
|
||||
{
|
||||
switch ( orientation )
|
||||
|
@ -2544,25 +2659,27 @@ int Monitor::Capture()
|
|||
case ROTATE_180 :
|
||||
case ROTATE_270 :
|
||||
{
|
||||
image.Rotate( (orientation-1)*90 );
|
||||
capture_image->Rotate( (orientation-1)*90 );
|
||||
break;
|
||||
}
|
||||
case FLIP_HORI :
|
||||
case FLIP_VERT :
|
||||
{
|
||||
image.Flip( orientation==FLIP_HORI );
|
||||
capture_image->Flip( orientation==FLIP_HORI );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( image.Size() != camera->ImageSize() )
|
||||
}
|
||||
if ( true ) {
|
||||
|
||||
if ( capture_image->Size() != camera->ImageSize() )
|
||||
{
|
||||
Error( "Captured image does not match expected size, check width, height and colour depth" );
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
int index = image_count%image_buffer_count;
|
||||
if ( (index == shared_data->last_read_index) && (function > MONITOR) )
|
||||
{
|
||||
Warning( "Buffer overrun at index %d, image %d, slow down capture, speed up analysis or increase ring buffer size", index, image_count );
|
||||
|
@ -2579,11 +2696,9 @@ int Monitor::Capture()
|
|||
gettimeofday( image_buffer[index].timestamp, NULL );
|
||||
if ( config.timestamp_on_capture )
|
||||
{
|
||||
TimestampImage( &image, image_buffer[index].timestamp );
|
||||
TimestampImage( capture_image, image_buffer[index].timestamp );
|
||||
}
|
||||
image_buffer[index].image->CopyBuffer( image );
|
||||
|
||||
shared_data->signal = CheckSignal( &image );
|
||||
shared_data->signal = CheckSignal(capture_image);
|
||||
shared_data->last_write_index = index;
|
||||
shared_data->last_write_time = image_buffer[index].timestamp->tv_sec;
|
||||
|
||||
|
@ -2697,7 +2812,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
ref_image.WriteJpeg( diag_path );
|
||||
}
|
||||
|
||||
Image *delta_image = ref_image.Delta( comp_image );
|
||||
ref_image.Delta( comp_image, &delta_image);
|
||||
|
||||
if ( config.record_diag_images )
|
||||
{
|
||||
|
@ -2706,7 +2821,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%d/diag-d.jpg", config.dir_events, id );
|
||||
}
|
||||
delta_image->WriteJpeg( diag_path );
|
||||
delta_image.WriteJpeg( diag_path );
|
||||
}
|
||||
|
||||
// Blank out all exclusion zones
|
||||
|
@ -2719,7 +2834,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
continue;
|
||||
}
|
||||
Debug( 3, "Blanking inactive zone %s", zone->Label() );
|
||||
delta_image->Fill( RGB_BLACK, zone->GetPolygon() );
|
||||
delta_image.Fill( RGB_BLACK, zone->GetPolygon() );
|
||||
}
|
||||
|
||||
// Check preclusive zones first
|
||||
|
@ -2731,7 +2846,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
continue;
|
||||
}
|
||||
Debug( 3, "Checking preclusive zone %s", zone->Label() );
|
||||
if ( zone->CheckAlarms( delta_image ) )
|
||||
if ( zone->CheckAlarms( &delta_image ) )
|
||||
{
|
||||
alarm = true;
|
||||
score += zone->Score();
|
||||
|
@ -2760,7 +2875,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
continue;
|
||||
}
|
||||
Debug( 3, "Checking active zone %s", zone->Label() );
|
||||
if ( zone->CheckAlarms( delta_image ) )
|
||||
if ( zone->CheckAlarms( &delta_image ) )
|
||||
{
|
||||
alarm = true;
|
||||
score += zone->Score();
|
||||
|
@ -2788,7 +2903,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
continue;
|
||||
}
|
||||
Debug( 3, "Checking inclusive zone %s", zone->Label() );
|
||||
if ( zone->CheckAlarms( delta_image ) )
|
||||
if ( zone->CheckAlarms( &delta_image ) )
|
||||
{
|
||||
alarm = true;
|
||||
score += zone->Score();
|
||||
|
@ -2817,7 +2932,7 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
continue;
|
||||
}
|
||||
Debug( 3, "Checking exclusive zone %s", zone->Label() );
|
||||
if ( zone->CheckAlarms( delta_image ) )
|
||||
if ( zone->CheckAlarms( &delta_image ) )
|
||||
{
|
||||
alarm = true;
|
||||
score += zone->Score();
|
||||
|
@ -2841,7 +2956,6 @@ unsigned int Monitor::DetectMotion( const Image &comp_image, Event::StringSet &z
|
|||
shared_data->alarm_x = shared_data->alarm_y = -1;
|
||||
}
|
||||
|
||||
delete delta_image;
|
||||
// This is a small and innocent hack to prevent scores of 0 being returned in alarm state
|
||||
return( score?score:alarm );
|
||||
}
|
||||
|
@ -2888,6 +3002,7 @@ bool Monitor::DumpSettings( char *output, bool verbose )
|
|||
}
|
||||
#endif // ZM_HAS_V4L
|
||||
sprintf( output+strlen(output), "Colours : %d\n", camera->Colours() );
|
||||
sprintf( output+strlen(output), "Subpixel Order : %d\n", camera->SubpixelOrder() );
|
||||
sprintf( output+strlen(output), "Event Prefix : %s\n", event_prefix );
|
||||
sprintf( output+strlen(output), "Label Format : %s\n", label_format );
|
||||
sprintf( output+strlen(output), "Label Coord : %d,%d\n", label_coord.X(), label_coord.Y() );
|
||||
|
@ -3327,7 +3442,7 @@ bool MonitorStream::sendFrame( Image *image, struct timeval *timestamp )
|
|||
{
|
||||
if ( !vid_stream )
|
||||
{
|
||||
vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, send_image->Colours(), send_image->Width(), send_image->Height() );
|
||||
vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, send_image->Colours(), send_image->SubpixelOrder(), send_image->Width(), send_image->Height() );
|
||||
fprintf( stdout, "Content-type: %s\r\n\r\n", vid_stream->MimeType() );
|
||||
vid_stream->OpenStream();
|
||||
}
|
||||
|
@ -3359,7 +3474,7 @@ bool MonitorStream::sendFrame( Image *image, struct timeval *timestamp )
|
|||
break;
|
||||
case STREAM_RAW :
|
||||
fprintf( stdout, "Content-Type: image/x-rgb\r\n" );
|
||||
img_buffer = send_image->Buffer();
|
||||
img_buffer = (uint8_t*)send_image->Buffer();
|
||||
img_buffer_size = send_image->Size();
|
||||
break;
|
||||
case STREAM_ZIP :
|
||||
|
@ -3464,7 +3579,7 @@ void MonitorStream::runStream()
|
|||
while ( !zm_terminate )
|
||||
{
|
||||
bool got_command = false;
|
||||
if ( feof( stdout ) || ferror( stdout ) )
|
||||
if ( feof( stdout ) || ferror( stdout ) || !monitor->ShmValid() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -3473,7 +3588,9 @@ void MonitorStream::runStream()
|
|||
|
||||
if ( connkey )
|
||||
{
|
||||
got_command = checkCommandQueue();
|
||||
while(checkCommandQueue()) {
|
||||
got_command = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool frame_sent = false;
|
||||
|
|
|
@ -23,11 +23,13 @@
|
|||
#include "zm.h"
|
||||
#include "zm_coord.h"
|
||||
#include "zm_image.h"
|
||||
#include "zm_rgb.h"
|
||||
#include "zm_zone.h"
|
||||
#include "zm_event.h"
|
||||
#include "zm_camera.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define SIGNAL_CAUSE "Signal"
|
||||
#define MOTION_CAUSE "Motion"
|
||||
|
@ -85,43 +87,64 @@ protected:
|
|||
|
||||
typedef enum { CLOSE_TIME, CLOSE_IDLE, CLOSE_ALARM } EventCloseMode;
|
||||
|
||||
/* sizeof(SharedData) expected to be 336 bytes on 32bit and 64bit */
|
||||
typedef struct
|
||||
{
|
||||
int size;
|
||||
bool valid;
|
||||
bool active;
|
||||
bool signal;
|
||||
State state;
|
||||
int last_write_index;
|
||||
int last_read_index;
|
||||
time_t last_write_time;
|
||||
time_t last_read_time;
|
||||
int last_event;
|
||||
int action;
|
||||
int brightness;
|
||||
int hue;
|
||||
int colour;
|
||||
int contrast;
|
||||
int alarm_x;
|
||||
int alarm_y;
|
||||
char control_state[256];
|
||||
uint32_t size; /* +0 */
|
||||
uint32_t last_write_index; /* +4 */
|
||||
uint32_t last_read_index; /* +8 */
|
||||
uint32_t state; /* +12 */
|
||||
uint32_t last_event; /* +16 */
|
||||
uint32_t action; /* +20 */
|
||||
int32_t brightness; /* +24 */
|
||||
int32_t hue; /* +28 */
|
||||
int32_t colour; /* +32 */
|
||||
int32_t contrast; /* +36 */
|
||||
int32_t alarm_x; /* +40 */
|
||||
int32_t alarm_y; /* +44 */
|
||||
uint8_t valid; /* +48 */
|
||||
uint8_t active; /* +49 */
|
||||
uint8_t signal; /* +50 */
|
||||
uint8_t format; /* +51 */
|
||||
uint32_t imagesize; /* +52 */
|
||||
uint32_t epadding1; /* +56 */
|
||||
uint32_t epadding2; /* +60 */
|
||||
/*
|
||||
** This keeps 32bit time_t and 64bit time_t identical and compatible as long as time is before 2038.
|
||||
** Shared memory layout should be identical for both 32bit and 64bit and is multiples of 16.
|
||||
*/
|
||||
union { /* +64 */
|
||||
time_t last_write_time;
|
||||
uint64_t extrapad1;
|
||||
};
|
||||
union { /* +72 */
|
||||
time_t last_read_time;
|
||||
uint64_t extrapad2;
|
||||
};
|
||||
uint8_t control_state[256]; /* +80 */
|
||||
|
||||
} SharedData;
|
||||
|
||||
typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState;
|
||||
|
||||
/* sizeof(TriggerData) expected to be 560 on 32bit & and 64bit */
|
||||
typedef struct
|
||||
{
|
||||
int size;
|
||||
TriggerState trigger_state;
|
||||
int trigger_score;
|
||||
uint32_t size;
|
||||
uint32_t trigger_state;
|
||||
uint32_t trigger_score;
|
||||
uint32_t padding;
|
||||
char trigger_cause[32];
|
||||
char trigger_text[256];
|
||||
char trigger_showtext[256];
|
||||
} TriggerData;
|
||||
|
||||
/* sizeof(Snapshot) expected to be 16 bytes on 32bit and 32 bytes on 64bit */
|
||||
struct Snapshot
|
||||
{
|
||||
struct timeval *timestamp;
|
||||
Image *image;
|
||||
void* padding;
|
||||
};
|
||||
|
||||
class MonitorLink
|
||||
|
@ -142,8 +165,8 @@ protected:
|
|||
int mem_size;
|
||||
unsigned char *mem_ptr;
|
||||
|
||||
SharedData *shared_data;
|
||||
TriggerData *trigger_data;
|
||||
volatile SharedData *shared_data;
|
||||
volatile TriggerData *trigger_data;
|
||||
|
||||
int last_state;
|
||||
int last_event;
|
||||
|
@ -187,6 +210,7 @@ protected:
|
|||
unsigned int width; // Normally the same as the camera, but not if partly rotated
|
||||
unsigned int height; // Normally the same as the camera, but not if partly rotated
|
||||
Orientation orientation; // Whether the image has to be rotated at all
|
||||
unsigned int deinterlacing;
|
||||
int brightness; // The statically saved brightness of the camera
|
||||
int contrast; // The statically saved contrast of the camera
|
||||
int hue; // The statically saved hue of the camera
|
||||
|
@ -210,7 +234,7 @@ protected:
|
|||
Rgb signal_check_colour; // The colour that the camera will emit when no video signal detected
|
||||
|
||||
double fps;
|
||||
Image image;
|
||||
Image delta_image;
|
||||
Image ref_image;
|
||||
|
||||
Purpose purpose; // What this monitor has been created to do
|
||||
|
@ -241,6 +265,7 @@ protected:
|
|||
TriggerData *trigger_data;
|
||||
|
||||
Snapshot *image_buffer;
|
||||
Snapshot next_buffer; /* Used by four field deinterlacing */
|
||||
|
||||
Camera *camera;
|
||||
|
||||
|
@ -253,7 +278,7 @@ protected:
|
|||
MonitorLink **linked_monitors;
|
||||
|
||||
public:
|
||||
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
~Monitor();
|
||||
|
||||
void AddZones( int p_n_zones, Zone *p_zones[] );
|
||||
|
@ -300,7 +325,9 @@ public:
|
|||
|
||||
unsigned int Width() const { return( width ); }
|
||||
unsigned int Height() const { return( height ); }
|
||||
unsigned int Colours() const { return( camera->Colours() ); }
|
||||
unsigned int Colours() const { return( camera->Colours() ); }
|
||||
unsigned int SubpixelOrder() const { return( camera->SubpixelOrder() ); }
|
||||
|
||||
|
||||
State GetState() const;
|
||||
int GetImage( int index=-1, int scale=100 ) const;
|
||||
|
@ -314,7 +341,7 @@ public:
|
|||
void ForceAlarmOn( int force_score, const char *force_case, const char *force_text="" );
|
||||
void ForceAlarmOff();
|
||||
void CancelForced();
|
||||
TriggerState GetTriggerState() const { return( trigger_data?trigger_data->trigger_state:TRIGGER_CANCEL ); }
|
||||
TriggerState GetTriggerState() const { return( (TriggerState)(trigger_data?trigger_data->trigger_state:TRIGGER_CANCEL )); }
|
||||
|
||||
void actionReload();
|
||||
void actionEnable();
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "zm.h"
|
||||
#include "zm_rgb.h"
|
||||
#include "zm_mpeg.h"
|
||||
|
||||
#if HAVE_LIBAVCODEC
|
||||
|
@ -68,9 +69,45 @@ void VideoStream::SetupFormat( const char *p_filename, const char *p_format )
|
|||
snprintf( ofc->filename, sizeof(ofc->filename), "%s", filename );
|
||||
}
|
||||
|
||||
void VideoStream::SetupCodec( int colours, int width, int height, int bitrate, double frame_rate )
|
||||
void VideoStream::SetupCodec( int colours, int subpixelorder, int width, int height, int bitrate, double frame_rate )
|
||||
{
|
||||
pf = (colours==1?PIX_FMT_GRAY8:PIX_FMT_RGB24);
|
||||
/* ffmpeg format matching */
|
||||
switch(colours) {
|
||||
case ZM_COLOUR_RGB24:
|
||||
{
|
||||
if(subpixelorder == ZM_SUBPIX_ORDER_BGR) {
|
||||
/* BGR subpixel order */
|
||||
pf = PIX_FMT_BGR24;
|
||||
} else {
|
||||
/* Assume RGB subpixel order */
|
||||
pf = PIX_FMT_RGB24;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ZM_COLOUR_RGB32:
|
||||
{
|
||||
if(subpixelorder == ZM_SUBPIX_ORDER_ARGB) {
|
||||
/* ARGB subpixel order */
|
||||
pf = PIX_FMT_ARGB;
|
||||
} else if(subpixelorder == ZM_SUBPIX_ORDER_ABGR) {
|
||||
/* ABGR subpixel order */
|
||||
pf = PIX_FMT_ABGR;
|
||||
} else if(subpixelorder == ZM_SUBPIX_ORDER_BGRA) {
|
||||
/* BGRA subpixel order */
|
||||
pf = PIX_FMT_BGRA;
|
||||
} else {
|
||||
/* Assume RGBA subpixel order */
|
||||
pf = PIX_FMT_RGBA;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ZM_COLOUR_GRAY8:
|
||||
pf = PIX_FMT_GRAY8;
|
||||
break;
|
||||
default:
|
||||
Panic("Unexpected colours: %d",colours);
|
||||
break;
|
||||
}
|
||||
|
||||
/* add the video streams using the default format codecs
|
||||
and initialize the codecs */
|
||||
|
@ -188,7 +225,7 @@ void VideoStream::OpenStream()
|
|||
Panic( "Could not allocate opicture" );
|
||||
}
|
||||
int size = avpicture_get_size( c->pix_fmt, c->width, c->height);
|
||||
uint8_t *opicture_buf = (uint8_t *)malloc(size);
|
||||
uint8_t *opicture_buf = (uint8_t *)av_malloc(size);
|
||||
if ( !opicture_buf )
|
||||
{
|
||||
av_free(opicture);
|
||||
|
@ -196,7 +233,7 @@ void VideoStream::OpenStream()
|
|||
}
|
||||
avpicture_fill( (AVPicture *)opicture, opicture_buf, c->pix_fmt, c->width, c->height );
|
||||
|
||||
/* if the output format is not RGB24, then a temporary RGB24
|
||||
/* if the output format is not identical to the input format, then a temporary
|
||||
picture is needed too. It is then converted to the required
|
||||
output format */
|
||||
tmp_opicture = NULL;
|
||||
|
@ -208,7 +245,7 @@ void VideoStream::OpenStream()
|
|||
Panic( "Could not allocate temporary opicture" );
|
||||
}
|
||||
int size = avpicture_get_size( pf, c->width, c->height);
|
||||
uint8_t *tmp_opicture_buf = (uint8_t *)malloc(size);
|
||||
uint8_t *tmp_opicture_buf = (uint8_t *)av_malloc(size);
|
||||
if (!tmp_opicture_buf)
|
||||
{
|
||||
av_free( tmp_opicture );
|
||||
|
@ -244,7 +281,7 @@ void VideoStream::OpenStream()
|
|||
av_write_header(ofc);
|
||||
}
|
||||
|
||||
VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height )
|
||||
VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int subpixelorder, int width, int height )
|
||||
{
|
||||
if ( !initialised )
|
||||
{
|
||||
|
@ -252,7 +289,7 @@ VideoStream::VideoStream( const char *filename, const char *format, int bitrate,
|
|||
}
|
||||
|
||||
SetupFormat( filename, format );
|
||||
SetupCodec( colours, width, height, bitrate, frame_rate );
|
||||
SetupCodec( colours, subpixelorder, width, height, bitrate, frame_rate );
|
||||
SetParameters();
|
||||
}
|
||||
|
||||
|
@ -303,7 +340,7 @@ VideoStream::~VideoStream()
|
|||
av_free(ofc);
|
||||
}
|
||||
|
||||
double VideoStream::EncodeFrame( uint8_t *buffer, int buffer_size, bool add_timestamp, unsigned int timestamp )
|
||||
double VideoStream::EncodeFrame( const uint8_t *buffer, int buffer_size, bool add_timestamp, unsigned int timestamp )
|
||||
{
|
||||
#ifdef HAVE_LIBSWSCALE
|
||||
static struct SwsContext *img_convert_ctx = 0;
|
||||
|
@ -337,7 +374,7 @@ double VideoStream::EncodeFrame( uint8_t *buffer, int buffer_size, bool add_time
|
|||
}
|
||||
sws_scale( img_convert_ctx, tmp_opicture->data, tmp_opicture->linesize, 0, c->height, opicture->data, opicture->linesize );
|
||||
#else // HAVE_LIBSWSCALE
|
||||
img_convert( (AVPicture *)opicture, c->pix_fmt, (AVPicture *)tmp_opicture, pf, c->width, c->height );
|
||||
Fatal("swscale is required for MPEG mode");
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
}
|
||||
else
|
||||
|
|
|
@ -54,15 +54,15 @@ protected:
|
|||
static void Initialise();
|
||||
|
||||
void SetupFormat( const char *p_filename, const char *format );
|
||||
void SetupCodec( int colours, int width, int height, int bitrate, double frame_rate );
|
||||
void SetupCodec( int colours, int subpixelorder, int width, int height, int bitrate, double frame_rate );
|
||||
void SetParameters();
|
||||
|
||||
public:
|
||||
VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int width, int height );
|
||||
VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int subpixelorder, int width, int height );
|
||||
~VideoStream();
|
||||
const char *MimeType() const;
|
||||
void OpenStream();
|
||||
double EncodeFrame( uint8_t *buffer, int buffer_size, bool add_timestamp=false, unsigned int timestamp=0 );
|
||||
double EncodeFrame( const uint8_t *buffer, int buffer_size, bool add_timestamp=false, unsigned int timestamp=0 );
|
||||
};
|
||||
|
||||
#endif // HAVE_LIBAVCODEC
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
#include "zm_utils.h"
|
||||
|
||||
RemoteCamera::RemoteCamera( int p_id, const std::string &p_protocol, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_palette, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
Camera( p_id, REMOTE_SRC, p_width, p_height, p_palette, p_brightness, p_contrast, p_hue, p_colour, p_capture ),
|
||||
RemoteCamera::RemoteCamera( int p_id, const std::string &p_protocol, const std::string &p_host, const std::string &p_port, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
|
||||
Camera( p_id, REMOTE_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture ),
|
||||
protocol( p_protocol ),
|
||||
host( p_host ),
|
||||
port( p_port ),
|
||||
|
|
|
@ -1102,7 +1102,7 @@ int RemoteCameraHttp::Capture( Image &image )
|
|||
{
|
||||
case JPEG :
|
||||
{
|
||||
if ( !image.DecodeJpeg( buffer.extract( content_length ), content_length ) )
|
||||
if ( !image.DecodeJpeg( buffer.extract( content_length ), content_length, colours, subpixelorder ) )
|
||||
{
|
||||
Error( "Unable to decode jpeg" );
|
||||
Disconnect();
|
||||
|
@ -1118,7 +1118,7 @@ int RemoteCameraHttp::Capture( Image &image )
|
|||
Disconnect();
|
||||
return( -1 );
|
||||
}
|
||||
image.Assign( width, height, colours, buffer );
|
||||
image.Assign( width, height, colours, subpixelorder, buffer, imagesize );
|
||||
break;
|
||||
}
|
||||
case X_RGBZ :
|
||||
|
@ -1129,7 +1129,7 @@ int RemoteCameraHttp::Capture( Image &image )
|
|||
Disconnect();
|
||||
return( -1 );
|
||||
}
|
||||
image.Assign( width, height, colours, buffer );
|
||||
image.Assign( width, height, colours, subpixelorder, buffer, imagesize );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
|
|
|
@ -47,10 +47,53 @@ RemoteCameraRtsp::RemoteCameraRtsp( int p_id, const std::string &p_method, const
|
|||
{
|
||||
Initialise();
|
||||
}
|
||||
|
||||
mFormatContext = NULL;
|
||||
mVideoStreamId = -1;
|
||||
mCodecContext = NULL;
|
||||
mCodec = NULL;
|
||||
mRawFrame = NULL;
|
||||
mFrame = NULL;
|
||||
frameCount = 0;
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
mConvertContext = NULL;
|
||||
#endif
|
||||
/* Has to be located inside the constructor so other components such as zma will receive correct colours and subpixel order */
|
||||
if(colours == ZM_COLOUR_RGB32) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_RGBA;
|
||||
imagePixFormat = PIX_FMT_RGBA;
|
||||
} else if(colours == ZM_COLOUR_RGB24) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_RGB;
|
||||
imagePixFormat = PIX_FMT_RGB24;
|
||||
} else if(colours == ZM_COLOUR_GRAY8) {
|
||||
subpixelorder = ZM_SUBPIX_ORDER_NONE;
|
||||
imagePixFormat = PIX_FMT_GRAY8;
|
||||
} else {
|
||||
Panic("Unexpected colours: %d",colours);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RemoteCameraRtsp::~RemoteCameraRtsp()
|
||||
{
|
||||
av_freep( &mFrame );
|
||||
av_freep( &mRawFrame );
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
if ( mConvertContext )
|
||||
{
|
||||
sws_freeContext( mConvertContext );
|
||||
mConvertContext = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( mCodecContext )
|
||||
{
|
||||
avcodec_close( mCodecContext );
|
||||
mCodecContext = NULL; // Freed by av_close_input_file
|
||||
}
|
||||
|
||||
if ( capture )
|
||||
{
|
||||
Terminate();
|
||||
|
@ -72,17 +115,11 @@ void RemoteCameraRtsp::Initialise()
|
|||
|
||||
av_register_all();
|
||||
|
||||
frameCount = 0;
|
||||
|
||||
Connect();
|
||||
}
|
||||
|
||||
void RemoteCameraRtsp::Terminate()
|
||||
{
|
||||
avcodec_close( codecContext );
|
||||
av_free( codecContext );
|
||||
av_free( picture );
|
||||
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
@ -119,36 +156,63 @@ int RemoteCameraRtsp::PrimeCapture()
|
|||
|
||||
Debug( 2, "Got sources" );
|
||||
|
||||
formatContext = rtspThread->getFormatContext();
|
||||
mFormatContext = rtspThread->getFormatContext();
|
||||
|
||||
// Find the first video stream
|
||||
int videoStream=-1;
|
||||
for ( int i = 0; i < formatContext->nb_streams; i++ )
|
||||
// Find first video stream present
|
||||
mVideoStreamId = -1;
|
||||
|
||||
for ( int i = 0; i < mFormatContext->nb_streams; i++ )
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
|
||||
if ( formatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
|
||||
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
|
||||
#else
|
||||
if ( formatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
|
||||
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
|
||||
#endif
|
||||
{
|
||||
videoStream = i;
|
||||
mVideoStreamId = i;
|
||||
break;
|
||||
}
|
||||
if ( videoStream == -1 )
|
||||
if ( mVideoStreamId == -1 )
|
||||
Fatal( "Unable to locate video stream" );
|
||||
|
||||
// Get a pointer to the codec context for the video stream
|
||||
codecContext = formatContext->streams[videoStream]->codec;
|
||||
mCodecContext = mFormatContext->streams[mVideoStreamId]->codec;
|
||||
|
||||
// Find the decoder for the video stream
|
||||
codec = avcodec_find_decoder( codecContext->codec_id );
|
||||
if ( codec == NULL )
|
||||
Panic( "Unable to locate codec %d decoder", codecContext->codec_id );
|
||||
mCodec = avcodec_find_decoder( mCodecContext->codec_id );
|
||||
if ( mCodec == NULL )
|
||||
Panic( "Unable to locate codec %d decoder", mCodecContext->codec_id );
|
||||
|
||||
// Open codec
|
||||
if ( avcodec_open( codecContext, codec ) < 0 )
|
||||
if ( avcodec_open( mCodecContext, mCodec ) < 0 )
|
||||
Panic( "Can't open codec" );
|
||||
|
||||
picture = avcodec_alloc_frame();
|
||||
// Allocate space for the native video frame
|
||||
mRawFrame = avcodec_alloc_frame();
|
||||
|
||||
// Allocate space for the converted video frame
|
||||
mFrame = avcodec_alloc_frame();
|
||||
|
||||
if(mRawFrame == NULL || mFrame == NULL)
|
||||
Fatal( "Unable to allocate frame(s)");
|
||||
|
||||
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
||||
if( pSize != imagesize) {
|
||||
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
||||
}
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
if(!sws_isSupportedInput(mCodecContext->pix_fmt)) {
|
||||
Fatal("swscale does not support the codec format: %c%c%c%c",(mCodecContext->pix_fmt)&0xff,((mCodecContext->pix_fmt>>8)&0xff),((mCodecContext->pix_fmt>>16)&0xff),((mCodecContext->pix_fmt>>24)&0xff));
|
||||
}
|
||||
|
||||
if(!sws_isSupportedOutput(imagePixFormat)) {
|
||||
Fatal("swscale does not support the target format: %c%c%c%c",(imagePixFormat)&0xff,((imagePixFormat>>8)&0xff),((imagePixFormat>>16)&0xff),((imagePixFormat>>24)&0xff));
|
||||
}
|
||||
|
||||
#else // HAVE_LIBSWSCALE
|
||||
Fatal( "You must compile ffmpeg with the --enable-swscale option to use RTSP cameras" );
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -167,101 +231,88 @@ int RemoteCameraRtsp::PreCapture()
|
|||
|
||||
int RemoteCameraRtsp::Capture( Image &image )
|
||||
{
|
||||
AVPacket packet;
|
||||
uint8_t* directbuffer;
|
||||
int frameComplete = false;
|
||||
|
||||
/* Request a writeable buffer of the target image */
|
||||
directbuffer = image.WriteBuffer(width, height, colours, subpixelorder);
|
||||
if(directbuffer == NULL) {
|
||||
Error("Failed requesting writeable buffer for the captured image.");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
while ( true )
|
||||
{
|
||||
buffer.clear();
|
||||
if ( !rtspThread->isRunning() )
|
||||
break;
|
||||
//if ( rtspThread->stopped() )
|
||||
//break;
|
||||
return (-1);
|
||||
|
||||
if ( rtspThread->getFrame( buffer ) )
|
||||
{
|
||||
Debug( 3, "Read frame %d bytes", buffer.size() );
|
||||
Debug( 4, "Address %p", buffer.head() );
|
||||
Hexdump( 4, buffer.head(), 16 );
|
||||
|
||||
static AVFrame *tmp_picture = NULL;
|
||||
|
||||
if ( !tmp_picture )
|
||||
{
|
||||
//if ( c->pix_fmt != pf )
|
||||
//{
|
||||
tmp_picture = avcodec_alloc_frame();
|
||||
if ( !tmp_picture )
|
||||
{
|
||||
Panic( "Could not allocate temporary opicture" );
|
||||
}
|
||||
int size = avpicture_get_size( PIX_FMT_RGB24, width, height);
|
||||
uint8_t *tmp_picture_buf = (uint8_t *)malloc(size);
|
||||
if (!tmp_picture_buf)
|
||||
{
|
||||
av_free( tmp_picture );
|
||||
Panic( "Could not allocate temporary opicture" );
|
||||
}
|
||||
avpicture_fill( (AVPicture *)tmp_picture, tmp_picture_buf, PIX_FMT_RGB24, width, height );
|
||||
//}
|
||||
}
|
||||
|
||||
if ( !buffer.size() )
|
||||
return( -1 );
|
||||
|
||||
AVPacket packet;
|
||||
av_init_packet( &packet );
|
||||
int initialFrameCount = frameCount;
|
||||
while ( buffer.size() > 0 )
|
||||
{
|
||||
int got_picture = false;
|
||||
packet.data = buffer.head();
|
||||
packet.size = buffer.size();
|
||||
int len = avcodec_decode_video2( codecContext, picture, &got_picture, &packet );
|
||||
if ( len < 0 )
|
||||
{
|
||||
if ( frameCount > initialFrameCount )
|
||||
{
|
||||
// Decoded at least one frame
|
||||
return( 0 );
|
||||
}
|
||||
Error( "Error while decoding frame %d", frameCount );
|
||||
Hexdump( Logger::ERROR, buffer.head(), buffer.size()>256?256:buffer.size() );
|
||||
buffer.clear();
|
||||
continue;
|
||||
//return( -1 );
|
||||
}
|
||||
Debug( 2, "Frame: %d - %d/%d", frameCount, len, buffer.size() );
|
||||
//if ( buffer.size() < 400 )
|
||||
//Hexdump( 0, buffer.head(), buffer.size() );
|
||||
|
||||
while ( !frameComplete && buffer.size() > 0 )
|
||||
{
|
||||
packet.data = buffer.head();
|
||||
packet.size = buffer.size();
|
||||
int len = avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet );
|
||||
if ( len < 0 )
|
||||
{
|
||||
Error( "Error while decoding frame %d", frameCount );
|
||||
Hexdump( Logger::ERROR, buffer.head(), buffer.size()>256?256:buffer.size() );
|
||||
buffer.clear();
|
||||
continue;
|
||||
}
|
||||
Debug( 2, "Frame: %d - %d/%d", frameCount, len, buffer.size() );
|
||||
//if ( buffer.size() < 400 )
|
||||
//Hexdump( 0, buffer.head(), buffer.size() );
|
||||
|
||||
buffer -= len;
|
||||
|
||||
if ( got_picture )
|
||||
{
|
||||
/* the picture is allocated by the decoder. no need to free it */
|
||||
Debug( 1, "Got picture %d", frameCount );
|
||||
}
|
||||
if ( frameComplete ) {
|
||||
|
||||
Debug( 3, "Got frame %d", frameCount );
|
||||
|
||||
avpicture_fill( (AVPicture *)mFrame, directbuffer, imagePixFormat, width, height);
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
if(mConvertContext == NULL) {
|
||||
if(config.cpu_extensions && sseversion >= 20) {
|
||||
mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC | SWS_CPU_CAPS_SSE2, NULL, NULL, NULL );
|
||||
} else {
|
||||
mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL );
|
||||
}
|
||||
if(mConvertContext == NULL)
|
||||
Fatal( "Unable to create conversion context");
|
||||
}
|
||||
|
||||
if ( sws_scale( mConvertContext, mRawFrame->data, mRawFrame->linesize, 0, mCodecContext->height, mFrame->data, mFrame->linesize ) < 0 )
|
||||
Fatal( "Unable to convert raw format %u to target format %u at frame %d", mCodecContext->pix_fmt, imagePixFormat, frameCount );
|
||||
#else // HAVE_LIBSWSCALE
|
||||
Fatal( "You must compile ffmpeg with the --enable-swscale option to use RTSP cameras" );
|
||||
#endif // HAVE_LIBSWSCALE
|
||||
|
||||
frameCount++;
|
||||
|
||||
static struct SwsContext *img_convert_ctx = 0;
|
||||
|
||||
if ( !img_convert_ctx )
|
||||
{
|
||||
img_convert_ctx = sws_getCachedContext( NULL, codecContext->width, codecContext->height, codecContext->pix_fmt, width, height, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL );
|
||||
if ( !img_convert_ctx )
|
||||
Panic( "Unable to initialise image scaling context" );
|
||||
}
|
||||
|
||||
sws_scale( img_convert_ctx, picture->data, picture->linesize, 0, height, tmp_picture->data, tmp_picture->linesize );
|
||||
|
||||
image.Assign( width, height, colours, tmp_picture->data[0] );
|
||||
|
||||
frameCount++;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "Unable to get picture from frame" );
|
||||
}
|
||||
buffer -= len;
|
||||
}
|
||||
}
|
||||
} /* frame complete */
|
||||
|
||||
av_free_packet( &packet );
|
||||
} /* getFrame() */
|
||||
|
||||
if(frameComplete)
|
||||
return (0);
|
||||
|
||||
}
|
||||
return( -1 );
|
||||
return (0) ;
|
||||
}
|
||||
|
||||
int RemoteCameraRtsp::PostCapture()
|
||||
|
|
|
@ -46,11 +46,21 @@ protected:
|
|||
|
||||
RtspThread *rtspThread;
|
||||
|
||||
AVFormatContext *formatContext;
|
||||
AVCodec *codec;
|
||||
AVCodecContext *codecContext;
|
||||
AVFrame *picture;
|
||||
int frameCount;
|
||||
|
||||
#if HAVE_LIBAVFORMAT
|
||||
AVFormatContext *mFormatContext;
|
||||
int mVideoStreamId;
|
||||
AVCodecContext *mCodecContext;
|
||||
AVCodec *mCodec;
|
||||
AVFrame *mRawFrame;
|
||||
AVFrame *mFrame;
|
||||
PixelFormat imagePixFormat;
|
||||
#endif // HAVE_LIBAVFORMAT
|
||||
|
||||
#if HAVE_LIBSWSCALE
|
||||
struct SwsContext *mConvertContext;
|
||||
#endif
|
||||
|
||||
public:
|
||||
RemoteCameraRtsp( int p_id, const std::string &method, const std::string &host, const std::string &port, const std::string &path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
||||
|
|
128
src/zm_rgb.h
128
src/zm_rgb.h
|
@ -20,11 +20,7 @@
|
|||
#ifndef ZM_RGB_H
|
||||
#define ZM_RGB_H
|
||||
|
||||
typedef unsigned int Rgb; // RGB colour type
|
||||
|
||||
#define RED(ptr) (*(ptr))
|
||||
#define GREEN(ptr) (*(ptr+1))
|
||||
#define BLUE(ptr) (*(ptr+2))
|
||||
typedef uint32_t Rgb; // RGB colour type
|
||||
|
||||
#define WHITE 0xff
|
||||
#define WHITE_R 0xff
|
||||
|
@ -38,16 +34,124 @@ typedef unsigned int Rgb; // RGB colour type
|
|||
|
||||
#define RGB_WHITE (0x00ffffff)
|
||||
#define RGB_BLACK (0x00000000)
|
||||
#define RGB_RED (0x00ff0000)
|
||||
#define RGB_RED (0x000000ff)
|
||||
#define RGB_GREEN (0x0000ff00)
|
||||
#define RGB_BLUE (0x000000ff)
|
||||
#define RGB_ORANGE (0x00ffa500)
|
||||
#define RGB_PURPLE (0x00800080)
|
||||
#define RGB_BLUE (0x00ff0000)
|
||||
#define RGB_ORANGE (0x0000a5ff)
|
||||
#define RGB_PURPLE (0x00800080)
|
||||
#define RGB_TRANSPARENT (0x01000000)
|
||||
|
||||
#define RGB_VAL(v,c) (((v)>>(16-((c)*8)))&0xff)
|
||||
#define RGB_RED_VAL(v) (((v)>>16)&0xff)
|
||||
#define RGB_GREEN_VAL(v) (((v)>>8)&0xff)
|
||||
#define RGB_BLUE_VAL(v) ((v)&0xff)
|
||||
|
||||
/* RGB or RGBA macros */
|
||||
#define BLUE_VAL_RGBA(v) (((v)>>16)&0xff)
|
||||
#define GREEN_VAL_RGBA(v) (((v)>>8)&0xff)
|
||||
#define RED_VAL_RGBA(v) ((v)&0xff)
|
||||
#define ALPHA_VAL_RGBA(v) ((v)>>24)&0xff)
|
||||
#define RED_PTR_RGBA(ptr) (*((uint8_t*)ptr))
|
||||
#define GREEN_PTR_RGBA(ptr) (*((uint8_t*)ptr+1))
|
||||
#define BLUE_PTR_RGBA(ptr) (*((uint8_t*)ptr+2))
|
||||
#define ALPHA_PTR_RGBA(ptr) (*((uint8_t*)ptr+3))
|
||||
|
||||
/* BGR or BGRA */
|
||||
#define RED_VAL_BGRA(v) (((v)>>16)&0xff)
|
||||
#define GREEN_VAL_BGRA(v) (((v)>>8)&0xff)
|
||||
#define BLUE_VAL_BGRA(v) ((v)&0xff)
|
||||
#define ALPHA_VAL_BGRA(v) ((v)>>24)&0xff)
|
||||
#define RED_PTR_BGRA(ptr) (*((uint8_t*)ptr+2))
|
||||
#define GREEN_PTR_BGRA(ptr) (*((uint8_t*)ptr+1))
|
||||
#define BLUE_PTR_BGRA(ptr) (*((uint8_t*)ptr))
|
||||
#define ALPHA_PTR_BGRA(ptr) (*((uint8_t*)ptr+3))
|
||||
|
||||
/* ARGB */
|
||||
#define BLUE_VAL_ARGB(v) (((v)>>24)&0xff)
|
||||
#define GREEN_VAL_ARGB(v) (((v)>>16)&0xff)
|
||||
#define RED_VAL_ARGB(v) (((v)>>8)&0xff)
|
||||
#define ALPHA_VAL_ARGB(v) ((v)&0xff)
|
||||
#define RED_PTR_ARGB(ptr) (*((uint8_t*)ptr+1))
|
||||
#define GREEN_PTR_ARGB(ptr) (*((uint8_t*)ptr+2))
|
||||
#define BLUE_PTR_ARGB(ptr) (*((uint8_t*)ptr+3))
|
||||
#define ALPHA_PTR_ARGB(ptr) (*((uint8_t*)ptr))
|
||||
|
||||
/* ABGR */
|
||||
#define BLUE_VAL_ABGR(v) (((v)>>8)&0xff)
|
||||
#define GREEN_VAL_ABGR(v) (((v)>>16)&0xff)
|
||||
#define RED_VAL_ABGR(v) (((v)>>24)&0xff)
|
||||
#define ALPHA_VAL_ABGR(v) ((v)&0xff)
|
||||
#define RED_PTR_ABGR(ptr) (*((uint8_t*)ptr+3))
|
||||
#define GREEN_PTR_ABGR(ptr) (*((uint8_t*)ptr+2))
|
||||
#define BLUE_PTR_ABGR(ptr) (*((uint8_t*)ptr+1))
|
||||
#define ALPHA_PTR_ABGR(ptr) (*((uint8_t*)ptr))
|
||||
|
||||
|
||||
#define RGBA_BGRA_ZEROALPHA(v) ((v)&0x00ffffff)
|
||||
#define ARGB_ABGR_ZEROALPHA(v) ((v)&0xffffff00)
|
||||
|
||||
/* ITU-R BT.709: Y = (0.2126 * R) + (0.7152 * G) + (0.0722 * B) */
|
||||
/* ITU-R BT.601: Y = (0.299 * R) + (0.587 * G) + (0.114 * B) */
|
||||
/* The formulas below produce an almost identical result to the weighted algorithms from the ITU-R BT.601 standard and the newer ITU-R BT.709 standard, but a lot faster */
|
||||
// #define RGB_FASTLUM_SINGLE_ITU709(v) ((RED(v)+RED(v)+BLUE(v)+GREEN(v)+GREEN(v)+GREEN(v)+GREEN(v)+GREEN(v))>>3)
|
||||
// #define RGB_FASTLUM_VALUES_ITU709(ra,ga,ba) (((ra)+(ra)+(ba)+(ga)+(ga)+(ga)+(ga)+(ga))>>3)
|
||||
// #define RGB_FASTLUM_SINGLE_ITU601(v) ((RED(v)+RED(v)+RED(v)+BLUE(v)+GREEN(v)+GREEN(v)+GREEN(v)+GREEN(v))>>3)
|
||||
// #define RGB_FASTLUM_VALUES_ITU601(ra,ga,ba) (((ra)+(ra)+(ra)+(ba)+(ga)+(ga)+(ga)+(ga))>>3)
|
||||
|
||||
/* ZM colours */
|
||||
#define ZM_COLOUR_RGB32 4
|
||||
#define ZM_COLOUR_RGB24 3
|
||||
#define ZM_COLOUR_GRAY8 1
|
||||
|
||||
/* Subpixel ordering */
|
||||
/* Based on byte order naming. For example, for ARGB (on both little endian or big endian) byte+0 should be alpha, byte+1 should be red, and so on. */
|
||||
#define ZM_SUBPIX_ORDER_NONE 2
|
||||
#define ZM_SUBPIX_ORDER_RGB 6
|
||||
#define ZM_SUBPIX_ORDER_BGR 5
|
||||
#define ZM_SUBPIX_ORDER_BGRA 7
|
||||
#define ZM_SUBPIX_ORDER_RGBA 8
|
||||
#define ZM_SUBPIX_ORDER_ABGR 9
|
||||
#define ZM_SUBPIX_ORDER_ARGB 10
|
||||
|
||||
/* A macro to use default subpixel order for a specified colour. */
|
||||
/* for grayscale it will use NONE, for 3 colours it will use R,G,B, for 4 colours it will use R,G,B,A */
|
||||
#define ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(c) ((c)<<1)
|
||||
|
||||
/* Convert RGB colour value into BGR\ARGB\ABGR */
|
||||
inline Rgb rgb_convert(Rgb p_col, int p_subpixorder) {
|
||||
Rgb result;
|
||||
|
||||
switch(p_subpixorder) {
|
||||
|
||||
case ZM_SUBPIX_ORDER_BGR:
|
||||
case ZM_SUBPIX_ORDER_BGRA:
|
||||
{
|
||||
BLUE_PTR_BGRA(&result) = BLUE_VAL_RGBA(p_col);
|
||||
GREEN_PTR_BGRA(&result) = GREEN_VAL_RGBA(p_col);
|
||||
RED_PTR_BGRA(&result) = RED_VAL_RGBA(p_col);
|
||||
}
|
||||
break;
|
||||
case ZM_SUBPIX_ORDER_ARGB:
|
||||
{
|
||||
BLUE_PTR_ARGB(&result) = BLUE_VAL_RGBA(p_col);
|
||||
GREEN_PTR_ARGB(&result) = GREEN_VAL_RGBA(p_col);
|
||||
RED_PTR_ARGB(&result) = RED_VAL_RGBA(p_col);
|
||||
}
|
||||
break;
|
||||
case ZM_SUBPIX_ORDER_ABGR:
|
||||
{
|
||||
BLUE_PTR_ABGR(&result) = BLUE_VAL_RGBA(p_col);
|
||||
GREEN_PTR_ABGR(&result) = GREEN_VAL_RGBA(p_col);
|
||||
RED_PTR_ABGR(&result) = RED_VAL_RGBA(p_col);
|
||||
}
|
||||
break;
|
||||
/* Grayscale */
|
||||
case ZM_SUBPIX_ORDER_NONE:
|
||||
result = p_col & 0xff;
|
||||
break;
|
||||
default:
|
||||
return p_col;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // ZM_RGB_H
|
||||
|
|
|
@ -233,7 +233,7 @@ bool StreamBase::sendTextFrame( const char *frame_text )
|
|||
{
|
||||
Debug( 2, "Sending text frame '%s'", frame_text );
|
||||
|
||||
Image image( monitor->Width(), monitor->Height(), monitor->Colours() );
|
||||
Image image( monitor->Width(), monitor->Height(), monitor->Colours(), monitor->SubpixelOrder() );
|
||||
image.Annotate( frame_text, image.centreCoord( frame_text ) );
|
||||
|
||||
if ( scale != 100 )
|
||||
|
@ -245,7 +245,7 @@ bool StreamBase::sendTextFrame( const char *frame_text )
|
|||
{
|
||||
if ( !vid_stream )
|
||||
{
|
||||
vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, image.Colours(), image.Width(), image.Height() );
|
||||
vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, image.Colours(), image.SubpixelOrder(), image.Width(), image.Height() );
|
||||
fprintf( stdout, "Content-type: %s\r\n\r\n", vid_stream->MimeType() );
|
||||
vid_stream->OpenStream();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef ZM_THREAD_H
|
||||
#define ZM_THREAD_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "zm_exception.h"
|
||||
#include "zm_utils.h"
|
||||
|
@ -146,38 +147,38 @@ private:
|
|||
mutable Condition mCondition;
|
||||
|
||||
public:
|
||||
ThreadData() : mCondition( mMutex )
|
||||
__attribute__((used)) ThreadData() : mCondition( mMutex )
|
||||
{
|
||||
}
|
||||
ThreadData( T value ) : mValue( value ), mCondition( mMutex )
|
||||
__attribute__((used)) ThreadData( T value ) : mValue( value ), mCondition( mMutex )
|
||||
{
|
||||
}
|
||||
//~ThreadData() {}
|
||||
|
||||
operator T() const
|
||||
__attribute__((used)) operator T() const
|
||||
{
|
||||
return( getValue() );
|
||||
}
|
||||
const T operator=( const T value )
|
||||
__attribute__((used)) const T operator=( const T value )
|
||||
{
|
||||
return( setValue( value ) );
|
||||
}
|
||||
|
||||
const T getValueImmediate() const
|
||||
__attribute__((used)) const T getValueImmediate() const
|
||||
{
|
||||
return( mValue );
|
||||
}
|
||||
T setValueImmediate( const T value )
|
||||
__attribute__((used)) T setValueImmediate( const T value )
|
||||
{
|
||||
return( mValue = value );
|
||||
}
|
||||
const T getValue() const;
|
||||
T setValue( const T value );
|
||||
const T getUpdatedValue() const;
|
||||
const T getUpdatedValue( double secs ) const;
|
||||
const T getUpdatedValue( int secs ) const;
|
||||
void updateValueSignal( const T value );
|
||||
void updateValueBroadcast( const T value );
|
||||
__attribute__((used)) const T getValue() const;
|
||||
__attribute__((used)) T setValue( const T value );
|
||||
__attribute__((used)) const T getUpdatedValue() const;
|
||||
__attribute__((used)) const T getUpdatedValue( double secs ) const;
|
||||
__attribute__((used)) const T getUpdatedValue( int secs ) const;
|
||||
__attribute__((used)) void updateValueSignal( const T value );
|
||||
__attribute__((used)) void updateValueBroadcast( const T value );
|
||||
};
|
||||
|
||||
class Thread
|
||||
|
|
104
src/zm_utils.cpp
104
src/zm_utils.cpp
|
@ -18,11 +18,15 @@
|
|||
//
|
||||
|
||||
//#include "zm_logger.h"
|
||||
#include "zm.h"
|
||||
#include "zm_utils.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
unsigned int sseversion = 0;
|
||||
|
||||
const std::string stringtf( const char *format, ... )
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -147,3 +151,103 @@ const std::string base64Encode( const std::string &inString )
|
|||
}
|
||||
return( outString );
|
||||
}
|
||||
|
||||
/* Sets sse_version */
|
||||
void ssedetect() {
|
||||
#if (defined(__i386__) || defined(__x86_64__))
|
||||
/* x86 or x86-64 processor */
|
||||
uint32_t r_edx, r_ecx;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"mov $0x1,%%eax\n\t"
|
||||
"cpuid\n\t"
|
||||
: "=d" (r_edx), "=c" (r_ecx)
|
||||
:
|
||||
: "%eax", "%ebx"
|
||||
);
|
||||
|
||||
if (r_ecx & 0x00000200) {
|
||||
sseversion = 35; /* SSSE3 */
|
||||
Debug(1,"Detected a x86\\x86-64 processor with SSSE3");
|
||||
} else if (r_ecx & 0x00000001) {
|
||||
sseversion = 30; /* SSE3 */
|
||||
Debug(1,"Detected a x86\\x86-64 processor with SSE3");
|
||||
} else if (r_edx & 0x04000000) {
|
||||
sseversion = 20; /* SSE2 */
|
||||
Debug(1,"Detected a x86\\x86-64 processor with SSE2");
|
||||
} else if (r_edx & 0x02000000) {
|
||||
sseversion = 10; /* SSE */
|
||||
Debug(1,"Detected a x86\\x86-64 processor with SSE");
|
||||
} else {
|
||||
sseversion = 0;
|
||||
Debug(1,"Detected a x86\\x86-64 processor");
|
||||
}
|
||||
|
||||
#else
|
||||
/* Non x86 or x86-64 processor, SSE2 is not available */
|
||||
Debug(1,"Detected a non x86\\x86-64 processor");
|
||||
sseversion = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* SSE2 aligned memory copy. Useful for big copying of aligned memory like image buffers in ZM */
|
||||
/* For platforms without SSE2 we will use standard x86 asm memcpy or glibc's memcpy() */
|
||||
__attribute__((noinline,__target__("sse2"))) void* sse2_aligned_memcpy(void* dest, const void* src, size_t bytes) {
|
||||
#if ((defined(__i386__) || defined(__x86_64__) || defined(ZM_KEEP_SSE)) && !defined(ZM_STRIP_SSE))
|
||||
if(bytes > 128) {
|
||||
unsigned int remainder = bytes % 128;
|
||||
const uint8_t* lastsrc = (uint8_t*)src + (bytes - remainder);
|
||||
|
||||
__asm__ __volatile__(
|
||||
"sse2_copy_iter:\n\t"
|
||||
"movdqa (%0),%%xmm0\n\t"
|
||||
"movdqa 0x10(%0),%%xmm1\n\t"
|
||||
"movdqa 0x20(%0),%%xmm2\n\t"
|
||||
"movdqa 0x30(%0),%%xmm3\n\t"
|
||||
"movdqa 0x40(%0),%%xmm4\n\t"
|
||||
"movdqa 0x50(%0),%%xmm5\n\t"
|
||||
"movdqa 0x60(%0),%%xmm6\n\t"
|
||||
"movdqa 0x70(%0),%%xmm7\n\t"
|
||||
"movntdq %%xmm0,(%1)\n\t"
|
||||
"movntdq %%xmm1,0x10(%1)\n\t"
|
||||
"movntdq %%xmm2,0x20(%1)\n\t"
|
||||
"movntdq %%xmm3,0x30(%1)\n\t"
|
||||
"movntdq %%xmm4,0x40(%1)\n\t"
|
||||
"movntdq %%xmm5,0x50(%1)\n\t"
|
||||
"movntdq %%xmm6,0x60(%1)\n\t"
|
||||
"movntdq %%xmm7,0x70(%1)\n\t"
|
||||
"add $0x80, %0\n\t"
|
||||
"add $0x80, %1\n\t"
|
||||
"cmp %2, %0\n\t"
|
||||
"jb sse2_copy_iter\n\t"
|
||||
"test %3, %3\n\t"
|
||||
"jz sse2_copy_finish\n\t"
|
||||
"cld\n\t"
|
||||
"rep movsb\n\t"
|
||||
"sse2_copy_finish:\n\t"
|
||||
:
|
||||
: "S" (src), "D" (dest), "r" (lastsrc), "c" (remainder)
|
||||
: "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7", "cc", "memory"
|
||||
);
|
||||
|
||||
} else {
|
||||
/* Standard memcpy */
|
||||
__asm__ __volatile__("cld; rep movsb" :: "S"(src), "D"(dest), "c"(bytes) : "cc", "memory");
|
||||
}
|
||||
#else
|
||||
/* Non x86\x86-64 platform, use memcpy */
|
||||
memcpy(dest,src,bytes);
|
||||
#endif
|
||||
return dest;
|
||||
}
|
||||
|
||||
void timespec_diff(struct timespec *start, struct timespec *end, struct timespec *diff) {
|
||||
if (((end->tv_nsec)-(start->tv_nsec))<0) {
|
||||
diff->tv_sec = end->tv_sec-start->tv_sec-1;
|
||||
diff->tv_nsec = 1000000000+end->tv_nsec-start->tv_nsec;
|
||||
} else {
|
||||
diff->tv_sec = end->tv_sec-start->tv_sec;
|
||||
diff->tv_nsec = end->tv_nsec-start->tv_nsec;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef ZM_UTILS_H
|
||||
#define ZM_UTILS_H
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -43,4 +45,10 @@ inline int min( int a, int b )
|
|||
return( a<=b?a:b );
|
||||
}
|
||||
|
||||
void ssedetect();
|
||||
void* sse2_aligned_memcpy(void* dest, const void* src, size_t bytes);
|
||||
void timespec_diff(struct timespec *start, struct timespec *end, struct timespec *diff);
|
||||
|
||||
extern unsigned int sseversion;
|
||||
|
||||
#endif // ZM_UTILS_H
|
||||
|
|
402
src/zm_zone.cpp
402
src/zm_zone.cpp
|
@ -60,38 +60,45 @@ void Zone::Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_
|
|||
image = 0;
|
||||
score = 0;
|
||||
|
||||
overload_count = 0;
|
||||
overload_count = 0;
|
||||
|
||||
pg_image = new Image( monitor->Width(), monitor->Height(), 1 );
|
||||
pg_image = new Image( monitor->Width(), monitor->Height(), 1, ZM_SUBPIX_ORDER_NONE);
|
||||
pg_image->Clear();
|
||||
pg_image->Fill( 0xff, polygon );
|
||||
pg_image->Outline( 0xff, polygon );
|
||||
pg_image->Crop( polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() );
|
||||
|
||||
ranges = new Range[polygon.Height()];
|
||||
int y = polygon.LoY();
|
||||
for ( int py = 0; py < polygon.Height(); py++, y++ )
|
||||
ranges = new Range[monitor->Height()];
|
||||
for ( int y = 0; y < monitor->Height(); y++)
|
||||
{
|
||||
int x = polygon.LoX();
|
||||
ranges[py].lo_x = -1;
|
||||
ranges[py].hi_x = -1;
|
||||
ranges[py].off_x = 0;
|
||||
unsigned char *ppoly = pg_image->Buffer( 0, py );
|
||||
for ( int px = 0; px < polygon.Width(); px++, x++, ppoly++ )
|
||||
ranges[y].lo_x = -1;
|
||||
ranges[y].hi_x = -1;
|
||||
ranges[y].off_x = 0;
|
||||
const uint8_t *ppoly = pg_image->Buffer( 0, y );
|
||||
for ( int x = 0; x < monitor->Width(); x++, ppoly++ )
|
||||
{
|
||||
if ( *ppoly )
|
||||
{
|
||||
if ( ranges[py].lo_x == -1 )
|
||||
if ( ranges[y].lo_x == -1 )
|
||||
{
|
||||
ranges[py].lo_x = x;
|
||||
ranges[py].off_x = px;
|
||||
ranges[y].lo_x = x;
|
||||
}
|
||||
if ( ranges[py].hi_x < x )
|
||||
if ( ranges[y].hi_x < x )
|
||||
{
|
||||
ranges[py].hi_x = x;
|
||||
ranges[y].hi_x = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( config.record_diag_images )
|
||||
{
|
||||
static char diag_path[PATH_MAX] = "";
|
||||
if ( !diag_path[0] )
|
||||
{
|
||||
snprintf( diag_path, sizeof(diag_path), "%s/%s/diag-%d-poly.jpg", config.dir_events, monitor->Name(), id);
|
||||
}
|
||||
pg_image->WriteJpeg( diag_path );
|
||||
}
|
||||
}
|
||||
|
||||
Zone::~Zone()
|
||||
|
@ -119,20 +126,23 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
|
||||
ResetStats();
|
||||
|
||||
if ( overload_count )
|
||||
{
|
||||
Info( "In overload mode, %d frames of %d remaining", overload_count, overload_frames );
|
||||
Debug( 4, "In overload mode, %d frames of %d remaining", overload_count, overload_frames );
|
||||
overload_count--;
|
||||
return( false );
|
||||
}
|
||||
if ( overload_count )
|
||||
{
|
||||
Info( "In overload mode, %d frames of %d remaining", overload_count, overload_frames );
|
||||
Debug( 4, "In overload mode, %d frames of %d remaining", overload_count, overload_frames );
|
||||
overload_count--;
|
||||
return( false );
|
||||
}
|
||||
|
||||
delete image;
|
||||
// Get the difference image
|
||||
Image *diff_image = image = new Image( *delta_image );
|
||||
int diff_width = diff_image->Width();
|
||||
uint8_t* diff_buff = (uint8_t*)diff_image->Buffer();
|
||||
uint8_t* pdiff;
|
||||
const uint8_t* ppoly;
|
||||
|
||||
unsigned long pixel_diff_count = 0;
|
||||
unsigned int pixel_diff_count = 0;
|
||||
|
||||
int alarm_lo_x = 0;
|
||||
int alarm_hi_x = 0;
|
||||
|
@ -141,77 +151,23 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
|
||||
int alarm_mid_x = -1;
|
||||
int alarm_mid_y = -1;
|
||||
|
||||
int lo_y = polygon.LoY();
|
||||
int hi_y = polygon.HiY();
|
||||
int lo_x;
|
||||
int hi_x;
|
||||
|
||||
unsigned int lo_y = polygon.LoY();
|
||||
unsigned int lo_x = polygon.LoX();
|
||||
unsigned int hi_x = polygon.HiX();
|
||||
unsigned int hi_y = polygon.HiY();
|
||||
|
||||
Debug( 4, "Checking alarms for zone %d/%s in lines %d -> %d", id, label, lo_y, hi_y );
|
||||
|
||||
|
||||
|
||||
Debug( 5, "Checking for alarmed pixels" );
|
||||
unsigned char *pdiff, *ppoly;
|
||||
// Create an upper margin
|
||||
if ( lo_y > 0 )
|
||||
{
|
||||
lo_x = ranges[0].lo_x;
|
||||
if ( lo_x > 0 )
|
||||
lo_x--;
|
||||
hi_x = ranges[0].hi_x;
|
||||
if ( hi_x < (diff_width-1) )
|
||||
hi_x++;
|
||||
pdiff = diff_image->Buffer( lo_x, lo_y-1 );
|
||||
memset( pdiff, BLACK, (hi_x-lo_x)+1 );
|
||||
}
|
||||
for ( int y = lo_y, py = 0; y <= hi_y; y++, py++ )
|
||||
{
|
||||
lo_x = ranges[py].lo_x;
|
||||
hi_x = ranges[py].hi_x;
|
||||
|
||||
Debug( 7, "Checking line %d from %d -> %d", y, lo_x, hi_x );
|
||||
pdiff = diff_image->Buffer( lo_x, y );
|
||||
ppoly = pg_image->Buffer( ranges[py].off_x, py );
|
||||
// Left margin
|
||||
if ( y < hi_y )
|
||||
{
|
||||
int next_lo_x = ranges[py+1].lo_x;
|
||||
if ( next_lo_x < lo_x )
|
||||
{
|
||||
int lo_x_diff = lo_x-next_lo_x;
|
||||
memset( pdiff-lo_x_diff, BLACK, lo_x_diff );
|
||||
}
|
||||
else if ( lo_x > 0 )
|
||||
*(pdiff-1) = BLACK;
|
||||
}
|
||||
else if ( lo_x > 0 )
|
||||
*(pdiff-1) = BLACK;
|
||||
for ( int x = lo_x; x <= hi_x; x++, pdiff++, ppoly++ )
|
||||
{
|
||||
if ( *ppoly && (*pdiff > min_pixel_threshold) && (!max_pixel_threshold || (*pdiff < max_pixel_threshold)) )
|
||||
{
|
||||
alarm_pixels++;
|
||||
pixel_diff_count += abs(*pdiff);
|
||||
*pdiff = WHITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pdiff = BLACK;
|
||||
}
|
||||
}
|
||||
// Right margin
|
||||
if ( y < hi_y )
|
||||
{
|
||||
int next_hi_x = ranges[py+1].hi_x;
|
||||
if ( next_hi_x > hi_x )
|
||||
{
|
||||
//printf( "%d: Setting %d-%d = %d\n", y, hi_x, next_hi_x, next_hi_x-hi_x );
|
||||
memset( pdiff, BLACK, next_hi_x-hi_x );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( pixel_diff_count && alarm_pixels )
|
||||
pixel_diff = pixel_diff_count/alarm_pixels;
|
||||
Debug( 5, "Got %d alarmed pixels, need %d -> %d, avg pixel diff %d", alarm_pixels, min_alarm_pixels, max_alarm_pixels, pixel_diff );
|
||||
/* if(config.cpu_extensions && sseversion >= 20) {
|
||||
sse2_alarmedpixels(diff_image, pg_image, &alarm_pixels, &pixel_diff_count);
|
||||
} else {
|
||||
std_alarmedpixels(diff_image, pg_image, &alarm_pixels, &pixel_diff_count);
|
||||
} */
|
||||
std_alarmedpixels(diff_image, pg_image, &alarm_pixels, &pixel_diff_count);
|
||||
|
||||
if ( config.record_diag_images )
|
||||
{
|
||||
static char diag_path[PATH_MAX] = "";
|
||||
|
@ -221,23 +177,30 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
||||
if ( pixel_diff_count && alarm_pixels )
|
||||
pixel_diff = pixel_diff_count/alarm_pixels;
|
||||
Debug( 5, "Got %d alarmed pixels, need %d -> %d, avg pixel diff %d", alarm_pixels, min_alarm_pixels, max_alarm_pixels, pixel_diff );
|
||||
|
||||
if ( !alarm_pixels )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
if ( min_alarm_pixels && (alarm_pixels < min_alarm_pixels) )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
if ( max_alarm_pixels && (alarm_pixels > max_alarm_pixels) )
|
||||
{
|
||||
overload_count = overload_frames;
|
||||
return( false );
|
||||
}
|
||||
if( alarm_pixels ) {
|
||||
if( min_alarm_pixels && (alarm_pixels < min_alarm_pixels) ) {
|
||||
/* Not enough pixels alarmed */
|
||||
return (false);
|
||||
} else if( max_alarm_pixels && (alarm_pixels > max_alarm_pixels) ) {
|
||||
/* Too many pixels alarmed */
|
||||
overload_count = overload_frames;
|
||||
return (false);
|
||||
}
|
||||
} else {
|
||||
/* No alarmed pixels */
|
||||
return (false);
|
||||
}
|
||||
|
||||
score = (100*alarm_pixels)/polygon.Area();
|
||||
if(score < 1)
|
||||
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
|
||||
Debug( 5, "Current score is %d", score );
|
||||
|
||||
|
||||
if ( check_method >= FILTERED_PIXELS )
|
||||
{
|
||||
int bx = filter_box.X();
|
||||
|
@ -249,16 +212,15 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
if ( bx > 1 || by > 1 )
|
||||
{
|
||||
// Now remove any pixels smaller than our filter size
|
||||
unsigned char *pdiff;
|
||||
unsigned char *cpdiff;
|
||||
int ldx, hdx, ldy, hdy;
|
||||
bool block;
|
||||
for ( int y = lo_y, py = 0; y <= hi_y; y++, py++ )
|
||||
for ( int y = lo_y; y <= hi_y; y++ )
|
||||
{
|
||||
int lo_x = ranges[py].lo_x;
|
||||
int hi_x = ranges[py].hi_x;
|
||||
int lo_x = ranges[y].lo_x;
|
||||
int hi_x = ranges[y].hi_x;
|
||||
|
||||
pdiff = diff_image->Buffer( lo_x, y );
|
||||
pdiff = (uint8_t*)diff_image->Buffer( lo_x, y );
|
||||
|
||||
for ( int x = lo_x; x <= hi_x; x++, pdiff++ )
|
||||
{
|
||||
|
@ -279,7 +241,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
{
|
||||
for ( int dx2 = 0; block && dx2 < bx; dx2++ )
|
||||
{
|
||||
cpdiff = diff_image->Buffer( x+dx+dx2, y+dy+dy2 );
|
||||
cpdiff = diff_buff + (((y+dy+dy2)*diff_width) + (x+dx+dx2));
|
||||
if ( !*cpdiff )
|
||||
{
|
||||
block = false;
|
||||
|
@ -302,6 +264,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
{
|
||||
alarm_filter_pixels = alarm_pixels;
|
||||
}
|
||||
|
||||
if ( config.record_diag_images )
|
||||
{
|
||||
static char diag_path[PATH_MAX] = "";
|
||||
|
@ -311,23 +274,26 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
|
||||
Debug( 5, "Got %d filtered pixels, need %d -> %d", alarm_filter_pixels, min_filter_pixels, max_filter_pixels );
|
||||
|
||||
if ( !alarm_filter_pixels )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
if ( min_filter_pixels && (alarm_filter_pixels < min_filter_pixels) )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
if ( max_filter_pixels && (alarm_filter_pixels > max_filter_pixels) )
|
||||
{
|
||||
overload_count = overload_frames;
|
||||
return( false );
|
||||
}
|
||||
|
||||
|
||||
if( alarm_filter_pixels ) {
|
||||
if( min_filter_pixels && (alarm_filter_pixels < min_filter_pixels) ) {
|
||||
/* Not enough pixels alarmed */
|
||||
return (false);
|
||||
} else if( max_filter_pixels && (alarm_filter_pixels > max_filter_pixels) ) {
|
||||
/* Too many pixels alarmed */
|
||||
overload_count = overload_frames;
|
||||
return (false);
|
||||
}
|
||||
} else {
|
||||
/* No filtered pixels */
|
||||
return (false);
|
||||
}
|
||||
|
||||
score = (100*alarm_filter_pixels)/(polygon.Area());
|
||||
if(score < 1)
|
||||
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
|
||||
Debug( 5, "Current score is %d", score );
|
||||
|
||||
if ( check_method >= BLOBS )
|
||||
|
@ -336,16 +302,16 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
typedef struct { unsigned char tag; int count; int lo_x; int hi_x; int lo_y; int hi_y; } BlobStats;
|
||||
BlobStats blob_stats[256];
|
||||
memset( blob_stats, 0, sizeof(BlobStats)*256 );
|
||||
unsigned char *pdiff, *spdiff;
|
||||
int last_x, last_y;
|
||||
uint8_t *spdiff;
|
||||
uint8_t last_x, last_y;
|
||||
BlobStats *bsx, *bsy;
|
||||
BlobStats *bsm, *bss;
|
||||
for ( int y = lo_y, py = 0; y <= hi_y; y++, py++ )
|
||||
for ( int y = lo_y; y <= hi_y; y++ )
|
||||
{
|
||||
int lo_x = ranges[py].lo_x;
|
||||
int hi_x = ranges[py].hi_x;
|
||||
int lo_x = ranges[y].lo_x;
|
||||
int hi_x = ranges[y].hi_x;
|
||||
|
||||
pdiff = diff_image->Buffer( lo_x, y );
|
||||
pdiff = (uint8_t*)diff_image->Buffer( lo_x, y );
|
||||
for ( int x = lo_x; x <= hi_x; x++, pdiff++ )
|
||||
{
|
||||
if ( *pdiff == WHITE )
|
||||
|
@ -353,8 +319,20 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
Debug( 9, "Got white pixel at %d,%d (%p)", x, y, pdiff );
|
||||
//last_x = (x>lo_x)?*(pdiff-1):0;
|
||||
//last_y = (y>lo_y&&x>=last_lo_x&&x<=last_hi_x)?*(pdiff-diff_width):0;
|
||||
last_x = x>0?*(pdiff-1):0;
|
||||
last_y = y>0?*(pdiff-diff_width):0;
|
||||
|
||||
last_x = 0;
|
||||
if(x > 0) {
|
||||
if((x-1) >= lo_x) {
|
||||
last_x = *(pdiff-1);
|
||||
}
|
||||
}
|
||||
|
||||
last_y = 0;
|
||||
if(y > 0) {
|
||||
if((y-1) >= lo_y && ranges[(y-1)].lo_x <= x && ranges[(y-1)].hi_x >= x) {
|
||||
last_y = *(pdiff-diff_width);
|
||||
}
|
||||
}
|
||||
|
||||
if ( last_x )
|
||||
{
|
||||
|
@ -369,6 +347,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
Debug( 9, "Matching neighbours, setting to %d", last_x );
|
||||
// Add to the blob from the x side (either side really)
|
||||
*pdiff = last_x;
|
||||
alarm_blob_pixels++;
|
||||
bsx->count++;
|
||||
if ( x > bsx->hi_x ) bsx->hi_x = x;
|
||||
if ( y > bsx->hi_y ) bsx->hi_y = y;
|
||||
|
@ -384,14 +363,14 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
Debug( 9, "Slave blob t:%d, c:%d, lx:%d, hx:%d, ly:%d, hy:%d", bss->tag, bss->count, bss->lo_x, bss->hi_x, bss->lo_y, bss->hi_y );
|
||||
// Now change all those pixels to the other setting
|
||||
int changed = 0;
|
||||
for ( int sy = bss->lo_y, psy = bss->lo_y-lo_y; sy <= bss->hi_y; sy++, psy++ )
|
||||
for ( int sy = bss->lo_y; sy <= bss->hi_y; sy++)
|
||||
{
|
||||
int lo_sx = bss->lo_x>=ranges[psy].lo_x?bss->lo_x:ranges[psy].lo_x;
|
||||
int hi_sx = bss->hi_x<=ranges[psy].hi_x?bss->hi_x:ranges[psy].hi_x;
|
||||
int lo_sx = bss->lo_x>=ranges[sy].lo_x?bss->lo_x:ranges[sy].lo_x;
|
||||
int hi_sx = bss->hi_x<=ranges[sy].hi_x?bss->hi_x:ranges[sy].hi_x;
|
||||
|
||||
Debug( 9, "Changing %d(%d), %d->%d", sy, psy, lo_sx, hi_sx );
|
||||
Debug( 9, "Range %d(%d), %d->%d", sy, psy, ranges[psy].lo_x, ranges[psy].hi_x );
|
||||
spdiff = diff_image->Buffer( lo_sx, sy );
|
||||
Debug( 9, "Changing %d, %d->%d", sy, lo_sx, hi_sx );
|
||||
Debug( 9, "Range %d, %d->%d", sy, ranges[sy].lo_x, ranges[sy].hi_x );
|
||||
spdiff = diff_buff + ((diff_width * sy) + lo_sx);
|
||||
for ( int sx = lo_sx; sx <= hi_sx; sx++, spdiff++ )
|
||||
{
|
||||
Debug( 9, "Pixel at %d,%d (%p) is %d", sx, sy, spdiff, *spdiff );
|
||||
|
@ -404,6 +383,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
}
|
||||
*pdiff = bsm->tag;
|
||||
alarm_blob_pixels++;
|
||||
if ( !changed )
|
||||
{
|
||||
Info( "Master blob t:%d, c:%d, lx:%d, hx:%d, ly:%d, hy:%d", bsm->tag, bsm->count, bsm->lo_x, bsm->hi_x, bsm->lo_y, bsm->hi_y );
|
||||
|
@ -439,6 +419,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
Debug( 9, "Setting to left neighbour %d", last_x );
|
||||
// Add to the blob from the x side
|
||||
*pdiff = last_x;
|
||||
alarm_blob_pixels++;
|
||||
bsx->count++;
|
||||
if ( x > bsx->hi_x ) bsx->hi_x = x;
|
||||
if ( y > bsx->hi_y ) bsx->hi_y = y;
|
||||
|
@ -448,12 +429,14 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
{
|
||||
if ( last_y )
|
||||
{
|
||||
Debug( 9, "Top neighbour is %d", last_y );
|
||||
Debug( 9, "Setting to top neighbour %d", last_y );
|
||||
|
||||
|
||||
// Add to the blob from the y side
|
||||
BlobStats *bsy = &blob_stats[last_y];
|
||||
|
||||
*pdiff = last_y;
|
||||
alarm_blob_pixels++;
|
||||
bsy->count++;
|
||||
if ( x > bsy->hi_x ) bsy->hi_x = x;
|
||||
if ( y > bsy->hi_y ) bsy->hi_y = y;
|
||||
|
@ -474,7 +457,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
{
|
||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||
{
|
||||
unsigned char *spdiff = diff_image->Buffer( bs->lo_x, sy );
|
||||
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
||||
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
||||
{
|
||||
if ( *spdiff == bs->tag )
|
||||
|
@ -501,6 +484,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
{
|
||||
Debug( 9, "Creating new blob %d", i );
|
||||
*pdiff = i;
|
||||
alarm_blob_pixels++;
|
||||
bs->tag = i;
|
||||
bs->count++;
|
||||
bs->lo_x = bs->hi_x = x;
|
||||
|
@ -533,10 +517,10 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
|
||||
if ( !alarm_blobs )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
alarm_blob_pixels = alarm_filter_pixels;
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
|
||||
Debug( 5, "Got %d raw blob pixels, %d raw blobs, need %d -> %d, %d -> %d", alarm_blob_pixels, alarm_blobs, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs );
|
||||
|
||||
// Now eliminate blobs under the threshold
|
||||
|
@ -551,7 +535,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
{
|
||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||
{
|
||||
unsigned char *spdiff = diff_image->Buffer( bs->lo_x, sy );
|
||||
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
||||
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
||||
{
|
||||
if ( *spdiff == bs->tag )
|
||||
|
@ -590,21 +574,26 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
diff_image->WriteJpeg( diag_path );
|
||||
}
|
||||
Debug( 5, "Got %d blob pixels, %d blobs, need %d -> %d, %d -> %d", alarm_blob_pixels, alarm_blobs, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs );
|
||||
|
||||
if ( !alarm_blobs )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
if ( min_blobs && (alarm_blobs < min_blobs) )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
if ( max_blobs && (alarm_blobs > max_blobs) )
|
||||
{
|
||||
overload_count = overload_frames;
|
||||
return( false );
|
||||
}
|
||||
Debug( 5, "Got %d blob pixels, %d blobs, need %d -> %d, %d -> %d", alarm_blob_pixels, alarm_blobs, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs );
|
||||
|
||||
if( alarm_blobs ) {
|
||||
if( min_blobs && (alarm_blobs < min_blobs) ) {
|
||||
/* Not enough pixels alarmed */
|
||||
return (false);
|
||||
} else if(max_blobs && (alarm_blobs > max_blobs) ) {
|
||||
/* Too many pixels alarmed */
|
||||
overload_count = overload_frames;
|
||||
return (false);
|
||||
}
|
||||
} else {
|
||||
/* No blobs */
|
||||
return (false);
|
||||
}
|
||||
|
||||
score = (100*alarm_blob_pixels)/(polygon.Area());
|
||||
if(score < 1)
|
||||
score = 1; /* Fix for score of 0 when frame meets thresholds but alarmed area is not big enough */
|
||||
Debug( 5, "Current score is %d", score );
|
||||
|
||||
alarm_lo_x = polygon.HiX()+1;
|
||||
alarm_hi_x = polygon.LoX()-1;
|
||||
|
@ -624,7 +613,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
|
||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||
{
|
||||
unsigned char *spdiff = diff_image->Buffer( bs->lo_x, sy );
|
||||
spdiff = diff_buff + ((diff_width * sy) + bs->lo_x);
|
||||
for ( int sx = bs->lo_x; sx <= bs->hi_x; sx++, spdiff++ )
|
||||
{
|
||||
if ( *spdiff == bs->tag )
|
||||
|
@ -650,8 +639,6 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
if ( alarm_hi_y < bs->hi_y ) alarm_hi_y = bs->hi_y;
|
||||
}
|
||||
}
|
||||
score = ((100*alarm_blob_pixels)/int(sqrt((double)alarm_blobs)))/(polygon.Area());
|
||||
Debug( 5, "Current score is %d", score );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -662,11 +649,14 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
|
||||
if ( type == INCLUSIVE )
|
||||
{
|
||||
// score >>= 1;
|
||||
score /= 2;
|
||||
}
|
||||
else if ( type == EXCLUSIVE )
|
||||
{
|
||||
// score <<= 1;
|
||||
score *= 2;
|
||||
|
||||
}
|
||||
|
||||
Debug( 5, "Adjusted score is %d", score );
|
||||
|
@ -690,17 +680,14 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
|
||||
if ( (type < PRECLUSIVE) && check_method >= BLOBS && config.create_analysis_images )
|
||||
{
|
||||
int lo_x = polygon.LoX();
|
||||
int hi_x = polygon.HiX();
|
||||
int lo_y = polygon.LoY();
|
||||
int hi_y = polygon.HiY();
|
||||
// First mask out anything we don't want
|
||||
for ( int y = lo_y, py = 0; y <= hi_y; y++, py++ )
|
||||
{
|
||||
pdiff = diff_image->Buffer( lo_x, y );
|
||||
|
||||
int lo_x2 = ranges[py].lo_x;
|
||||
int hi_x2 = ranges[py].hi_x;
|
||||
// First mask out anything we don't want
|
||||
for ( int y = lo_y; y <= hi_y; y++ )
|
||||
{
|
||||
pdiff = diff_buff + ((diff_width * y) + lo_x);
|
||||
|
||||
int lo_x2 = ranges[y].lo_x;
|
||||
int hi_x2 = ranges[y].hi_x;
|
||||
|
||||
int lo_gap = lo_x2-lo_x;
|
||||
if ( lo_gap > 0 )
|
||||
|
@ -716,7 +703,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
}
|
||||
|
||||
ppoly = pg_image->Buffer( lo_gap, py );
|
||||
ppoly = pg_image->Buffer( lo_x2, y );
|
||||
for ( int x = lo_x2; x <= hi_x2; x++, pdiff++, ppoly++ )
|
||||
{
|
||||
if ( !*ppoly )
|
||||
|
@ -738,7 +725,13 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
|||
}
|
||||
}
|
||||
}
|
||||
image = diff_image->HighlightEdges( alarm_rgb, &polygon.Extent() );
|
||||
|
||||
if( monitor->Colours() == ZM_COLOUR_GRAY8 ) {
|
||||
image = diff_image->HighlightEdges( alarm_rgb, ZM_COLOUR_RGB24, ZM_SUBPIX_ORDER_RGB, &polygon.Extent() );
|
||||
} else {
|
||||
image = diff_image->HighlightEdges( alarm_rgb, monitor->Colours(), monitor->SubpixelOrder(), &polygon.Extent() );
|
||||
}
|
||||
|
||||
// Only need to delete this when 'image' becomes detached and points somewhere else
|
||||
delete diff_image;
|
||||
}
|
||||
|
@ -917,14 +910,17 @@ int Zone::Load( Monitor *monitor, Zone **&zones )
|
|||
int MinBlobs = dbrow[col]?atoi(dbrow[col]):0; col++;
|
||||
int MaxBlobs = dbrow[col]?atoi(dbrow[col]):0; col++;
|
||||
int OverloadFrames = dbrow[col]?atoi(dbrow[col]):0; col++;
|
||||
|
||||
/* HTML colour code is actually BGR in memory, we want RGB */
|
||||
AlarmRGB = rgb_convert(AlarmRGB, ZM_SUBPIX_ORDER_BGR);
|
||||
|
||||
Debug( 5, "Parsing polygon %s", Coords );
|
||||
Polygon polygon;
|
||||
if ( !ParsePolygonString( Coords, polygon ) )
|
||||
Panic( "Unable to parse polygon string '%s' for zone %d/%s for monitor %s", Coords, Id, Name, monitor->Name() );
|
||||
|
||||
if ( polygon.LoX() < 0 || polygon.HiX() >= monitor->Width() || polygon.LoY() < 0 || polygon.HiY() >= monitor->Height() )
|
||||
Panic( "Zone %d/%s for monitor %s extends outside of image dimensions, %d, %d, %d, %d", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() );
|
||||
if ( polygon.LoX() < 0 || polygon.HiX() >= monitor->Width() || polygon.LoY() < 0 || polygon.HiY() >= monitor->Height() )
|
||||
Panic( "Zone %d/%s for monitor %s extends outside of image dimensions, %d, %d, %d, %d", Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY() );
|
||||
|
||||
if ( false && !strcmp( Units, "Percent" ) )
|
||||
{
|
||||
|
@ -993,3 +989,47 @@ bool Zone::DumpSettings( char *output, bool /*verbose*/ )
|
|||
return( true );
|
||||
}
|
||||
|
||||
void Zone::std_alarmedpixels(Image* pdiff_image, const Image* ppoly_image, unsigned int* pixel_count, unsigned int* pixel_sum) {
|
||||
uint32_t pixelsalarmed = 0;
|
||||
uint32_t pixelsdifference = 0;
|
||||
uint8_t *pdiff;
|
||||
const uint8_t *ppoly;
|
||||
uint8_t calc_max_pixel_threshold = 255;
|
||||
unsigned int lo_y;
|
||||
unsigned int hi_y;
|
||||
unsigned int lo_x;
|
||||
unsigned int hi_x;
|
||||
|
||||
if(max_pixel_threshold)
|
||||
calc_max_pixel_threshold = max_pixel_threshold;
|
||||
|
||||
lo_y = polygon.LoY();
|
||||
hi_y = polygon.HiY();
|
||||
for ( int y = lo_y; y <= hi_y; y++ )
|
||||
{
|
||||
lo_x = ranges[y].lo_x;
|
||||
hi_x = ranges[y].hi_x;
|
||||
|
||||
Debug( 7, "Checking line %d from %d -> %d", y, lo_x, hi_x );
|
||||
pdiff = (uint8_t*)pdiff_image->Buffer( lo_x, y );
|
||||
ppoly = ppoly_image->Buffer( lo_x, y );
|
||||
|
||||
for ( int x = lo_x; x <= hi_x; x++, pdiff++, ppoly++ )
|
||||
{
|
||||
if ( *ppoly && (*pdiff > min_pixel_threshold) && (*pdiff <= calc_max_pixel_threshold) )
|
||||
{
|
||||
pixelsalarmed++;
|
||||
pixelsdifference += *pdiff;
|
||||
*pdiff = WHITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pdiff = BLACK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Store the results */
|
||||
*pixel_count = pixelsalarmed;
|
||||
*pixel_sum = pixelsdifference;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
|||
// Outputs/Statistics
|
||||
bool alarmed;
|
||||
int pixel_diff;
|
||||
int alarm_pixels;
|
||||
unsigned int alarm_pixels;
|
||||
int alarm_filter_pixels;
|
||||
int alarm_blob_pixels;
|
||||
int alarm_blobs;
|
||||
|
@ -94,7 +94,8 @@ protected:
|
|||
|
||||
protected:
|
||||
void Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold, int p_max_pixel_threshold, int p_min_alarm_pixels, int p_max_alarm_pixels, const Coord &p_filter_box, int p_min_filter_pixels, int p_max_filter_pixels, int p_min_blob_pixels, int p_max_blob_pixels, int p_min_blobs, int p_max_blobs, int p_overload_frames );
|
||||
|
||||
void std_alarmedpixels(Image* pdiff_image, const Image* ppoly_image, unsigned int* pixel_count, unsigned int* pixel_sum);
|
||||
|
||||
public:
|
||||
Zone( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon, const Rgb p_alarm_rgb, CheckMethod p_check_method, int p_min_pixel_threshold=15, int p_max_pixel_threshold=0, int p_min_alarm_pixels=50, int p_max_alarm_pixels=75000, const Coord &p_filter_box=Coord( 3, 3 ), int p_min_filter_pixels=50, int p_max_filter_pixels=50000, int p_min_blob_pixels=10, int p_max_blob_pixels=0, int p_min_blobs=0, int p_max_blobs=0, int p_overload_frames=0 )
|
||||
{
|
||||
|
|
|
@ -93,6 +93,8 @@ int main( int argc, char *argv[] )
|
|||
zmLoadConfig();
|
||||
|
||||
logInit( log_id_string );
|
||||
|
||||
ssedetect();
|
||||
|
||||
Monitor *monitor = Monitor::Load( id, true, Monitor::ANALYSIS );
|
||||
|
||||
|
|
|
@ -151,6 +151,8 @@ int main( int argc, char *argv[] )
|
|||
zmLoadConfig();
|
||||
|
||||
logInit( log_id_string );
|
||||
|
||||
ssedetect();
|
||||
|
||||
Monitor **monitors = 0;
|
||||
int n_monitors = 0;
|
||||
|
|
|
@ -161,6 +161,8 @@ int main( int argc, char *argv[] )
|
|||
zmLoadConfig();
|
||||
|
||||
logInit( "zmf" );
|
||||
|
||||
ssedetect();
|
||||
|
||||
Monitor *monitor = Monitor::Load( id, false, Monitor::QUERY );
|
||||
|
||||
|
|
|
@ -88,6 +88,8 @@ int main( int argc, const char *argv[] )
|
|||
zmLoadConfig();
|
||||
|
||||
logInit( "zms" );
|
||||
|
||||
ssedetect();
|
||||
|
||||
zmSetDefaultTermHandler();
|
||||
zmSetDefaultDieHandler();
|
||||
|
|
|
@ -145,7 +145,10 @@ int main(int argc, char** argv) {
|
|||
printf("Loading ZoneMinder configurations...");
|
||||
zmLoadConfig();
|
||||
printf("Done.\n");
|
||||
|
||||
logInit("zmstreamer");
|
||||
|
||||
ssedetect();
|
||||
|
||||
// Setting stream parameters
|
||||
MonitorStream stream;
|
||||
|
|
|
@ -299,8 +299,9 @@ if ( !empty($action) )
|
|||
if ( daemonCheck() )
|
||||
{
|
||||
$restart = ($oldFunction == 'None') || ($newFunction == 'None') || ($newEnabled != $oldEnabled);
|
||||
zmaControl( $monitor, "stop" );
|
||||
zmcControl( $monitor, $restart?"restart":"" );
|
||||
zmaControl( $monitor, "reload" );
|
||||
zmaControl( $monitor, "start" );
|
||||
}
|
||||
$refreshParent = true;
|
||||
}
|
||||
|
@ -530,8 +531,9 @@ if ( !empty($action) )
|
|||
//session_write_close();
|
||||
if ( daemonCheck() )
|
||||
{
|
||||
zmaControl( $monitor, "stop" );
|
||||
zmcControl( $monitor, "restart" );
|
||||
zmaControl( $monitor, "restart" );
|
||||
zmaControl( $monitor, "start" );
|
||||
}
|
||||
//daemonControl( 'restart', 'zmwatch.pl' );
|
||||
$refreshParent = true;
|
||||
|
|
|
@ -76,6 +76,7 @@ setlocale( LC_TIME, 'Big5' ); //Date and time formatting 4.3.0 and after
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 位元色彩',
|
||||
'32BitColour' => '32 位元色彩', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 位元灰階',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Actual',
|
||||
|
@ -130,6 +131,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 位彩色',
|
||||
'32BitColour' => '32 位彩色', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 位灰度',
|
||||
'Action' => '活动动作',
|
||||
'Actual' => '实际',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => '报警帧数必须设为大于1的整数',
|
||||
'BadAlarmMaxFPS' => '报警最大帧率必须是正整数或正浮点数',
|
||||
'BadChannel' => '通道必须设为大于零的整数',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => '必须为器件设置有效值',
|
||||
'BadFPSReportInterval' => 'FPS帧数报告间隔缓冲数必须是0以上整数',
|
||||
'BadFormat' => '格式必须设为大于零的整数',
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 bit barevná',
|
||||
'32BitColour' => '32 bit barevná', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit ¹edá ¹kála',
|
||||
'Action' => 'Akce',
|
||||
'Actual' => 'Skuteèná',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24-Bit-Farbe',
|
||||
'32BitColour' => '32-Bit-Farbe', // Added - 2011-06-15
|
||||
'8BitGrey' => '8-Bit-Grau',
|
||||
'Action' => 'Aktion',
|
||||
'Actual' => 'Original',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Die Bildanzahl muss ganzzahlig 1 oder größer sein',
|
||||
'BadAlarmMaxFPS' => 'Alarm-Maximum-FPS muss eine positive Ganzzahl oder eine Gleitkommazahl sein',
|
||||
'BadChannel' => 'Der Kanal muss ganzzahlig 0 oder größer sein',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Das Gerät muss eine gültige Systemresource sein',
|
||||
'BadFPSReportInterval' => 'Der FPS-Intervall-Puffer-Zähler muss ganzzahlig 0 oder größer sein',
|
||||
'BadFormat' => 'Das Format muss ganzzahlig 0 oder größer sein',
|
||||
|
|
|
@ -73,6 +73,7 @@ header( "Content-Type: text/html; charset=windows-1252" );
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 bit farve',
|
||||
'32BitColour' => '32 bit farve', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit greyscale',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Aktuel',
|
||||
|
@ -127,6 +128,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -81,6 +81,7 @@ $SLANG = array(
|
|||
'More' => 'More',
|
||||
'Clear' => 'Clear',
|
||||
'24BitColour' => '24 bit colour',
|
||||
'32BitColour' => '32 bit colour',
|
||||
'8BitGrey' => '8 bit greyscale',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Actual',
|
||||
|
@ -148,6 +149,7 @@ $SLANG = array(
|
|||
'BadMaxFPS' => 'Maximum FPS must be a positive integer or floating point value',
|
||||
'BadNameChars' => 'Names may only contain alphanumeric characters plus hyphen and underscore',
|
||||
'BadPalette' => 'Palette must be set to a valid value',
|
||||
'BadColours' => 'Target colour must be set to a valid value',
|
||||
'BadPath' => 'Path must be set to a valid value',
|
||||
'BadPort' => 'Port must be set to a valid number',
|
||||
'BadPostEventCount' => 'Post event image count must be an integer of zero or more',
|
||||
|
|
|
@ -71,6 +71,7 @@ require_once( 'lang/en_gb.php' );
|
|||
|
||||
// Simple String Replacements
|
||||
$SLANG['24BitColour'] = '24 bit color';
|
||||
$SLANG['32BitColour'] = '32 bit color';
|
||||
$SLANG['8BitGrey'] = '8 bit grayscale';
|
||||
$SLANG['Colour'] = 'Color';
|
||||
$SLANG['Grey'] = 'Gray';
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'Color 24 bits',
|
||||
'32BitColour' => 'Color 32 bits', // Added - 2011-06-15
|
||||
'8BitGrey' => 'Grises 8 bits',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Actual',
|
||||
|
@ -77,6 +78,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -68,6 +68,7 @@ header( "Content-Type: text/html; charset=UTF-8" );
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 bit colour',
|
||||
'32BitColour' => '32 bit colour', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit greyscale',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Actual',
|
||||
|
@ -122,6 +123,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to a valid value',
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'Couleur 24 bit',
|
||||
'32BitColour' => 'Couleur 32 bit', // Added - 2011-06-15
|
||||
'8BitGrey' => 'Gris 8 bit',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Réel',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -72,6 +72,7 @@ setlocale( LC_ALL, 'he_IL' ); //All locale settings 4.3.0 and after
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'öáò 24 áéè',
|
||||
'32BitColour' => 'öáò 32 áéè', // Added - 2011-06-15
|
||||
'8BitGrey' => 'âååðé àôåø 8 áéè',
|
||||
'Action' => 'ôòåìä',
|
||||
'Actual' => 'î÷åøé',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -81,6 +81,7 @@ setlocale( LC_ALL, 'hu_HU' );
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 bites szín',
|
||||
'32BitColour' => '32 bites szín', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit szürkeárnyalat',
|
||||
'Action' => 'Művelet',
|
||||
'Actual' => 'Valós',
|
||||
|
@ -135,6 +136,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Riadó képek száma 1 vagy nagyobb egész szám legyen',
|
||||
'BadAlarmMaxFPS' => 'A riadó maximális FPS száma pozitív szám legyen',
|
||||
'BadChannel' => 'A csatorna száma 0 vagy nagyobb egész szám legyen',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Az eszköz érték valós legyen',
|
||||
'BadFPSReportInterval' => 'FPS információs időköz puffer számlálója 0 vagy nagyobb egész legyen',
|
||||
'BadFormat' => 'A típus 0 vagy nagyobb egész szám legyen',
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'colori a 24 bit',
|
||||
'32BitColour' => 'colori a 32 bit', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit scala di grigio',
|
||||
'Action' => 'Azione',
|
||||
'Actual' => 'Attuale',
|
||||
|
@ -131,6 +132,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Il numero di frame di un allarme deve essere un numero intero superiore a uno',
|
||||
'BadAlarmMaxFPS' => 'Il numero massimo di FPS dell\'allarme deve essere un numero intero positivo o un valore in virgola mobile',
|
||||
'BadChannel' => 'Il canale deve essere settato con un numero intero uguale o maggiore di zero',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Il dispositivo deve essere impostato con un valore valido',
|
||||
'BadFPSReportInterval' => 'L\'intervallo di FPS per i report deve essere un numero intero superiore a 0',
|
||||
'BadFormat' => 'Il formato deve essere impostato con un numero intero come 0 o maggiore',
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24ËޯĶװ',
|
||||
'32BitColour' => '32ËޯĶװ', // Added - 2011-06-15
|
||||
'8BitGrey' => '8ËޯĔZ’W‰æ‘œ',
|
||||
'Action' => 'Action',
|
||||
'Actual' => '<27>¶’†Œp',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 bit kleuren',
|
||||
'32BitColour' => '32 bit kleuren', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit grijstinten',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Aktueel',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -72,6 +72,7 @@ setlocale( LC_ALL, 'pl_PL' ); // All locale settings 4.3.0 and after
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'Kolor (24 bity)',
|
||||
'32BitColour' => 'Kolor (32 bity)', // Added - 2011-06-15
|
||||
'8BitGrey' => 'Cz/b (8 bitów)',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Aktualny',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'cor 24 bits',
|
||||
'32BitColour' => 'cor 32 bits', // Added - 2011-06-15
|
||||
'8BitGrey' => 'cinza 8 bits',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Atual',
|
||||
|
@ -66,6 +67,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -43,6 +43,7 @@ setlocale( LC_ALL, 'ro_RO' );
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => 'Color ân 24 biţi',
|
||||
'32BitColour' => 'Color ân 32 biţi', // Added - 2011-06-15
|
||||
'8BitGrey' => 'Scală gri ân 8 biţi',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Real',
|
||||
|
@ -97,6 +98,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -72,6 +72,7 @@ header( "Content-Type: text/html; charset=koi8-r" );
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 ÂÉÔÎÙÊ Ã×ÅÔ',
|
||||
'32BitColour' => '32 ÂÉÔÎÙÊ Ã×ÅÔ', // Added - 2011-06-15
|
||||
'8BitGrey' => '256 ÏÔÔÅÎËÏ× ÓÅÒÏÇÏ',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'äÅÊÓÔ×ÉÔÅÌØÎÙÊ',
|
||||
|
@ -126,6 +127,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
|
||||
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
|
||||
'BadChannel' => 'Channel must be set to an integer of zero or more',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Device must be set to a valid value',
|
||||
'BadFPSReportInterval' => 'FPS report interval buffer count must be an integer of 0 or more',
|
||||
'BadFormat' => 'Format must be set to an integer of zero or more',
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
// Simple String Replacements
|
||||
$SLANG = array(
|
||||
'24BitColour' => '24 bitars färg',
|
||||
'32BitColour' => '32 bitars färg', // Added - 2011-06-15
|
||||
'8BitGrey' => '8 bit gråskala',
|
||||
'Action' => 'Action',
|
||||
'Actual' => 'Verklig',
|
||||
|
@ -127,6 +128,7 @@ $SLANG = array(
|
|||
'BadAlarmFrameCount' => 'Ramantalet för larm måste vara ett heltal, minsta värdet är 1',
|
||||
'BadAlarmMaxFPS' => 'Larm för bilder/s måste vara ett positivt heltal eller ett flyttal',
|
||||
'BadChannel' => 'Kanalen måste vara ett heltal, noll eller högre',
|
||||
'BadColours' => 'Target colour must be set to a valid value', // Added - 2011-06-15
|
||||
'BadDevice' => 'Enheten måste sättas till ett giltigt värde',
|
||||
'BadFPSReportInterval' => 'Buffern för ramintervallrapporten måste vara ett heltal på minst 0 eller högre',
|
||||
'BadFormat' => 'Formatet måste vara ett heltal, noll eller högre',
|
||||
|
|
|
@ -66,10 +66,12 @@ function validateForm( form )
|
|||
errors[errors.length] = "<?= $SLANG['BadMaxFPS'] ?>";
|
||||
if ( form.elements['newMonitor[AlarmMaxFPS]'].value && !(parseFloat(form.elements['newMonitor[AlarmMaxFPS]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?= $SLANG['BadAlarmMaxFPS'] ?>";
|
||||
if ( !form.elements['newMonitor[RefBlendPerc]'].value || !(parseInt(form.elements['newMonitor[RefBlendPerc]'].value) > 0 ) )
|
||||
if ( !form.elements['newMonitor[RefBlendPerc]'].value || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) > 100 ) || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) < 0 ) )
|
||||
errors[errors.length] = "<?= $SLANG['BadRefBlendPerc'] ?>";
|
||||
if ( form.elements['newMonitor[Type]'].value == 'Local' )
|
||||
{
|
||||
if ( !form.elements['newMonitor[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
|
||||
errors[errors.length] = "<?= $SLANG['BadPalette'] ?>";
|
||||
if ( !form.elements['newMonitor[Device]'].value )
|
||||
errors[errors.length] = "<?= $SLANG['BadDevice'] ?>";
|
||||
if ( !form.elements['newMonitor[Channel]'].value || !form.elements['newMonitor[Channel]'].value.match( /^\d+$/ ) )
|
||||
|
@ -91,8 +93,8 @@ function validateForm( form )
|
|||
if ( !form.elements['newMonitor[Path]'].value )
|
||||
errors[errors.length] = "<?= $SLANG['BadPath'] ?>";
|
||||
}
|
||||
if ( !form.elements['newMonitor[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
|
||||
errors[errors.length] = "<?= $SLANG['BadPalette'] ?>";
|
||||
if ( !form.elements['newMonitor[Colours]'].value || (parseInt(form.elements['newMonitor[Colours]'].value) != 1 && parseInt(form.elements['newMonitor[Colours]'].value) != 3 && parseInt(form.elements['newMonitor[Colours]'].value) != 4 ) )
|
||||
errors[errors.length] = "<?= $SLANG['BadColours'] ?>";
|
||||
if ( !form.elements['newMonitor[Width]'].value || !(parseInt(form.elements['newMonitor[Width]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?= $SLANG['BadWidth'] ?>";
|
||||
if ( !form.elements['newMonitor[Height]'].value || !(parseInt(form.elements['newMonitor[Height]'].value) > 0 ) )
|
||||
|
|
|
@ -204,10 +204,6 @@ function getStreamCmdResponse( respObj, respText )
|
|||
}
|
||||
$('enableDisableAlarms').removeClass( 'hidden' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$('enableDisableAlarms').addClass( 'hidden' );
|
||||
}
|
||||
}
|
||||
else
|
||||
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
|
||||
|
|
|
@ -56,25 +56,27 @@ else
|
|||
'Enabled' => true,
|
||||
'LinkedMonitors' => "",
|
||||
'Type' => "",
|
||||
'Device' => "/dev/video",
|
||||
'Device' => "/dev/video0",
|
||||
'Channel' => "0",
|
||||
'Format' => "",
|
||||
'Format' => 0x000000ff,
|
||||
'Protocol' => "",
|
||||
'Method' => "",
|
||||
'Host' => "",
|
||||
'Path' => "",
|
||||
'Port' => "80",
|
||||
'Palette' => "",
|
||||
'Width' => "",
|
||||
'Height' => "",
|
||||
'Colours' => 3,
|
||||
'Palette' => 0,
|
||||
'Width' => "320",
|
||||
'Height' => "240",
|
||||
'Orientation' => "0",
|
||||
'LabelFormat' => '%N - %y/%m/%d %H:%M:%S',
|
||||
'Deinterlacing' => 0,
|
||||
'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
|
||||
'LabelX' => 0,
|
||||
'LabelY' => 0,
|
||||
'ImageBufferCount' => 40,
|
||||
'ImageBufferCount' => 50,
|
||||
'WarmupCount' => 25,
|
||||
'PreEventCount' => 10,
|
||||
'PostEventCount' => 10,
|
||||
'PreEventCount' => 25,
|
||||
'PostEventCount' => 25,
|
||||
'StreamReplayBuffer' => 1000,
|
||||
'AlarmFrameCount' => 1,
|
||||
'Controllable' => 0,
|
||||
|
@ -93,11 +95,11 @@ else
|
|||
'MaxFPS' => "",
|
||||
'AlarmMaxFPS' => "",
|
||||
'FPSReportInterval' => 1000,
|
||||
'RefBlendPerc' => 7,
|
||||
'RefBlendPerc' => 12,
|
||||
'DefaultView' => 'Events',
|
||||
'DefaultRate' => '100',
|
||||
'DefaultScale' => '100',
|
||||
'SignalCheckColour' => '#0100BE',
|
||||
'SignalCheckColour' => '#0000c0',
|
||||
'WebColour' => 'red',
|
||||
'Triggers' => "",
|
||||
);
|
||||
|
@ -149,7 +151,7 @@ if ( !empty($_REQUEST['preset']) )
|
|||
}
|
||||
if ( !empty($_REQUEST['probe']) )
|
||||
{
|
||||
$probe = unserialize( $_REQUEST['probe'] );
|
||||
$probe = unserialize(base64_decode($_REQUEST['probe']));
|
||||
foreach ( $probe as $name=>$value )
|
||||
{
|
||||
if ( isset($value) )
|
||||
|
@ -164,8 +166,6 @@ if ( !empty($_REQUEST['probe']) )
|
|||
$newMonitor['Format'] = 0x000000ff;
|
||||
elseif ( $newMonitor['Format'] == 'NTSC' )
|
||||
$newMonitor['Format'] = 0x0000b000;
|
||||
else
|
||||
$newMonitor['Format'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,6 @@ unset($httpMethods['jpegTags']);
|
|||
if ( ZM_HAS_V4L1 )
|
||||
{
|
||||
$v4l1DeviceFormats = array(
|
||||
$SLANG['Undefined'] => '',
|
||||
"PAL" => 0,
|
||||
"NTSC" => 1,
|
||||
"SECAM" => 2,
|
||||
|
@ -229,22 +228,21 @@ if ( ZM_HAS_V4L1 )
|
|||
$v4l1DeviceChannels["$i"] = $i;
|
||||
|
||||
$v4l1LocalPalettes = array(
|
||||
$SLANG['Undefined'] => '',
|
||||
$SLANG['Grey'] => 1,
|
||||
"RGB24" => 4,
|
||||
"RGB565" => 3,
|
||||
"RGB555" => 6,
|
||||
"YUV422" => 7,
|
||||
"YUYV" => 8,
|
||||
"YUV422P" => 13,
|
||||
"YUV420P" => 15
|
||||
"BGR32" => 5,
|
||||
"BGR24" => 4,
|
||||
"*YUYV" => 8,
|
||||
"*RGB565" => 3,
|
||||
"*RGB555" => 6,
|
||||
"*YUV422" => 7,
|
||||
"*YUV422P" => 13,
|
||||
"*YUV420P" => 15
|
||||
);
|
||||
}
|
||||
|
||||
if ( ZM_HAS_V4L2 )
|
||||
{
|
||||
$v4l2DeviceFormats = array(
|
||||
$SLANG['Undefined'] => '',
|
||||
"PAL" => 0x000000ff,
|
||||
"NTSC" => 0x0000b000,
|
||||
"PAL B" => 0x00000001,
|
||||
|
@ -281,30 +279,38 @@ if ( ZM_HAS_V4L2 )
|
|||
$v4l2DeviceChannels["$i"] = $i;
|
||||
|
||||
$v4l2LocalPalettes = array(
|
||||
$SLANG['Undefined'] => '',
|
||||
"Auto" => 0, /* Automatic palette selection */
|
||||
|
||||
/* Pixel format FOURCC depth Description */
|
||||
//"RGB332" => fourcc('R','G','B','1'), /* 8 RGB-3-3-2 */
|
||||
"RGB444" => fourcc('R','4','4','4'), /* 16 xxxxrrrr ggggbbbb */
|
||||
"RGB555" => fourcc('R','G','B','O'), /* 16 RGB-5-5-5 */
|
||||
"RGB565" => fourcc('R','G','B','P'), /* 16 RGB-5-6-5 */
|
||||
//"RGB555X" => fourcc('R','G','B','Q'), /* 16 RGB-5-5-5 BE */
|
||||
//"RGB565X" => fourcc('R','G','B','R'), /* 16 RGB-5-6-5 BE */
|
||||
"BGR24" => fourcc('B','G','R','3'), /* 24 BGR-8-8-8 */
|
||||
"RGB24" => fourcc('R','G','B','3'), /* 24 RGB-8-8-8 */
|
||||
$SLANG['Grey'] => fourcc('G','R','E','Y'), /* 8 Greyscale */
|
||||
"BGR32" => fourcc('B','G','R','4'), /* 32 BGR-8-8-8-8 */
|
||||
"RGB32" => fourcc('R','G','B','4'), /* 32 RGB-8-8-8-8 */
|
||||
"GREY" => fourcc('G','R','E','Y'), /* 8 Greyscale */
|
||||
"BGR24" => fourcc('B','G','R','3'), /* 24 BGR-8-8-8 */
|
||||
"RGB24" => fourcc('R','G','B','3'), /* 24 RGB-8-8-8 */
|
||||
"*YUYV" => fourcc('Y','U','Y','V'), /* 16 YUV 4:2:2 */
|
||||
|
||||
/* compressed formats */
|
||||
"*JPEG" => fourcc('J','P','E','G'), /* JFIF JPEG */
|
||||
"*MJPEG" => fourcc('M','J','P','G'), /* Motion-JPEG */
|
||||
//"DV" => fourcc('d','v','s','d'), /* 1394 */
|
||||
//"MPEG" => fourcc('M','P','E','G'), /* MPEG-1/2/4 */
|
||||
|
||||
//"RGB332" => fourcc('R','G','B','1'), /* 8 RGB-3-3-2 */
|
||||
"*RGB444" => fourcc('R','4','4','4'), /* 16 xxxxrrrr ggggbbbb */
|
||||
"*RGB555" => fourcc('R','G','B','O'), /* 16 RGB-5-5-5 */
|
||||
"*RGB565" => fourcc('R','G','B','P'), /* 16 RGB-5-6-5 */
|
||||
//"RGB555X" => fourcc('R','G','B','Q'), /* 16 RGB-5-5-5 BE */
|
||||
//"RGB565X" => fourcc('R','G','B','R'), /* 16 RGB-5-6-5 BE */
|
||||
//"Y16" => fourcc('Y','1','6',''), /* 16 Greyscale */
|
||||
//"PAL8" => fourcc('P','A','L','8'), /* 8 8-bit palette */
|
||||
//"YVU410" => fourcc('Y','V','U','9'), /* 9 YVU 4:1:0 */
|
||||
//"YVU420" => fourcc('Y','V','1','2'), /* 12 YVU 4:2:0 */
|
||||
"YUYV" => fourcc('Y','U','Y','V'), /* 16 YUV 4:2:2 */
|
||||
|
||||
//"UYVY" => fourcc('U','Y','V','Y'), /* 16 YUV 4:2:2 */
|
||||
"YUV422P" => fourcc('4','2','2','P'), /* 16 YVU422 planar */
|
||||
"YUV411P" => fourcc('4','1','1','P'), /* 16 YVU411 planar */
|
||||
"*YUV422P" => fourcc('4','2','2','P'), /* 16 YVU422 planar */
|
||||
"*YUV411P" => fourcc('4','1','1','P'), /* 16 YVU411 planar */
|
||||
//"Y41P" => fourcc('Y','4','1','P'), /* 12 YUV 4:1:1 */
|
||||
"YUV444" => fourcc('Y','4','4','4'), /* 16 xxxxyyyy uuuuvvvv */
|
||||
"*YUV444" => fourcc('Y','4','4','4'), /* 16 xxxxyyyy uuuuvvvv */
|
||||
//"YUV555" => fourcc('Y','U','V','O'), /* 16 YUV-5-5-5 */
|
||||
//"YUV565" => fourcc('Y','U','V','P'), /* 16 YUV-5-6-5 */
|
||||
//"YUV32" => fourcc('Y','U','V','4'), /* 32 YUV-8-8-8-8 */
|
||||
|
@ -314,8 +320,8 @@ if ( ZM_HAS_V4L2 )
|
|||
//"NV21" => fourcc('N','V','2','1'), /* 12 Y/CrCb 4:2:0 */
|
||||
|
||||
/* The following formats are not defined in the V4L2 specification */
|
||||
"YUV410" => fourcc('Y','U','V','9'), /* 9 YUV 4:1:0 */
|
||||
"YUV420" => fourcc('Y','U','1','2'), /* 12 YUV 4:2:0 */
|
||||
"*YUV410" => fourcc('Y','U','V','9'), /* 9 YUV 4:1:0 */
|
||||
"*YUV420" => fourcc('Y','U','1','2'), /* 12 YUV 4:2:0 */
|
||||
//"YYUV" => fourcc('Y','Y','U','V'), /* 16 YUV 4:2:2 */
|
||||
//"HI240" => fourcc('H','I','2','4'), /* 8 8-bit color */
|
||||
//"HM12" => fourcc('H','M','1','2'), /* 8 YUV 4:2:0 16x16 macroblocks */
|
||||
|
@ -325,12 +331,6 @@ if ( ZM_HAS_V4L2 )
|
|||
//"SGBRG8" => fourcc('G','B','R','G'), /* 8 GBGB.. RGRG.. */
|
||||
//"SBGGR16" => fourcc('B','Y','R','2'), /* 16 BGBG.. GRGR.. */
|
||||
|
||||
/* compressed formats */
|
||||
//"MJPEG" => fourcc('M','J','P','G'), /* Motion-JPEG */
|
||||
"JPEG" => fourcc('J','P','E','G'), /* JFIF JPEG */
|
||||
//"DV" => fourcc('d','v','s','d'), /* 1394 */
|
||||
//"MPEG" => fourcc('M','P','E','G'), /* MPEG-1/2/4 */
|
||||
|
||||
/* Vendor-specific formats */
|
||||
//"WNVA" => fourcc('W','N','V','A'), /* Winnov hw compress */
|
||||
//"SN9C10X" => fourcc('S','9','1','0'), /* SN9C10x compression */
|
||||
|
@ -347,9 +347,10 @@ if ( ZM_HAS_V4L2 )
|
|||
);
|
||||
}
|
||||
|
||||
$remoteColours = $fileColours = array(
|
||||
$Colours = array(
|
||||
$SLANG['8BitGrey'] => 1,
|
||||
$SLANG['24BitColour'] => 3
|
||||
$SLANG['24BitColour'] => 3,
|
||||
$SLANG['32BitColour'] => 4
|
||||
);
|
||||
|
||||
$orientations = array(
|
||||
|
@ -361,6 +362,33 @@ $orientations = array(
|
|||
$SLANG['FlippedVert'] => 'vert'
|
||||
);
|
||||
|
||||
$deinterlaceopts = array(
|
||||
"Disabled" => 0x00000000,
|
||||
"Four field motion adaptive - Soft" => 0x00001E04, /* 30 change */
|
||||
"Four field motion adaptive - Medium" => 0x00001404, /* 20 change */
|
||||
"Four field motion adaptive - Hard" => 0x00000A04, /* 10 change */
|
||||
"Discard" => 0x00000001,
|
||||
"Linear" => 0x00000002,
|
||||
"Blend" => 0x00000003,
|
||||
"Blend (25%)" => 0x00000205
|
||||
);
|
||||
|
||||
$deinterlaceopts_v4l2 = array(
|
||||
"Disabled" => 0x00000000,
|
||||
"Four field motion adaptive - Soft" => 0x00001E04, /* 30 change */
|
||||
"Four field motion adaptive - Medium" => 0x00001404, /* 20 change */
|
||||
"Four field motion adaptive - Hard" => 0x00000A04, /* 10 change */
|
||||
"Discard" => 0x00000001,
|
||||
"Linear" => 0x00000002,
|
||||
"Blend" => 0x00000003,
|
||||
"Blend (25%)" => 0x00000205,
|
||||
"V4L2: Capture top field only" => 0x02000000,
|
||||
"V4L2: Capture bottom field only" => 0x03000000,
|
||||
"V4L2: Alternate fields (Bob)" => 0x07000000,
|
||||
"V4L2: Progressive" => 0x01000000,
|
||||
"V4L2: Interlaced" => 0x04000000,
|
||||
);
|
||||
|
||||
xhtmlHeaders(__FILE__, $SLANG['Monitor']." - ".validHtmlStr($monitor['Name']) );
|
||||
?>
|
||||
<body>
|
||||
|
@ -435,6 +463,7 @@ if ( ZM_HAS_V4L && ($tab != 'source' || $newMonitor['Type'] != 'Local') )
|
|||
<input type="hidden" name="newMonitor[Device]" value="<?= validHtmlStr($newMonitor['Device']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Channel]" value="<?= validHtmlStr($newMonitor['Channel']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Format]" value="<?= validHtmlStr($newMonitor['Format']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Palette]" value="<?= validHtmlStr($newMonitor['Palette']) ?>"/>
|
||||
<?php
|
||||
}
|
||||
if ( $tab != 'source' || $newMonitor['Type'] != 'Remote' )
|
||||
|
@ -460,10 +489,11 @@ if ( $tab != 'source' || ($newMonitor['Type'] != 'Remote' && $newMonitor['Type']
|
|||
if ( $tab != 'source' )
|
||||
{
|
||||
?>
|
||||
<input type="hidden" name="newMonitor[Palette]" value="<?= validHtmlStr($newMonitor['Palette']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Colours]" value="<?= validHtmlStr($newMonitor['Colours']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Width]" value="<?= validHtmlStr($newMonitor['Width']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Height]" value="<?= validHtmlStr($newMonitor['Height']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Orientation]" value="<?= validHtmlStr($newMonitor['Orientation']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Deinterlacing]" value="<?= validHtmlStr($newMonitor['Deinterlacing']) ?>"/>
|
||||
<?php
|
||||
}
|
||||
if ( $tab != 'timestamp' )
|
||||
|
@ -604,14 +634,6 @@ switch ( $tab )
|
|||
}
|
||||
case 'source' :
|
||||
{
|
||||
// Set up initial palette value
|
||||
if ( $newMonitor['Palette'] == '' )
|
||||
{
|
||||
if ( ZM_HAS_V4L && $newMonitor['Type'] == 'Local' )
|
||||
$newMonitor['Palette'] = 4;
|
||||
else
|
||||
$newMonitor['Palette'] = 3;
|
||||
}
|
||||
if ( ZM_HAS_V4L && $newMonitor['Type'] == "Local" )
|
||||
{
|
||||
?>
|
||||
|
@ -626,7 +648,7 @@ switch ( $tab )
|
|||
<tr><td><?= $SLANG['CapturePalette'] ?></td><td><select name="newMonitor[Palette]"><?php foreach ( $v4l1LocalPalettes as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Palette'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
else if ( ZM_HAS_V4L2 && $newMonitor['Method'] == 'v4l2' )
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr><td><?= $SLANG['DeviceChannel'] ?></td><td><select name="newMonitor[Channel]"><?php foreach ( $v4l2DeviceChannels as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Channel'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
|
@ -656,21 +678,32 @@ switch ( $tab )
|
|||
<tr><td><?= $SLANG['RemoteHostName'] ?></td><td><input type="text" name="newMonitor[Host]" value="<?= validHtmlStr($newMonitor['Host']) ?>" size="36"/></td></tr>
|
||||
<tr><td><?= $SLANG['RemoteHostPort'] ?></td><td><input type="text" name="newMonitor[Port]" value="<?= validHtmlStr($newMonitor['Port']) ?>" size="6"/></td></tr>
|
||||
<tr><td><?= $SLANG['RemoteHostPath'] ?></td><td><input type="text" name="newMonitor[Path]" value="<?= validHtmlStr($newMonitor['Path']) ?>" size="36"/></td></tr>
|
||||
<tr><td><?= $SLANG['RemoteImageColours'] ?></td><td><select name="newMonitor[Palette]"><?php foreach ( $remoteColours as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Palette'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
elseif ( $newMonitor['Type'] == "File" || $newMonitor['Type'] == "Ffmpeg" )
|
||||
{
|
||||
?>
|
||||
<tr><td><?= $SLANG['SourcePath'] ?></td><td><input type="text" name="newMonitor[Path]" value="<?= validHtmlStr($newMonitor['Path']) ?>" size="36"/></td></tr>
|
||||
<tr><td><?= $SLANG['SourceColours'] ?></td><td><select name="newMonitor[Palette]"><?php foreach ( $fileColours as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Palette'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td><?= "Target Colorspace" ?></td><td><select name="newMonitor[Colours]"><?php foreach ( $Colours as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Colours'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<tr><td><?= $SLANG['CaptureWidth'] ?> (<?= $SLANG['Pixels'] ?>)</td><td><input type="text" name="newMonitor[Width]" value="<?= validHtmlStr($newMonitor['Width']) ?>" size="4" onkeyup="updateMonitorDimensions(this);"/></td></tr>
|
||||
<tr><td><?= $SLANG['CaptureHeight'] ?> (<?= $SLANG['Pixels'] ?>)</td><td><input type="text" name="newMonitor[Height]" value="<?= validHtmlStr($newMonitor['Height']) ?>" size="4" onkeyup="updateMonitorDimensions(this);"/></td></tr>
|
||||
<tr><td><?= $SLANG['PreserveAspect'] ?></td><td><input type="checkbox" name="preserveAspectRatio" value="1"/></td></tr>
|
||||
<tr><td><?= $SLANG['Orientation'] ?></td><td><select name="newMonitor[Orientation]"><?php foreach ( $orientations as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Orientation'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
if ( $newMonitor['Type'] == "Local" )
|
||||
{
|
||||
?>
|
||||
<tr><td><?= "Deinterlacing" ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts_v4l2 as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Deinterlacing'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<tr><td><?= "Deinterlacing" ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Deinterlacing'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ if ( !canEdit( 'Monitors' ) )
|
|||
$cameras = array();
|
||||
$cameras[0] = $SLANG['ChooseDetectedCamera'];
|
||||
|
||||
if ( ZM_V4L2 )
|
||||
if ( ZM_HAS_V4L2 )
|
||||
{
|
||||
// Probe Local Cameras
|
||||
//
|
||||
|
@ -45,7 +45,7 @@ if ( ZM_V4L2 )
|
|||
|
||||
$devices = array();
|
||||
$preferredStandards = array( 'PAL', 'NTSC' );
|
||||
$preferredFormats = array( '422P', 'YUYV', 'BGR3' );
|
||||
$preferredFormats = array( 'BGR3', 'RGB3', 'YUYV', 'UYVY', 'JPEG', 'MJPG', '422P', 'YU12', 'GREY' );
|
||||
foreach ( $output as $line )
|
||||
{
|
||||
if ( !preg_match( '/^d:([^|]+).*S:([^|]*).*F:([^|]+).*I:(\d+)\|(.+)$/', $line, $deviceMatches ) )
|
||||
|
@ -83,6 +83,7 @@ if ( ZM_V4L2 )
|
|||
'Type' => 'Local',
|
||||
'Device' => $deviceMatches[1],
|
||||
'Channel' => $i,
|
||||
'Colours' => 3,
|
||||
'Format' => $preferredStandard,
|
||||
'Palette' => $preferredFormat,
|
||||
);
|
||||
|
@ -93,10 +94,15 @@ if ( ZM_V4L2 )
|
|||
}
|
||||
else
|
||||
{
|
||||
$inputMonitor['Width'] = 352;
|
||||
$inputMonitor['Width'] = 384;
|
||||
$inputMonitor['Height'] = 288;
|
||||
}
|
||||
$inputDesc = htmlspecialchars(serialize($inputMonitor));
|
||||
if ( $preferredFormat == 'GREY' )
|
||||
{
|
||||
$inputMonitor['Colours'] = 1;
|
||||
$inputMonitor['SignalCheckColour'] = '#000023';
|
||||
}
|
||||
$inputDesc = base64_encode(serialize($inputMonitor));
|
||||
$inputString = $deviceMatches[1].', chan '.$i.($input['free']?(" - ".$SLANG['Available']):(" (".$monitors[$input['id']]['Name'].")"));
|
||||
$inputs[] = $input;
|
||||
$cameras[$inputDesc] = $inputString;
|
||||
|
@ -120,7 +126,7 @@ function probeAxis( $ip )
|
|||
'Host' => $ip,
|
||||
'Port' => 80,
|
||||
'Path' => '/axis-cgi/mjpg/video.cgi?resolution=320x240',
|
||||
'Palette' => 3,
|
||||
'Colours' => 3,
|
||||
'Width' => 320,
|
||||
'Height' => 240,
|
||||
),
|
||||
|
@ -154,7 +160,7 @@ function probePana( $ip )
|
|||
'Host' => $ip,
|
||||
'Port' => 80,
|
||||
'Path' => '/nphMotionJpeg?Resolution=320x240&Quality=Standard',
|
||||
'Palette' => 3,
|
||||
'Colours' => 3,
|
||||
'Width' => 320,
|
||||
'Height' => 240,
|
||||
),
|
||||
|
@ -174,7 +180,7 @@ function probeActi( $ip )
|
|||
'Host' => 'Admin:123456@'.$ip,
|
||||
'Port' => 7070,
|
||||
'Path' => '',
|
||||
'Palette' => 3,
|
||||
'Colours' => 3,
|
||||
'Width' => 320,
|
||||
'Height' => 240,
|
||||
),
|
||||
|
@ -209,7 +215,7 @@ function probeVivotek( $ip )
|
|||
'Host' => $ip,
|
||||
'Port' => 554,
|
||||
'Path' => '',
|
||||
'Palette' => 3,
|
||||
'Colours' => 3,
|
||||
'Width' => 352,
|
||||
'Height' => 240,
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue