Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas

pull/2082/head
Isaac Connor 2018-04-17 12:32:10 -04:00
commit 3b0282f6ec
19 changed files with 29 additions and 17 deletions

View File

@ -537,7 +537,7 @@ MAIN: while( $loop ) {
$cleaned = 0; $cleaned = 0;
Debug("Checking for Orphaned Frames"); Debug("Checking for Orphaned Frames");
my $selectOrphanedFramesSql = 'SELECT DISTINCT EventId FROM Frames my $selectOrphanedFramesSql = 'SELECT DISTINCT EventId FROM Frames
WHERE EventId NOT IN (SELECT Id FROM Events)'; WHERE (SELECT COUNT(*) FROM Events WHERE Events.Id=EventId)=0';
my $selectOrphanedFramesSth = $dbh->prepare_cached( $selectOrphanedFramesSql ) my $selectOrphanedFramesSth = $dbh->prepare_cached( $selectOrphanedFramesSql )
or Fatal( "Can't prepare '$selectOrphanedFramesSql': ".$dbh->errstr() ); or Fatal( "Can't prepare '$selectOrphanedFramesSql': ".$dbh->errstr() );
$res = $selectOrphanedFramesSth->execute() $res = $selectOrphanedFramesSth->execute()

View File

@ -89,6 +89,7 @@ public:
virtual int Capture( Image &image )=0; virtual int Capture( Image &image )=0;
virtual int PostCapture()=0; virtual int PostCapture()=0;
virtual int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) = 0; virtual int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) = 0;
virtual int Close()=0;
}; };
#endif // ZM_CAMERA_H #endif // ZM_CAMERA_H

View File

@ -73,6 +73,7 @@ public:
void Initialise(); void Initialise();
void Terminate(); void Terminate();
int Close() { return 0; };
int PrimeCapture(); int PrimeCapture();
int PreCapture(); int PreCapture();

View File

@ -137,7 +137,7 @@ FfmpegCamera::~FfmpegCamera() {
delete videoStore; delete videoStore;
videoStore = NULL; videoStore = NULL;
} }
CloseFfmpeg(); Close();
if ( capture ) { if ( capture ) {
Terminate(); Terminate();
@ -161,7 +161,7 @@ void FfmpegCamera::Terminate() {
int FfmpegCamera::PrimeCapture() { int FfmpegCamera::PrimeCapture() {
if ( mCanCapture ) { if ( mCanCapture ) {
Info( "Priming capture from %s, CLosing", mPath.c_str() ); Info( "Priming capture from %s, CLosing", mPath.c_str() );
CloseFfmpeg(); Close();
} }
mVideoStreamId = -1; mVideoStreamId = -1;
mAudioStreamId = -1; mAudioStreamId = -1;
@ -631,7 +631,7 @@ int FfmpegCamera::OpenFfmpeg() {
return 0; return 0;
} // int FfmpegCamera::OpenFfmpeg() } // int FfmpegCamera::OpenFfmpeg()
int FfmpegCamera::CloseFfmpeg() { int FfmpegCamera::Close() {
Debug(2, "CloseFfmpeg called."); Debug(2, "CloseFfmpeg called.");

View File

@ -74,7 +74,7 @@ class FfmpegCamera : public Camera {
AVPacket packet; AVPacket packet;
int OpenFfmpeg(); int OpenFfmpeg();
int CloseFfmpeg(); int Close();
bool mCanCapture; bool mCanCapture;
#endif // HAVE_LIBAVFORMAT #endif // HAVE_LIBAVFORMAT

View File

@ -47,6 +47,7 @@ public:
int Capture( Image &image ); int Capture( Image &image );
int PostCapture(); int PostCapture();
int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);}; int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);};
int Close() { return 0; };
}; };
#endif // ZM_FILE_CAMERA_H #endif // ZM_FILE_CAMERA_H

View File

@ -72,6 +72,7 @@ public:
int Capture( Image &image ); int Capture( Image &image );
int CaptureAndRecord( Image &image, timeval recording, char* event_directory ); int CaptureAndRecord( Image &image, timeval recording, char* event_directory );
int PostCapture(); int PostCapture();
int Close() { return 0; };
}; };
#endif // HAVE_LIBVLC #endif // HAVE_LIBVLC

View File

@ -163,6 +163,7 @@ public:
int Capture( Image &image ); int Capture( Image &image );
int PostCapture(); int PostCapture();
int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);}; int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);};
int Close() { return 0; };
static bool GetCurrentSettings( const char *device, char *output, int version, bool verbose ); static bool GetCurrentSettings( const char *device, char *output, int version, bool verbose );
}; };

View File

@ -2770,6 +2770,7 @@ unsigned int Monitor::SubpixelOrder() const { return camera->SubpixelOrder(); }
int Monitor::PrimeCapture() const { return camera->PrimeCapture(); } int Monitor::PrimeCapture() const { return camera->PrimeCapture(); }
int Monitor::PreCapture() const { return camera->PreCapture(); } int Monitor::PreCapture() const { return camera->PreCapture(); }
int Monitor::PostCapture() const { return camera->PostCapture() ; } int Monitor::PostCapture() const { return camera->PostCapture() ; }
int Monitor::Close() { return camera->Close(); };
Monitor::Orientation Monitor::getOrientation() const { return orientation; } Monitor::Orientation Monitor::getOrientation() const { return orientation; }
Monitor::Snapshot *Monitor::getSnapshot() const { Monitor::Snapshot *Monitor::getSnapshot() const {

View File

@ -485,6 +485,7 @@ public:
int PreCapture() const; int PreCapture() const;
int Capture(); int Capture();
int PostCapture() const; int PostCapture() const;
int Close();
unsigned int DetectMotion( const Image &comp_image, Event::StringSet &zoneSet ); unsigned int DetectMotion( const Image &comp_image, Event::StringSet &zoneSet );
// DetectBlack seems to be unused. Check it on zm_monitor.cpp for more info. // DetectBlack seems to be unused. Check it on zm_monitor.cpp for more info.

View File

@ -57,7 +57,8 @@ public:
int PreCapture(); int PreCapture();
int Capture( Image &image ); int Capture( Image &image );
int PostCapture(); int PostCapture();
int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);}; int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return 0;};
int Close() { return 0; };
}; };
#endif // ZM_REMOTE_CAMERA_HTTP_H #endif // ZM_REMOTE_CAMERA_HTTP_H

View File

@ -67,6 +67,7 @@ public:
int Capture( Image &image ); int Capture( Image &image );
int PostCapture(); int PostCapture();
int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);}; int CaptureAndRecord( Image &image, timeval recording, char* event_directory ) {return(0);};
int Close() { return 0; };
}; };
#endif // ZM_REMOTE_CAMERA_NVSOCKET_H #endif // ZM_REMOTE_CAMERA_NVSOCKET_H

View File

@ -87,6 +87,7 @@ public:
int Capture( Image &image ); int Capture( Image &image );
int PostCapture(); int PostCapture();
int CaptureAndRecord( Image &image, timeval recording, char* event_directory ); int CaptureAndRecord( Image &image, timeval recording, char* event_directory );
int Close() { return 0; };
}; };
#endif // ZM_REMOTE_CAMERA_RTSP_H #endif // ZM_REMOTE_CAMERA_RTSP_H

View File

@ -295,16 +295,19 @@ int main(int argc, char *argv[]) {
if ( next_delays[i] <= min_delay || next_delays[i] <= 0 ) { if ( next_delays[i] <= min_delay || next_delays[i] <= 0 ) {
if ( monitors[i]->PreCapture() < 0 ) { if ( monitors[i]->PreCapture() < 0 ) {
Error("Failed to pre-capture monitor %d %d (%d/%d)", monitors[i]->Id(), monitors[i]->Name(), i+1, n_monitors); Error("Failed to pre-capture monitor %d %d (%d/%d)", monitors[i]->Id(), monitors[i]->Name(), i+1, n_monitors);
monitors[i]->Close();
result = -1; result = -1;
break; break;
} }
if ( monitors[i]->Capture() < 0 ) { if ( monitors[i]->Capture() < 0 ) {
Error("Failed to capture image from monitor %d %s (%d/%d)", monitors[i]->Id(), monitors[i]->Name(), i+1, n_monitors); Error("Failed to capture image from monitor %d %s (%d/%d)", monitors[i]->Id(), monitors[i]->Name(), i+1, n_monitors);
monitors[i]->Close();
result = -1; result = -1;
break; break;
} }
if ( monitors[i]->PostCapture() < 0 ) { if ( monitors[i]->PostCapture() < 0 ) {
Error("Failed to post-capture monitor %d %s (%d/%d)", monitors[i]->Id(), monitors[i]->Name(), i+1, n_monitors); Error("Failed to post-capture monitor %d %s (%d/%d)", monitors[i]->Id(), monitors[i]->Name(), i+1, n_monitors);
monitors[i]->Close();
result = -1; result = -1;
break; break;
} }
@ -339,7 +342,6 @@ int main(int argc, char *argv[]) {
delete [] capture_delays; delete [] capture_delays;
delete [] next_delays; delete [] next_delays;
delete [] last_capture_times; delete [] last_capture_times;
sleep(10);
} // end while ! zm_terminate outer connection loop } // end while ! zm_terminate outer connection loop
for ( int i = 0; i < n_monitors; i++ ) { for ( int i = 0; i < n_monitors; i++ ) {

@ -1 +1 @@
Subproject commit 1351dde6b4c75b215099ae8bcf5a21d6c6e10298 Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5

View File

@ -266,7 +266,6 @@ if ( ZM_OPT_X10 && canView( 'Devices' ) ) { ?>
} }
// if canview_reports // if canview_reports
?> ?>
<li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li>
<?php <?php
if (isset($_REQUEST['filter']['Query']['terms']['attr'])) { if (isset($_REQUEST['filter']['Query']['terms']['attr'])) {
$terms = $_REQUEST['filter']['Query']['terms']; $terms = $_REQUEST['filter']['Query']['terms'];
@ -288,6 +287,7 @@ if (isset($_REQUEST['filter']['Query']['terms']['attr'])) {
<?php <?php
} }
?> ?>
<li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li>
</ul> </ul>
<?php } // end if canView('Monitors') ?> <?php } // end if canView('Monitors') ?>

View File

@ -188,7 +188,7 @@ if ( (null !== $filter->Concurrent()) and $filter->Concurrent() )
<?php } ?> <?php } ?>
<p class="Name"> <p class="Name">
<label for="filter[Name]"><?php echo translate('Name') ?></label> <label for="filter[Name]"><?php echo translate('Name') ?></label>
<input type="text" id="filter[Name]" name="filter[Name]" value="<?php echo $filter->Name() ?>"/> <input type="text" id="filter[Name]" name="filter[Name]" value="<?php echo $filter->Name() ?>" oninput="updateButtons(this);"/>
</p> </p>
<table id="fieldsTable" class="filterTable"> <table id="fieldsTable" class="filterTable">
<tbody> <tbody>
@ -398,11 +398,11 @@ if ( ZM_OPT_MESSAGE ) {
</p> </p>
<p> <p>
<label for="background"><?php echo translate('BackgroundFilter') ?></label> <label for="background"><?php echo translate('BackgroundFilter') ?></label>
<input type="checkbox" id="filter[Background]" name="filter[Background]" value="1"<?php if ( !empty($filter->Background()) ) { ?> checked="checked"<?php } ?>/> <input type="checkbox" id="filter[Background]" name="filter[Background]" value="1"<?php if ( !empty($filter->Background()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
</p> </p>
<p> <p>
<label for="Concurrent"><?php echo translate('ConcurrentFilter') ?></label> <label for="Concurrent"><?php echo translate('ConcurrentFilter') ?></label>
<input type="checkbox" id="filter[Concurrent]" name="filter[Concurrent]" value="1"<?php if ( !empty($filter->Concurrent()) ) { ?> checked="checked"<?php } ?>/> <input type="checkbox" id="filter[Concurrent]" name="filter[Concurrent]" value="1"<?php if ( !empty($filter->Concurrent()) ) { ?> checked="checked"<?php } ?> onclick="updateButtons(this);"/>
</p> </p>
</div> </div>
<hr/> <hr/>

View File

@ -49,7 +49,7 @@ xhtmlHeaders(__FILE__, translate('Function'));
<div id="content"> <div id="content">
The following monitors will have these settings update when you click Save:<br/><br/> The following monitors will have these settings update when you click Save:<br/><br/>
<?php echo implode('<br/>', array_map( function($m){return $m->Id().' ' .$m->Name();}, $monitors ) ); ?> <?php echo implode('<br/>', array_map( function($m){return $m->Id().' ' .$m->Name();}, $monitors ) ); ?>
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="$j('#contentButtons').hide();return true;">
<input type="hidden" name="view" value="none"/> <input type="hidden" name="view" value="none"/>
<input type="hidden" name="action" value="save"/> <input type="hidden" name="action" value="save"/>
<input type="hidden" name="object" value="Monitor"/> <input type="hidden" name="object" value="Monitor"/>
@ -88,8 +88,8 @@ echo htmlSelect( 'newMonitor[Function]', $options, $monitor->Function() );
<input type="checkbox" name="newMonitor[Enabled]" id="newMonitor[Enabled]" value="1"<?php if ( !empty($monitors[0]->Enabled()) ) { ?> checked="checked"<?php } ?>/> <input type="checkbox" name="newMonitor[Enabled]" id="newMonitor[Enabled]" value="1"<?php if ( !empty($monitors[0]->Enabled()) ) { ?> checked="checked"<?php } ?>/>
</p> </p>
<div id="contentButtons"> <div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/> <button type="submit" value="Save"><?php echo translate('Save') ?></button>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/> <button onclick="closeWindow()"><?php echo translate('Cancel') ?></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -61,8 +61,8 @@ if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($display
if ( !isset($_REQUEST['minTime']) && !isset($_REQUEST['maxTime']) ) { if ( !isset($_REQUEST['minTime']) && !isset($_REQUEST['maxTime']) ) {
$time = time(); $time = time();
$maxTime = strftime('%FT%T',$time) - 3600; $maxTime = strftime('%FT%T',$time - 3600);
$minTime = strftime('%FT%T',$time - 2*3600); $minTime = strftime('%FT%T',$time - (2*3600) );
} }
if ( isset($_REQUEST['minTime']) ) if ( isset($_REQUEST['minTime']) )
$minTime = validHtmlStr($_REQUEST['minTime']); $minTime = validHtmlStr($_REQUEST['minTime']);