Merge branch 'more_gps' of github.com:ZoneMinder/zoneminder into more_gps
commit
c922629729
|
@ -0,0 +1,18 @@
|
|||
|
||||
DROP TABLE IF EXISTS `GPSReading`;
|
||||
CREATE TABLE `GPSReading` (
|
||||
Id int(10) NOT NULL auto_increment,
|
||||
`Latitude` DECIMAL(8,6),
|
||||
`Longitude` DECIMAL(9,6),
|
||||
`Accuracy` FLOAT,
|
||||
`Altitude` FLOAT,
|
||||
`AltitudeAccuracy` FLOAT,
|
||||
`Heading` FLOAT,
|
||||
`Speed` FLOAT,
|
||||
`TimeStamp` TimeStamp,
|
||||
`ObjectId` int(10),
|
||||
`ObjectTypeId` int(10),
|
||||
PRIMARY KEY (`Id`)
|
||||
);
|
||||
|
||||
CREATE INDEX GPSReading_Object_idx ON GPSReading (ObjectId, ObjectTypeId);
|
|
@ -0,0 +1,6 @@
|
|||
CREATE TABLE Object_Types (
|
||||
Id int(10) NOT NULL AUTO_INCREMENT,
|
||||
Name varchar(32) UNIQUE,
|
||||
Human TEXT,
|
||||
PRIMARY KEY (Id)
|
||||
);
|
|
@ -0,0 +1,87 @@
|
|||
# ==========================================================================
|
||||
#
|
||||
# ZoneMinder GPS Reading Module
|
||||
# Copyright (C) 2023 ZoneMinder Inc
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# ==========================================================================
|
||||
|
||||
package ZoneMinder::GPSReading;
|
||||
|
||||
use 5.006;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require ZoneMinder::Base;
|
||||
require ZoneMinder::Object;
|
||||
|
||||
use parent qw(ZoneMinder::Object);
|
||||
|
||||
use vars qw/ $table $primary_key %fields %defaults /;
|
||||
$table = 'GPSReading';
|
||||
$primary_key = 'Id';
|
||||
|
||||
%fields = (
|
||||
Id => 'Id',
|
||||
ObjectId => 'ObjectId',
|
||||
ObjectTypeId => 'ObjectTypeId',
|
||||
TimeStamp => 'TimeStamp',
|
||||
Latitude => 'Latitude',
|
||||
Longitude => 'Longitude'
|
||||
Accuracy => 'Accuracy',
|
||||
Altitude => 'Altitude',
|
||||
AltitudeAccuracy => 'AltitudeAccuracy',
|
||||
Heading => 'Heading',
|
||||
Speed => 'Speed',
|
||||
);
|
||||
%defaults => (
|
||||
'ObjectId' => undef,
|
||||
'ObjectTypeId' => undef,
|
||||
'TimeStamp' => 0,
|
||||
'Latitude' => '',
|
||||
'Longitude' => '',
|
||||
'Accuracy' => undef,
|
||||
'Altitude' => undef,
|
||||
'AltitudeAccuracy' => undef,
|
||||
'Heading' => undef,
|
||||
'Speed' => undef,
|
||||
);
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
ZoneMinder::GPSReading - Perl Class for GPSReadings
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use ZoneMinder::GPSReading;
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Isaac Connor, E<lt>isaac@zoneminder.comE<gt>
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2001-2017 ZoneMinder LLC
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself, either Perl version 5.8.3 or,
|
||||
at your option, any later version of Perl 5 you may have available.
|
||||
|
||||
|
||||
=cut
|
|
@ -966,6 +966,7 @@ bool Monitor::connect() {
|
|||
if (alarm_image.Buffer() + image_size > mem_ptr + mem_size) {
|
||||
Warning("We will exceed memsize by %td bytes!", (alarm_image.Buffer() + image_size) - (mem_ptr + mem_size));
|
||||
}
|
||||
image_pixelformats = (AVPixelFormat *)(shared_images + (image_buffer_count*image_size));
|
||||
|
||||
if (purpose == CAPTURE) {
|
||||
memset(mem_ptr, 0, mem_size);
|
||||
|
@ -2813,6 +2814,7 @@ bool Monitor::Decode() {
|
|||
index++;
|
||||
index = index % image_buffer_count;
|
||||
image_buffer[index]->Assign(*(packet->image));
|
||||
image_pixelformats[index] = packet->image->AVPixFormat();
|
||||
shared_timestamps[index] = zm::chrono::duration_cast<timeval>(packet->timestamp.time_since_epoch());
|
||||
shared_data->signal = (capture_image and signal_check_points) ? CheckSignal(capture_image) : true;
|
||||
shared_data->last_write_index = index;
|
||||
|
|
|
@ -519,6 +519,7 @@ protected:
|
|||
struct timeval *shared_timestamps;
|
||||
unsigned char *shared_images;
|
||||
std::vector<Image *> image_buffer;
|
||||
AVPixelFormat *image_pixelformats;
|
||||
|
||||
int video_stream_id; // will be filled in PrimeCapture
|
||||
int audio_stream_id; // will be filled in PrimeCapture
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
namespace ZM;
|
||||
require_once('database.php');
|
||||
require_once('Object.php');
|
||||
require_once('Object_Type.php');
|
||||
|
||||
class GPSReading extends ZM_Object {
|
||||
protected static $table = 'GPSReading';
|
||||
protected $defaults = array(
|
||||
'Id' => null,
|
||||
'ObjectId' => null,
|
||||
'ObjectTypeId' => null,
|
||||
'TimeStamp' => 0,
|
||||
'Latitude' => '',
|
||||
'Longitude' => '',
|
||||
'Accuracy' => null,
|
||||
'Altitude' => null,
|
||||
'AltitudeAccuracy' => null,
|
||||
'Heading' => null,
|
||||
'Speed' => null,
|
||||
);
|
||||
private $Event = null;
|
||||
|
||||
public static function find( $parameters = array(), $options = array() ) {
|
||||
return ZM_Object::_find(get_class(), $parameters, $options);
|
||||
}
|
||||
|
||||
public static function find_one( $parameters = array(), $options = array() ) {
|
||||
return ZM_Object::_find_one(get_class(), $parameters, $options);
|
||||
}
|
||||
|
||||
public function ZMObject($new=null) {
|
||||
if ($new) {
|
||||
$this->ZMObject = $new;
|
||||
$this->ObjectId = $new->Id();
|
||||
$this->Object_Type = $new->Object_Type();
|
||||
$this->ObjectTypeId = $this->Object_Type->Id();
|
||||
}
|
||||
if (!$this->ZMObject) {
|
||||
if ($this->{'ObjectId'}) {
|
||||
$this->ZMObject = ZM_Object::_find_one($this->Object_Type->Name(), ['Id'=> $this->{'ObjectId'}]);
|
||||
}
|
||||
}
|
||||
return $this->ZMObject;
|
||||
}
|
||||
} # end class GPSReading
|
||||
?>
|
Loading…
Reference in New Issue