diff --git a/db/zmalter-0.9.10.sql b/db/zmalter-0.9.10.sql new file mode 100644 index 000000000..f93b931f9 --- /dev/null +++ b/db/zmalter-0.9.10.sql @@ -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; diff --git a/src/zm_camera.cpp b/src/zm_camera.cpp index 6c351cd4a..bd4a6aa4c 100644 --- a/src/zm_camera.cpp +++ b/src/zm_camera.cpp @@ -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() diff --git a/src/zm_camera.h b/src/zm_camera.h index 26bd05341..d9221be11 100644 --- a/src/zm_camera.h +++ b/src/zm_camera.h @@ -20,6 +20,10 @@ #ifndef ZM_CAMERA_H #define ZM_CAMERA_H +#include +#include +#include + #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 ); } diff --git a/src/zm_image.h b/src/zm_image.h index 33dbff593..6836dfc7b 100644 --- a/src/zm_image.h +++ b/src/zm_image.h @@ -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 ) diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index 24a542e74..eda5dc1f8 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -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 ); +} diff --git a/src/zm_local_camera.h b/src/zm_local_camera.h index 1875774de..51c84eb3d 100644 --- a/src/zm_local_camera.h +++ b/src/zm_local_camera.h @@ -22,7 +22,6 @@ #include #include -#include #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 ); }; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 27c22a0d2..dcc3372cb 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -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 ); diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index a37b60805..8314c7830 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -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; diff --git a/src/zm_remote_camera.h b/src/zm_remote_camera.h index 471a65bb4..c10846d41 100644 --- a/src/zm_remote_camera.h +++ b/src/zm_remote_camera.h @@ -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 ); } diff --git a/web/zm_actions.php b/web/zm_actions.php index 219be602b..7fdfef1c3 100644 --- a/web/zm_actions.php +++ b/web/zm_actions.php @@ -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 diff --git a/web/zm_html.php b/web/zm_html.php index e29ee85f7..0e0c1da9b 100644 --- a/web/zm_html.php +++ b/web/zm_html.php @@ -243,7 +243,6 @@ function confirmStatus( new_status ) - @@ -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 ); ?> @@ -2128,6 +2129,7 @@ $source_types = array( "Local"=>"Local", "Remote"=>"Remote" ); Device Number (/dev/video?) Device Channel Device Format (0=PAL,1=NTSC etc) +Capture Palette "Local", "Remote"=>"Remote" ); Remote Host Name Remote Host Port Remote Host Path +Remote Image Colours Capture Width (pixels) Capture Height (pixels) - -Capture Colour Depth (bits) Timestamp Label Format Timestamp Label X Timestamp Label Y @@ -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" );