Changed colours to palettes and now supports YUV420P.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@471 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-04-12 16:17:17 +00:00
parent f54ec2c7ec
commit d1fd5c0828
11 changed files with 235 additions and 102 deletions

13
db/zmalter-0.9.10.sql Normal file
View File

@ -0,0 +1,13 @@
--
-- This updates a 0.9.10 database to 0.9.11
--
alter table Monitors change column Colours Palette tinyint(3) unsigned NOT NULL default '1';
update Monitors set Palette = 1 where Palette = 8;
update Monitors set Palette = 4 where Palette = 24;
-- These are optional, it just seemed a good time...
optimize table Frames;
optimize table Events;
optimize table Filters;
optimize table Zones;
optimize table Monitors;
optimize table Stats;

View File

@ -20,8 +20,9 @@
#include "zm.h"
#include "zm_camera.h"
Camera::Camera( SourceType p_type, int p_width, int p_height, int p_colours, bool p_capture ) : type( p_type ), width( p_width), height( p_height ), colours( p_colours ), capture( p_capture )
Camera::Camera( SourceType p_type, int p_width, int p_height, int p_palette, bool p_capture ) : type( p_type ), width( p_width), height( p_height ), palette( p_palette ), capture( p_capture )
{
colours = (palette==VIDEO_PALETTE_GREY?1:3);
}
Camera::~Camera()

View File

@ -20,6 +20,10 @@
#ifndef ZM_CAMERA_H
#define ZM_CAMERA_H
#include <sys/types.h>
#include <sys/ioctl.h>
#include <linux/videodev.h>
#include "zm_image.h"
//
@ -34,11 +38,12 @@ protected:
SourceType type;
unsigned int width;
unsigned int height;
unsigned int palette;
unsigned int colours;
bool capture;
public:
Camera( SourceType p_type, int p_width, int p_height, int p_colours, bool p_capture=true );
Camera( SourceType p_type, int p_width, int p_height, int p_palette, bool p_capture=true );
virtual ~Camera();
SourceType Type() const { return( type ); }
@ -46,6 +51,7 @@ public:
bool IsRemote() const { return( type == REMOTE ); }
unsigned int Width() const { return( width ); }
unsigned int Height() const { return( height ); }
unsigned int Palette() const { return( palette ); }
unsigned int Colours() const { return( colours ); }
unsigned int ImageSize() const { return( colours*width*height ); }

View File

@ -119,19 +119,7 @@ public:
buffer = new JSAMPLE[size];
memset( buffer, 0, size );
}
if ( colours == 1 || !ZM_LOCAL_BGR_INVERT )
{
memcpy( buffer, new_buffer, size );
}
else
{
for ( int i = 0; i < size; i += 3 )
{
buffer[i] = new_buffer[i+2];
buffer[i+1] = new_buffer[i+1];
buffer[i+2] = new_buffer[i];
}
}
memcpy( buffer, new_buffer, size );
}
inline void CopyBuffer( const Image &image )

View File

@ -34,7 +34,7 @@ video_mmap *LocalCamera::m_vmm;
int LocalCamera::m_videohandle;
unsigned char *LocalCamera::m_buffer=0;
LocalCamera::LocalCamera( int p_device, int p_channel, int p_format, int p_width, int p_height, int p_colours, bool p_capture ) : Camera( LOCAL, p_width, p_height, p_colours, p_capture ), device( p_device ), channel( p_channel ), format( p_format )
LocalCamera::LocalCamera( int p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, bool p_capture ) : Camera( LOCAL, p_width, p_height, p_palette, p_capture ), device( p_device ), channel( p_channel ), format( p_format )
{
if ( !camera_count++ && capture )
{
@ -101,14 +101,12 @@ void LocalCamera::Initialise()
exit(-1);
}
if ( colours == 1 )
if ( (vid_pic.palette = palette) == VIDEO_PALETTE_GREY )
{
vid_pic.palette = VIDEO_PALETTE_GREY;
vid_pic.depth = 8;
}
else
{
vid_pic.palette = VIDEO_PALETTE_RGB24;
vid_pic.depth = 24;
}
@ -134,7 +132,7 @@ void LocalCamera::Initialise()
m_vmm[loop].frame = loop;
m_vmm[loop].width = width;
m_vmm[loop].height = height;
m_vmm[loop].format = (colours==1?VIDEO_PALETTE_GREY:VIDEO_PALETTE_RGB24);
m_vmm[loop].format = palette;
}
m_buffer = (unsigned char *)mmap(0, m_vmb.size, PROT_READ, MAP_SHARED, m_videohandle,0);
@ -406,3 +404,187 @@ bool LocalCamera::GetCurrentSettings( int device, char *output, bool verbose )
}
return( true );
}
int LocalCamera::PreCapture()
{
//Info(( "%s: Capturing image\n", id ));
if ( camera_count > 1 )
{
//Info(( "Switching\n" ));
struct video_channel vs;
vs.channel = channel;
//vs.norm = VIDEO_MODE_AUTO;
vs.norm = format;
vs.flags = 0;
vs.type = VIDEO_TYPE_CAMERA;
if(ioctl(m_videohandle, VIDIOCSCHAN, &vs))
{
Error(( "Failed to set camera source %d: %s\n", channel, strerror(errno) ));
return( -1 );
}
}
//Info(( "MC:%d\n", m_videohandle ));
if ( ioctl(m_videohandle, VIDIOCMCAPTURE, &m_vmm[m_cap_frame]) )
{
Error(( "Capture failure for frame %d: %s\n", m_cap_frame, strerror(errno)));
return( -1 );
}
m_cap_frame = (m_cap_frame+1)%m_vmb.frames;
return( 0 );
}
unsigned char *LocalCamera::PostCapture()
{
//Info(( "%s: Capturing image\n", id ));
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
{
Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno)));
return( 0 );
}
unsigned char *buffer = m_buffer+(m_sync_frame*m_vmb.size/m_vmb.frames);
m_sync_frame = (m_sync_frame+1)%m_vmb.frames;
return( buffer );
}
int LocalCamera::PostCapture( Image &image )
{
//Info(( "%s: Capturing image\n", id ));
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
{
Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno)));
return( -1 );
}
unsigned char *buffer = m_buffer+(m_sync_frame*m_vmb.size/m_vmb.frames);
m_sync_frame = (m_sync_frame+1)%m_vmb.frames;
static unsigned char temp_buffer[2048*1536];
switch( palette )
{
case VIDEO_PALETTE_YUV420P :
{
static unsigned char y_plane[2048*1536];
static char u_plane[2048*1536];
static char v_plane[2048*1536];
unsigned char *rgb_ptr = temp_buffer;
unsigned char *y_ptr = y_plane;
char *u1_ptr = u_plane;
char *u2_ptr = u_plane+width;
char *v1_ptr = v_plane;
char *v2_ptr = v_plane+width;
int Y_size = width*height;
int C_size = Y_size/4;
unsigned char *Y_ptr = buffer;
unsigned char *Cb_ptr = buffer + Y_size;
unsigned char *Cr_ptr = Cb_ptr + C_size;
int y,u,v;
for ( int i = 0; i < Y_size; i++ )
{
if ( *Y_ptr <= 16 )
*y_ptr = 0;
else if ( *Y_ptr >= 235 )
*y_ptr = 255;
else
*y_ptr = (255*((*Y_ptr)-16))/219;
y_ptr++;
Y_ptr++;
//y = (255*((*Y_ptr++)-16))/219;
//*y_ptr++ = y<0?0:(y>255?255:y);
}
int half_width = width/2;
for ( int i = 0, j = 0; i < C_size; i++, j++ )
{
if ( j == half_width )
{
j = 0;
u1_ptr += width;
u2_ptr += width;
v1_ptr += width;
v2_ptr += width;
}
if ( *Cb_ptr <= 16 )
u = 0;
else if ( *Cb_ptr >= 240 )
u = 255;
else
u = (127*((*Cb_ptr)-128))/112;
Cb_ptr++;
//u = (127*((*Cb_ptr++)-128))/112;
//u = u<0?0:(u>255?255:u);
*u1_ptr++ = u;
*u1_ptr++ = u;
*u2_ptr++ = u;
*u2_ptr++ = u;
if ( *Cr_ptr <= 16 )
v = 0;
else if ( *Cr_ptr >= 240 )
v = 255;
else
v = (127*((*Cr_ptr)-128))/112;
Cr_ptr++;
//v = (127*((*Cr_ptr++)-128))/112;
//v = v<0?0:(v>255?255:v);
*v1_ptr++ = v;
*v1_ptr++ = v;
*v2_ptr++ = v;
*v2_ptr++ = v;
}
y_ptr = y_plane;
u1_ptr = u_plane;
v1_ptr = v_plane;
int size = Y_size*3;
int r,g,b;
for ( int i = 0; i < size; i++ )
{
y = *y_ptr++;
u = *u1_ptr++;
v = *v1_ptr++;
r = y + ((1402*v)/1000);
g = y - (((344*u)/1000)+((714*v)/1000));
b = y + ((1772*u)/1000);
*rgb_ptr++ = r<0?0:(r>255?255:r);
*rgb_ptr++ = g<0?0:(g>255?255:g);
*rgb_ptr++ = b<0?0:(b>255?255:b);
}
buffer = temp_buffer;
break;
}
case VIDEO_PALETTE_RGB24 :
{
if ( ZM_LOCAL_BGR_INVERT )
{
int size = width*height*3;
for ( int i = 0; i < size; i += 3 )
{
temp_buffer[i] = buffer[i+2];
temp_buffer[i+1] = buffer[i+1];
temp_buffer[i+2] = buffer[i];
}
}
buffer = temp_buffer;
break;
}
default : // Everything else is straightforward, for now.
{
break;
}
}
image.Assign( width, height, colours, buffer );
return( 0 );
}

View File

@ -22,7 +22,6 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <linux/videodev.h>
#include "zm_camera.h"
@ -48,7 +47,7 @@ protected:
static int camera_count;
public:
LocalCamera( int p_device, int p_channel, int p_format, int p_width, int p_height, int p_colours, bool p_capture=true );
LocalCamera( int p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, bool p_capture=true );
~LocalCamera();
void Initialise();
@ -58,67 +57,9 @@ public:
unsigned int Channel() const { return( channel ); }
unsigned int Format() const { return( format ); }
int PreCapture()
{
//Info(( "%s: Capturing image\n", id ));
if ( camera_count > 1 )
{
//Info(( "Switching\n" ));
struct video_channel vs;
vs.channel = channel;
//vs.norm = VIDEO_MODE_AUTO;
vs.norm = format;
vs.flags = 0;
vs.type = VIDEO_TYPE_CAMERA;
if(ioctl(m_videohandle, VIDIOCSCHAN, &vs))
{
Error(( "Failed to set camera source %d: %s\n", channel, strerror(errno) ));
return( -1 );
}
}
//Info(( "MC:%d\n", m_videohandle ));
if ( ioctl(m_videohandle, VIDIOCMCAPTURE, &m_vmm[m_cap_frame]) )
{
Error(( "Capture failure for frame %d: %s\n", m_cap_frame, strerror(errno)));
return( -1 );
}
m_cap_frame = (m_cap_frame+1)%m_vmb.frames;
return( 0 );
}
unsigned char *PostCapture()
{
//Info(( "%s: Capturing image\n", id ));
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
{
Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno)));
return( 0 );
}
unsigned char *buffer = m_buffer+(m_sync_frame*m_vmb.size/m_vmb.frames);
m_sync_frame = (m_sync_frame+1)%m_vmb.frames;
return( buffer );
}
int PostCapture( Image &image )
{
//Info(( "%s: Capturing image\n", id ));
if ( ioctl(m_videohandle, VIDIOCSYNC, &m_sync_frame) )
{
Error(( "Sync failure for frame %d: %s\n", m_sync_frame, strerror(errno)));
return( -1 );
}
unsigned char *buffer = m_buffer+(m_sync_frame*m_vmb.size/m_vmb.frames);
m_sync_frame = (m_sync_frame+1)%m_vmb.frames;
image.Assign( width, height, colours, buffer );
return( 0 );
}
int PreCapture();
unsigned char *PostCapture();
int PostCapture( Image &image );
static bool GetCurrentSettings( int device, char *output, bool verbose );
};

View File

@ -530,11 +530,11 @@ int Monitor::Load( int device, Monitor **&monitors, bool capture )
static char sql[256];
if ( device == -1 )
{
strcpy( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None'" );
strcpy( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None'" );
}
else
{
sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Device = %d", device );
sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Device = %d", device );
}
if ( mysql_query( &dbconn, sql ) )
{
@ -554,7 +554,7 @@ int Monitor::Load( int device, Monitor **&monitors, bool capture )
monitors = new Monitor *[n_monitors];
for( int i = 0; MYSQL_ROW dbrow = mysql_fetch_row( result ); i++ )
{
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8])/8, capture, dbrow[9], Coord( atoi(dbrow[10]), atoi(dbrow[11]) ), atoi(dbrow[12]), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atof(dbrow[16])>0.0?int(1000.0/atof(dbrow[16])):0, atoi(dbrow[17]), atoi(dbrow[18]) );
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8]), capture, dbrow[9], Coord( atoi(dbrow[10]), atoi(dbrow[11]) ), atoi(dbrow[12]), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atof(dbrow[16])>0.0?int(1000.0/atof(dbrow[16])):0, atoi(dbrow[17]), atoi(dbrow[18]) );
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
@ -576,11 +576,11 @@ int Monitor::Load( const char *host, const char*port, const char *path, Monitor
static char sql[256];
if ( !host )
{
strcpy( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Colours, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None'" );
strcpy( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None'" );
}
else
{
sprintf( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Colours, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Host = '%s' and Port = '%s' and Path = '%s'", host, port, path );
sprintf( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Host = '%s' and Port = '%s' and Path = '%s'", host, port, path );
}
if ( mysql_query( &dbconn, sql ) )
{
@ -600,7 +600,7 @@ int Monitor::Load( const char *host, const char*port, const char *path, Monitor
monitors = new Monitor *[n_monitors];
for( int i = 0; MYSQL_ROW dbrow = mysql_fetch_row( result ); i++ )
{
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), dbrow[3], dbrow[4], dbrow[5], atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8])/8, capture, dbrow[9], Coord( atoi(dbrow[10]), atoi(dbrow[11]) ), atoi(dbrow[12]), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atof(dbrow[16])>0.0?int(1000.0/atof(dbrow[16])):0, atoi(dbrow[17]), atoi(dbrow[18]) );
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), dbrow[3], dbrow[4], dbrow[5], atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8]), capture, dbrow[9], Coord( atoi(dbrow[10]), atoi(dbrow[11]) ), atoi(dbrow[12]), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atof(dbrow[16])>0.0?int(1000.0/atof(dbrow[16])):0, atoi(dbrow[17]), atoi(dbrow[18]) );
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
@ -620,7 +620,7 @@ int Monitor::Load( const char *host, const char*port, const char *path, Monitor
Monitor *Monitor::Load( int id, bool load_zones )
{
static char sql[256];
sprintf( sql, "select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Colours, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = %d", id );
sprintf( sql, "select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = %d", id );
if ( mysql_query( &dbconn, sql ) )
{
Error(( "Can't run query: %s", mysql_error( &dbconn ) ));
@ -640,11 +640,11 @@ Monitor *Monitor::Load( int id, bool load_zones )
{
if ( !strcmp( dbrow[2], "Local" ) )
{
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12])/8, false, dbrow[13], Coord( atoi(dbrow[14]), atoi(dbrow[15]) ), atoi(dbrow[16]), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atof(dbrow[20])>0.0?int(1000.0/atof(dbrow[20])):0, atoi(dbrow[21]), atoi(dbrow[22]) );
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12]), false, dbrow[13], Coord( atoi(dbrow[14]), atoi(dbrow[15]) ), atoi(dbrow[16]), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atof(dbrow[20])>0.0?int(1000.0/atof(dbrow[20])):0, atoi(dbrow[21]), atoi(dbrow[22]) );
}
else
{
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), dbrow[7], dbrow[8], dbrow[9], atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12])/8, false, dbrow[13], Coord( atoi(dbrow[14]), atoi(dbrow[15]) ), atoi(dbrow[16]), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atof(dbrow[20])>0.0?int(1000.0/atof(dbrow[20])):0, atoi(dbrow[21]), atoi(dbrow[22]) );
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), dbrow[7], dbrow[8], dbrow[9], atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12]), false, dbrow[13], Coord( atoi(dbrow[14]), atoi(dbrow[15]) ), atoi(dbrow[16]), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atof(dbrow[20])>0.0?int(1000.0/atof(dbrow[20])):0, atoi(dbrow[21]), atoi(dbrow[22]) );
}
int n_zones = 0;
if ( load_zones )
@ -739,7 +739,8 @@ bool Monitor::DumpSettings( char *output, bool verbose )
}
sprintf( output+strlen(output), "Width : %d\n", ((LocalCamera *)camera)->Width() );
sprintf( output+strlen(output), "Height : %d\n", camera->Height() );
sprintf( output+strlen(output), "Colour Depth : %d\n", 8*camera->Colours() );
sprintf( output+strlen(output), "Palette : %d\n", camera->Palette() );
sprintf( output+strlen(output), "Colours : %d\n", camera->Colours() );
sprintf( output+strlen(output), "Label Format : %s\n", label_format );
sprintf( output+strlen(output), "Label Coord : %d,%d\n", label_coord.X(), label_coord.Y() );
sprintf( output+strlen(output), "Image Buffer Count : %d\n", image_buffer_count );

View File

@ -37,7 +37,7 @@
#include "zm_remote_camera.h"
RemoteCamera::RemoteCamera( const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_colours, bool p_capture ) : Camera( REMOTE, p_width, p_height, p_colours, p_capture ), host( p_host ), port( p_port ), path( p_path )
RemoteCamera::RemoteCamera( const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, bool p_capture ) : Camera( REMOTE, p_width, p_height, p_palette, p_capture ), host( p_host ), port( p_port ), path( p_path )
{
sd = -1;
hp = 0;

View File

@ -58,7 +58,7 @@ protected:
int sd;
public:
RemoteCamera( const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_colours, bool p_capture=true );
RemoteCamera( const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, bool p_capture=true );
~RemoteCamera();
const char *Host() const { return( host ); }

View File

@ -246,7 +246,7 @@ if ( $action )
}
if ( $new_width != $monitor['Width'] ) $changes[] = "Width = '$new_width'";
if ( $new_height != $monitor['Height'] ) $changes[] = "Height = '$new_height'";
if ( $new_colours != $monitor['Colours'] ) $changes[] = "Colours = '$new_colours'";
if ( $new_colours != $monitor['Palette'] ) $changes[] = "Palette = '$new_palette'";
if ( $new_label_format != $monitor['LabelFormat'] ) $changes[] = "LabelFormat = '$new_label_format'";
if ( $new_label_x != $monitor['LabelX'] ) $changes[] = "LabelX = '$new_label_x'";
if ( $new_label_y != $monitor['LabelY'] ) $changes[] = "LabelY = '$new_label_y'";
@ -271,7 +271,7 @@ if ( $action )
die( mysql_error() );
if ( $new_name != $monitor[Name] )
{
exec( escape_shell_command( "mv ".EVENTS_PATH."/$monitor[Name] ".EVENTS_PATH."/$new_name" ) );
exec( escapeshellcommand( "mv ".EVENTS_PATH."/$monitor[Name] ".EVENTS_PATH."/$new_name" ) );
}
}
else

View File

@ -243,7 +243,6 @@ function confirmStatus( new_status )
<?php } else { ?>
<td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&mid=<?= $monitor[Id] ?>', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?> );"><span class="<?= $dclass ?>"><?= $monitor[Host] ?></span></a></td>
<?php } ?>
<!--<td align="left" class="text"><?= $monitor[Width] ?>x<?= $monitor[Height] ?>x<?= $monitor[Colours]*8 ?></td>-->
<td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[EventCount] ?></a></td>
<td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1&trms=2&attr1=Archived&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=last+hour', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[HourEventCount] ?></a></td>
<td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1&trms=2&attr1=Archived&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=last+day', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[DayEventCount] ?></a></td>
@ -2064,6 +2063,8 @@ function configureButton(form,name)
$monitor[FPSReportInterval] = 1000;
$monitor[RefBlendPerc] = 10;
}
$local_palettes = array( "Greyscale"=>1, "RGB24"=>4, "YUV420P"=>15 );
$remote_palettes = array( "8 bit greyscale"=>1, "24 bit colour"=>4 );
?>
<html>
<head>
@ -2128,6 +2129,7 @@ $source_types = array( "Local"=>"Local", "Remote"=>"Remote" );
<tr><td align="left" class="text">Device Number (/dev/video?)</td><td align="left" class="text"><input type="text" name="new_device" value="<?= $monitor[Device] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Device Channel</td><td align="left" class="text"><input type="text" name="new_channel" value="<?= $monitor[Channel] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Device Format (0=PAL,1=NTSC etc)</td><td align="left" class="text"><input type="text" name="new_format" value="<?= $monitor[Format] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Capture Palette</td><td align="left" class="text"><select name="new_palette" class="form"><?php foreach ( $local_palettes as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $monitor[Palette] ) { ?> selected<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
<?php
}
else
@ -2136,13 +2138,12 @@ $source_types = array( "Local"=>"Local", "Remote"=>"Remote" );
<tr><td align="left" class="text">Remote Host Name</td><td align="left" class="text"><input type="text" name="new_host" value="<?= $monitor[Host] ?>" size="16" class="form"></td></tr>
<tr><td align="left" class="text">Remote Host Port</td><td align="left" class="text"><input type="text" name="new_port" value="<?= $monitor[Port] ?>" size="6" class="form"></td></tr>
<tr><td align="left" class="text">Remote Host Path</td><td align="left" class="text"><input type="text" name="new_path" value="<?= $monitor[Path] ?>" size="36" class="form"></td></tr>
<tr><td align="left" class="text">Remote Image Colours</td><td align="left" class="text"><select name="new_palette" class="form"><?php foreach ( $remote_palettes as $name => $value ) { ?><option value= <?= $value ?>"<?php if ( $value == $monitor[Palette] ) { ?> selected<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
<?php
}
?>
<tr><td align="left" class="text">Capture Width (pixels)</td><td align="left" class="text"><input type="text" name="new_width" value="<?= $monitor[Width] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Capture Height (pixels)</td><td align="left" class="text"><input type="text" name="new_height" value="<?= $monitor[Height] ?>" size="4" class="form"></td></tr>
<?php $depths = array( 8, 24 ); ?>
<tr><td align="left" class="text">Capture Colour Depth (bits)</td><td align="left" class="text"><select name="new_colours" class="form"><?php foreach ( $depths as $depth ) { ?><option<?php if ( $depth == $monitor[Colours] ) { ?> selected<?php } ?>><?= $depth ?></option><?php } ?></select></td></tr>
<tr><td align="left" class="text">Timestamp Label Format</td><td align="left" class="text"><input type="text" name="new_label_format" value="<?= $monitor[LabelFormat] ?>" size="20" class="form"></td></tr>
<tr><td align="left" class="text">Timestamp Label X</td><td align="left" class="text"><input type="text" name="new_label_x" value="<?= $monitor[LabelX] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Timestamp Label Y</td><td align="left" class="text"><input type="text" name="new_label_y" value="<?= $monitor[LabelY] ?>" size="4" class="form"></td></tr>
@ -2427,7 +2428,7 @@ function closeWindow()
}
case "video" :
{
$result = mysql_query( "select E.*,M.Name as MonitorName, M.Colours from Events as E, Monitors as M where E.Id = '$eid' and E.MonitorId = M.Id" );
$result = mysql_query( "select E.*,M.Name as MonitorName, M.Palette from Events as E, Monitors as M where E.Id = '$eid' and E.MonitorId = M.Id" );
if ( !$result )
die( mysql_error() );
$event = mysql_fetch_assoc( $result );
@ -2459,7 +2460,7 @@ function closeWindow()
fputs( $fp, "REFERENCE_FRAME ORIGINAL\n" );
fputs( $fp, "FRAME_RATE 24\n" );
if ( $event[Colours] == 1 )
if ( $event[Palette] == 1 )
fputs( $fp, "INPUT_CONVERT ".ZM_PATH_NETPBM."/jpegtopnm * | ".ZM_PATH_NETPBM."/pgmtoppm white | ".ZM_PATH_NETPBM."/ppmtojpeg\n" );
else
fputs( $fp, "INPUT_CONVERT *\n" );