Removed extraneous line ends from Error and Debug.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@486 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
709d66b34e
commit
7d9924f702
|
@ -31,7 +31,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_mon
|
||||||
sprintf( sql, "insert into Events set MonitorId=%d, Name='Event', StartTime='%s'", monitor->Id(), start_time_str );
|
sprintf( sql, "insert into Events set MonitorId=%d, Name='Event', StartTime='%s'", monitor->Id(), start_time_str );
|
||||||
if ( mysql_query( &dbconn, sql ) )
|
if ( mysql_query( &dbconn, sql ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't insert event: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't insert event: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
id = mysql_insert_id( &dbconn );
|
id = mysql_insert_id( &dbconn );
|
||||||
|
@ -52,7 +52,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_mon
|
||||||
{
|
{
|
||||||
if ( mkdir( path, 0755 ) )
|
if ( mkdir( path, 0755 ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't make %s: %s\n", path, strerror(errno)));
|
Error(( "Can't make %s: %s", path, strerror(errno)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ Event::~Event()
|
||||||
sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, delta_time.positive?"":"-", delta_time.tv_sec, delta_time.tv_usec/10000, frames, alarm_frames, tot_score, (int)(tot_score/alarm_frames), max_score, id );
|
sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, delta_time.positive?"":"-", delta_time.tv_sec, delta_time.tv_usec/10000, frames, alarm_frames, tot_score, (int)(tot_score/alarm_frames), max_score, id );
|
||||||
if ( mysql_query( &dbconn, sql ) )
|
if ( mysql_query( &dbconn, sql ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't update event: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't update event: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ void Event::AddFrame( struct timeval timestamp, const Image *image, const Image
|
||||||
sprintf( sql, "insert into Frames set EventId=%d, FrameId=%d, AlarmFrame=%d, ImagePath='%s', Delta=%s%ld.%02ld, Score=%d", id, frames, alarm_image!=0, event_file, delta_time.positive?"":"-", delta_time.tv_sec, delta_time.tv_usec/10000, score );
|
sprintf( sql, "insert into Frames set EventId=%d, FrameId=%d, AlarmFrame=%d, ImagePath='%s', Delta=%s%ld.%02ld, Score=%d", id, frames, alarm_image!=0, event_file, delta_time.positive?"":"-", delta_time.tv_sec, delta_time.tv_usec/10000, score );
|
||||||
if ( mysql_query( &dbconn, sql ) )
|
if ( mysql_query( &dbconn, sql ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't insert frame: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't insert frame: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
end_frame_id = mysql_insert_id( &dbconn );
|
end_frame_id = mysql_insert_id( &dbconn );
|
||||||
|
@ -116,14 +116,14 @@ void Event::StreamEvent( const char *path, int event_id, unsigned long refresh,
|
||||||
sprintf( sql, "select Id, EventId, ImagePath, TimeStamp from Frames where EventId = %d order by Id", event_id );
|
sprintf( sql, "select Id, EventId, ImagePath, TimeStamp from Frames where EventId = %d order by Id", event_id );
|
||||||
if ( mysql_query( &dbconn, sql ) )
|
if ( mysql_query( &dbconn, sql ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't run query: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't run query: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MYSQL_RES *result = mysql_store_result( &dbconn );
|
MYSQL_RES *result = mysql_store_result( &dbconn );
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
Error(( "Can't use query result: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't use query result: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void Event::StreamEvent( const char *path, int event_id, unsigned long refresh,
|
||||||
fprintf( fd, "--ZoneMinderFrame\r\n" );
|
fprintf( fd, "--ZoneMinderFrame\r\n" );
|
||||||
|
|
||||||
int n_frames = mysql_num_rows( result );
|
int n_frames = mysql_num_rows( result );
|
||||||
Info(( "Got %d frames\n", n_frames ));
|
Info(( "Got %d frames", n_frames ));
|
||||||
FILE *fdj = NULL;
|
FILE *fdj = NULL;
|
||||||
int n_bytes = 0;
|
int n_bytes = 0;
|
||||||
static unsigned char buffer[0x10000];
|
static unsigned char buffer[0x10000];
|
||||||
|
@ -162,7 +162,7 @@ void Event::StreamEvent( const char *path, int event_id, unsigned long refresh,
|
||||||
}
|
}
|
||||||
if ( mysql_errno( &dbconn ) )
|
if ( mysql_errno( &dbconn ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't fetch row: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't fetch row: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
// Yadda yadda
|
// Yadda yadda
|
||||||
|
|
|
@ -63,7 +63,7 @@ void Image::ReadJpeg( const char *filename )
|
||||||
FILE * infile;
|
FILE * infile;
|
||||||
if ((infile = fopen(filename, "rb" )) == NULL)
|
if ((infile = fopen(filename, "rb" )) == NULL)
|
||||||
{
|
{
|
||||||
Error(( "Can't open %s: %s\n", filename, strerror(errno)));
|
Error(( "Can't open %s: %s", filename, strerror(errno)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
jpeg_stdio_src(&cinfo, infile);
|
jpeg_stdio_src(&cinfo, infile);
|
||||||
|
@ -114,7 +114,7 @@ void Image::WriteJpeg( const char *filename ) const
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
if ((outfile = fopen(filename, "wb" )) == NULL)
|
if ((outfile = fopen(filename, "wb" )) == NULL)
|
||||||
{
|
{
|
||||||
Error(( "Can't open %s: %s\n", filename, strerror(errno)));
|
Error(( "Can't open %s: %s", filename, strerror(errno)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
jpeg_stdio_dest(&cinfo, outfile);
|
jpeg_stdio_dest(&cinfo, outfile);
|
||||||
|
|
|
@ -57,21 +57,21 @@ void LocalCamera::Initialise()
|
||||||
sprintf( device_path, "/dev/video%d", device );
|
sprintf( device_path, "/dev/video%d", device );
|
||||||
if( (m_videohandle=open(device_path, O_RDONLY)) <=0 )
|
if( (m_videohandle=open(device_path, O_RDONLY)) <=0 )
|
||||||
{
|
{
|
||||||
Error(( "Failed to open video device %s: %s\n", device_path, strerror(errno) ));
|
Error(( "Failed to open video device %s: %s", device_path, strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct video_window vid_win;
|
struct video_window vid_win;
|
||||||
if( !ioctl( m_videohandle, VIDIOCGWIN, &vid_win))
|
if( !ioctl( m_videohandle, VIDIOCGWIN, &vid_win))
|
||||||
{
|
{
|
||||||
Info(( "X:%d\n", vid_win.x ));
|
Info(( "X:%d", vid_win.x ));
|
||||||
Info(( "Y:%d\n", vid_win.y ));
|
Info(( "Y:%d", vid_win.y ));
|
||||||
Info(( "W:%d\n", vid_win.width ));
|
Info(( "W:%d", vid_win.width ));
|
||||||
Info(( "H:%d\n", vid_win.height ));
|
Info(( "H:%d", vid_win.height ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to get window attributes: %s\n", strerror(errno) ));
|
Error(( "Failed to get window attributes: %s", strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
vid_win.x = 0;
|
vid_win.x = 0;
|
||||||
|
@ -81,23 +81,23 @@ void LocalCamera::Initialise()
|
||||||
|
|
||||||
if( ioctl( m_videohandle, VIDIOCSWIN, &vid_win ) )
|
if( ioctl( m_videohandle, VIDIOCSWIN, &vid_win ) )
|
||||||
{
|
{
|
||||||
Error(( "Failed to set window attributes: %s\n", strerror(errno) ));
|
Error(( "Failed to set window attributes: %s", strerror(errno) ));
|
||||||
if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1);
|
if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct video_picture vid_pic;
|
struct video_picture vid_pic;
|
||||||
if( !ioctl( m_videohandle, VIDIOCGPICT, &vid_pic))
|
if( !ioctl( m_videohandle, VIDIOCGPICT, &vid_pic))
|
||||||
{
|
{
|
||||||
Info(( "P:%d\n", vid_pic.palette ));
|
Info(( "P:%d", vid_pic.palette ));
|
||||||
Info(( "D:%d\n", vid_pic.depth ));
|
Info(( "D:%d", vid_pic.depth ));
|
||||||
Info(( "B:%d\n", vid_pic.brightness ));
|
Info(( "B:%d", vid_pic.brightness ));
|
||||||
Info(( "h:%d\n", vid_pic.hue ));
|
Info(( "h:%d", vid_pic.hue ));
|
||||||
Info(( "Cl:%d\n", vid_pic.colour ));
|
Info(( "Cl:%d", vid_pic.colour ));
|
||||||
Info(( "Cn:%d\n", vid_pic.contrast ));
|
Info(( "Cn:%d", vid_pic.contrast ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to get picture attributes: %s\n", strerror(errno) ));
|
Error(( "Failed to get picture attributes: %s", strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,18 +123,18 @@ void LocalCamera::Initialise()
|
||||||
|
|
||||||
if( ioctl( m_videohandle, VIDIOCSPICT, &vid_pic ) )
|
if( ioctl( m_videohandle, VIDIOCSPICT, &vid_pic ) )
|
||||||
{
|
{
|
||||||
Error(( "Failed to set picture attributes: %s\n", strerror(errno) ));
|
Error(( "Failed to set picture attributes: %s", strerror(errno) ));
|
||||||
if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1);
|
if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1);
|
||||||
}
|
}
|
||||||
if(!ioctl(m_videohandle, VIDIOCGMBUF, &m_vmb))
|
if(!ioctl(m_videohandle, VIDIOCGMBUF, &m_vmb))
|
||||||
{
|
{
|
||||||
m_vmm = new video_mmap[m_vmb.frames];
|
m_vmm = new video_mmap[m_vmb.frames];
|
||||||
Info(( "vmb.frames = %d\n", m_vmb.frames ));
|
Info(( "vmb.frames = %d", m_vmb.frames ));
|
||||||
Info(( "vmb.size = %d\n", m_vmb.size ));
|
Info(( "vmb.size = %d", m_vmb.size ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to setup memory: %s\n", strerror(errno) ));
|
Error(( "Failed to setup memory: %s", strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,14 +158,14 @@ void LocalCamera::Initialise()
|
||||||
|
|
||||||
if( !ioctl( m_videohandle, VIDIOCGCHAN, &vid_src))
|
if( !ioctl( m_videohandle, VIDIOCGCHAN, &vid_src))
|
||||||
{
|
{
|
||||||
Info(( "C:%d\n", vid_src.channel ));
|
Info(( "C:%d", vid_src.channel ));
|
||||||
Info(( "F:%d\n", vid_src.norm ));
|
Info(( "F:%d", vid_src.norm ));
|
||||||
Info(( "Fl:%x\n", vid_src.flags ));
|
Info(( "Fl:%x", vid_src.flags ));
|
||||||
Info(( "T:%d\n", vid_src.type ));
|
Info(( "T:%d", vid_src.type ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to get camera source: %s\n", strerror(errno) ));
|
Error(( "Failed to get camera source: %s", strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,35 +175,35 @@ void LocalCamera::Initialise()
|
||||||
vid_src.type = VIDEO_TYPE_CAMERA;
|
vid_src.type = VIDEO_TYPE_CAMERA;
|
||||||
if(ioctl(m_videohandle, VIDIOCSCHAN, &vid_src))
|
if(ioctl(m_videohandle, VIDIOCSCHAN, &vid_src))
|
||||||
{
|
{
|
||||||
Error(( "Failed to set camera source %d: %s\n", channel, strerror(errno) ));
|
Error(( "Failed to set camera source %d: %s", channel, strerror(errno) ));
|
||||||
if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1);
|
if ( !ZM_STRICT_VIDEO_CONFIG ) exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ioctl( m_videohandle, VIDIOCGWIN, &vid_win))
|
if( !ioctl( m_videohandle, VIDIOCGWIN, &vid_win))
|
||||||
{
|
{
|
||||||
Info(( "X:%d\n", vid_win.x ));
|
Info(( "X:%d", vid_win.x ));
|
||||||
Info(( "Y:%d\n", vid_win.y ));
|
Info(( "Y:%d", vid_win.y ));
|
||||||
Info(( "W:%d\n", vid_win.width ));
|
Info(( "W:%d", vid_win.width ));
|
||||||
Info(( "H:%d\n", vid_win.height ));
|
Info(( "H:%d", vid_win.height ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to get window data: %s\n", strerror(errno) ));
|
Error(( "Failed to get window data: %s", strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ioctl( m_videohandle, VIDIOCGPICT, &vid_pic))
|
if( !ioctl( m_videohandle, VIDIOCGPICT, &vid_pic))
|
||||||
{
|
{
|
||||||
Info(( "P:%d\n", vid_pic.palette ));
|
Info(( "P:%d", vid_pic.palette ));
|
||||||
Info(( "D:%d\n", vid_pic.depth ));
|
Info(( "D:%d", vid_pic.depth ));
|
||||||
Info(( "B:%d\n", vid_pic.brightness ));
|
Info(( "B:%d", vid_pic.brightness ));
|
||||||
Info(( "h:%d\n", vid_pic.hue ));
|
Info(( "h:%d", vid_pic.hue ));
|
||||||
Info(( "Cl:%d\n", vid_pic.colour ));
|
Info(( "Cl:%d", vid_pic.colour ));
|
||||||
Info(( "Cn:%d\n", vid_pic.contrast ));
|
Info(( "Cn:%d", vid_pic.contrast ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to get window data: %s\n", strerror(errno) ));
|
Error(( "Failed to get window data: %s", strerror(errno) ));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose )
|
||||||
sprintf( output, output+strlen(output), "Checking Video Device: %s\n", device_path );
|
sprintf( output, output+strlen(output), "Checking Video Device: %s\n", device_path );
|
||||||
if( (m_videohandle=open(device_path, O_RDONLY)) <=0 )
|
if( (m_videohandle=open(device_path, O_RDONLY)) <=0 )
|
||||||
{
|
{
|
||||||
Error(( "Failed to open video device %s: %s\n", device_path, strerror(errno) ));
|
Error(( "Failed to open video device %s: %s", device_path, strerror(errno) ));
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
sprintf( output+strlen(output), "Error, failed to open video device: %s\n", strerror(errno) );
|
sprintf( output+strlen(output), "Error, failed to open video device: %s\n", strerror(errno) );
|
||||||
else
|
else
|
||||||
|
@ -405,7 +405,7 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(( "Failed to get channel %d attributes: %s\n", chan, strerror(errno) ));
|
Error(( "Failed to get channel %d attributes: %s", chan, strerror(errno) ));
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
sprintf( output, "Error, failed to get channel %d attributes: %s\n", chan, strerror(errno) );
|
sprintf( output, "Error, failed to get channel %d attributes: %s\n", chan, strerror(errno) );
|
||||||
else
|
else
|
||||||
|
@ -418,11 +418,11 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose )
|
||||||
|
|
||||||
int LocalCamera::PreCapture()
|
int LocalCamera::PreCapture()
|
||||||
{
|
{
|
||||||
//Info(( "%s: Capturing image\n", id ));
|
//Info(( "%s: Capturing image", id ));
|
||||||
|
|
||||||
if ( camera_count > 1 )
|
if ( camera_count > 1 )
|
||||||
{
|
{
|
||||||
//Info(( "Switching\n" ));
|
//Info(( "Switching" ));
|
||||||
struct video_channel vs;
|
struct video_channel vs;
|
||||||
|
|
||||||
vs.channel = channel;
|
vs.channel = channel;
|
||||||
|
@ -432,14 +432,14 @@ int LocalCamera::PreCapture()
|
||||||
vs.type = VIDEO_TYPE_CAMERA;
|
vs.type = VIDEO_TYPE_CAMERA;
|
||||||
if(ioctl(m_videohandle, VIDIOCSCHAN, &vs))
|
if(ioctl(m_videohandle, VIDIOCSCHAN, &vs))
|
||||||
{
|
{
|
||||||
Error(( "Failed to set camera source %d: %s\n", channel, strerror(errno) ));
|
Error(( "Failed to set camera source %d: %s", channel, strerror(errno) ));
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Info(( "MC:%d\n", m_videohandle ));
|
//Info(( "MC:%d", m_videohandle ));
|
||||||
if ( ioctl(m_videohandle, VIDIOCMCAPTURE, &m_vmm[m_cap_frame]) )
|
if ( ioctl(m_videohandle, VIDIOCMCAPTURE, &m_vmm[m_cap_frame]) )
|
||||||
{
|
{
|
||||||
Error(( "Capture failure for frame %d: %s\n", m_cap_frame, strerror(errno)));
|
Error(( "Capture failure for frame %d: %s", m_cap_frame, strerror(errno)));
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
m_cap_frame = (m_cap_frame+1)%m_vmb.frames;
|
m_cap_frame = (m_cap_frame+1)%m_vmb.frames;
|
||||||
|
@ -448,11 +448,11 @@ int LocalCamera::PreCapture()
|
||||||
|
|
||||||
unsigned char *LocalCamera::PostCapture()
|
unsigned char *LocalCamera::PostCapture()
|
||||||
{
|
{
|
||||||
//Info(( "%s: Capturing image\n", id ));
|
//Info(( "%s: Capturing image", id ));
|
||||||
|
|
||||||
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
|
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
|
||||||
{
|
{
|
||||||
Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno)));
|
Error(( "Sync failure for frame %d: %s", m_sync_frame, strerror(errno)));
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,11 +464,11 @@ unsigned char *LocalCamera::PostCapture()
|
||||||
|
|
||||||
int LocalCamera::PostCapture( Image &image )
|
int LocalCamera::PostCapture( Image &image )
|
||||||
{
|
{
|
||||||
//Info(( "%s: Capturing image\n", id ));
|
//Info(( "%s: Capturing image", id ));
|
||||||
|
|
||||||
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
|
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
|
||||||
{
|
{
|
||||||
Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno)));
|
Error(( "Sync failure for frame %d: %s", m_sync_frame, strerror(errno)));
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,14 +47,14 @@ Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_ch
|
||||||
shmid = shmget( ZM_SHM_KEY|id, shared_images_size, IPC_CREAT|0777 );
|
shmid = shmget( ZM_SHM_KEY|id, shared_images_size, IPC_CREAT|0777 );
|
||||||
if ( shmid < 0 )
|
if ( shmid < 0 )
|
||||||
{
|
{
|
||||||
Error(( "Can't shmget: %s\n", strerror(errno)));
|
Error(( "Can't shmget: %s", strerror(errno)));
|
||||||
exit( -1 );
|
exit( -1 );
|
||||||
}
|
}
|
||||||
unsigned char *shm_ptr = (unsigned char *)shmat( shmid, 0, 0 );
|
unsigned char *shm_ptr = (unsigned char *)shmat( shmid, 0, 0 );
|
||||||
shared_images = (SharedImages *)shm_ptr;
|
shared_images = (SharedImages *)shm_ptr;
|
||||||
if ( shared_images < 0 )
|
if ( shared_images < 0 )
|
||||||
{
|
{
|
||||||
Error(( "Can't shmat: %s\n", strerror(errno)));
|
Error(( "Can't shmat: %s", strerror(errno)));
|
||||||
exit( -1 );
|
exit( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
|
||||||
BlobStats *bs = &blob_stats[i];
|
BlobStats *bs = &blob_stats[i];
|
||||||
if ( bs->count && ((min_blob_pixels && bs->count < min_blob_pixels) || (max_blob_pixels && bs->count > max_blob_pixels)) )
|
if ( bs->count && ((min_blob_pixels && bs->count < min_blob_pixels) || (max_blob_pixels && bs->count > max_blob_pixels)) )
|
||||||
{
|
{
|
||||||
//Info(( "Eliminating blob %d, %d pixels (%d,%d - %d,%d)\n", i, bs->count, bs->lo_x, bs->lo_y, bs->hi_x, bs->hi_y ));
|
//Info(( "Eliminating blob %d, %d pixels (%d,%d - %d,%d)", i, bs->count, bs->lo_x, bs->lo_y, bs->hi_x, bs->hi_y ));
|
||||||
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
for ( int sy = bs->lo_y; sy <= bs->hi_y; sy++ )
|
||||||
{
|
{
|
||||||
unsigned char *spdiff = diff_image->Buffer( bs->lo_x, sy );
|
unsigned char *spdiff = diff_image->Buffer( bs->lo_x, sy );
|
||||||
|
|
|
@ -41,7 +41,7 @@ bool fixDevice( int device )
|
||||||
|
|
||||||
if ( stat( device_path, &stat_buf ) < 0 )
|
if ( stat( device_path, &stat_buf ) < 0 )
|
||||||
{
|
{
|
||||||
Error(( "Can't stat %s: %s\n", device_path, strerror(errno)));
|
Error(( "Can't stat %s: %s", device_path, strerror(errno)));
|
||||||
return( false );
|
return( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,15 +68,15 @@ bool fixDevice( int device )
|
||||||
mode_t mode = stat_buf.st_mode;
|
mode_t mode = stat_buf.st_mode;
|
||||||
if ( mode & mask )
|
if ( mode & mask )
|
||||||
{
|
{
|
||||||
Info(( "Permissions on %s are ok at %o\n", device_path, mode ));
|
Info(( "Permissions on %s are ok at %o", device_path, mode ));
|
||||||
return( true );
|
return( true );
|
||||||
}
|
}
|
||||||
mode |= mask;
|
mode |= mask;
|
||||||
|
|
||||||
Info(( "Resetting permission on %s to %o\n", device_path, mode ));
|
Info(( "Resetting permissions on %s to %o", device_path, mode ));
|
||||||
if ( chmod( device_path, mode ) < 0 )
|
if ( chmod( device_path, mode ) < 0 )
|
||||||
{
|
{
|
||||||
Error(( "Can't chmod %s to %o: %s\n", device_path, mode, strerror(errno)));
|
Error(( "Can't chmod %s to %o: %s", device_path, mode, strerror(errno)));
|
||||||
return( false );
|
return( false );
|
||||||
}
|
}
|
||||||
return( true );
|
return( true );
|
||||||
|
@ -110,14 +110,14 @@ int main( int argc, char *argv[] )
|
||||||
sprintf( sql, "select distinct Device from Monitors where Type = 'Local'" );
|
sprintf( sql, "select distinct Device from Monitors where Type = 'Local'" );
|
||||||
if ( mysql_query( &dbconn, sql ) )
|
if ( mysql_query( &dbconn, sql ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't run query: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't run query: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MYSQL_RES *result = mysql_store_result( &dbconn );
|
MYSQL_RES *result = mysql_store_result( &dbconn );
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
Error(( "Can't use query result: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't use query result: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
if ( mysql_errno( &dbconn ) )
|
if ( mysql_errno( &dbconn ) )
|
||||||
{
|
{
|
||||||
Error(( "Can't fetch row: %s\n", mysql_error( &dbconn ) ));
|
Error(( "Can't fetch row: %s", mysql_error( &dbconn ) ));
|
||||||
exit( mysql_errno( &dbconn ) );
|
exit( mysql_errno( &dbconn ) );
|
||||||
}
|
}
|
||||||
// Yadda yadda
|
// Yadda yadda
|
||||||
|
|
Loading…
Reference in New Issue