Add record_audio member, also correct whitespace
This commit is contained in:
parent
4e8255c80a
commit
2a3ed0c32c
135
src/zm_monitor.h
135
src/zm_monitor.h
|
@ -45,20 +45,17 @@
|
||||||
// This is the main class for monitors. Each monitor is associated
|
// This is the main class for monitors. Each monitor is associated
|
||||||
// with a camera and is effectively a collector for events.
|
// with a camera and is effectively a collector for events.
|
||||||
//
|
//
|
||||||
class Monitor
|
class Monitor {
|
||||||
{
|
|
||||||
friend class MonitorStream;
|
friend class MonitorStream;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
QUERY=0,
|
QUERY=0,
|
||||||
CAPTURE,
|
CAPTURE,
|
||||||
ANALYSIS
|
ANALYSIS
|
||||||
} Purpose;
|
} Purpose;
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
NONE=1,
|
NONE=1,
|
||||||
MONITOR,
|
MONITOR,
|
||||||
MODECT,
|
MODECT,
|
||||||
|
@ -67,8 +64,7 @@ public:
|
||||||
NODECT
|
NODECT
|
||||||
} Function;
|
} Function;
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
ROTATE_0=1,
|
ROTATE_0=1,
|
||||||
ROTATE_90,
|
ROTATE_90,
|
||||||
ROTATE_180,
|
ROTATE_180,
|
||||||
|
@ -77,8 +73,7 @@ public:
|
||||||
FLIP_VERT
|
FLIP_VERT
|
||||||
} Orientation;
|
} Orientation;
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
IDLE,
|
IDLE,
|
||||||
PREALARM,
|
PREALARM,
|
||||||
ALARM,
|
ALARM,
|
||||||
|
@ -94,8 +89,7 @@ protected:
|
||||||
typedef enum { CLOSE_TIME, CLOSE_IDLE, CLOSE_ALARM } EventCloseMode;
|
typedef enum { CLOSE_TIME, CLOSE_IDLE, CLOSE_ALARM } EventCloseMode;
|
||||||
|
|
||||||
/* sizeof(SharedData) expected to be 336 bytes on 32bit and 64bit */
|
/* sizeof(SharedData) expected to be 336 bytes on 32bit and 64bit */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t size; /* +0 */
|
uint32_t size; /* +0 */
|
||||||
uint32_t last_write_index; /* +4 */
|
uint32_t last_write_index; /* +4 */
|
||||||
uint32_t last_read_index; /* +8 */
|
uint32_t last_read_index; /* +8 */
|
||||||
|
@ -134,8 +128,7 @@ protected:
|
||||||
typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState;
|
typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState;
|
||||||
|
|
||||||
/* sizeof(TriggerData) expected to be 560 on 32bit & and 64bit */
|
/* sizeof(TriggerData) expected to be 560 on 32bit & and 64bit */
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint32_t trigger_state;
|
uint32_t trigger_state;
|
||||||
uint32_t trigger_score;
|
uint32_t trigger_score;
|
||||||
|
@ -146,8 +139,7 @@ protected:
|
||||||
} TriggerData;
|
} TriggerData;
|
||||||
|
|
||||||
/* sizeof(Snapshot) expected to be 16 bytes on 32bit and 32 bytes on 64bit */
|
/* sizeof(Snapshot) expected to be 16 bytes on 32bit and 32 bytes on 64bit */
|
||||||
struct Snapshot
|
struct Snapshot {
|
||||||
{
|
|
||||||
struct timeval *timestamp;
|
struct timeval *timestamp;
|
||||||
Image *image;
|
Image *image;
|
||||||
void* padding;
|
void* padding;
|
||||||
|
@ -156,8 +148,7 @@ protected:
|
||||||
//TODO: Technically we can't exclude this struct when people don't have avformat as the Memory.pm module doesn't know about avformat
|
//TODO: Technically we can't exclude this struct when people don't have avformat as the Memory.pm module doesn't know about avformat
|
||||||
#if 1
|
#if 1
|
||||||
//sizeOf(VideoStoreData) expected to be 4104 bytes on 32bit and 64bit
|
//sizeOf(VideoStoreData) expected to be 4104 bytes on 32bit and 64bit
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
char event_file[4096];
|
char event_file[4096];
|
||||||
uint32_t recording; //bool arch dependent so use uint32 instead
|
uint32_t recording; //bool arch dependent so use uint32 instead
|
||||||
|
@ -167,8 +158,7 @@ protected:
|
||||||
|
|
||||||
#endif // HAVE_LIBAVFORMAT
|
#endif // HAVE_LIBAVFORMAT
|
||||||
|
|
||||||
class MonitorLink
|
class MonitorLink {
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
@ -196,21 +186,17 @@ protected:
|
||||||
MonitorLink( int p_id, const char *p_name );
|
MonitorLink( int p_id, const char *p_name );
|
||||||
~MonitorLink();
|
~MonitorLink();
|
||||||
|
|
||||||
inline int Id() const
|
inline int Id() const {
|
||||||
{
|
|
||||||
return( id );
|
return( id );
|
||||||
}
|
}
|
||||||
inline const char *Name() const
|
inline const char *Name() const {
|
||||||
{
|
|
||||||
return( name );
|
return( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isConnected() const
|
inline bool isConnected() const {
|
||||||
{
|
|
||||||
return( connected );
|
return( connected );
|
||||||
}
|
}
|
||||||
inline time_t getLastConnectTime() const
|
inline time_t getLastConnectTime() const {
|
||||||
{
|
|
||||||
return( last_connect_time );
|
return( last_connect_time );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +226,7 @@ protected:
|
||||||
int videowriterpref;
|
int videowriterpref;
|
||||||
std::string encoderparams;
|
std::string encoderparams;
|
||||||
std::vector<EncoderParameter_t> encoderparamsvec;
|
std::vector<EncoderParameter_t> encoderparamsvec;
|
||||||
|
bool record_audio; // Whether to store the audio that we receive
|
||||||
|
|
||||||
int brightness; // The statically saved brightness of the camera
|
int brightness; // The statically saved brightness of the camera
|
||||||
int contrast; // The statically saved contrast of the camera
|
int contrast; // The statically saved contrast of the camera
|
||||||
|
@ -332,54 +319,84 @@ protected:
|
||||||
public:
|
public:
|
||||||
// OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info.
|
// OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info.
|
||||||
//bool OurCheckAlarms( Zone *zone, const Image *pImage );
|
//bool OurCheckAlarms( Zone *zone, const Image *pImage );
|
||||||
Monitor( int p_id, const char *p_name, unsigned int p_server_id, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, int p_savejpegs, int p_videowriter, std::string p_encoderparams, 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 );
|
Monitor(
|
||||||
|
int p_id,
|
||||||
|
const char *p_name,
|
||||||
|
unsigned int p_server_id,
|
||||||
|
int p_function,
|
||||||
|
bool p_enabled,
|
||||||
|
const char *p_linked_monitors,
|
||||||
|
Camera *p_camera,
|
||||||
|
int p_orientation,
|
||||||
|
unsigned int p_deinterlacing,
|
||||||
|
int p_savejpegs,
|
||||||
|
int p_videowriter,
|
||||||
|
std::string p_encoderparams,
|
||||||
|
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
|
||||||
|
);
|
||||||
~Monitor();
|
~Monitor();
|
||||||
|
|
||||||
void AddZones( int p_n_zones, Zone *p_zones[] );
|
void AddZones( int p_n_zones, Zone *p_zones[] );
|
||||||
void AddPrivacyBitmask( Zone *p_zones[] );
|
void AddPrivacyBitmask( Zone *p_zones[] );
|
||||||
|
|
||||||
bool connect();
|
bool connect();
|
||||||
inline int ShmValid() const
|
inline int ShmValid() const {
|
||||||
{
|
|
||||||
return( shared_data->valid );
|
return( shared_data->valid );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int Id() const
|
inline int Id() const {
|
||||||
{
|
|
||||||
return( id );
|
return( id );
|
||||||
}
|
}
|
||||||
inline const char *Name() const
|
inline const char *Name() const {
|
||||||
{
|
|
||||||
return( name );
|
return( name );
|
||||||
}
|
}
|
||||||
inline Function GetFunction() const
|
inline Function GetFunction() const {
|
||||||
{
|
|
||||||
return( function );
|
return( function );
|
||||||
}
|
}
|
||||||
inline bool Enabled()
|
inline bool Enabled() {
|
||||||
{
|
|
||||||
if ( function <= MONITOR )
|
if ( function <= MONITOR )
|
||||||
return( false );
|
return( false );
|
||||||
return( enabled );
|
return( enabled );
|
||||||
}
|
}
|
||||||
inline const char *EventPrefix() const
|
inline const char *EventPrefix() const {
|
||||||
{
|
|
||||||
return( event_prefix );
|
return( event_prefix );
|
||||||
}
|
}
|
||||||
inline bool Ready()
|
inline bool Ready() {
|
||||||
{
|
|
||||||
if ( function <= MONITOR )
|
if ( function <= MONITOR )
|
||||||
return( false );
|
return( false );
|
||||||
return( image_count > ready_count );
|
return( image_count > ready_count );
|
||||||
}
|
}
|
||||||
inline bool Active()
|
inline bool Active() {
|
||||||
{
|
|
||||||
if ( function <= MONITOR )
|
if ( function <= MONITOR )
|
||||||
return( false );
|
return( false );
|
||||||
return( enabled && shared_data->active );
|
return( enabled && shared_data->active );
|
||||||
}
|
}
|
||||||
inline bool Exif()
|
inline bool Exif() {
|
||||||
{
|
|
||||||
return( embed_exif );
|
return( embed_exif );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,17 +437,14 @@ public:
|
||||||
int actionColour( int p_colour=-1 );
|
int actionColour( int p_colour=-1 );
|
||||||
int actionContrast( int p_contrast=-1 );
|
int actionContrast( int p_contrast=-1 );
|
||||||
|
|
||||||
inline int PrimeCapture()
|
inline int PrimeCapture() {
|
||||||
{
|
|
||||||
return( camera->PrimeCapture() );
|
return( camera->PrimeCapture() );
|
||||||
}
|
}
|
||||||
inline int PreCapture()
|
inline int PreCapture() {
|
||||||
{
|
|
||||||
return( camera->PreCapture() );
|
return( camera->PreCapture() );
|
||||||
}
|
}
|
||||||
int Capture();
|
int Capture();
|
||||||
int PostCapture()
|
int PostCapture() {
|
||||||
{
|
|
||||||
return( camera->PostCapture() );
|
return( camera->PostCapture() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,8 +487,7 @@ public:
|
||||||
|
|
||||||
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
|
||||||
|
|
||||||
class MonitorStream : public StreamBase
|
class MonitorStream : public StreamBase {
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
typedef struct SwapImage {
|
typedef struct SwapImage {
|
||||||
bool valid;
|
bool valid;
|
||||||
|
@ -505,19 +518,15 @@ protected:
|
||||||
void processCommand( const CmdMsg *msg );
|
void processCommand( const CmdMsg *msg );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MonitorStream() : playback_buffer( 0 ), delayed( false ), frame_count( 0 )
|
MonitorStream() : playback_buffer( 0 ), delayed( false ), frame_count( 0 ) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
void setStreamBuffer( int p_playback_buffer )
|
void setStreamBuffer( int p_playback_buffer ) {
|
||||||
{
|
|
||||||
playback_buffer = p_playback_buffer;
|
playback_buffer = p_playback_buffer;
|
||||||
}
|
}
|
||||||
void setStreamTTL( time_t p_ttl )
|
void setStreamTTL( time_t p_ttl ) {
|
||||||
{
|
|
||||||
ttl = p_ttl;
|
ttl = p_ttl;
|
||||||
}
|
}
|
||||||
bool setStreamStart( int monitor_id )
|
bool setStreamStart( int monitor_id ) {
|
||||||
{
|
|
||||||
return loadMonitor( monitor_id );
|
return loadMonitor( monitor_id );
|
||||||
}
|
}
|
||||||
void runStream();
|
void runStream();
|
||||||
|
|
Loading…
Reference in New Issue