Merge branch 'storageareas' of github.com:ZoneMinder/ZoneMinder into storageareas
This commit is contained in:
commit
386afc3546
|
@ -45,4 +45,4 @@ script:
|
||||||
- mysql -uzmuser -pzmpass < db/zm_create.sql
|
- mysql -uzmuser -pzmpass < db/zm_create.sql
|
||||||
- mysql -uzmuser -pzmpass zm < db/test.monitor.sql
|
- mysql -uzmuser -pzmpass zm < db/test.monitor.sql
|
||||||
- sudo zmpkg.pl start
|
- sudo zmpkg.pl start
|
||||||
- sudo zmfilter.pl -f purgewhenfull
|
- sudo zmfilter.pl --filter purgewhenfull
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ "$1" = "configure" ]; then
|
||||||
chown www-data:root /var/log/zm
|
chown www-data:root /var/log/zm
|
||||||
chown www-data:www-data /var/lib/zm
|
chown www-data:www-data /var/lib/zm
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
chown www-data:www-data -R /var/cache/zoneminder
|
chown www-data:www-data /var/cache/zoneminder /var/cache/zoneminder/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do this every time the package is installed or upgraded
|
# Do this every time the package is installed or upgraded
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ "$1" = "configure" ]; then
|
||||||
chown www-data:root /var/log/zm
|
chown www-data:root /var/log/zm
|
||||||
chown www-data:www-data /var/lib/zm
|
chown www-data:www-data /var/lib/zm
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
chown www-data:www-data -R /var/cache/zoneminder
|
chown www-data:www-data /var/cache/zoneminder /var/cache/zoneminder/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do this every time the package is installed or upgraded
|
# Do this every time the package is installed or upgraded
|
||||||
|
|
|
@ -6,6 +6,7 @@ Uploaders: Vagrant Cascadian <vagrant@debian.org>
|
||||||
Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apache2-dev, dh-linktree
|
Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apache2-dev, dh-linktree
|
||||||
,cmake
|
,cmake
|
||||||
,libavcodec-ffmpeg-dev, libavformat-ffmpeg-dev, libswscale-ffmpeg-dev, libavutil-ffmpeg-dev, libavdevice-ffmpeg-dev
|
,libavcodec-ffmpeg-dev, libavformat-ffmpeg-dev, libswscale-ffmpeg-dev, libavutil-ffmpeg-dev, libavdevice-ffmpeg-dev
|
||||||
|
,libx264-dev, libmp4v2-dev,
|
||||||
,libbz2-dev
|
,libbz2-dev
|
||||||
,libgcrypt-dev
|
,libgcrypt-dev
|
||||||
,libcurl4-gnutls-dev
|
,libcurl4-gnutls-dev
|
||||||
|
@ -34,10 +35,8 @@ Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
|
||||||
,javascript-common
|
,javascript-common
|
||||||
,libav-tools
|
,libav-tools
|
||||||
,libdate-manip-perl
|
,libdate-manip-perl, libmime-lite-perl, libmime-tools-perl
|
||||||
,libdbd-mysql-perl
|
,libdbd-mysql-perl
|
||||||
,libmime-lite-perl
|
|
||||||
,libmime-tools-perl
|
|
||||||
,libphp-serialization-perl
|
,libphp-serialization-perl
|
||||||
,libmodule-load-conditional-perl
|
,libmodule-load-conditional-perl
|
||||||
,libnet-sftp-foreign-perl
|
,libnet-sftp-foreign-perl
|
||||||
|
@ -57,12 +56,12 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
|
||||||
,libsys-cpu-perl, libsys-meminfo-perl
|
,libsys-cpu-perl, libsys-meminfo-perl
|
||||||
,mysql-client | virtual-mysql-client
|
,mysql-client | virtual-mysql-client
|
||||||
,perl-modules
|
,perl-modules
|
||||||
,php5-mysql, php5-gd
|
,php5-mysql | php-mysql, php5-gd | php-gd
|
||||||
,policykit-1
|
,policykit-1
|
||||||
,rsyslog | system-log-daemon
|
,rsyslog | system-log-daemon
|
||||||
,zip
|
,zip
|
||||||
Recommends: ${misc:Recommends}
|
Recommends: ${misc:Recommends}
|
||||||
,libapache2-mod-php5 | php5-fpm
|
,libapache2-mod-php5 | libapache2-mod-php7 | php5-fpm
|
||||||
,mysql-server | virtual-mysql-server
|
,mysql-server | virtual-mysql-server
|
||||||
,zoneminder-doc (>= ${source:Version})
|
,zoneminder-doc (>= ${source:Version})
|
||||||
Suggests: fcgiwrap, logrotate
|
Suggests: fcgiwrap, logrotate
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ "$1" = "configure" ]; then
|
||||||
chown www-data:root /var/log/zm
|
chown www-data:root /var/log/zm
|
||||||
chown www-data:www-data /var/lib/zm
|
chown www-data:www-data /var/lib/zm
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
chown www-data:www-data -R /var/cache/zoneminder
|
chown www-data:www-data /var/cache/zoneminder /var/cache/zoneminder/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do this every time the package is installed or upgraded
|
# Do this every time the package is installed or upgraded
|
||||||
|
|
|
@ -3825,6 +3825,41 @@ body = "ZM alarm detected - %EL% secs, %EF%/%EFA% frames, t%EST%/m%ESM%/a%ESA% s
|
||||||
readonly => 1,
|
readonly => 1,
|
||||||
category => "dynamic",
|
category => "dynamic",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => "ZM_SSMTP_MAIL",
|
||||||
|
default => "no",
|
||||||
|
description => qqq("
|
||||||
|
Use a SSMTP mail server if available.
|
||||||
|
NEW_MAIL_MODULES must be enabled
|
||||||
|
"),
|
||||||
|
requires => [
|
||||||
|
{ name => "ZM_OPT_EMAIL", value => "yes" },
|
||||||
|
{ name => "ZM_OPT_MESSAGE", value => "yes" },
|
||||||
|
{ name => "ZM_NEW_MAIL_MODULES", value => "yes" }
|
||||||
|
],
|
||||||
|
help => qqq("
|
||||||
|
SSMTP is a lightweight and efficient method to send email.
|
||||||
|
The SSMTP application is not installed by default.
|
||||||
|
NEW_MAIL_MODULES must also be enabled.
|
||||||
|
Please visit: http://www.zoneminder.com/wiki/index.php/How_to_get_ssmtp_working_with_Zoneminder
|
||||||
|
for setup and configuration help.
|
||||||
|
"),
|
||||||
|
type => $types{boolean},
|
||||||
|
category => "mail",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name => "ZM_SSMTP_PATH",
|
||||||
|
default => "",
|
||||||
|
description => "SSMTP executable path",
|
||||||
|
requires => [{ name => "ZM_SSMTP_MAIL", value => "yes" }],
|
||||||
|
help => qqq("
|
||||||
|
Recommend setting the path to the SSMTP application.
|
||||||
|
If path is not defined. Zoneminder will try to determine
|
||||||
|
the path via shell command. Example path: /usr/sbin/ssmtp.
|
||||||
|
"),
|
||||||
|
type => $types{string},
|
||||||
|
category => "mail",
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
our %options_hash = map { ( $_->{name}, $_ ) } @options;
|
our %options_hash = map { ( $_->{name}, $_ ) } @options;
|
||||||
|
|
|
@ -155,10 +155,12 @@ MAIN: while( $loop ) {
|
||||||
Fatal("ZM_AUDIT_MIN_AGE is not set in config.");
|
Fatal("ZM_AUDIT_MIN_AGE is not set in config.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my %Monitors;
|
||||||
my $db_monitors;
|
my $db_monitors;
|
||||||
my $monitorSelectSql = "select Id from Monitors order by Id";
|
my $monitorSelectSql = "select * from Monitors order by Id";
|
||||||
my $monitorSelectSth = $dbh->prepare_cached( $monitorSelectSql )
|
my $monitorSelectSth = $dbh->prepare_cached( $monitorSelectSql )
|
||||||
or Fatal( "Can't prepare '$monitorSelectSql': ".$dbh->errstr() );
|
or Fatal( "Can't prepare '$monitorSelectSql': ".$dbh->errstr() );
|
||||||
|
|
||||||
my $eventSelectSql = "SELECT Id, (unix_timestamp() - unix_timestamp(StartTime)) as Age
|
my $eventSelectSql = "SELECT Id, (unix_timestamp() - unix_timestamp(StartTime)) as Age
|
||||||
FROM Events WHERE MonitorId = ? ORDER BY Id";
|
FROM Events WHERE MonitorId = ? ORDER BY Id";
|
||||||
my $eventSelectSth = $dbh->prepare_cached( $eventSelectSql )
|
my $eventSelectSth = $dbh->prepare_cached( $eventSelectSql )
|
||||||
|
@ -169,6 +171,8 @@ MAIN: while( $loop ) {
|
||||||
or Fatal( "Can't execute: ".$monitorSelectSth->errstr() );
|
or Fatal( "Can't execute: ".$monitorSelectSth->errstr() );
|
||||||
while( my $monitor = $monitorSelectSth->fetchrow_hashref() )
|
while( my $monitor = $monitorSelectSth->fetchrow_hashref() )
|
||||||
{
|
{
|
||||||
|
$Monitors{$$monitor{Id}} = $monitor;
|
||||||
|
|
||||||
Debug( "Found database monitor '$monitor->{Id}'" );
|
Debug( "Found database monitor '$monitor->{Id}'" );
|
||||||
my $db_events = $db_monitors->{$monitor->{Id}} = {};
|
my $db_events = $db_monitors->{$monitor->{Id}} = {};
|
||||||
my $res = $eventSelectSth->execute( $monitor->{Id} )
|
my $res = $eventSelectSth->execute( $monitor->{Id} )
|
||||||
|
@ -467,20 +471,30 @@ MAIN: while( $loop ) {
|
||||||
|
|
||||||
# New audit to close any events that were left open for longer than MIN_AGE seconds
|
# New audit to close any events that were left open for longer than MIN_AGE seconds
|
||||||
my $selectUnclosedEventsSql =
|
my $selectUnclosedEventsSql =
|
||||||
"SELECT E.Id,
|
#"SELECT E.Id, ANY_VALUE(E.MonitorId),
|
||||||
max(F.TimeStamp) as EndTime,
|
#
|
||||||
unix_timestamp(max(F.TimeStamp)) - unix_timestamp(E.StartTime) as Length,
|
#max(F.TimeStamp) as EndTime,
|
||||||
max(F.FrameId) as Frames,
|
#unix_timestamp(max(F.TimeStamp)) - unix_timestamp(E.StartTime) as Length,
|
||||||
|
#max(F.FrameId) as Frames,
|
||||||
|
#count(if(F.Score>0,1,NULL)) as AlarmFrames,
|
||||||
|
#sum(F.Score) as TotScore,
|
||||||
|
#max(F.Score) as MaxScore
|
||||||
|
#FROM Events as E
|
||||||
|
#INNER JOIN Frames as F on E.Id = F.EventId
|
||||||
|
#WHERE isnull(E.Frames) or isnull(E.EndTime)
|
||||||
|
#GROUP BY E.Id HAVING EndTime < (now() - interval ".$Config{ZM_AUDIT_MIN_AGE}." second)"
|
||||||
|
#;
|
||||||
|
"SELECT *, unix_timestamp(StartTime) AS TimeStamp FROM Events WHERE EndTime IS NULL AND StartTime < (now() - interval ".$Config{ZM_AUDIT_MIN_AGE}." second)";
|
||||||
|
|
||||||
|
my $selectFrameDataSql = "SELECT max(TimeStamp) as EndTime, unix_timestamp(max(TimeStamp)) AS EndTimeStamp, max(FrameId) as Frames,
|
||||||
count(if(F.Score>0,1,NULL)) as AlarmFrames,
|
count(if(F.Score>0,1,NULL)) as AlarmFrames,
|
||||||
sum(F.Score) as TotScore,
|
sum(F.Score) as TotScore,
|
||||||
max(F.Score) as MaxScore,
|
max(F.Score) as MaxScore
|
||||||
M.EventPrefix as Prefix
|
FROM Frames WHERE EventId=?";
|
||||||
FROM Events as E
|
my $selectFrameDataSth = $dbh->prepare_cached($selectFrameDataSql)
|
||||||
LEFT JOIN Monitors as M on E.MonitorId = M.Id
|
or Fatal( "Can't prepare '$selectFrameDataSql': ".$dbh->errstr() );
|
||||||
INNER JOIN Frames as F on E.Id = F.EventId
|
|
||||||
WHERE isnull(E.Frames) or isnull(E.EndTime)
|
|
||||||
GROUP BY E.Id HAVING EndTime < (now() - interval ".$Config{ZM_AUDIT_MIN_AGE}." second)"
|
|
||||||
;
|
|
||||||
my $selectUnclosedEventsSth = $dbh->prepare_cached( $selectUnclosedEventsSql )
|
my $selectUnclosedEventsSth = $dbh->prepare_cached( $selectUnclosedEventsSql )
|
||||||
or Fatal( "Can't prepare '$selectUnclosedEventsSql': ".$dbh->errstr() );
|
or Fatal( "Can't prepare '$selectUnclosedEventsSql': ".$dbh->errstr() );
|
||||||
my $updateUnclosedEventsSql =
|
my $updateUnclosedEventsSql =
|
||||||
|
@ -505,26 +519,32 @@ MAIN: while( $loop ) {
|
||||||
aud_print( "Found open event '$event->{Id}'" );
|
aud_print( "Found open event '$event->{Id}'" );
|
||||||
if ( confirm( 'close', 'closing' ) )
|
if ( confirm( 'close', 'closing' ) )
|
||||||
{
|
{
|
||||||
$res = $updateUnclosedEventsSth->execute
|
$res = $selectFrameDataSth->execute( $event->{Id} );
|
||||||
(
|
my $frame = $selectFrameDataSth->fetchrow_hashref();
|
||||||
sprintf("%s%d%s",
|
if ( $frame ) {
|
||||||
$event->{Prefix},
|
$res = $updateUnclosedEventsSth->execute
|
||||||
$event->{Id},
|
(
|
||||||
RECOVER_TAG
|
sprintf("%s%d%s",
|
||||||
),
|
$Monitors{$event->{MonitorId}}->{EventPrefix},
|
||||||
$event->{EndTime},
|
$event->{Id},
|
||||||
$event->{Length},
|
RECOVER_TAG
|
||||||
$event->{Frames},
|
),
|
||||||
$event->{AlarmFrames},
|
$frame->{EndTime},
|
||||||
$event->{TotScore},
|
$frame->{EndTimeStamp} - $event->{TimeStamp},
|
||||||
$event->{AlarmFrames}
|
$frame->{Frames},
|
||||||
? int($event->{TotScore} / $event->{AlarmFrames})
|
$frame->{AlarmFrames},
|
||||||
: 0
|
$frame->{TotScore},
|
||||||
,
|
$frame->{AlarmFrames}
|
||||||
$event->{MaxScore},
|
? int($frame->{TotScore} / $frame->{AlarmFrames})
|
||||||
RECOVER_TEXT,
|
: 0
|
||||||
$event->{Id}
|
,
|
||||||
) or Fatal( "Can't execute: ".$updateUnclosedEventsSth->errstr() );
|
$frame->{MaxScore},
|
||||||
|
RECOVER_TEXT,
|
||||||
|
$event->{Id}
|
||||||
|
) or Fatal( "Can't execute: ".$updateUnclosedEventsSth->errstr() );
|
||||||
|
} else {
|
||||||
|
Error("SHOULD DELETE");
|
||||||
|
} # end if has frame data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@ sub killAll
|
||||||
my $killall;
|
my $killall;
|
||||||
if ( '@HOST_OS@' eq 'BSD' )
|
if ( '@HOST_OS@' eq 'BSD' )
|
||||||
{
|
{
|
||||||
$killall = 'killall -';
|
$killall = 'killall -q -';
|
||||||
} elsif ( '@HOST_OS@' eq 'solaris' ) {
|
} elsif ( '@HOST_OS@' eq 'solaris' ) {
|
||||||
$killall = 'pkill -';
|
$killall = 'pkill -';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -779,9 +779,31 @@ sub sendEmail
|
||||||
Disposition => "attachment"
|
Disposition => "attachment"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if ( $Config{ZM_SSMTP_MAIL} ){
|
||||||
|
|
||||||
|
my $ssmtp_location = $Config{ZM_SSMTP_PATH};
|
||||||
|
|
||||||
|
if( ! $ssmtp_location ){
|
||||||
|
|
||||||
|
$ssmtp_location = qx('which ssmtp');
|
||||||
|
|
||||||
|
if ( logDebugging() )
|
||||||
|
{
|
||||||
|
Debug( "which ssmtp: $ssmtp_location - set ssmtp path in options to suppress this message\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$mail->send( 'sendmail', $ssmtp_location, $Config{ZM_EMAIL_ADDRESS} );
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
|
||||||
|
$mail->send();
|
||||||
|
}
|
||||||
### Send the Message
|
### Send the Message
|
||||||
MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
|
#MIME::Lite->send( "smtp", $Config{ZM_EMAIL_HOST}, Timeout=>60 );
|
||||||
$mail->send();
|
#$mail->send();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,7 +117,8 @@ void zmLoadConfig()
|
||||||
|
|
||||||
Debug( 1, "Fetching ZM_SERVER_ID For Name = %s", staticConfig.SERVER_NAME.c_str() );
|
Debug( 1, "Fetching ZM_SERVER_ID For Name = %s", staticConfig.SERVER_NAME.c_str() );
|
||||||
std::string sql = stringtf("SELECT Id FROM Servers WHERE Name='%s'", staticConfig.SERVER_NAME.c_str() );
|
std::string sql = stringtf("SELECT Id FROM Servers WHERE Name='%s'", staticConfig.SERVER_NAME.c_str() );
|
||||||
if ( MYSQL_ROW dbrow = zmDbFetchOne( sql.c_str() ) ) {
|
zmDbRow dbrow;
|
||||||
|
if ( dbrow.fetch( sql.c_str() ) ) {
|
||||||
staticConfig.SERVER_ID = atoi(dbrow[0]);
|
staticConfig.SERVER_ID = atoi(dbrow[0]);
|
||||||
} else {
|
} else {
|
||||||
Fatal("Can't get ServerId for Server %s", staticConfig.SERVER_NAME.c_str() );
|
Fatal("Can't get ServerId for Server %s", staticConfig.SERVER_NAME.c_str() );
|
||||||
|
@ -128,7 +129,8 @@ void zmLoadConfig()
|
||||||
Debug( 1, "Fetching ZM_SERVER_NAME For Id = %d", staticConfig.SERVER_ID );
|
Debug( 1, "Fetching ZM_SERVER_NAME For Id = %d", staticConfig.SERVER_ID );
|
||||||
std::string sql = stringtf("SELECT Name FROM Servers WHERE Id='%d'", staticConfig.SERVER_ID );
|
std::string sql = stringtf("SELECT Name FROM Servers WHERE Id='%d'", staticConfig.SERVER_ID );
|
||||||
|
|
||||||
if ( MYSQL_ROW dbrow = zmDbFetchOne( sql.c_str() ) ) {
|
zmDbRow dbrow;
|
||||||
|
if ( dbrow.fetch( sql.c_str() ) ) {
|
||||||
staticConfig.SERVER_NAME = std::string(dbrow[0]);
|
staticConfig.SERVER_NAME = std::string(dbrow[0]);
|
||||||
} else {
|
} else {
|
||||||
Fatal("Can't get ServerName for Server ID %d", staticConfig.SERVER_ID );
|
Fatal("Can't get ServerName for Server ID %d", staticConfig.SERVER_ID );
|
||||||
|
|
|
@ -95,19 +95,38 @@ MYSQL_RES * zmDbFetch( const char * query ) {
|
||||||
return result;
|
return result;
|
||||||
} // end MYSQL_RES * zmDbFetch( const char * query );
|
} // end MYSQL_RES * zmDbFetch( const char * query );
|
||||||
|
|
||||||
MYSQL_ROW zmDbFetchOne( const char *query ) {
|
zmDbRow *zmDbFetchOne( const char *query ) {
|
||||||
MYSQL_RES *result = zmDbFetch( query );
|
zmDbRow *row = new zmDbRow();
|
||||||
int n_rows = mysql_num_rows( result );
|
if ( row->fetch( query ) ) {
|
||||||
if ( n_rows != 1 ) {
|
return row;
|
||||||
Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query );
|
}
|
||||||
return NULL;
|
delete row;
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
MYSQL_ROW dbrow = mysql_fetch_row( result );
|
|
||||||
mysql_free_result( result );
|
MYSQL_RES *zmDbRow::fetch( const char *query ) {
|
||||||
if ( ! dbrow ) {
|
result_set = zmDbFetch( query );
|
||||||
Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) );
|
if ( ! result_set ) return result_set;
|
||||||
return NULL;
|
|
||||||
}
|
int n_rows = mysql_num_rows( result_set );
|
||||||
return dbrow;
|
if ( n_rows != 1 ) {
|
||||||
|
Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query );
|
||||||
|
mysql_free_result( result_set );
|
||||||
|
result_set = NULL;
|
||||||
|
return result_set;
|
||||||
|
}
|
||||||
|
|
||||||
|
row = mysql_fetch_row( result_set );
|
||||||
|
if ( ! row ) {
|
||||||
|
mysql_free_result( result_set );
|
||||||
|
result_set = NULL;
|
||||||
|
Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) );
|
||||||
|
} else {
|
||||||
|
Debug(3, "Succes");
|
||||||
|
}
|
||||||
|
return result_set;
|
||||||
|
}
|
||||||
|
zmDbRow::~zmDbRow() {
|
||||||
|
if ( result_set )
|
||||||
|
mysql_free_result( result_set );
|
||||||
}
|
}
|
||||||
|
|
17
src/zm_db.h
17
src/zm_db.h
|
@ -22,6 +22,21 @@
|
||||||
|
|
||||||
#include <mysql/mysql.h>
|
#include <mysql/mysql.h>
|
||||||
|
|
||||||
|
class zmDbRow {
|
||||||
|
private:
|
||||||
|
MYSQL_RES *result_set;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
public:
|
||||||
|
zmDbRow() { result_set = NULL; row = NULL; };
|
||||||
|
MYSQL_RES *fetch( const char *query );
|
||||||
|
zmDbRow( MYSQL_RES *, MYSQL_ROW *row );
|
||||||
|
~zmDbRow();
|
||||||
|
|
||||||
|
char *operator[](unsigned int index) const {
|
||||||
|
return row[index];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,7 +48,7 @@ void zmDbConnect();
|
||||||
void zmDbClose();
|
void zmDbClose();
|
||||||
|
|
||||||
MYSQL_RES * zmDbFetch( const char *query );
|
MYSQL_RES * zmDbFetch( const char *query );
|
||||||
MYSQL_ROW zmDbFetchOne( const char *query );
|
zmDbRow *zmDbFetchOne( const char *query );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -167,12 +167,21 @@ int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check the buffer sizes */
|
/* Check the buffer sizes */
|
||||||
size_t insize = avpicture_get_size(in_pf, width, height);
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
size_t insize = av_image_get_buffer_size(in_pf, width, height,1);
|
||||||
|
#else
|
||||||
|
size_t insize = avpicture_get_size(in_pf, width, height);
|
||||||
|
#endif
|
||||||
if(insize != in_buffer_size) {
|
if(insize != in_buffer_size) {
|
||||||
Error("The input buffer size does not match the expected size for the input format. Required: %d Available: %d", insize, in_buffer_size);
|
Error("The input buffer size does not match the expected size for the input format. Required: %d Available: %d", insize, in_buffer_size);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
size_t outsize = avpicture_get_size(out_pf, width, height);
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
size_t outsize = av_image_get_buffer_size(out_pf, width, height,1);
|
||||||
|
#else
|
||||||
|
size_t outsize = avpicture_get_size(out_pf, width, height);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(outsize < out_buffer_size) {
|
if(outsize < out_buffer_size) {
|
||||||
Error("The output buffer is undersized for the output format. Required: %d Available: %d", outsize, out_buffer_size);
|
Error("The output buffer is undersized for the output format. Required: %d Available: %d", outsize, out_buffer_size);
|
||||||
return -5;
|
return -5;
|
||||||
|
@ -186,13 +195,29 @@ int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the buffers */
|
/* Fill in the buffers */
|
||||||
if(!avpicture_fill( (AVPicture*)input_avframe, (uint8_t*)in_buffer, in_pf, width, height ) ) {
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
Error("Failed filling input frame with input buffer");
|
if(av_image_fill_arrays(input_avframe->data, input_avframe->linesize,
|
||||||
return -7;
|
(uint8_t*)in_buffer, in_pf, width, height, 1) <= 0)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
if(avpicture_fill( (AVPicture*)input_avframe, (uint8_t*)in_buffer,
|
||||||
|
in_pf, width, height ) <= 0)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
Error("Failed filling input frame with input buffer");
|
||||||
|
return -7;
|
||||||
}
|
}
|
||||||
if(!avpicture_fill( (AVPicture*)output_avframe, out_buffer, out_pf, width, height ) ) {
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
Error("Failed filling output frame with output buffer");
|
if(av_image_fill_arrays(output_avframe->data, output_avframe->linesize,
|
||||||
return -8;
|
out_buffer, out_pf, width, height, 1) <= 0)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
if(avpicture_fill( (AVPicture*)output_avframe, out_buffer,
|
||||||
|
out_pf, width, height ) <= 0)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
Error("Failed filling output frame with output buffer");
|
||||||
|
return -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do the conversion */
|
/* Do the conversion */
|
||||||
|
|
|
@ -48,6 +48,12 @@ extern "C" {
|
||||||
#else
|
#else
|
||||||
#include <libavcodec/opt.h>
|
#include <libavcodec/opt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
#include <libavutil/imgutils.h>
|
||||||
|
#else
|
||||||
|
#include <libavutil/avutil.h>
|
||||||
|
#endif
|
||||||
#elif HAVE_FFMPEG_AVUTIL_H
|
#elif HAVE_FFMPEG_AVUTIL_H
|
||||||
#include <ffmpeg/avutil.h>
|
#include <ffmpeg/avutil.h>
|
||||||
#include <ffmpeg/base64.h>
|
#include <ffmpeg/base64.h>
|
||||||
|
|
|
@ -193,7 +193,13 @@ int FfmpegCamera::Capture( Image &image )
|
||||||
if ( frameComplete ) {
|
if ( frameComplete ) {
|
||||||
Debug( 4, "Got frame %d", frameCount );
|
Debug( 4, "Got frame %d", frameCount );
|
||||||
|
|
||||||
avpicture_fill( (AVPicture *)mFrame, directbuffer, imagePixFormat, width, height);
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(mFrame->data, mFrame->linesize,
|
||||||
|
directbuffer, imagePixFormat, width, height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)mFrame, directbuffer,
|
||||||
|
imagePixFormat, width, height);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_LIBSWSCALE
|
#if HAVE_LIBSWSCALE
|
||||||
if(mConvertContext == NULL) {
|
if(mConvertContext == NULL) {
|
||||||
|
@ -395,7 +401,12 @@ int FfmpegCamera::OpenFfmpeg() {
|
||||||
|
|
||||||
Debug ( 1, "Allocated frames" );
|
Debug ( 1, "Allocated frames" );
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
int pSize = av_image_get_buffer_size( imagePixFormat, width, height,1 );
|
||||||
|
#else
|
||||||
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
||||||
|
#endif
|
||||||
|
|
||||||
if( (unsigned int)pSize != imagesize) {
|
if( (unsigned int)pSize != imagesize) {
|
||||||
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
||||||
}
|
}
|
||||||
|
@ -583,8 +594,8 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi
|
||||||
|
|
||||||
//Keep the last keyframe so we can establish immediate video
|
//Keep the last keyframe so we can establish immediate video
|
||||||
if(packet.flags & AV_PKT_FLAG_KEY) {
|
if(packet.flags & AV_PKT_FLAG_KEY) {
|
||||||
Debug(4, "Have keyframe");
|
//Debug(4, "Have keyframe");
|
||||||
av_copy_packet(&lastKeyframePkt, &packet);
|
//av_copy_packet(&lastKeyframePkt, &packet);
|
||||||
//TODO I think we need to store the key frame location for seeking as part of the event
|
//TODO I think we need to store the key frame location for seeking as part of the event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,11 @@ LocalCamera::LocalCamera(
|
||||||
if ( !tmpPicture )
|
if ( !tmpPicture )
|
||||||
Fatal( "Could not allocate temporary picture" );
|
Fatal( "Could not allocate temporary picture" );
|
||||||
|
|
||||||
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
int pSize = av_image_get_buffer_size( imagePixFormat, width, height,1 );
|
||||||
|
#else
|
||||||
|
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
||||||
|
#endif
|
||||||
if( (unsigned int)pSize != imagesize) {
|
if( (unsigned int)pSize != imagesize) {
|
||||||
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
||||||
}
|
}
|
||||||
|
@ -877,7 +881,18 @@ void LocalCamera::Initialise()
|
||||||
#endif
|
#endif
|
||||||
if ( !capturePictures[i] )
|
if ( !capturePictures[i] )
|
||||||
Fatal( "Could not allocate picture" );
|
Fatal( "Could not allocate picture" );
|
||||||
avpicture_fill( (AVPicture *)capturePictures[i], (uint8_t*)v4l2_data.buffers[i].start, capturePixFormat, v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(capturePictures[i]->data,
|
||||||
|
capturePictures[i]->linesize,
|
||||||
|
(uint8_t*)v4l2_data.buffers[i].start,capturePixFormat,
|
||||||
|
v4l2_data.fmt.fmt.pix.width,
|
||||||
|
v4l2_data.fmt.fmt.pix.height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)capturePictures[i],
|
||||||
|
(uint8_t*)v4l2_data.buffers[i].start, capturePixFormat,
|
||||||
|
v4l2_data.fmt.fmt.pix.width,
|
||||||
|
v4l2_data.fmt.fmt.pix.height );
|
||||||
|
#endif
|
||||||
#endif // HAVE_LIBSWSCALE
|
#endif // HAVE_LIBSWSCALE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,7 +1050,16 @@ void LocalCamera::Initialise()
|
||||||
#endif
|
#endif
|
||||||
if ( !capturePictures[i] )
|
if ( !capturePictures[i] )
|
||||||
Fatal( "Could not allocate picture" );
|
Fatal( "Could not allocate picture" );
|
||||||
avpicture_fill( (AVPicture *)capturePictures[i], (unsigned char *)v4l1_data.bufptr+v4l1_data.frames.offsets[i], capturePixFormat, width, height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(capturePictures[i]->data,
|
||||||
|
capturePictures[i]->linesize,
|
||||||
|
(unsigned char *)v4l1_data.bufptr+v4l1_data.frames.offsets[i],
|
||||||
|
capturePixFormat, width, height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)capturePictures[i],
|
||||||
|
(unsigned char *)v4l1_data.bufptr+v4l1_data.frames.offsets[i],
|
||||||
|
capturePixFormat, width, height );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif // HAVE_LIBSWSCALE
|
#endif // HAVE_LIBSWSCALE
|
||||||
|
|
||||||
|
@ -2131,7 +2155,14 @@ int LocalCamera::Capture( Image &image )
|
||||||
|
|
||||||
Debug( 9, "Calling sws_scale to perform the conversion" );
|
Debug( 9, "Calling sws_scale to perform the conversion" );
|
||||||
/* Use swscale to convert the image directly into the shared memory */
|
/* Use swscale to convert the image directly into the shared memory */
|
||||||
avpicture_fill( (AVPicture *)tmpPicture, directbuffer, imagePixFormat, width, height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(tmpPicture->data,
|
||||||
|
tmpPicture->linesize, directbuffer,
|
||||||
|
imagePixFormat, width, height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)tmpPicture, directbuffer,
|
||||||
|
imagePixFormat, width, height );
|
||||||
|
#endif
|
||||||
sws_scale( imgConversionContext, capturePictures[capture_frame]->data, capturePictures[capture_frame]->linesize, 0, height, tmpPicture->data, tmpPicture->linesize );
|
sws_scale( imgConversionContext, capturePictures[capture_frame]->data, capturePictures[capture_frame]->linesize, 0, height, tmpPicture->data, tmpPicture->linesize );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -286,8 +286,8 @@ Monitor::Monitor(
|
||||||
storage_id( p_storage_id ),
|
storage_id( p_storage_id ),
|
||||||
function( (Function)p_function ),
|
function( (Function)p_function ),
|
||||||
enabled( p_enabled ),
|
enabled( p_enabled ),
|
||||||
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
|
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() ),
|
height( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Width():p_camera->Height() ),
|
||||||
orientation( (Orientation)p_orientation ),
|
orientation( (Orientation)p_orientation ),
|
||||||
deinterlacing( p_deinterlacing ),
|
deinterlacing( p_deinterlacing ),
|
||||||
savejpegspref( p_savejpegs ),
|
savejpegspref( p_savejpegs ),
|
||||||
|
@ -1119,8 +1119,8 @@ void Monitor::DumpZoneImage( const char *zone_string ) {
|
||||||
Debug(3, "Trying to load from event");
|
Debug(3, "Trying to load from event");
|
||||||
// Grab the most revent event image
|
// Grab the most revent event image
|
||||||
std::string sql = stringtf( "SELECT MAX(Id) FROM Events WHERE MonitorId=%d AND Frames > 0", id );
|
std::string sql = stringtf( "SELECT MAX(Id) FROM Events WHERE MonitorId=%d AND Frames > 0", id );
|
||||||
MYSQL_ROW eventid_row = zmDbFetchOne(sql.c_str() );
|
zmDbRow eventid_row;
|
||||||
if ( eventid_row ) {
|
if ( eventid_row.fetch( sql.c_str() ) ) {
|
||||||
int event_id = atoi( eventid_row[0] );
|
int event_id = atoi( eventid_row[0] );
|
||||||
|
|
||||||
Debug( 3, "Got event %d", event_id );
|
Debug( 3, "Got event %d", event_id );
|
||||||
|
@ -2182,9 +2182,6 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
||||||
col++;
|
col++;
|
||||||
bool embed_exif = (*dbrow[col] != '0'); col++;
|
bool embed_exif = (*dbrow[col] != '0'); col++;
|
||||||
|
|
||||||
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;
|
int extras = (deinterlacing>>24)&0xff;
|
||||||
|
|
||||||
Camera *camera = new LocalCamera(
|
Camera *camera = new LocalCamera(
|
||||||
|
@ -2195,8 +2192,8 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
||||||
v4l_multi_buffer,
|
v4l_multi_buffer,
|
||||||
v4l_captures_per_frame,
|
v4l_captures_per_frame,
|
||||||
method,
|
method,
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
palette,
|
palette,
|
||||||
brightness,
|
brightness,
|
||||||
|
@ -2349,9 +2346,6 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
||||||
int track_motion = atoi(dbrow[col]); col++;
|
int track_motion = atoi(dbrow[col]); col++;
|
||||||
bool embed_exif = (*dbrow[col] != '0'); col++;
|
bool embed_exif = (*dbrow[col] != '0'); col++;
|
||||||
|
|
||||||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
|
||||||
int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
|
|
||||||
|
|
||||||
Camera *camera = 0;
|
Camera *camera = 0;
|
||||||
if ( protocol == "http" ) {
|
if ( protocol == "http" ) {
|
||||||
camera = new RemoteCameraHttp(
|
camera = new RemoteCameraHttp(
|
||||||
|
@ -2360,8 +2354,8 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
||||||
host, // Host
|
host, // Host
|
||||||
port, // Port
|
port, // Port
|
||||||
path, // Path
|
path, // Path
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -2379,8 +2373,8 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
|
||||||
host, // Host
|
host, // Host
|
||||||
port, // Port
|
port, // Port
|
||||||
path, // Path
|
path, // Path
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
rtsp_describe,
|
rtsp_describe,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
|
@ -2531,14 +2525,11 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
|
||||||
int track_motion = atoi(dbrow[col]); col++;
|
int track_motion = atoi(dbrow[col]); col++;
|
||||||
bool embed_exif = (*dbrow[col] != '0'); col++;
|
bool embed_exif = (*dbrow[col] != '0'); col++;
|
||||||
|
|
||||||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
|
||||||
int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
|
|
||||||
|
|
||||||
Camera *camera = new FileCamera(
|
Camera *camera = new FileCamera(
|
||||||
id,
|
id,
|
||||||
path, // File
|
path, // File
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -2688,16 +2679,13 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
||||||
int track_motion = atoi(dbrow[col]); col++;
|
int track_motion = atoi(dbrow[col]); col++;
|
||||||
bool embed_exif = (*dbrow[col] != '0'); col++;
|
bool embed_exif = (*dbrow[col] != '0'); col++;
|
||||||
|
|
||||||
int cam_width = ((orientation==ROTATE_90||orientation==ROTATE_270)?height:width);
|
|
||||||
int cam_height = ((orientation==ROTATE_90||orientation==ROTATE_270)?width:height);
|
|
||||||
|
|
||||||
Camera *camera = new FfmpegCamera(
|
Camera *camera = new FfmpegCamera(
|
||||||
id,
|
id,
|
||||||
path, // File
|
path, // File
|
||||||
method,
|
method,
|
||||||
options,
|
options,
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -2770,8 +2758,8 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
|
||||||
Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
std::string sql = stringtf( "select Id, Name, ServerId, StorageId, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Protocol, Method, Host, Port, Path, Options, User, Pass, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, RTSPDescribe, SaveJPEGs, VideoWriter, EncoderParameters, RecordAudio, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, LabelSize, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour, Exif from Monitors where Id = %d", p_id );
|
std::string sql = stringtf( "select Id, Name, ServerId, StorageId, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Protocol, Method, Host, Port, Path, Options, User, Pass, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, RTSPDescribe, SaveJPEGs, VideoWriter, EncoderParameters, RecordAudio, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, LabelSize, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour, Exif from Monitors where Id = %d", p_id );
|
||||||
|
|
||||||
MYSQL_ROW dbrow = zmDbFetchOne( sql.c_str() );
|
zmDbRow dbrow;
|
||||||
if ( ! dbrow ) {
|
if ( ! dbrow.fetch( sql.c_str() ) ) {
|
||||||
Error( "Can't use query result: %s", mysql_error( &dbconn ) );
|
Error( "Can't use query result: %s", mysql_error( &dbconn ) );
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
|
@ -2869,9 +2857,6 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
col++;
|
col++;
|
||||||
bool embed_exif = (*dbrow[col] != '0'); col++;
|
bool embed_exif = (*dbrow[col] != '0'); col++;
|
||||||
|
|
||||||
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;
|
int extras = (deinterlacing>>24)&0xff;
|
||||||
|
|
||||||
Camera *camera = 0;
|
Camera *camera = 0;
|
||||||
|
@ -2885,8 +2870,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
v4l_multi_buffer,
|
v4l_multi_buffer,
|
||||||
v4l_captures_per_frame,
|
v4l_captures_per_frame,
|
||||||
method,
|
method,
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
palette,
|
palette,
|
||||||
brightness,
|
brightness,
|
||||||
|
@ -2908,8 +2893,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
host.c_str(),
|
host.c_str(),
|
||||||
port.c_str(),
|
port.c_str(),
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -2926,8 +2911,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
host.c_str(),
|
host.c_str(),
|
||||||
port.c_str(),
|
port.c_str(),
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
rtsp_describe,
|
rtsp_describe,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
|
@ -2947,8 +2932,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
camera = new FileCamera(
|
camera = new FileCamera(
|
||||||
id,
|
id,
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -2964,8 +2949,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
method,
|
method,
|
||||||
options,
|
options,
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -2984,8 +2969,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
method,
|
method,
|
||||||
options,
|
options,
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
@ -3004,8 +2989,8 @@ Monitor *Monitor::Load( unsigned int p_id, bool load_zones, Purpose purpose ) {
|
||||||
path.c_str(),
|
path.c_str(),
|
||||||
user.c_str(),
|
user.c_str(),
|
||||||
pass.c_str(),
|
pass.c_str(),
|
||||||
cam_width,
|
width,
|
||||||
cam_height,
|
height,
|
||||||
colours,
|
colours,
|
||||||
brightness,
|
brightness,
|
||||||
contrast,
|
contrast,
|
||||||
|
|
|
@ -417,8 +417,8 @@ public:
|
||||||
return( embed_exif );
|
return( embed_exif );
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Width() const { return( width ); }
|
unsigned int Width() const { return width; }
|
||||||
unsigned int Height() const { return( height ); }
|
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() ); }
|
unsigned int SubpixelOrder() const { return( camera->SubpixelOrder() ); }
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,13 @@ void VideoStream::OpenStream( )
|
||||||
Panic( "Could not allocate opicture" );
|
Panic( "Could not allocate opicture" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
int size = av_image_get_buffer_size( c->pix_fmt, c->width,
|
||||||
|
c->height, 1 );
|
||||||
|
#else
|
||||||
int size = avpicture_get_size( c->pix_fmt, c->width, c->height );
|
int size = avpicture_get_size( c->pix_fmt, c->width, c->height );
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t *opicture_buf = (uint8_t *)av_malloc( size );
|
uint8_t *opicture_buf = (uint8_t *)av_malloc( size );
|
||||||
if ( !opicture_buf )
|
if ( !opicture_buf )
|
||||||
{
|
{
|
||||||
|
@ -344,7 +350,13 @@ void VideoStream::OpenStream( )
|
||||||
#endif
|
#endif
|
||||||
Panic( "Could not allocate opicture_buf" );
|
Panic( "Could not allocate opicture_buf" );
|
||||||
}
|
}
|
||||||
avpicture_fill( (AVPicture *)opicture, opicture_buf, c->pix_fmt, c->width, c->height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(opicture->data, opicture->linesize,
|
||||||
|
opicture_buf, c->pix_fmt, c->width, c->height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)opicture, opicture_buf, c->pix_fmt,
|
||||||
|
c->width, c->height );
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if the output format is not identical to the input format, then a temporary
|
/* 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
|
picture is needed too. It is then converted to the required
|
||||||
|
@ -361,7 +373,12 @@ void VideoStream::OpenStream( )
|
||||||
{
|
{
|
||||||
Panic( "Could not allocate tmp_opicture" );
|
Panic( "Could not allocate tmp_opicture" );
|
||||||
}
|
}
|
||||||
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
int size = av_image_get_buffer_size( pf, c->width,
|
||||||
|
c->height,1 );
|
||||||
|
#else
|
||||||
int size = avpicture_get_size( pf, c->width, c->height );
|
int size = avpicture_get_size( pf, c->width, c->height );
|
||||||
|
#endif
|
||||||
uint8_t *tmp_opicture_buf = (uint8_t *)av_malloc( size );
|
uint8_t *tmp_opicture_buf = (uint8_t *)av_malloc( size );
|
||||||
if ( !tmp_opicture_buf )
|
if ( !tmp_opicture_buf )
|
||||||
{
|
{
|
||||||
|
@ -372,7 +389,14 @@ void VideoStream::OpenStream( )
|
||||||
#endif
|
#endif
|
||||||
Panic( "Could not allocate tmp_opicture_buf" );
|
Panic( "Could not allocate tmp_opicture_buf" );
|
||||||
}
|
}
|
||||||
avpicture_fill( (AVPicture *)tmp_opicture, tmp_opicture_buf, pf, c->width, c->height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(tmp_opicture->data,
|
||||||
|
tmp_opicture->linesize, tmp_opicture_buf, pf,
|
||||||
|
c->width, c->height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)tmp_opicture,
|
||||||
|
tmp_opicture_buf, pf, c->width, c->height );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,14 +702,14 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t *buffer, int buffer_size,
|
||||||
#endif
|
#endif
|
||||||
if ( got_packet )
|
if ( got_packet )
|
||||||
{
|
{
|
||||||
if ( c->coded_frame->key_frame )
|
// if ( c->coded_frame->key_frame )
|
||||||
{
|
// {
|
||||||
#if LIBAVCODEC_VERSION_CHECK(52, 30, 2, 30, 2)
|
//#if LIBAVCODEC_VERSION_CHECK(52, 30, 2, 30, 2)
|
||||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
// pkt->flags |= AV_PKT_FLAG_KEY;
|
||||||
#else
|
//#else
|
||||||
pkt->flags |= PKT_FLAG_KEY;
|
// pkt->flags |= PKT_FLAG_KEY;
|
||||||
#endif
|
//#endif
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ( pkt->pts != (int64_t)AV_NOPTS_VALUE )
|
if ( pkt->pts != (int64_t)AV_NOPTS_VALUE )
|
||||||
{
|
{
|
||||||
|
|
|
@ -238,13 +238,18 @@ int RemoteCameraRtsp::PrimeCapture()
|
||||||
mFrame = avcodec_alloc_frame();
|
mFrame = avcodec_alloc_frame();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(mRawFrame == NULL || mFrame == NULL)
|
if(mRawFrame == NULL || mFrame == NULL)
|
||||||
Fatal( "Unable to allocate frame(s)");
|
Fatal( "Unable to allocate frame(s)");
|
||||||
|
|
||||||
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
int pSize = av_image_get_buffer_size( imagePixFormat, width, height, 1 );
|
||||||
|
#else
|
||||||
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
int pSize = avpicture_get_size( imagePixFormat, width, height );
|
||||||
if( (unsigned int)pSize != imagesize) {
|
#endif
|
||||||
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
|
||||||
}
|
if( (unsigned int)pSize != imagesize) {
|
||||||
|
Fatal("Image size mismatch. Required: %d Available: %d",pSize,imagesize);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
#if HAVE_LIBSWSCALE
|
#if HAVE_LIBSWSCALE
|
||||||
if(!sws_isSupportedInput(mCodecContext->pix_fmt)) {
|
if(!sws_isSupportedInput(mCodecContext->pix_fmt)) {
|
||||||
|
@ -299,24 +304,6 @@ int RemoteCameraRtsp::Capture( Image &image ) {
|
||||||
if ( !buffer.size() )
|
if ( !buffer.size() )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
int avResult = av_read_frame( mFormatContext, &packet );
|
|
||||||
if ( avResult < 0 ) {
|
|
||||||
char errbuf[AV_ERROR_MAX_STRING_SIZE];
|
|
||||||
av_strerror(avResult, errbuf, AV_ERROR_MAX_STRING_SIZE);
|
|
||||||
if (
|
|
||||||
// Check if EOF.
|
|
||||||
(avResult == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) ||
|
|
||||||
// Check for Connection failure.
|
|
||||||
(avResult == -110)
|
|
||||||
) {
|
|
||||||
Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf);
|
|
||||||
//ReopenFfmpeg();
|
|
||||||
}
|
|
||||||
|
|
||||||
Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mCodecContext->codec_id == AV_CODEC_ID_H264) {
|
if(mCodecContext->codec_id == AV_CODEC_ID_H264) {
|
||||||
// SPS and PPS frames should be saved and appended to IDR frames
|
// SPS and PPS frames should be saved and appended to IDR frames
|
||||||
int nalType = (buffer.head()[3] & 0x1f);
|
int nalType = (buffer.head()[3] & 0x1f);
|
||||||
|
@ -339,6 +326,8 @@ int avResult = av_read_frame( mFormatContext, &packet );
|
||||||
buffer += lastSps;
|
buffer += lastSps;
|
||||||
buffer += lastPps;
|
buffer += lastPps;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Debug(3, "Not an h264 packet");
|
||||||
}
|
}
|
||||||
|
|
||||||
av_init_packet( &packet );
|
av_init_packet( &packet );
|
||||||
|
@ -498,9 +487,15 @@ int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* even
|
||||||
|
|
||||||
Debug( 3, "Got frame %d", frameCount );
|
Debug( 3, "Got frame %d", frameCount );
|
||||||
|
|
||||||
avpicture_fill( (AVPicture *)mFrame, directbuffer, imagePixFormat, width, height );
|
#if LIBAVUTIL_VERSION_CHECK(54, 6, 0, 6, 0)
|
||||||
|
av_image_fill_arrays(mFrame->data, mFrame->linesize,
|
||||||
|
directbuffer, imagePixFormat, width, height, 1);
|
||||||
|
#else
|
||||||
|
avpicture_fill( (AVPicture *)mFrame, directbuffer,
|
||||||
|
imagePixFormat, width, height);
|
||||||
|
#endif
|
||||||
|
|
||||||
//Video recording
|
//Video recording
|
||||||
if ( recording && !wasRecording ) {
|
if ( recording && !wasRecording ) {
|
||||||
//Instantiate the video storage module
|
//Instantiate the video storage module
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ Storage::Storage( unsigned int p_id ) {
|
||||||
char sql[ZM_SQL_SML_BUFSIZ];
|
char sql[ZM_SQL_SML_BUFSIZ];
|
||||||
snprintf( sql, sizeof(sql), "SELECT Id, Name, Path from Storage WHERE Id=%d", p_id );
|
snprintf( sql, sizeof(sql), "SELECT Id, Name, Path from Storage WHERE Id=%d", p_id );
|
||||||
Debug(1,"Loading Storage for %d using %s", p_id, sql );
|
Debug(1,"Loading Storage for %d using %s", p_id, sql );
|
||||||
MYSQL_ROW dbrow = zmDbFetchOne( sql );
|
zmDbRow dbrow;
|
||||||
if ( ! dbrow ) {
|
if ( ! dbrow.fetch( sql ) ) {
|
||||||
Error( "Unable to load storage area for id %d: %s", p_id, mysql_error( &dbconn ) );
|
Error( "Unable to load storage area for id %d: %s", p_id, mysql_error( &dbconn ) );
|
||||||
} else {
|
} else {
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
require_once( 'database.php' );
|
||||||
|
require_once( 'Event.php' );
|
||||||
|
|
||||||
|
class Frame {
|
||||||
|
public function __construct( $IdOrRow ) {
|
||||||
|
$row = NULL;
|
||||||
|
if ( $IdOrRow ) {
|
||||||
|
if ( is_integer( $IdOrRow ) or is_numeric( $IdOrRow ) ) {
|
||||||
|
$row = dbFetchOne( 'SELECT * FROM Frames WHERE Id=?', NULL, array( $IdOrRow ) );
|
||||||
|
if ( ! $row ) {
|
||||||
|
Error("Unable to load Frame record for Id=" . $IdOrRow );
|
||||||
|
}
|
||||||
|
} elseif ( is_array( $IdOrRow ) ) {
|
||||||
|
$row = $IdOrRow;
|
||||||
|
} else {
|
||||||
|
Error("Unknown argument passed to Frame Constructor ($IdOrRow)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} # end if isset($IdOrRow)
|
||||||
|
|
||||||
|
if ( $row ) {
|
||||||
|
foreach ($row as $k => $v) {
|
||||||
|
$this->{$k} = $v;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Error("No row for Frame " . $IdOrRow );
|
||||||
|
}
|
||||||
|
} // end function __construct
|
||||||
|
public function Storage() {
|
||||||
|
return $this->Event()->Storage();
|
||||||
|
}
|
||||||
|
public function Event() {
|
||||||
|
return new Event( $this->{'EventId'} );
|
||||||
|
}
|
||||||
|
public function __call( $fn, array $args){
|
||||||
|
if(isset($this->{$fn})){
|
||||||
|
return $this->{$fn};
|
||||||
|
#array_unshift($args, $this);
|
||||||
|
#call_user_func_array( $this->{$fn}, $args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Path() {
|
||||||
|
$Storage = $this->Storage();
|
||||||
|
return $Storage->Path().'/'.$this->Relative_Path();
|
||||||
|
}
|
||||||
|
public function Relative_Path() {
|
||||||
|
$event_path = "";
|
||||||
|
|
||||||
|
if ( ZM_USE_DEEP_STORAGE )
|
||||||
|
{
|
||||||
|
$event_path =
|
||||||
|
$this->{'MonitorId'}
|
||||||
|
.'/'.strftime( "%y/%m/%d/%H/%M/%S",
|
||||||
|
$this->Time()
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event_path =
|
||||||
|
$this->{'MonitorId'}
|
||||||
|
.'/'.$this->{'Id'}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( $event_path );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImageSrc( ) {
|
||||||
|
return ZM_BASE_URL.'/index.php?view=image&fid='.$this->{'Id'};
|
||||||
|
} // end function getImageSrc
|
||||||
|
} # end class
|
||||||
|
?>
|
|
@ -230,6 +230,7 @@ $SLANG = array(
|
||||||
'ChooseLogFormat' => 'Choose a log format',
|
'ChooseLogFormat' => 'Choose a log format',
|
||||||
'ChooseLogSelection' => 'Choose a log selection',
|
'ChooseLogSelection' => 'Choose a log selection',
|
||||||
'ChoosePreset' => 'Choose Preset',
|
'ChoosePreset' => 'Choose Preset',
|
||||||
|
'CloneMonitor' => 'Clone Monitor',
|
||||||
'Close' => 'Close',
|
'Close' => 'Close',
|
||||||
'Colour' => 'Colour',
|
'Colour' => 'Colour',
|
||||||
'Command' => 'Command',
|
'Command' => 'Command',
|
||||||
|
|
|
@ -30,7 +30,7 @@ function getControlCommands( $monitor )
|
||||||
$cmds['PresetGoto'] = "presetGoto";
|
$cmds['PresetGoto'] = "presetGoto";
|
||||||
$cmds['PresetHome'] = "presetHome";
|
$cmds['PresetHome'] = "presetHome";
|
||||||
|
|
||||||
if ( !empty($monitor->CanZoom) )
|
if ( !empty($monitor->CanZoom()) )
|
||||||
{
|
{
|
||||||
if ( $monitor->CanZoomCon() )
|
if ( $monitor->CanZoomCon() )
|
||||||
$cmds['ZoomRoot'] = "zoomCon";
|
$cmds['ZoomRoot'] = "zoomCon";
|
||||||
|
@ -45,7 +45,7 @@ function getControlCommands( $monitor )
|
||||||
$cmds['ZoomMan'] = "zoomMan";
|
$cmds['ZoomMan'] = "zoomMan";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($monitor->CanFocus) )
|
if ( !empty($monitor->CanFocus()) )
|
||||||
{
|
{
|
||||||
if ( $monitor->CanFocusCon() )
|
if ( $monitor->CanFocusCon() )
|
||||||
$cmds['FocusRoot'] = "focusCon";
|
$cmds['FocusRoot'] = "focusCon";
|
||||||
|
@ -60,7 +60,7 @@ function getControlCommands( $monitor )
|
||||||
$cmds['FocusMan'] = "focusMan";
|
$cmds['FocusMan'] = "focusMan";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($monitor->CanIris) )
|
if ( !empty($monitor->CanIris()) )
|
||||||
{
|
{
|
||||||
if ( $monitor->CanIrisCon() )
|
if ( $monitor->CanIrisCon() )
|
||||||
$cmds['IrisRoot'] = "irisCon";
|
$cmds['IrisRoot'] = "irisCon";
|
||||||
|
@ -75,7 +75,7 @@ function getControlCommands( $monitor )
|
||||||
$cmds['IrisMan'] = "irisMan";
|
$cmds['IrisMan'] = "irisMan";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($monitor->CanWhite) )
|
if ( !empty($monitor->CanWhite()) )
|
||||||
{
|
{
|
||||||
if ( $monitor->CanWhiteCon() )
|
if ( $monitor->CanWhiteCon() )
|
||||||
$cmds['WhiteRoot'] = "whiteCon";
|
$cmds['WhiteRoot'] = "whiteCon";
|
||||||
|
@ -89,7 +89,7 @@ function getControlCommands( $monitor )
|
||||||
$cmds['WhiteMan'] = "whiteMan";
|
$cmds['WhiteMan'] = "whiteMan";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($monitor->CanGain) )
|
if ( !empty($monitor->CanGain()) )
|
||||||
{
|
{
|
||||||
if ( $monitor->CanGainCon() )
|
if ( $monitor->CanGainCon() )
|
||||||
$cmds['GainRoot'] = "gainCon";
|
$cmds['GainRoot'] = "gainCon";
|
||||||
|
@ -103,7 +103,7 @@ function getControlCommands( $monitor )
|
||||||
$cmds['GainMan'] = "gainMan";
|
$cmds['GainMan'] = "gainMan";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($monitor->CanMove) )
|
if ( !empty($monitor->CanMove()) )
|
||||||
{
|
{
|
||||||
if ( $monitor->CanMoveCon() )
|
if ( $monitor->CanMoveCon() )
|
||||||
{
|
{
|
||||||
|
@ -246,9 +246,9 @@ function controlPanTilt( $monitor, $cmds )
|
||||||
<div class="pantiltLabel"><?php echo translate('PanTilt') ?></div>
|
<div class="pantiltLabel"><?php echo translate('PanTilt') ?></div>
|
||||||
<div class="pantiltButtons">
|
<div class="pantiltButtons">
|
||||||
<?php
|
<?php
|
||||||
$hasPan = $monitor->CanPan;
|
$hasPan = $monitor->CanPan();
|
||||||
$hasTilt = $monitor->CanTilt;
|
$hasTilt = $monitor->CanTilt();
|
||||||
$hasDiag = $hasPan && $hasTilt && $monitor->CanMoveDiag;
|
$hasDiag = $hasPan && $hasTilt && $monitor->CanMoveDiag();
|
||||||
?>
|
?>
|
||||||
<div class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpLeft'] ?>',event,-1,-1)"></div>
|
<div class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpLeft'] ?>',event,-1,-1)"></div>
|
||||||
<div class="arrowBtn upBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUp'] ?>',event,0,-1)"></div>
|
<div class="arrowBtn upBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUp'] ?>',event,0,-1)"></div>
|
||||||
|
@ -278,7 +278,7 @@ function controlPresets( $monitor, $cmds )
|
||||||
$labels[$row['Preset']] = $row['Label'];
|
$labels[$row['Preset']] = $row['Label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$presetBreak = (int)(($monitor->NumPresets+1)/((int)(($monitor->NumPresets-1)/MAX_PRESETS)+1));
|
$presetBreak = (int)(($monitor->NumPresets()+1)/((int)(($monitor->NumPresets()-1)/MAX_PRESETS)+1));
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
|
@ -286,7 +286,7 @@ function controlPresets( $monitor, $cmds )
|
||||||
<!--<div><?php echo translate('Presets') ?></div>-->
|
<!--<div><?php echo translate('Presets') ?></div>-->
|
||||||
<div>
|
<div>
|
||||||
<?php
|
<?php
|
||||||
for ( $i = 1; $i <= $monitor->NumPresets; $i++ )
|
for ( $i = 1; $i <= $monitor->NumPresets(); $i++ )
|
||||||
{
|
{
|
||||||
?><input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?$labels[$i]:"" ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/><?php
|
?><input type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?$labels[$i]:"" ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/><?php
|
||||||
if ( $i && (($i%$presetBreak) == 0) )
|
if ( $i && (($i%$presetBreak) == 0) )
|
||||||
|
|
|
@ -589,7 +589,6 @@ else if (document.layers) window.onload=start_slider;
|
||||||
|
|
||||||
function exportEventImagesMaster( $eids )
|
function exportEventImagesMaster( $eids )
|
||||||
{
|
{
|
||||||
global $SLANG;
|
|
||||||
ob_start();
|
ob_start();
|
||||||
exportHeader( translate('Images').' Master' );
|
exportHeader( translate('Images').' Master' );
|
||||||
?>
|
?>
|
||||||
|
@ -599,9 +598,9 @@ function exportEventImagesMaster( $eids )
|
||||||
foreach ($eids as $eid) {
|
foreach ($eids as $eid) {
|
||||||
//get monitor id and event id
|
//get monitor id and event id
|
||||||
$sql = 'SELECT E.MonitorId, E.StartTime, E.Id
|
$sql = 'SELECT E.MonitorId, E.StartTime, E.Id
|
||||||
FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId)
|
FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId)
|
||||||
WHERE E.Id = ?
|
WHERE E.Id = ?
|
||||||
';
|
';
|
||||||
$event = dbFetchOne( $sql, NULL, array( $eid ) );
|
$event = dbFetchOne( $sql, NULL, array( $eid ) );
|
||||||
$eventMonitorId[$eid] = $event['MonitorId'];
|
$eventMonitorId[$eid] = $event['MonitorId'];
|
||||||
$eventPath[$eid] = mygetEventPath( $event );
|
$eventPath[$eid] = mygetEventPath( $event );
|
||||||
|
|
|
@ -48,7 +48,7 @@ var popupSizes = {
|
||||||
'log': { 'width': 1080, 'height': 720 },
|
'log': { 'width': 1080, 'height': 720 },
|
||||||
'login': { 'width': 720, 'height': 480 },
|
'login': { 'width': 720, 'height': 480 },
|
||||||
'logout': { 'width': 260, 'height': 100 },
|
'logout': { 'width': 260, 'height': 100 },
|
||||||
'monitor': { 'width': 450, 'height': 440 },
|
'monitor': { 'width': 700, 'height': 640 },
|
||||||
'monitorpreset':{ 'width': 440, 'height': 200 },
|
'monitorpreset':{ 'width': 440, 'height': 200 },
|
||||||
'monitorprobe': { 'width': 500, 'height': 240 },
|
'monitorprobe': { 'width': 500, 'height': 240 },
|
||||||
'monitorselect':{ 'width': 160, 'height': 200 },
|
'monitorselect':{ 'width': 160, 'height': 200 },
|
||||||
|
|
|
@ -48,7 +48,7 @@ var popupSizes = {
|
||||||
'log': { 'width': 1080, 'height': 720 },
|
'log': { 'width': 1080, 'height': 720 },
|
||||||
'login': { 'width': 720, 'height': 480 },
|
'login': { 'width': 720, 'height': 480 },
|
||||||
'logout': { 'width': 260, 'height': 150 },
|
'logout': { 'width': 260, 'height': 150 },
|
||||||
'monitor': { 'width': 600, 'height': 780 },
|
'monitor': { 'width': 800, 'height': 780 },
|
||||||
'monitorpreset':{ 'width': 440, 'height': 200 },
|
'monitorpreset':{ 'width': 440, 'height': 200 },
|
||||||
'monitorprobe': { 'width': 500, 'height': 240 },
|
'monitorprobe': { 'width': 500, 'height': 240 },
|
||||||
'monitorselect':{ 'width': 160, 'height': 200 },
|
'monitorselect':{ 'width': 160, 'height': 200 },
|
||||||
|
|
|
@ -21,7 +21,7 @@ xhtmlHeaders( __FILE__, translate('Console') );
|
||||||
<th class="colName"><?php echo translate('Name') ?></th>
|
<th class="colName"><?php echo translate('Name') ?></th>
|
||||||
<th class="colFunction"><?php echo translate('Function') ?></th>
|
<th class="colFunction"><?php echo translate('Function') ?></th>
|
||||||
<?php if ( count($servers) ) { ?>
|
<?php if ( count($servers) ) { ?>
|
||||||
<th class="colServer"><?php echo translate('Server') ?></th>
|
<th class="colServer"><?php echo translate('Server') ?></th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th class="colSource"><?php echo translate('Source') ?></th>
|
<th class="colSource"><?php echo translate('Source') ?></th>
|
||||||
<?php if ( $show_storage_areas ) { ?>
|
<?php if ( $show_storage_areas ) { ?>
|
||||||
|
@ -54,7 +54,9 @@ if ( canEdit('Monitors') )
|
||||||
if ( $show_storage_areas ) { $columns += 1; }
|
if ( $show_storage_areas ) { $columns += 1; }
|
||||||
echo $columns;
|
echo $columns;
|
||||||
?>">
|
?>">
|
||||||
<input type="button" class="btn btn-default" value="<?php echo translate('AddNewMonitor'); ?>" onclick="createPopup( '?view=monitor', 'zmMonitor0', 'monitor' ); return( false );"></input>
|
<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
|
||||||
|
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
for ( $i = 0; $i < count($eventCounts); $i++ )
|
for ( $i = 0; $i < count($eventCounts); $i++ )
|
||||||
|
@ -80,7 +82,7 @@ foreach( $displayMonitors as $monitor )
|
||||||
$dclass = "errorText";
|
$dclass = "errorText";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// https://github.com/ZoneMinder/ZoneMinder/issues/1082
|
// https://github.com/ZoneMinder/ZoneMinder/issues/1082
|
||||||
if ( !$monitor['zma'] && $monitor['Function']!='Monitor' )
|
if ( !$monitor['zma'] && $monitor['Function']!='Monitor' )
|
||||||
$dclass = "warnText";
|
$dclass = "warnText";
|
||||||
else
|
else
|
||||||
|
@ -99,7 +101,7 @@ foreach( $displayMonitors as $monitor )
|
||||||
<td class="colName"><?php echo makePopupLink( '?view=watch&mid='.$monitor['Id'], 'zmWatch'.$monitor['Id'], array( 'watch', reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) ), $monitor['Name'], $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></td>
|
<td class="colName"><?php echo makePopupLink( '?view=watch&mid='.$monitor['Id'], 'zmWatch'.$monitor['Id'], array( 'watch', reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) ), $monitor['Name'], $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></td>
|
||||||
<td class="colFunction"><?php echo makePopupLink( '?view=function&mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$fclass.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<td class="colFunction"><?php echo makePopupLink( '?view=function&mid='.$monitor['Id'], 'zmFunction', 'function', '<span class="'.$fclass.'">'.translate('Fn'.$monitor['Function']).( empty($monitor['Enabled']) ? ', disabled' : '' ) .'</span>', canEdit( 'Monitors' ) ) ?></td>
|
||||||
<?php if ( count($servers) ) { ?>
|
<?php if ( count($servers) ) { ?>
|
||||||
<td class="colServer"><?php
|
<td class="colServer"><?php
|
||||||
$Server = new Server( $monitor['ServerId'] );
|
$Server = new Server( $monitor['ServerId'] );
|
||||||
echo $Server->Name();
|
echo $Server->Name();
|
||||||
?></td>
|
?></td>
|
||||||
|
@ -113,9 +115,9 @@ echo $Server->Name();
|
||||||
<?php } elseif ( $monitor['Type'] == "Ffmpeg" || $monitor['Type'] == "Libvlc" ) {
|
<?php } elseif ( $monitor['Type'] == "Ffmpeg" || $monitor['Type'] == "Libvlc" ) {
|
||||||
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
|
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
|
||||||
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
|
$shortpath = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
|
||||||
if ( $shortpath == '' ) {
|
if ( $shortpath == '' ) {
|
||||||
$shortpath = 'Monitor ' . $monitor['Id'];
|
$shortpath = 'Monitor ' . $monitor['Id'];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></td>
|
<td class="colSource"><?php echo makePopupLink( '?view=monitor&mid='.$monitor['Id'], 'zmMonitor'.$monitor['Id'], 'monitor', '<span class="'.$dclass.'">'.$shortpath.'</span>', canEdit( 'Monitors' ) ) ?></td>
|
||||||
<?php } elseif ( $monitor['Type'] == "cURL" ) { ?>
|
<?php } elseif ( $monitor['Type'] == "cURL" ) { ?>
|
||||||
|
|
|
@ -27,7 +27,7 @@ if ( !canView( 'Events' ) )
|
||||||
$eid = validInt( $_REQUEST['eid'] );
|
$eid = validInt( $_REQUEST['eid'] );
|
||||||
$fid = !empty($_REQUEST['fid'])?validInt($_REQUEST['fid']):1;
|
$fid = !empty($_REQUEST['fid'])?validInt($_REQUEST['fid']):1;
|
||||||
|
|
||||||
$sql = 'SELECT E.*,M.Name AS MonitorName,M.Width,M.Height,M.DefaultRate,M.DefaultScale,M.VideoWriter,M.SaveJPEGs,M.Orientation,M.LabelFormat FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?';
|
$sql = 'SELECT E.*,M.Name AS MonitorName,E.Width,E.Height,M.DefaultRate,M.DefaultScale,M.VideoWriter,M.SaveJPEGs,M.Orientation,M.LabelFormat FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?';
|
||||||
$sql_values = array( $eid );
|
$sql_values = array( $eid );
|
||||||
|
|
||||||
if ( $user['MonitorIds'] ) {
|
if ( $user['MonitorIds'] ) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ if ( !canView( 'Events' ) )
|
||||||
$view = "error";
|
$view = "error";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
require_once('includes/Frame.php');
|
||||||
|
|
||||||
$eid = validInt($_REQUEST['eid']);
|
$eid = validInt($_REQUEST['eid']);
|
||||||
if ( !empty($_REQUEST['fid']) )
|
if ( !empty($_REQUEST['fid']) )
|
||||||
|
@ -38,58 +39,60 @@ if ( !empty($fid) ) {
|
||||||
} else {
|
} else {
|
||||||
$frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $event['MaxScore'] ) );
|
$frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $event['MaxScore'] ) );
|
||||||
}
|
}
|
||||||
|
$frame = new Frame( $frame );
|
||||||
|
|
||||||
$maxFid = $event['Frames'];
|
$maxFid = $event['Frames'];
|
||||||
|
|
||||||
$firstFid = 1;
|
$firstFid = 1;
|
||||||
$prevFid = $frame['FrameId']-1;
|
$prevFid = $frame->FrameId()-1;
|
||||||
$nextFid = $frame['FrameId']+1;
|
$nextFid = $frame->FrameId()+1;
|
||||||
$lastFid = $maxFid;
|
$lastFid = $maxFid;
|
||||||
|
|
||||||
$alarmFrame = $frame['Type']=='Alarm';
|
$alarmFrame = $frame->Type()=='Alarm';
|
||||||
|
|
||||||
if ( isset( $_REQUEST['scale'] ) )
|
if ( isset( $_REQUEST['scale'] ) )
|
||||||
$scale = validInt($_REQUEST['scale']);
|
$scale = validInt($_REQUEST['scale']);
|
||||||
else
|
else
|
||||||
$scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
$scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||||
|
|
||||||
$imageData = getImageSrc( $event, $frame, $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") );
|
$imageData = getImageSrc( $event, $frame->FrameId(), $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") );
|
||||||
|
|
||||||
$imagePath = $imageData['thumbPath'];
|
$imagePath = $imageData['thumbPath'];
|
||||||
$eventPath = $imageData['eventPath'];
|
$eventPath = $imageData['eventPath'];
|
||||||
$dImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-d.jpg", $eventPath, $frame['FrameId'] );
|
$dImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-d.jpg", $eventPath, $frame->FrameId() );
|
||||||
$rImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-r.jpg", $eventPath, $frame['FrameId'] );
|
$rImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-r.jpg", $eventPath, $frame->FrameId() );
|
||||||
|
|
||||||
$focusWindow = true;
|
$focusWindow = true;
|
||||||
|
|
||||||
xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$frame['FrameId'] );
|
xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$frame->FrameId() );
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<div id="page">
|
<div id="page">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="headerButtons">
|
<div id="headerButtons">
|
||||||
<?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&eid='.$event['Id'].'&fid='.$frame['FrameId'], 'zmStats', 'stats', translate('Stats') ); } ?>
|
<?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&eid='.$event['Id'].'&fid='.$frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?>
|
||||||
<?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&action=delete&markEid=<?php echo $event['Id'] ?>"><?php echo translate('Delete') ?></a><?php } ?>
|
<?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&action=delete&markEid=<?php echo $event['Id'] ?>"><?php echo translate('Delete') ?></a><?php } ?>
|
||||||
<a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a>
|
<a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a>
|
||||||
</div>
|
</div>
|
||||||
<h2><?php echo translate('Frame') ?> <?php echo $event['Id']."-".$frame['FrameId']." (".$frame['Score'].")" ?></h2>
|
<h2><?php echo translate('Frame') ?> <?php echo $event['Id']."-".$frame->FrameId()." (".$frame->Score().")" ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<p id="image">
|
<p id="image">
|
||||||
<?php if ( in_array($event['VideoWriter'],array("1","2")) ) { ?>
|
<?php if ( in_array($event['VideoWriter'],array("1","2")) ) { ?>
|
||||||
<img src="?view=image-ffmpeg&eid=<?php echo $event['Id'] ?>&fid=<?php echo $frame['FrameId'] ?>&scale=<?php echo $event['DefaultScale'] ?>" class="<?php echo $imageData['imageClass'] ?>">
|
<img src="?view=image-ffmpeg&eid=<?php echo $event['Id'] ?>&fid=<?php echo $frame->FrameId() ?>&scale=<?php echo $event['DefaultScale'] ?>" class="<?php echo $imageData['imageClass'] ?>">
|
||||||
<?php } else {
|
<?php } else {
|
||||||
if ( $imageData['hasAnalImage'] ) { ?><a href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $frame['FrameId'] ?>&scale=<?php echo $scale ?>&show=<?php echo $imageData['isAnalImage']?"capt":"anal" ?>"><?php } ?><img src="<?php echo viewImagePath( $imagePath ) ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $frame['EventId']."-".$frame['FrameId'] ?>" class="<?php echo $imageData['imageClass'] ?>"/><?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
|
if ( $imageData['hasAnalImage'] ) { ?><a href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $frame->FrameId() ?>&scale=<?php echo $scale ?>&show=<?php echo $imageData['isAnalImage']?"capt":"anal" ?>"><?php } ?>
|
||||||
|
<img src="<?php echo $frame->getImageSrc() ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $frame->EventId()."-".$frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/><?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</p>
|
</p>
|
||||||
<p id="controls">
|
<p id="controls">
|
||||||
<?php if ( $frame['FrameId'] > 1 ) { ?>
|
<?php if ( $frame->FrameId() > 1 ) { ?>
|
||||||
<a id="firstLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $firstFid ?>&scale=<?php echo $scale ?>"><?php echo translate('First') ?></a>
|
<a id="firstLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $firstFid ?>&scale=<?php echo $scale ?>"><?php echo translate('First') ?></a>
|
||||||
<?php } if ( $frame['FrameId'] > 1 ) { ?>
|
<?php } if ( $frame->FrameId() > 1 ) { ?>
|
||||||
<a id="prevLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $prevFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Prev') ?></a>
|
<a id="prevLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $prevFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Prev') ?></a>
|
||||||
<?php } if ( $frame['FrameId'] < $maxFid ) { ?>
|
<?php } if ( $frame->FrameId() < $maxFid ) { ?>
|
||||||
<a id="nextLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $nextFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Next') ?></a>
|
<a id="nextLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $nextFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Next') ?></a>
|
||||||
<?php } if ( $frame['FrameId'] < $maxFid ) { ?>
|
<?php } if ( $frame->FrameId() < $maxFid ) { ?>
|
||||||
<a id="lastLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $lastFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Last') ?></a>
|
<a id="lastLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $lastFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Last') ?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
var jsTranslatedAddText;
|
||||||
|
var jsTranslatedCloneText;
|
||||||
|
|
||||||
function setButtonStates( element )
|
function setButtonStates( element )
|
||||||
{
|
{
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
|
@ -15,9 +18,36 @@ function setButtonStates( element )
|
||||||
}
|
}
|
||||||
$(element).getParent( 'tr' ).toggleClass( 'highlight' );
|
$(element).getParent( 'tr' ).toggleClass( 'highlight' );
|
||||||
form.editBtn.disabled = (checked!=1);
|
form.editBtn.disabled = (checked!=1);
|
||||||
|
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
|
||||||
|
|
||||||
form.deleteBtn.disabled = (checked==0);
|
form.deleteBtn.disabled = (checked==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addMonitor( element)
|
||||||
|
{
|
||||||
|
|
||||||
|
var form = element.form;
|
||||||
|
var dupParam;
|
||||||
|
var monitorId=-1;
|
||||||
|
if (form.addBtn.value == jsTranslatedCloneText)
|
||||||
|
{
|
||||||
|
// get the value of the first checkbox
|
||||||
|
for ( var i = 0; i < form.elements.length; i++ )
|
||||||
|
{
|
||||||
|
if ( form.elements[i].type == "checkbox" )
|
||||||
|
{
|
||||||
|
if ( form.elements[i].checked )
|
||||||
|
{
|
||||||
|
monitorId = form.elements[i].value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
|
||||||
|
createPopup( '?view=monitor'+dupParam, 'zmMonitor0','monitor' );
|
||||||
|
}
|
||||||
|
|
||||||
function editMonitor( element )
|
function editMonitor( element )
|
||||||
{
|
{
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
|
@ -55,6 +85,8 @@ function reloadWindow()
|
||||||
|
|
||||||
function initPage()
|
function initPage()
|
||||||
{
|
{
|
||||||
|
jsTranslatedAddText = translatedAddText;
|
||||||
|
jsTranslatedCloneText = translatedCloneText;
|
||||||
reloadWindow.periodical( consoleRefreshTimeout );
|
reloadWindow.periodical( consoleRefreshTimeout );
|
||||||
if ( showVersionPopup )
|
if ( showVersionPopup )
|
||||||
createPopup( '?view=version', 'zmVersion', 'version' );
|
createPopup( '?view=version', 'zmVersion', 'version' );
|
||||||
|
|
|
@ -26,7 +26,7 @@ elseif ( ZM_DYN_SHOW_DONATE_REMINDER )
|
||||||
?>
|
?>
|
||||||
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
|
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
|
||||||
var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;
|
var showDonatePopup = <?php echo isset($showDonatePopup )?'true':'false' ?>;
|
||||||
|
var translatedAddText = "<?php echo translate('AddNewMonitor') ?>";
|
||||||
|
var translatedCloneText = "<?php echo translate('CloneMonitor') ?>";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,80 +58,88 @@ if ( ! empty($_REQUEST['mid']) ) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$nextId = getTableAutoInc( 'Monitors' );
|
$nextId = getTableAutoInc( 'Monitors' );
|
||||||
$monitor = new Monitor();
|
if ( ! empty( $_REQUEST['dupId'] ) ) {
|
||||||
$monitor->set( array(
|
$monitor = new Monitor( $_REQUEST['dupId'] );
|
||||||
'Id' => 0,
|
if ( ZM_OPT_X10 )
|
||||||
'Name' => translate('Monitor').'-'.$nextId,
|
$x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['dupId']) );
|
||||||
'Function' => "Monitor",
|
$clonedName = $monitor->Name();
|
||||||
'Enabled' => true,
|
$monitor->Name( translate('Monitor').'-'.$nextId );
|
||||||
'LinkedMonitors' => "",
|
} else {
|
||||||
'Type' => "",
|
$monitor = new Monitor();
|
||||||
'Device' => "/dev/video0",
|
$monitor->set( array(
|
||||||
'Channel' => "0",
|
'Id' => 0,
|
||||||
'Format' => 0x000000ff,
|
'Name' => translate('Monitor').'-'.$nextId,
|
||||||
'Protocol' => "",
|
'Function' => "Monitor",
|
||||||
'Method' => "",
|
'Enabled' => true,
|
||||||
'Host' => "",
|
'LinkedMonitors' => "",
|
||||||
'Path' => "",
|
'Type' => "",
|
||||||
'Options' => "",
|
'Device' => "/dev/video0",
|
||||||
'Port' => "80",
|
'Channel' => "0",
|
||||||
'User' => "",
|
'Format' => 0x000000ff,
|
||||||
'Pass' => "",
|
'Protocol' => "",
|
||||||
'Colours' => 3,
|
'Method' => "",
|
||||||
'Palette' => 0,
|
'Host' => "",
|
||||||
'Width' => "320",
|
'Path' => "",
|
||||||
'Height' => "240",
|
'Options' => "",
|
||||||
'Orientation' => "0",
|
'Port' => "80",
|
||||||
'Deinterlacing' => 0,
|
'User' => "",
|
||||||
'RTSPDescribe' => 0,
|
'Pass' => "",
|
||||||
'SaveJPEGs' => "3",
|
'Colours' => 3,
|
||||||
'VideoWriter' => "0",
|
'Palette' => 0,
|
||||||
'EncoderParameters' => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n",
|
'Width' => "320",
|
||||||
'RecordAudio' => '0',
|
'Height' => "240",
|
||||||
'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
|
'Orientation' => "0",
|
||||||
'LabelX' => 0,
|
'Deinterlacing' => 0,
|
||||||
'LabelY' => 0,
|
'RTSPDescribe' => 0,
|
||||||
'LabelSize' => 1,
|
'SaveJPEGs' => "3",
|
||||||
'ImageBufferCount' => 50,
|
'VideoWriter' => "0",
|
||||||
'WarmupCount' => 25,
|
'EncoderParameters' => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n",
|
||||||
'PreEventCount' => 25,
|
'RecordAudio' => '0',
|
||||||
'PostEventCount' => 25,
|
'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
|
||||||
'StreamReplayBuffer' => 1000,
|
'LabelX' => 0,
|
||||||
'AlarmFrameCount' => 1,
|
'LabelY' => 0,
|
||||||
'Controllable' => 0,
|
'LabelSize' => 1,
|
||||||
'ControlId' => "",
|
'ImageBufferCount' => 50,
|
||||||
'ControlType' => 0,
|
'WarmupCount' => 25,
|
||||||
'ControlDevice' => "",
|
'PreEventCount' => 25,
|
||||||
'ControlAddress' => "",
|
'PostEventCount' => 25,
|
||||||
'AutoStopTimeout' => "",
|
'StreamReplayBuffer' => 1000,
|
||||||
'TrackMotion' => 0,
|
'AlarmFrameCount' => 1,
|
||||||
'TrackDelay' => "",
|
'Controllable' => 0,
|
||||||
'ReturnLocation' => -1,
|
'ControlId' => "",
|
||||||
'ReturnDelay' => "",
|
'ControlType' => 0,
|
||||||
'SectionLength' => 600,
|
'ControlDevice' => "",
|
||||||
'FrameSkip' => 0,
|
'ControlAddress' => "",
|
||||||
'MotionFrameSkip' => 0,
|
'AutoStopTimeout' => "",
|
||||||
'EventPrefix' => 'Event-',
|
'TrackMotion' => 0,
|
||||||
'AnalysisFPS' => "",
|
'TrackDelay' => "",
|
||||||
'AnalysisUpdateDelay' => 0,
|
'ReturnLocation' => -1,
|
||||||
'MaxFPS' => "",
|
'ReturnDelay' => "",
|
||||||
'AlarmMaxFPS' => "",
|
'SectionLength' => 600,
|
||||||
'FPSReportInterval' => 1000,
|
'FrameSkip' => 0,
|
||||||
'RefBlendPerc' => 6,
|
'MotionFrameSkip' => 0,
|
||||||
'AlarmRefBlendPerc' => 6,
|
'EventPrefix' => 'Event-',
|
||||||
'DefaultView' => 'Events',
|
'AnalysisFPS' => "",
|
||||||
'DefaultRate' => '100',
|
'AnalysisUpdateDelay' => 0,
|
||||||
'DefaultScale' => '100',
|
'MaxFPS' => "",
|
||||||
'SignalCheckColour' => '#0000c0',
|
'AlarmMaxFPS' => "",
|
||||||
'WebColour' => 'red',
|
'FPSReportInterval' => 1000,
|
||||||
'Exif' => '0',
|
'RefBlendPerc' => 6,
|
||||||
'Triggers' => "",
|
'AlarmRefBlendPerc' => 6,
|
||||||
'V4LMultiBuffer' => '',
|
'DefaultView' => 'Events',
|
||||||
'V4LCapturesPerFrame' => 1,
|
'DefaultRate' => '100',
|
||||||
'ServerId' => $Server['Id'],
|
'DefaultScale' => '100',
|
||||||
'StorageId' => '',
|
'SignalCheckColour' => '#0000c0',
|
||||||
) );
|
'WebColour' => 'red',
|
||||||
}
|
'Exif' => '0',
|
||||||
|
'Triggers' => "",
|
||||||
|
'V4LMultiBuffer' => '',
|
||||||
|
'V4LCapturesPerFrame' => 1,
|
||||||
|
'ServerId' => $Server['Id'],
|
||||||
|
'StorageId' => '',
|
||||||
|
) );
|
||||||
|
} # end if $_REQUEST['dupID']
|
||||||
|
} # end if $_REQUEST['mid']
|
||||||
|
|
||||||
if ( ZM_OPT_X10 && empty($x10Monitor) ) {
|
if ( ZM_OPT_X10 && empty($x10Monitor) ) {
|
||||||
$x10Monitor = array(
|
$x10Monitor = array(
|
||||||
|
@ -143,6 +151,7 @@ if ( ZM_OPT_X10 && empty($x10Monitor) ) {
|
||||||
|
|
||||||
function fourcc( $a, $b, $c, $d ) {
|
function fourcc( $a, $b, $c, $d ) {
|
||||||
return( ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24) );
|
return( ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_REQUEST['newMonitor'] ) ) {
|
if ( isset( $_REQUEST['newMonitor'] ) ) {
|
||||||
|
@ -455,23 +464,22 @@ $videowriteropts = array(
|
||||||
xhtmlHeaders(__FILE__, translate('Monitor')." - ".validHtmlStr($monitor->Name) );
|
xhtmlHeaders(__FILE__, translate('Monitor')." - ".validHtmlStr($monitor->Name) );
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<div id="page">
|
<div id="page">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<?php if ( canEdit( 'Monitors' ) ) { ?>
|
<?php if ( canEdit( 'Monitors' ) ) { ?>
|
||||||
|
<?php if ( isset ($_REQUEST['dupId'])) { ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
Configuration cloned from Monitor: <?php echo $clonedName ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
<div id="headerButtons">
|
<div id="headerButtons">
|
||||||
<a href="#" onclick="createPopup( '?view=monitorprobe&mid=<?php echo $monitor->Id ?>', 'zmMonitorProbe<?php echo $monitor->Id ?>', 'monitorprobe' ); return( false );"><?php echo translate('Probe') ?></a>
|
<a href="#" onclick="createPopup( '?view=monitorprobe&mid=<?php echo $monitor->Id ?>', 'zmMonitorProbe<?php echo $monitor->Id ?>', 'monitorprobe' ); return( false );"><?php echo translate('Probe') ?></a>
|
||||||
<?php
|
<?php if ( ZM_HAS_ONVIF ) { ?>
|
||||||
if ( ZM_HAS_ONVIF ) {
|
<a href="#" onclick="createPopup( '?view=onvifprobe&mid=<?php echo $monitor->Id ?>', 'zmOnvifProbe<?php echo $monitor->Id ?>', 'onvifprobe' ); return( false );"><?php echo translate('OnvifProbe') ?></a>
|
||||||
?>
|
<?php } ?>
|
||||||
<a href="#" onclick="createPopup( '?view=onvifprobe&mid=<?php echo $monitor->Id ?>', 'zmOnvifProbe<?php echo $monitor->Id ?>', 'onvifprobe' ); return( false );"><?php echo translate('OnvifProbe') ?></a>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<a href="#" onclick="createPopup( '?view=monitorpreset&mid=<?php echo $monitor->Id ?>', 'zmMonitorPreset<?php echo $monitor->Id ?>', 'monitorpreset' ); return( false );"><?php echo translate('Presets') ?></a>
|
<a href="#" onclick="createPopup( '?view=monitorpreset&mid=<?php echo $monitor->Id ?>', 'zmMonitorPreset<?php echo $monitor->Id ?>', 'monitorpreset' ); return( false );"><?php echo translate('Presets') ?></a>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
?>
|
|
||||||
<h2><?php echo translate('Monitor') ?> - <?php echo validHtmlStr($monitor->Name) ?><?php if ( !empty($monitor->Id) ) { ?> (<?php echo $monitor->Id ?>)<?php } ?></h2>
|
<h2><?php echo translate('Monitor') ?> - <?php echo validHtmlStr($monitor->Name) ?><?php if ( !empty($monitor->Id) ) { ?> (<?php echo $monitor->Id ?>)<?php } ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
@ -717,21 +725,21 @@ switch ( $tab )
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><?php echo translate('AnalysisFPS') ?></td><td><input type="text" name="newMonitor[AnalysisFPS]" value="<?php echo validHtmlStr($monitor->AnalysisFPS) ?>" size="6"/></td></tr>
|
<tr><td><?php echo translate('AnalysisFPS') ?></td><td><input type="text" name="newMonitor[AnalysisFPS]" value="<?php echo validHtmlStr($monitor->AnalysisFPS) ?>" size="6"/></td></tr>
|
||||||
<?php
|
<?php if ( $monitor->Type != "Local" && $monitor->Type != "File" ) { ?>
|
||||||
if ( $monitor->Type != "Local" && $monitor->Type != "File" )
|
<tr>
|
||||||
{
|
<td><?php echo translate('MaximumFPS') ?> (<?php echo makePopupLink('?view=optionhelp&option=OPTIONS_MAXFPS', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td>
|
||||||
?>
|
<td><input type="text" onclick="document.getElementById('newMonitor[MaxFPS]').innerHTML= ' CAUTION: See the help text'" name="newMonitor[MaxFPS]" value="<?php echo validHtmlStr($monitor->MaxFPS) ?>" size="5"/><span id="newMonitor[MaxFPS]" style="color:red"></span></td>
|
||||||
<tr><td><?php echo translate('MaximumFPS') ?> (<?php echo makePopupLink('?view=optionhelp&option=OPTIONS_MAXFPS', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" onclick="document.getElementById('newMonitor[MaxFPS]').innerHTML= ' CAUTION: See the help text'" name="newMonitor[MaxFPS]" value="<?php echo validHtmlStr($monitor->MaxFPS) ?>" size="5"/><span id="newMonitor[MaxFPS]" style="color:red"></span></td></tr>
|
</tr>
|
||||||
<tr><td><?php echo translate('AlarmMaximumFPS') ?> (<?php echo makePopupLink('?view=optionhelp&option=OPTIONS_MAXFPS', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td><td><input type="text" onclick="document.getElementById('newMonitor[AlarmMaxFPS]').innerHTML= ' CAUTION: See the help text'" name="newMonitor[AlarmMaxFPS]" value="<?php echo validHtmlStr($monitor->AlarmMaxFPS) ?>" size="5"/><span id="newMonitor[AlarmMaxFPS]" style="color:red"></span></td></tr>
|
<tr>
|
||||||
<?php
|
<td><?php echo translate('AlarmMaximumFPS') ?> (<?php echo makePopupLink('?view=optionhelp&option=OPTIONS_MAXFPS', 'zmOptionHelp', 'optionhelp', '?' ) ?>)</td>
|
||||||
} else {
|
<td><input type="text" onclick="document.getElementById('newMonitor[AlarmMaxFPS]').innerHTML= ' CAUTION: See the help text'" name="newMonitor[AlarmMaxFPS]" value="<?php echo validHtmlStr($monitor->AlarmMaxFPS) ?>" size="5"/><span id="newMonitor[AlarmMaxFPS]" style="color:red"></span></td>
|
||||||
?>
|
</tr>
|
||||||
|
<?php } else { ?>
|
||||||
<tr><td><?php echo translate('MaximumFPS') ?></td><td><input type="text" name="newMonitor[MaxFPS]" value="<?php echo validHtmlStr($monitor->MaxFPS) ?>" size="5"/></td></tr>
|
<tr><td><?php echo translate('MaximumFPS') ?></td><td><input type="text" name="newMonitor[MaxFPS]" value="<?php echo validHtmlStr($monitor->MaxFPS) ?>" size="5"/></td></tr>
|
||||||
<tr><td><?php echo translate('AlarmMaximumFPS') ?></td><td><input type="text" name="newMonitor[AlarmMaxFPS]" value="<?php echo validHtmlStr($monitor->AlarmMaxFPS) ?>" size="5"/></td></tr>
|
<tr><td><?php echo translate('AlarmMaximumFPS') ?></td><td><input type="text" name="newMonitor[AlarmMaxFPS]" value="<?php echo validHtmlStr($monitor->AlarmMaxFPS) ?>" size="5"/></td></tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if ( ZM_FAST_IMAGE_BLENDS )
|
if ( ZM_FAST_IMAGE_BLENDS ) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<tr><td><?php echo translate('RefImageBlendPct') ?></td><td><select name="newMonitor[RefBlendPerc]"><?php foreach ( $fastblendopts as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->RefBlendPerc ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
<tr><td><?php echo translate('RefImageBlendPct') ?></td><td><select name="newMonitor[RefBlendPerc]"><?php foreach ( $fastblendopts as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->RefBlendPerc ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
||||||
<tr><td><?php echo translate('AlmRefImageBlendPct') ?></td><td><select name="newMonitor[AlarmRefBlendPerc]"><?php foreach ( $fastblendopts_alarm as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->AlarmRefBlendPerc ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
<tr><td><?php echo translate('AlmRefImageBlendPct') ?></td><td><select name="newMonitor[AlarmRefBlendPerc]"><?php foreach ( $fastblendopts_alarm as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->AlarmRefBlendPerc ) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>
|
||||||
|
@ -970,13 +978,14 @@ switch ( $tab )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div id="contentButtons">
|
<div id="contentButtons">
|
||||||
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
|
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -40,6 +40,7 @@ if ( !canView( 'Events' ) )
|
||||||
|
|
||||||
require_once('includes/Storage.php');
|
require_once('includes/Storage.php');
|
||||||
require_once('includes/Event.php');
|
require_once('includes/Event.php');
|
||||||
|
require_once('includes/Frame.php');
|
||||||
|
|
||||||
header( 'Content-type: image/jpeg' );
|
header( 'Content-type: image/jpeg' );
|
||||||
|
|
||||||
|
@ -67,6 +68,12 @@ if ( empty($_REQUEST['path']) )
|
||||||
$Event = new Event( $_REQUEST['eid'] );
|
$Event = new Event( $_REQUEST['eid'] );
|
||||||
$Storage = $Event->Storage();
|
$Storage = $Event->Storage();
|
||||||
$path = $Event->Relative_Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$_REQUEST['fid']).'-capture.jpg';
|
$path = $Event->Relative_Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$_REQUEST['fid']).'-capture.jpg';
|
||||||
|
} else {
|
||||||
|
# If we are only specifying fid, then the fid must be the primary key into the frames table. But when the event is specified, then it is the frame #
|
||||||
|
$Frame = new Frame( $_REQUEST['fid'] );
|
||||||
|
$Event = new Event( $Frame->EventId() );
|
||||||
|
$Storage = $Event->Storage();
|
||||||
|
$path = $Event->Relative_Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$Frame->FrameId()).'-capture.jpg';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$errorText = "No image path";
|
$errorText = "No image path";
|
||||||
|
|
Loading…
Reference in New Issue