Skip to content

Commit

Permalink
Renamed 'Blacken' zone type to 'Privacy'
Browse files Browse the repository at this point in the history
  • Loading branch information
schrorg committed Aug 20, 2015
1 parent acacd24 commit 5b46519
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions db/zm_create.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ DROP TABLE IF EXISTS `ZonePresets`;
CREATE TABLE `ZonePresets` (
`Id` int(10) unsigned NOT NULL auto_increment,
`Name` varchar(64) NOT NULL default '',
`Type` enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Blacken') NOT NULL default 'Active',
`Type` enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Privacy') NOT NULL default 'Active',
`Units` enum('Pixels','Percent') NOT NULL default 'Pixels',
`CheckMethod` enum('AlarmedPixels','FilteredPixels','Blobs') NOT NULL default 'Blobs',
`MinPixelThreshold` smallint(5) unsigned default NULL,
Expand Down Expand Up @@ -511,7 +511,7 @@ CREATE TABLE `Zones` (
`Id` int(10) unsigned NOT NULL auto_increment,
`MonitorId` int(10) unsigned NOT NULL default '0',
`Name` varchar(64) NOT NULL default '',
`Type` enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Blacken') NOT NULL default 'Active',
`Type` enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Privacy') NOT NULL default 'Active',
`Units` enum('Pixels','Percent') NOT NULL default 'Pixels',
`NumCoords` tinyint(3) unsigned NOT NULL default '0',
`Coords` tinytext NOT NULL,
Expand Down
6 changes: 3 additions & 3 deletions db/zm_update-1.28.105.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
--

--
-- Add Blacken type to Zone Types
-- Add Privacy type to Zone Types
--

alter table Zones modify Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Blacken') NOT NULL DEFAULT 'Active';
alter table ZonePresets modify Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Blacken') NOT NULL DEFAULT 'Active';
alter table Zones modify Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Privacy') NOT NULL DEFAULT 'Active';
alter table ZonePresets modify Type enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Privacy') NOT NULL DEFAULT 'Active';
4 changes: 2 additions & 2 deletions src/zm_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ const Coord Image::centreCoord( const char *text ) const
}

/* RGB32 compatible: complete */
void Image::Blacken( const unsigned char *p_bitmask, const Rgb pixel_colour )
void Image::MaskPrivacy( const unsigned char *p_bitmask, const Rgb pixel_colour )
{
const uint8_t pixel_r_col = RED_VAL_RGBA(pixel_colour);
const uint8_t pixel_g_col = GREEN_VAL_RGBA(pixel_colour);
Expand Down Expand Up @@ -1781,7 +1781,7 @@ void Image::Blacken( const unsigned char *p_bitmask, const Rgb pixel_colour )
i++;
}
} else {
Panic("Blacken called with unexpected colours: %d", colours);
Panic("MaskPrivacy called with unexpected colours: %d", colours);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/zm_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class Image
void Delta( const Image &image, Image* targetimage) const;

const Coord centreCoord( const char *text ) const;
void Blacken( const unsigned char *p_bitmask, const Rgb pixel_colour=RGB_BLACK );
void MaskPrivacy( const unsigned char *p_bitmask, const Rgb pixel_colour=RGB_BLACK );
void Annotate( const char *p_text, const Coord &coord, const int size=1, const Rgb fg_colour=RGB_WHITE, const Rgb bg_colour=RGB_BLACK );
Image *HighlightEdges( Rgb colour, unsigned int p_colours, unsigned int p_subpixelorder, const Box *limits=0 );
//Image *HighlightEdges( Rgb colour, const Polygon &polygon );
Expand Down
46 changes: 23 additions & 23 deletions src/zm_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ Monitor::Monitor(
Purpose p_purpose,
int p_n_zones,
Zone *p_zones[],
const unsigned char *blacken_bitmask
const unsigned char *privacy_bitmask
) : id( p_id ),
function( (Function)p_function ),
enabled( p_enabled ),
Expand Down Expand Up @@ -608,9 +608,9 @@ Monitor::~Monitor()
delete[] images;
images = 0;
}
if ( blacken_bitmask ) {
delete[] blacken_bitmask;
blacken_bitmask = NULL;
if ( privacy_bitmask ) {
delete[] privacy_bitmask;
privacy_bitmask = NULL;
}
if ( mem_ptr ) {
if ( event )
Expand Down Expand Up @@ -691,25 +691,25 @@ void Monitor::AddZones( int p_n_zones, Zone *p_zones[] )
zones = p_zones;
}

void Monitor::AddBlackenBitmask( Zone *p_zones[] )
void Monitor::AddPrivacyBitmask( Zone *p_zones[] )
{
delete[] blacken_bitmask;
blacken_bitmask = NULL;
Image *blacken_image = NULL;
delete[] privacy_bitmask;
privacy_bitmask = NULL;
Image *privacy_image = NULL;

for ( int i = 0; i < n_zones; i++ )
if ( p_zones[i]->IsBlacken() )
if ( p_zones[i]->IsPrivacy() )
{
if ( !blacken_image )
if ( !privacy_image )
{
blacken_image = new Image( width, height, 1, ZM_SUBPIX_ORDER_NONE);
blacken_image->Clear();
privacy_image = new Image( width, height, 1, ZM_SUBPIX_ORDER_NONE);
privacy_image->Clear();
}
blacken_image->Fill( 0xff, p_zones[i]->GetPolygon() );
blacken_image->Outline( 0xff, p_zones[i]->GetPolygon() );
privacy_image->Fill( 0xff, p_zones[i]->GetPolygon() );
privacy_image->Outline( 0xff, p_zones[i]->GetPolygon() );
}
if ( blacken_image )
blacken_bitmask = blacken_image->Buffer();
if ( privacy_image )
privacy_bitmask = privacy_image->Buffer();
}

Monitor::State Monitor::GetState() const
Expand Down Expand Up @@ -2205,7 +2205,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmask( zones );
monitors[i]->AddPrivacyBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name, n_zones );
}
if ( mysql_errno( &dbconn ) )
Expand Down Expand Up @@ -2387,7 +2387,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmask( zones );
monitors[i]->AddPrivacyBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name.c_str(), n_zones );
}
if ( mysql_errno( &dbconn ) )
Expand Down Expand Up @@ -2532,7 +2532,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmask( zones );
monitors[i]->AddPrivacyBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name, n_zones );
}
if ( mysql_errno( &dbconn ) )
Expand Down Expand Up @@ -2682,7 +2682,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
Zone **zones = 0;
int n_zones = Zone::Load( monitors[i], zones );
monitors[i]->AddZones( n_zones, zones );
monitors[i]->AddBlackenBitmask( zones );
monitors[i]->AddPrivacyBitmask( zones );
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name, n_zones );
}
if ( mysql_errno( &dbconn ) )
Expand Down Expand Up @@ -3010,7 +3010,7 @@ Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
Zone **zones = 0;
n_zones = Zone::Load( monitor, zones );
monitor->AddZones( n_zones, zones );
monitor->AddBlackenBitmask( zones );
monitor->AddPrivacyBitmask( zones );
}
Debug( 1, "Loaded monitor %d(%s), %d zones", id, name.c_str(), n_zones );
}
Expand Down Expand Up @@ -3128,8 +3128,8 @@ int Monitor::Capture()
}
}

if ( blacken_bitmask )
capture_image->Blacken( blacken_bitmask );
if ( privacy_bitmask )
capture_image->MaskPrivacy( privacy_bitmask );

gettimeofday( image_buffer[index].timestamp, NULL );
if ( config.timestamp_on_capture )
Expand Down
6 changes: 3 additions & 3 deletions src/zm_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ friend class MonitorStream;

int n_zones;
Zone **zones;
const unsigned char *blacken_bitmask;
const unsigned char *privacy_bitmask;

struct timeval **timestamps;
Image **images;
Expand All @@ -307,11 +307,11 @@ friend class MonitorStream;
public:
// OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info.
//bool OurCheckAlarms( Zone *zone, const Image *pImage );
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int label_size, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_motion_frame_skip, double p_analysis_fps, unsigned int p_analysis_update_delay, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, bool p_embed_exif, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0, const unsigned char *blacken_bitmask=NULL );
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int label_size, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_motion_frame_skip, double p_analysis_fps, unsigned int p_analysis_update_delay, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, int p_alarm_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, bool p_embed_exif, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0, const unsigned char *privacy_bitmask=NULL );
~Monitor();

void AddZones( int p_n_zones, Zone *p_zones[] );
void AddBlackenBitmask( Zone *p_zones[] );
void AddPrivacyBitmask( Zone *p_zones[] );

bool connect();
inline int ShmValid() const
Expand Down
4 changes: 2 additions & 2 deletions src/zm_zone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ int Zone::Load( Monitor *monitor, Zone **&zones )
{
zones[i] = new Zone( monitor, Id, Name, polygon );
}
else if ( atoi(dbrow[2]) == Zone::BLACKEN )
else if ( atoi(dbrow[2]) == Zone::PRIVACY )
{
zones[i] = new Zone( monitor, Id, Name, (Zone::ZoneType)Type, polygon );
}
Expand Down Expand Up @@ -1043,7 +1043,7 @@ bool Zone::DumpSettings( char *output, bool /*verbose*/ )
type==EXCLUSIVE?"Exclusive":(
type==PRECLUSIVE?"Preclusive":(
type==INACTIVE?"Inactive":(
type==BLACKEN?"Blacken":"Unknown"
type==PRIVACY?"Privacy":"Unknown"
))))));
sprintf( output+strlen(output), " Shape : %d points\n", polygon.getNumCoords() );
for ( int i = 0; i < polygon.getNumCoords(); i++ )
Expand Down
4 changes: 2 additions & 2 deletions src/zm_zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Zone
};

public:
typedef enum { ACTIVE=1, INCLUSIVE, EXCLUSIVE, PRECLUSIVE, INACTIVE, BLACKEN } ZoneType;
typedef enum { ACTIVE=1, INCLUSIVE, EXCLUSIVE, PRECLUSIVE, INACTIVE, PRIVACY } ZoneType;
typedef enum { ALARMED_PIXELS=1, FILTERED_PIXELS, BLOBS } CheckMethod;

protected:
Expand Down Expand Up @@ -127,7 +127,7 @@ class Zone
inline bool IsExclusive() const { return( type == EXCLUSIVE ); }
inline bool IsPreclusive() const { return( type == PRECLUSIVE ); }
inline bool IsInactive() const { return( type == INACTIVE ); }
inline bool IsBlacken() const { return( type == BLACKEN ); }
inline bool IsPrivacy() const { return( type == PRIVACY ); }
inline const Image *AlarmImage() const { return( image ); }
inline const Polygon &GetPolygon() const { return( polygon ); }
inline bool Alarmed() const { return( alarmed ); }
Expand Down
4 changes: 2 additions & 2 deletions web/skins/classic/views/js/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function validateForm( form )
{
errors[errors.length] = selfIntersectingString;
}
if ( form.elements['newZone[Type]'].value != 'Inactive' && form.elements['newZone[Type]'].value != 'Blacken' )
if ( form.elements['newZone[Type]'].value != 'Inactive' && form.elements['newZone[Type]'].value != 'Privacy' )
{
if ( !form.newAlarmRgbR.value || !form.newAlarmRgbG.value || !form.newAlarmRgbB.value )
{
Expand Down Expand Up @@ -95,7 +95,7 @@ function submitForm( form )
function applyZoneType()
{
var form = document.zoneForm;
if ( form.elements['newZone[Type]'].value == 'Inactive' || form.elements['newZone[Type]'].value == 'Blacken' )
if ( form.elements['newZone[Type]'].value == 'Inactive' || form.elements['newZone[Type]'].value == 'Privacy' )
{
form.presetSelector.disabled = true;
form.newAlarmRgbR.disabled = true;
Expand Down

0 comments on commit 5b46519

Please sign in to comment.