mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-24 06:27:07 -04:00
remove some space
This commit is contained in:
58
src/zma.cpp
58
src/zma.cpp
@@ -1,21 +1,21 @@
|
||||
//
|
||||
// ZoneMinder Analysis Daemon, $Date$, $Revision$
|
||||
// Copyright (C) 2001-2008 Philip Coombes
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//
|
||||
|
||||
/*
|
||||
|
||||
@@ -58,18 +58,18 @@ behind.
|
||||
#include "zm_monitor.h"
|
||||
|
||||
void Usage() {
|
||||
fprintf( stderr, "zma -m <monitor_id>\n" );
|
||||
fprintf( stderr, "Options:\n" );
|
||||
fprintf( stderr, " -m, --monitor <monitor_id> : Specify which monitor to use\n" );
|
||||
fprintf( stderr, " -h, --help : This screen\n" );
|
||||
fprintf( stderr, " -v, --version : Report the installed version of ZoneMinder\n" );
|
||||
exit( 0 );
|
||||
fprintf(stderr, "zma -m <monitor_id>\n");
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -m, --monitor <monitor_id> : Specify which monitor to use\n");
|
||||
fprintf(stderr, " -h, --help : This screen\n");
|
||||
fprintf(stderr, " -v, --version : Report the installed version of ZoneMinder\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] ) {
|
||||
self = argv[0];
|
||||
|
||||
srand( getpid() * time( 0 ) );
|
||||
srand(getpid() * time(0));
|
||||
|
||||
int id = -1;
|
||||
|
||||
@@ -106,39 +106,39 @@ int main( int argc, char *argv[] ) {
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
fprintf( stderr, "Extraneous options, " );
|
||||
fprintf(stderr, "Extraneous options, ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
printf("%s ", argv[optind++]);
|
||||
printf("\n");
|
||||
Usage();
|
||||
}
|
||||
|
||||
if ( id < 0 ) {
|
||||
fprintf( stderr, "Bogus monitor %d\n", id );
|
||||
fprintf(stderr, "Bogus monitor %d\n", id);
|
||||
Usage();
|
||||
exit( 0 );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
char log_id_string[16];
|
||||
snprintf( log_id_string, sizeof(log_id_string), "zma_m%d", id );
|
||||
snprintf(log_id_string, sizeof(log_id_string), "zma_m%d", id);
|
||||
|
||||
zmLoadConfig();
|
||||
|
||||
logInit( log_id_string );
|
||||
|
||||
logInit(log_id_string);
|
||||
|
||||
hwcaps_detect();
|
||||
|
||||
Monitor *monitor = Monitor::Load( id, true, Monitor::ANALYSIS );
|
||||
Monitor *monitor = Monitor::Load(id, true, Monitor::ANALYSIS);
|
||||
|
||||
if ( monitor ) {
|
||||
Info( "In mode %d/%d, warming up", monitor->GetFunction(), monitor->Enabled() );
|
||||
Info("In mode %d/%d, warming up", monitor->GetFunction(), monitor->Enabled());
|
||||
|
||||
zmSetDefaultHupHandler();
|
||||
zmSetDefaultTermHandler();
|
||||
zmSetDefaultDieHandler();
|
||||
|
||||
sigset_t block_set;
|
||||
sigemptyset( &block_set );
|
||||
sigemptyset(&block_set);
|
||||
|
||||
useconds_t analysis_rate = monitor->GetAnalysisRate();
|
||||
unsigned int analysis_update_delay = monitor->GetAnalysisUpdateDelay();
|
||||
@@ -148,11 +148,11 @@ int main( int argc, char *argv[] ) {
|
||||
|
||||
while( !zm_terminate ) {
|
||||
// Process the next image
|
||||
sigprocmask( SIG_BLOCK, &block_set, 0 );
|
||||
sigprocmask(SIG_BLOCK, &block_set, 0);
|
||||
|
||||
// Some periodic updates are required for variable capturing framerate
|
||||
if ( analysis_update_delay ) {
|
||||
cur_time = time( 0 );
|
||||
cur_time = time(0);
|
||||
if ( (unsigned int)( cur_time - last_analysis_update_time ) > analysis_update_delay ) {
|
||||
analysis_rate = monitor->GetAnalysisRate();
|
||||
monitor->UpdateAdaptiveSkip();
|
||||
@@ -161,22 +161,22 @@ int main( int argc, char *argv[] ) {
|
||||
}
|
||||
|
||||
if ( !monitor->Analyse() ) {
|
||||
usleep( monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE );
|
||||
usleep(monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE);
|
||||
} else if ( analysis_rate ) {
|
||||
usleep( analysis_rate );
|
||||
usleep(analysis_rate);
|
||||
}
|
||||
|
||||
if ( zm_reload ) {
|
||||
monitor->Reload();
|
||||
logTerm();
|
||||
logInit( log_id_string );
|
||||
logInit(log_id_string);
|
||||
zm_reload = false;
|
||||
}
|
||||
sigprocmask( SIG_UNBLOCK, &block_set, 0 );
|
||||
sigprocmask(SIG_UNBLOCK, &block_set, 0);
|
||||
} // end while ! zm_terminate
|
||||
delete monitor;
|
||||
} else {
|
||||
fprintf( stderr, "Can't find monitor with id of %d\n", id );
|
||||
fprintf(stderr, "Can't find monitor with id of %d\n", id);
|
||||
}
|
||||
Image::Deinitialise();
|
||||
logTerm();
|
||||
|
||||
Reference in New Issue
Block a user