Merge branch 'master' of github.com:zoneminder/ZoneMinder into onvif_updated_to_upstream

This commit is contained in:
Isaac Connor 2020-05-12 11:20:49 -04:00
commit 1f3cf266a2
6 changed files with 52 additions and 31 deletions

View File

@ -339,6 +339,7 @@ sub profiles {
#
# use message parser without schema validation ???
#
return @profiles;
} # end sub profiles

View File

@ -102,7 +102,19 @@ if ( $action eq 'probe' ) {
$client->create_services();
if ( $action eq 'profiles' ) {
ZoneMinder::ONVIF::profiles($client);
my @profiles = ZoneMinder::ONVIF::profiles($client);
foreach my $profile ( @profiles ) {
my ( $token, $name, $encoding, $width, $height, $frame_rate_limit, $uri ) = @{$profile};
print join(', ', $token,
$name,
$encoding,
$width,
$height,
$frame_rate_limit,
$uri,
) . "\n";
} # end foreach profile
} elsif( $action eq 'move' ) {
my $dir = shift;
ZoneMinder::ONVIF::move($client, $dir);

View File

@ -671,8 +671,9 @@ void Event::AddFrame(Image *image, struct timeval timestamp, int score, Image *a
if ( db_frame ) {
static char sql[ZM_SQL_MED_BUFSIZ];
// The idea is to write out 1/sec
frame_data.push(new Frame(id, frames, frame_type, timestamp, delta_time, score));
if ( write_to_db || ( frame_data.size() > 20 ) ) {
if ( write_to_db || (frame_data.size() > (int)monitor->get_fps()) ) {
Debug(1, "Adding %d frames to DB", frame_data.size());
WriteDbFrames();
last_db_frame = frames;

View File

@ -547,6 +547,9 @@ public:
#if HAVE_LIBAVCODEC
//void StreamMpeg( const char *format, int scale=100, int maxfps=10, int bitrate=100000 );
#endif // HAVE_LIBAVCODEC
double get_fps( ) const {
return fps;
}
};
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))

View File

@ -246,7 +246,7 @@ function collectData() {
if ( isset($elementData['sql']) )
$fieldSql[] = $elementData['sql'].' as '.$element;
else
$fieldSql[] = '`'.$element.'`';
$fieldSql[] = $element;
if ( isset($elementData['table']) && isset($elementData['join']) ) {
$joinSql[] = 'left join '.$elementData['table'].' on '.$elementData['join'];
}
@ -258,6 +258,7 @@ function collectData() {
if ( count($fieldSql) ) {
$sql = 'SELECT '.join(', ', $fieldSql).' FROM '.$entitySpec['table'];
#$sql = 'SELECT '.join(', ', array_map($fieldSql, function($f){return '`'.$f.'`';})).' FROM '.$entitySpec['table'];
if ( $joinSql )
$sql .= ' '.join(' ', array_unique($joinSql));
if ( $id && !empty($entitySpec['selector']) ) {
@ -283,12 +284,12 @@ function collectData() {
$sort_fields = explode(',', $_REQUEST['sort']);
foreach ( $sort_fields as $sort_field ) {
preg_match('/^(\w+)\s*(ASC|DESC)?( NULLS FIRST)?$/i', $sort_field, $matches);
preg_match('/^`?(\w+)`?\s*(ASC|DESC)?( NULLS FIRST)?$/i', $sort_field, $matches);
if ( count($matches) ) {
if ( in_array($matches[1], $fieldSql) ) {
$sql .= $matches[1];
} else {
ZM\Error('Sort field ' . $matches[1] . ' not in SQL Fields');
ZM\Error('Sort field '.$matches[1].' from ' .$sort_field.' not in SQL Fields: '.join(',', $sort_field));
}
if ( count($matches) > 2 ) {
$sql .= ' '.strtoupper($matches[2]);

View File

@ -245,7 +245,7 @@ class Logger {
}
}
}
return( $this->level );
return $this->level;
}
public function debugOn() {
@ -258,7 +258,7 @@ class Logger {
if ( $this->termLevel != $termLevel )
$this->termLevel = $termLevel;
}
return( $this->termLevel );
return $this->termLevel;
}
public function databaseLevel($databaseLevel=NULL) {
@ -381,15 +381,15 @@ class Logger {
if ( $this->useErrorLog ) {
$message .= ' at '.$file.' line '.$line;
} else {
$message = $message;
}
if ( $level <= $this->termLevel ) {
if ( $this->hasTerm )
if ( $this->hasTerm ) {
print($message."\n");
else
print(preg_replace("/\n/", '<br/>', htmlspecialchars($message)).'<br/>');
} else {
// Didn't we already replace all newlines with spaces above?
print(preg_replace('/\n/', '<br/>', htmlspecialchars($message)).'<br/>');
}
}
if ( $level <= $this->fileLevel ) {
@ -402,6 +402,9 @@ class Logger {
}
} else if ( $this->logFd ) {
fprintf($this->logFd, $message."\n");
} else {
$this->fileLevel = self::NOLOG;
Error('No logFd but have fileLevel logging!?');
}
}