Compare commits
4 Commits
1.36.12_he
...
fix_zms_pa
Author | SHA1 | Date |
---|---|---|
Isaac Connor | fcc507b93e | |
Isaac Connor | d63df84c98 | |
Isaac Connor | f23ee8441f | |
Isaac Connor | 2901043bc9 |
|
@ -847,7 +847,7 @@ bool EventStream::loadEventData( int event_id )
|
||||||
|
|
||||||
mysql_free_result( result );
|
mysql_free_result( result );
|
||||||
|
|
||||||
if ( forceEventChange || mode == MODE_ALL_GAPLESS )
|
if ( forceEventChange || mode == ALL_GAPLESS )
|
||||||
{
|
{
|
||||||
if ( replay_rate > 0 )
|
if ( replay_rate > 0 )
|
||||||
curr_stream_time = event_data->frames[0].timestamp;
|
curr_stream_time = event_data->frames[0].timestamp;
|
||||||
|
@ -885,7 +885,7 @@ void EventStream::processCommand( const CmdMsg *msg )
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are in single event mode and at the last frame, replay the current event
|
// If we are in single event mode and at the last frame, replay the current event
|
||||||
if ( (mode == MODE_SINGLE) && (curr_frame_id == event_data->frame_count) )
|
if ( (mode == SINGLE) && (curr_frame_id == event_data->frame_count) )
|
||||||
curr_frame_id = 1;
|
curr_frame_id = 1;
|
||||||
|
|
||||||
replay_rate = ZM_RATE_BASE;
|
replay_rate = ZM_RATE_BASE;
|
||||||
|
@ -1148,7 +1148,7 @@ void EventStream::checkEventLoaded()
|
||||||
|
|
||||||
if ( reload_event )
|
if ( reload_event )
|
||||||
{
|
{
|
||||||
if ( forceEventChange || mode != MODE_SINGLE )
|
if ( forceEventChange || mode != SINGLE )
|
||||||
{
|
{
|
||||||
//Info( "SQL:%s", sql );
|
//Info( "SQL:%s", sql );
|
||||||
if ( mysql_query( &dbconn, sql ) )
|
if ( mysql_query( &dbconn, sql ) )
|
||||||
|
@ -1218,7 +1218,7 @@ bool EventStream::sendFrame( int delta_us )
|
||||||
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
||||||
|
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
if ( type == STREAM_MPEG )
|
if ( type == MPEG )
|
||||||
{
|
{
|
||||||
Image image( filepath );
|
Image image( filepath );
|
||||||
|
|
||||||
|
@ -1244,7 +1244,7 @@ bool EventStream::sendFrame( int delta_us )
|
||||||
|
|
||||||
fprintf( stdout, "--ZoneMinderFrame\r\n" );
|
fprintf( stdout, "--ZoneMinderFrame\r\n" );
|
||||||
|
|
||||||
if ( type != STREAM_JPEG )
|
if ( type != JPEG )
|
||||||
send_raw = false;
|
send_raw = false;
|
||||||
|
|
||||||
if ( send_raw )
|
if ( send_raw )
|
||||||
|
@ -1272,10 +1272,10 @@ bool EventStream::sendFrame( int delta_us )
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case STREAM_JPEG :
|
case JPEG :
|
||||||
send_image->EncodeJpeg( img_buffer, &img_buffer_size );
|
send_image->EncodeJpeg( img_buffer, &img_buffer_size );
|
||||||
break;
|
break;
|
||||||
case STREAM_ZIP :
|
case ZIP :
|
||||||
#if HAVE_ZLIB_H
|
#if HAVE_ZLIB_H
|
||||||
unsigned long zip_buffer_size;
|
unsigned long zip_buffer_size;
|
||||||
send_image->Zip( img_buffer, &zip_buffer_size );
|
send_image->Zip( img_buffer, &zip_buffer_size );
|
||||||
|
@ -1283,9 +1283,9 @@ bool EventStream::sendFrame( int delta_us )
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
Error("zlib is required for zipped images. Falling back to raw image");
|
Error("zlib is required for zipped images. Falling back to raw image");
|
||||||
type = STREAM_RAW;
|
type = RAW;
|
||||||
#endif // HAVE_ZLIB_H
|
#endif // HAVE_ZLIB_H
|
||||||
case STREAM_RAW :
|
case RAW :
|
||||||
img_buffer = (uint8_t*)(send_image->Buffer());
|
img_buffer = (uint8_t*)(send_image->Buffer());
|
||||||
img_buffer_size = send_image->Size();
|
img_buffer_size = send_image->Size();
|
||||||
break;
|
break;
|
||||||
|
@ -1297,13 +1297,13 @@ bool EventStream::sendFrame( int delta_us )
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case STREAM_JPEG :
|
case JPEG :
|
||||||
fprintf( stdout, "Content-Type: image/jpeg\r\n" );
|
fprintf( stdout, "Content-Type: image/jpeg\r\n" );
|
||||||
break;
|
break;
|
||||||
case STREAM_RAW :
|
case RAW :
|
||||||
fprintf( stdout, "Content-Type: image/x-rgb\r\n" );
|
fprintf( stdout, "Content-Type: image/x-rgb\r\n" );
|
||||||
break;
|
break;
|
||||||
case STREAM_ZIP :
|
case ZIP :
|
||||||
fprintf( stdout, "Content-Type: image/x-rgbz\r\n" );
|
fprintf( stdout, "Content-Type: image/x-rgbz\r\n" );
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
|
@ -1357,7 +1357,7 @@ void EventStream::runStream()
|
||||||
|
|
||||||
updateFrameRate( (double)event_data->frame_count/event_data->duration );
|
updateFrameRate( (double)event_data->frame_count/event_data->duration );
|
||||||
|
|
||||||
if ( type == STREAM_JPEG )
|
if ( mode == STREAM )
|
||||||
fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" );
|
fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" );
|
||||||
|
|
||||||
if ( !event_data )
|
if ( !event_data )
|
||||||
|
@ -1462,7 +1462,7 @@ void EventStream::runStream()
|
||||||
if ( !paused )
|
if ( !paused )
|
||||||
{
|
{
|
||||||
curr_frame_id += replay_rate>0?1:-1;
|
curr_frame_id += replay_rate>0?1:-1;
|
||||||
if ( send_frame && type != STREAM_MPEG )
|
if ( send_frame && type != MPEG )
|
||||||
{
|
{
|
||||||
Debug( 3, "dUs: %d", delta_us );
|
Debug( 3, "dUs: %d", delta_us );
|
||||||
usleep( delta_us );
|
usleep( delta_us );
|
||||||
|
@ -1472,9 +1472,9 @@ void EventStream::runStream()
|
||||||
{
|
{
|
||||||
usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) );
|
usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) );
|
||||||
}
|
}
|
||||||
}
|
} // end while ! terminate
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
if ( type == STREAM_MPEG )
|
if ( type == MPEG )
|
||||||
delete vid_stream;
|
delete vid_stream;
|
||||||
#endif // HAVE_LIBAVCODEC
|
#endif // HAVE_LIBAVCODEC
|
||||||
|
|
||||||
|
|
|
@ -48,22 +48,22 @@ class Monitor;
|
||||||
//
|
//
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
friend class EventStream;
|
friend class EventStream;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool initialised;
|
static bool initialised;
|
||||||
static char capture_file_format[PATH_MAX];
|
static char capture_file_format[PATH_MAX];
|
||||||
static char analyse_file_format[PATH_MAX];
|
static char analyse_file_format[PATH_MAX];
|
||||||
static char general_file_format[PATH_MAX];
|
static char general_file_format[PATH_MAX];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static int sd;
|
static int sd;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::set<std::string> StringSet;
|
typedef std::set<std::string> StringSet;
|
||||||
typedef std::map<std::string,StringSet> StringSetMap;
|
typedef std::map<std::string,StringSet> StringSetMap;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef enum { NORMAL, BULK, ALARM } FrameType;
|
typedef enum { NORMAL, BULK, ALARM } FrameType;
|
||||||
|
|
||||||
struct PreAlarmData
|
struct PreAlarmData
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
||||||
static int pre_alarm_count;
|
static int pre_alarm_count;
|
||||||
static PreAlarmData pre_alarm_data[MAX_PRE_ALARM_FRAMES];
|
static PreAlarmData pre_alarm_data[MAX_PRE_ALARM_FRAMES];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
Monitor *monitor;
|
Monitor *monitor;
|
||||||
struct timeval start_time;
|
struct timeval start_time;
|
||||||
|
@ -90,10 +90,10 @@ protected:
|
||||||
unsigned int max_score;
|
unsigned int max_score;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int last_db_frame;
|
int last_db_frame;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void Initialise()
|
static void Initialise()
|
||||||
{
|
{
|
||||||
if ( initialised )
|
if ( initialised )
|
||||||
|
@ -108,11 +108,11 @@ protected:
|
||||||
|
|
||||||
void createNotes( std::string ¬es );
|
void createNotes( std::string ¬es );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool OpenFrameSocket( int );
|
static bool OpenFrameSocket( int );
|
||||||
static bool ValidateFrameSocket( int );
|
static bool ValidateFrameSocket( int );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap );
|
Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap );
|
||||||
~Event();
|
~Event();
|
||||||
|
|
||||||
|
@ -133,10 +133,10 @@ public:
|
||||||
void AddFrames( int n_frames, Image **images, struct timeval **timestamps );
|
void AddFrames( int n_frames, Image **images, struct timeval **timestamps );
|
||||||
void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL );
|
void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps );
|
void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const char *getSubPath( struct tm *time )
|
static const char *getSubPath( struct tm *time )
|
||||||
{
|
{
|
||||||
static char subpath[PATH_MAX] = "";
|
static char subpath[PATH_MAX] = "";
|
||||||
|
@ -148,7 +148,7 @@ public:
|
||||||
return( Event::getSubPath( localtime( time ) ) );
|
return( Event::getSubPath( localtime( time ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int PreAlarmCount()
|
static int PreAlarmCount()
|
||||||
{
|
{
|
||||||
return( pre_alarm_count );
|
return( pre_alarm_count );
|
||||||
|
@ -189,10 +189,9 @@ public:
|
||||||
|
|
||||||
class EventStream : public StreamBase
|
class EventStream : public StreamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef enum { MODE_SINGLE, MODE_ALL, MODE_ALL_GAPLESS } StreamMode;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct FrameData {
|
struct FrameData {
|
||||||
//unsigned long id;
|
//unsigned long id;
|
||||||
time_t timestamp;
|
time_t timestamp;
|
||||||
|
@ -213,22 +212,22 @@ protected:
|
||||||
FrameData *frames;
|
FrameData *frames;
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const int STREAM_PAUSE_WAIT = 250000; // Microseconds
|
static const int STREAM_PAUSE_WAIT = 250000; // Microseconds
|
||||||
|
|
||||||
static const StreamMode DEFAULT_MODE = MODE_SINGLE;
|
static const StreamMode DEFAULT_MODE = SINGLE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StreamMode mode;
|
StreamMode mode;
|
||||||
bool forceEventChange;
|
bool forceEventChange;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int curr_frame_id;
|
int curr_frame_id;
|
||||||
double curr_stream_time;
|
double curr_stream_time;
|
||||||
|
|
||||||
EventData *event_data;
|
EventData *event_data;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool loadEventData( int event_id );
|
bool loadEventData( int event_id );
|
||||||
bool loadInitialEventData( int init_event_id, int init_frame_id );
|
bool loadInitialEventData( int init_event_id, int init_frame_id );
|
||||||
bool loadInitialEventData( int monitor_id, time_t event_time );
|
bool loadInitialEventData( int monitor_id, time_t event_time );
|
||||||
|
@ -237,7 +236,7 @@ protected:
|
||||||
void processCommand( const CmdMsg *msg );
|
void processCommand( const CmdMsg *msg );
|
||||||
bool sendFrame( int delta_us );
|
bool sendFrame( int delta_us );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EventStream()
|
EventStream()
|
||||||
{
|
{
|
||||||
mode = DEFAULT_MODE;
|
mode = DEFAULT_MODE;
|
||||||
|
|
|
@ -291,7 +291,7 @@ Monitor::Monitor(
|
||||||
Purpose p_purpose,
|
Purpose p_purpose,
|
||||||
int p_n_zones,
|
int p_n_zones,
|
||||||
Zone *p_zones[]
|
Zone *p_zones[]
|
||||||
) : id( p_id ),
|
) : id( p_id ),
|
||||||
function( (Function)p_function ),
|
function( (Function)p_function ),
|
||||||
enabled( p_enabled ),
|
enabled( p_enabled ),
|
||||||
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
|
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
|
||||||
|
@ -1916,7 +1916,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
||||||
} else {
|
} else {
|
||||||
v4l_captures_per_frame = config.captures_per_frame;
|
v4l_captures_per_frame = config.captures_per_frame;
|
||||||
}
|
}
|
||||||
Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
|
Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
|
||||||
col++;
|
col++;
|
||||||
const char *method = dbrow[col]; col++;
|
const char *method = dbrow[col]; col++;
|
||||||
|
|
||||||
|
@ -2537,7 +2537,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
||||||
} else {
|
} else {
|
||||||
v4l_captures_per_frame = config.captures_per_frame;
|
v4l_captures_per_frame = config.captures_per_frame;
|
||||||
}
|
}
|
||||||
Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
|
Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
std::string protocol = dbrow[col]; col++;
|
std::string protocol = dbrow[col]; col++;
|
||||||
|
@ -3039,49 +3039,49 @@ bool Monitor::closeEvent()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
bool Monitor::OurCheckAlarms( Zone *zone, const Image *pImage )
|
bool Monitor::OurCheckAlarms( Zone *zone, const Image *pImage )
|
||||||
{
|
{
|
||||||
Info("Entering OurCheckAlarms >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
Info("Entering OurCheckAlarms >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
unsigned char black_thr = 23;
|
unsigned char black_thr = 23;
|
||||||
int min_alarm_score = 10;
|
int min_alarm_score = 10;
|
||||||
int max_alarm_score = 99;
|
int max_alarm_score = 99;
|
||||||
//bool alarm = false;
|
//bool alarm = false;
|
||||||
unsigned int score;
|
unsigned int score;
|
||||||
Polygon zone_polygon = zone->GetPolygon();
|
Polygon zone_polygon = zone->GetPolygon();
|
||||||
Info("Got polygon of a zone. It has %d vertices.", zone_polygon.getNumCoords());
|
Info("Got polygon of a zone. It has %d vertices.", zone_polygon.getNumCoords());
|
||||||
|
|
||||||
zone->ResetStats();
|
zone->ResetStats();
|
||||||
Info("ResetStats done.");
|
Info("ResetStats done.");
|
||||||
|
|
||||||
if ( !zone->CheckOverloadCount() )
|
if ( !zone->CheckOverloadCount() )
|
||||||
{
|
{
|
||||||
Info("CheckOverloadCount() return false, we'll return false.");
|
Info("CheckOverloadCount() return false, we'll return false.");
|
||||||
return( false );
|
return( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
Image *pMaskImage = new Image(pImage->Width(), pImage->Height(), ZM_COLOUR_GRAY8, pImage->SubpixelOrder());
|
Image *pMaskImage = new Image(pImage->Width(), pImage->Height(), ZM_COLOUR_GRAY8, pImage->SubpixelOrder());
|
||||||
Info("Mask image created.");
|
Info("Mask image created.");
|
||||||
|
|
||||||
pMaskImage->Fill(BLACK);
|
pMaskImage->Fill(BLACK);
|
||||||
Info("Mask image filled with BLACK.");
|
Info("Mask image filled with BLACK.");
|
||||||
if (pImage->Colours() == ZM_COLOUR_GRAY8)
|
if (pImage->Colours() == ZM_COLOUR_GRAY8)
|
||||||
{
|
{
|
||||||
Info("Analysed image is not colored! Set score = 0.");
|
Info("Analysed image is not colored! Set score = 0.");
|
||||||
score = 0;
|
score = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info("Start processing image.");
|
Info("Start processing image.");
|
||||||
//Process image
|
//Process image
|
||||||
unsigned char *buffer = (unsigned char*)pImage->Buffer();
|
unsigned char *buffer = (unsigned char*)pImage->Buffer();
|
||||||
unsigned char *mask_buffer = (unsigned char*)pMaskImage->Buffer();
|
unsigned char *mask_buffer = (unsigned char*)pMaskImage->Buffer();
|
||||||
|
|
||||||
int black_pixels_count = 0;
|
int black_pixels_count = 0;
|
||||||
Info("Loop for black pixels counting and mask filling.");
|
Info("Loop for black pixels counting and mask filling.");
|
||||||
while (buffer < (pImage->Buffer() + pImage->Size()))
|
while (buffer < (pImage->Buffer() + pImage->Size()))
|
||||||
{
|
{
|
||||||
if ( (RED(buffer) < black_thr) && (GREEN(buffer) < black_thr) && (BLUE(buffer) < black_thr) )
|
if ( (RED(buffer) < black_thr) && (GREEN(buffer) < black_thr) && (BLUE(buffer) < black_thr) )
|
||||||
{
|
{
|
||||||
*mask_buffer = WHITE;
|
*mask_buffer = WHITE;
|
||||||
black_pixels_count++;
|
black_pixels_count++;
|
||||||
}
|
}
|
||||||
|
@ -3110,21 +3110,21 @@ bool Monitor::OurCheckAlarms( Zone *zone, const Image *pImage )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zone->SetScore(score);
|
zone->SetScore(score);
|
||||||
Info("Score have been set in zone.");
|
Info("Score have been set in zone.");
|
||||||
//Get mask
|
//Get mask
|
||||||
Rgb alarm_colour = RGB_RED;
|
Rgb alarm_colour = RGB_RED;
|
||||||
Image *tempImage = pMaskImage->HighlightEdges(alarm_colour, &zone_polygon.Extent() );
|
Image *tempImage = pMaskImage->HighlightEdges(alarm_colour, &zone_polygon.Extent() );
|
||||||
Info("After HighlightEdges");
|
Info("After HighlightEdges");
|
||||||
|
|
||||||
zone->SetAlarmImage(tempImage);
|
zone->SetAlarmImage(tempImage);
|
||||||
Info("After SetAlarmImage");
|
Info("After SetAlarmImage");
|
||||||
delete pMaskImage;
|
delete pMaskImage;
|
||||||
Info("After Delete pMaskImage");
|
Info("After Delete pMaskImage");
|
||||||
delete tempImage;
|
delete tempImage;
|
||||||
|
|
||||||
Info("Leaving OurCheckAlarms >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
Info("Leaving OurCheckAlarms >>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Monitor::DetectBlack(const Image &comp_image, Event::StringSet &zoneSet )
|
unsigned int Monitor::DetectBlack(const Image &comp_image, Event::StringSet &zoneSet )
|
||||||
|
@ -3135,8 +3135,8 @@ unsigned int Monitor::DetectBlack(const Image &comp_image, Event::StringSet &zon
|
||||||
|
|
||||||
if ( n_zones <= 0 ) return( alarm );
|
if ( n_zones <= 0 ) return( alarm );
|
||||||
|
|
||||||
// Coord alarm_centre;
|
// Coord alarm_centre;
|
||||||
// int top_score = -1;
|
// int top_score = -1;
|
||||||
|
|
||||||
// Find all alarm pixels in active zones
|
// Find all alarm pixels in active zones
|
||||||
Info("Number of zones to process %d", n_zones);
|
Info("Number of zones to process %d", n_zones);
|
||||||
|
@ -3158,30 +3158,30 @@ unsigned int Monitor::DetectBlack(const Image &comp_image, Event::StringSet &zon
|
||||||
Debug( 3, "Zone is alarmed, zone score = %d", zone->Score() );
|
Debug( 3, "Zone is alarmed, zone score = %d", zone->Score() );
|
||||||
Info( "Zone is alarmed, zone score = %d", zone->Score() );
|
Info( "Zone is alarmed, zone score = %d", zone->Score() );
|
||||||
zoneSet.insert( zone->Label() );
|
zoneSet.insert( zone->Label() );
|
||||||
// if ( config.opt_control && track_motion )
|
// if ( config.opt_control && track_motion )
|
||||||
// {
|
// {
|
||||||
// if ( (int)zone->Score() > top_score )
|
// if ( (int)zone->Score() > top_score )
|
||||||
// {
|
// {
|
||||||
// top_score = zone->Score();
|
// top_score = zone->Score();
|
||||||
// alarm_centre = zone->GetAlarmCentre();
|
// alarm_centre = zone->GetAlarmCentre();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
Info( "Finish checking active zone %s", zone->Label() );
|
Info( "Finish checking active zone %s", zone->Label() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if ( top_score > 0 )
|
// if ( top_score > 0 )
|
||||||
// {
|
// {
|
||||||
// shared_data->alarm_x = alarm_centre.X();
|
// shared_data->alarm_x = alarm_centre.X();
|
||||||
// shared_data->alarm_y = alarm_centre.Y();
|
// shared_data->alarm_y = alarm_centre.Y();
|
||||||
//
|
//
|
||||||
// Info( "Got alarm centre at %d,%d, at count %d", shared_data->alarm_x, shared_data->alarm_y, image_count );
|
// Info( "Got alarm centre at %d,%d, at count %d", shared_data->alarm_x, shared_data->alarm_y, image_count );
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// shared_data->alarm_x = shared_data->alarm_y = -1;
|
// shared_data->alarm_x = shared_data->alarm_y = -1;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// This is a small and innocent hack to prevent scores of 0 being returned in alarm state
|
// This is a small and innocent hack to prevent scores of 0 being returned in alarm state
|
||||||
Info("Leaving DetectBlack <<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
Info("Leaving DetectBlack <<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||||
|
@ -3788,7 +3788,7 @@ bool MonitorStream::sendFrame( const char *filepath, struct timeval *timestamp )
|
||||||
{
|
{
|
||||||
bool send_raw = ((scale>=ZM_SCALE_BASE)&&(zoom==ZM_SCALE_BASE));
|
bool send_raw = ((scale>=ZM_SCALE_BASE)&&(zoom==ZM_SCALE_BASE));
|
||||||
|
|
||||||
if ( type != STREAM_JPEG )
|
if ( type != JPEG )
|
||||||
send_raw = false;
|
send_raw = false;
|
||||||
if ( !config.timestamp_on_capture && timestamp )
|
if ( !config.timestamp_on_capture && timestamp )
|
||||||
send_raw = false;
|
send_raw = false;
|
||||||
|
@ -3856,7 +3856,7 @@ bool MonitorStream::sendFrame( Image *image, struct timeval *timestamp )
|
||||||
monitor->TimestampImage( send_image, timestamp );
|
monitor->TimestampImage( send_image, timestamp );
|
||||||
|
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
if ( type == STREAM_MPEG )
|
if ( type == MPEG )
|
||||||
{
|
{
|
||||||
if ( !vid_stream )
|
if ( !vid_stream )
|
||||||
{
|
{
|
||||||
|
@ -3886,16 +3886,16 @@ bool MonitorStream::sendFrame( Image *image, struct timeval *timestamp )
|
||||||
fprintf( stdout, "--ZoneMinderFrame\r\n" );
|
fprintf( stdout, "--ZoneMinderFrame\r\n" );
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case STREAM_JPEG :
|
case JPEG :
|
||||||
send_image->EncodeJpeg( img_buffer, &img_buffer_size );
|
send_image->EncodeJpeg( img_buffer, &img_buffer_size );
|
||||||
fprintf( stdout, "Content-Type: image/jpeg\r\n" );
|
fprintf( stdout, "Content-Type: image/jpeg\r\n" );
|
||||||
break;
|
break;
|
||||||
case STREAM_RAW :
|
case RAW :
|
||||||
fprintf( stdout, "Content-Type: image/x-rgb\r\n" );
|
fprintf( stdout, "Content-Type: image/x-rgb\r\n" );
|
||||||
img_buffer = (uint8_t*)send_image->Buffer();
|
img_buffer = (uint8_t*)send_image->Buffer();
|
||||||
img_buffer_size = send_image->Size();
|
img_buffer_size = send_image->Size();
|
||||||
break;
|
break;
|
||||||
case STREAM_ZIP :
|
case ZIP :
|
||||||
fprintf( stdout, "Content-Type: image/x-rgbz\r\n" );
|
fprintf( stdout, "Content-Type: image/x-rgbz\r\n" );
|
||||||
unsigned long zip_buffer_size;
|
unsigned long zip_buffer_size;
|
||||||
send_image->Zip( img_buffer, &zip_buffer_size );
|
send_image->Zip( img_buffer, &zip_buffer_size );
|
||||||
|
@ -3924,14 +3924,14 @@ bool MonitorStream::sendFrame( Image *image, struct timeval *timestamp )
|
||||||
maxfps /= 1.5;
|
maxfps /= 1.5;
|
||||||
Error( "Frame send time %d msec too slow, throttling maxfps to %.2f", frameSendTime, maxfps );
|
Error( "Frame send time %d msec too slow, throttling maxfps to %.2f", frameSendTime, maxfps );
|
||||||
}
|
}
|
||||||
}
|
} // endif HAVE_LIBAV and type==MPEG
|
||||||
last_frame_sent = TV_2_FLOAT( now );
|
last_frame_sent = TV_2_FLOAT( now );
|
||||||
return( true );
|
return( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorStream::runStream()
|
void MonitorStream::runStream()
|
||||||
{
|
{
|
||||||
if ( type == STREAM_SINGLE )
|
if ( mode == SINGLE )
|
||||||
{
|
{
|
||||||
// Not yet migrated over to stream class
|
// Not yet migrated over to stream class
|
||||||
monitor->SingleImage( scale );
|
monitor->SingleImage( scale );
|
||||||
|
@ -3944,7 +3944,7 @@ void MonitorStream::runStream()
|
||||||
|
|
||||||
updateFrameRate( monitor->GetFPS() );
|
updateFrameRate( monitor->GetFPS() );
|
||||||
|
|
||||||
if ( type == STREAM_JPEG )
|
if ( type == JPEG )
|
||||||
fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" );
|
fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" );
|
||||||
|
|
||||||
int last_read_index = monitor->image_buffer_count;
|
int last_read_index = monitor->image_buffer_count;
|
||||||
|
|
|
@ -249,7 +249,7 @@ bool StreamBase::sendTextFrame( const char *frame_text )
|
||||||
image.Scale( scale );
|
image.Scale( scale );
|
||||||
}
|
}
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
if ( type == STREAM_MPEG )
|
if ( type == MPEG )
|
||||||
{
|
{
|
||||||
if ( !vid_stream )
|
if ( !vid_stream )
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,20 +32,21 @@ class Monitor;
|
||||||
|
|
||||||
class StreamBase
|
class StreamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef enum { STREAM_JPEG, STREAM_RAW, STREAM_ZIP, STREAM_SINGLE, STREAM_MPEG } StreamType;
|
typedef enum { JPEG, RAW, ZIP, MPEG } StreamType;
|
||||||
|
typedef enum { SINGLE, STREAM, ALL, ALL_GAPLESS } StreamMode;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const int MAX_STREAM_DELAY = 5; // Seconds
|
static const int MAX_STREAM_DELAY = 5; // Seconds
|
||||||
|
|
||||||
static const StreamType DEFAULT_TYPE = STREAM_JPEG;
|
static const StreamType DEFAULT_TYPE = JPEG;
|
||||||
enum { DEFAULT_RATE=ZM_RATE_BASE };
|
enum { DEFAULT_RATE=ZM_RATE_BASE };
|
||||||
enum { DEFAULT_SCALE=ZM_SCALE_BASE };
|
enum { DEFAULT_SCALE=ZM_SCALE_BASE };
|
||||||
enum { DEFAULT_ZOOM=ZM_SCALE_BASE };
|
enum { DEFAULT_ZOOM=ZM_SCALE_BASE };
|
||||||
enum { DEFAULT_MAXFPS=10 };
|
enum { DEFAULT_MAXFPS=10 };
|
||||||
enum { DEFAULT_BITRATE=100000 };
|
enum { DEFAULT_BITRATE=100000 };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int msg_type;
|
int msg_type;
|
||||||
char msg_data[16];
|
char msg_data[16];
|
||||||
|
@ -59,11 +60,12 @@ protected:
|
||||||
typedef enum { MSG_CMD=1, MSG_DATA_WATCH, MSG_DATA_EVENT } MsgType;
|
typedef enum { MSG_CMD=1, MSG_DATA_WATCH, MSG_DATA_EVENT } MsgType;
|
||||||
typedef enum { CMD_NONE=0, CMD_PAUSE, CMD_PLAY, CMD_STOP, CMD_FASTFWD, CMD_SLOWFWD, CMD_SLOWREV, CMD_FASTREV, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_PAN, CMD_SCALE, CMD_PREV, CMD_NEXT, CMD_SEEK, CMD_VARPLAY, CMD_GET_IMAGE, CMD_QUERY=99 } MsgCommand;
|
typedef enum { CMD_NONE=0, CMD_PAUSE, CMD_PLAY, CMD_STOP, CMD_FASTFWD, CMD_SLOWFWD, CMD_SLOWREV, CMD_FASTREV, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_PAN, CMD_SCALE, CMD_PREV, CMD_NEXT, CMD_SEEK, CMD_VARPLAY, CMD_GET_IMAGE, CMD_QUERY=99 } MsgCommand;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Monitor *monitor;
|
Monitor *monitor;
|
||||||
|
|
||||||
StreamType type;
|
StreamType type;
|
||||||
const char *format;
|
StreamMode mode;
|
||||||
|
const char *format; // used to pass to ffmpeg libs
|
||||||
int replay_rate;
|
int replay_rate;
|
||||||
int scale;
|
int scale;
|
||||||
int zoom;
|
int zoom;
|
||||||
|
@ -71,7 +73,7 @@ protected:
|
||||||
int bitrate;
|
int bitrate;
|
||||||
unsigned short x, y;
|
unsigned short x, y;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int connkey;
|
int connkey;
|
||||||
int sd;
|
int sd;
|
||||||
char loc_sock_path[PATH_MAX];
|
char loc_sock_path[PATH_MAX];
|
||||||
|
@ -79,7 +81,7 @@ protected:
|
||||||
char rem_sock_path[PATH_MAX];
|
char rem_sock_path[PATH_MAX];
|
||||||
struct sockaddr_un rem_addr;
|
struct sockaddr_un rem_addr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool paused;
|
bool paused;
|
||||||
int step;
|
int step;
|
||||||
|
|
||||||
|
@ -98,7 +100,7 @@ protected:
|
||||||
|
|
||||||
CmdMsg msg;
|
CmdMsg msg;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool loadMonitor( int monitor_id );
|
bool loadMonitor( int monitor_id );
|
||||||
bool checkInitialised();
|
bool checkInitialised();
|
||||||
void updateFrameRate( double fps );
|
void updateFrameRate( double fps );
|
||||||
|
@ -107,12 +109,13 @@ protected:
|
||||||
bool checkCommandQueue();
|
bool checkCommandQueue();
|
||||||
virtual void processCommand( const CmdMsg *msg )=0;
|
virtual void processCommand( const CmdMsg *msg )=0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StreamBase()
|
StreamBase()
|
||||||
{
|
{
|
||||||
monitor = 0;
|
monitor = 0;
|
||||||
|
|
||||||
type = DEFAULT_TYPE;
|
type = DEFAULT_TYPE;
|
||||||
|
mode = STREAM;
|
||||||
format = "";
|
format = "";
|
||||||
replay_rate = DEFAULT_RATE;
|
replay_rate = DEFAULT_RATE;
|
||||||
scale = DEFAULT_SCALE;
|
scale = DEFAULT_SCALE;
|
||||||
|
@ -146,6 +149,10 @@ public:
|
||||||
{
|
{
|
||||||
type = p_type;
|
type = p_type;
|
||||||
}
|
}
|
||||||
|
void setStreamMode( StreamMode p_mode )
|
||||||
|
{
|
||||||
|
mode = p_mode;
|
||||||
|
}
|
||||||
void setStreamFormat( const char *p_format )
|
void setStreamFormat( const char *p_format )
|
||||||
{
|
{
|
||||||
format = p_format;
|
format = p_format;
|
||||||
|
|
87
src/zms.cpp
87
src/zms.cpp
|
@ -57,8 +57,9 @@ int main( int argc, const char *argv[] )
|
||||||
srand( getpid() * time( 0 ) );
|
srand( getpid() * time( 0 ) );
|
||||||
|
|
||||||
enum { ZMS_MONITOR, ZMS_EVENT } source = ZMS_MONITOR;
|
enum { ZMS_MONITOR, ZMS_EVENT } source = ZMS_MONITOR;
|
||||||
enum { ZMS_JPEG, ZMS_MPEG, ZMS_RAW, ZMS_ZIP, ZMS_SINGLE } mode = ZMS_JPEG;
|
StreamBase::StreamMode mode; // When streaming a live view or event, default to STREAM. If a frame is specified then default to SINGLE>
|
||||||
char format[32] = "";
|
StreamBase::StreamType type = StreamBase::JPEG;
|
||||||
|
char format[32] = ""; //used to specify format to ffmpeg libs
|
||||||
int monitor_id = 0;
|
int monitor_id = 0;
|
||||||
time_t event_time = 0;
|
time_t event_time = 0;
|
||||||
int event_id = 0;
|
int event_id = 0;
|
||||||
|
@ -68,7 +69,7 @@ int main( int argc, const char *argv[] )
|
||||||
double maxfps = 10.0;
|
double maxfps = 10.0;
|
||||||
unsigned int bitrate = 100000;
|
unsigned int bitrate = 100000;
|
||||||
unsigned int ttl = 0;
|
unsigned int ttl = 0;
|
||||||
EventStream::StreamMode replay = EventStream::MODE_SINGLE;
|
EventStream::StreamMode replay = EventStream::SINGLE;
|
||||||
char username[64] = "";
|
char username[64] = "";
|
||||||
char password[64] = "";
|
char password[64] = "";
|
||||||
char auth[64] = "";
|
char auth[64] = "";
|
||||||
|
@ -124,13 +125,36 @@ int main( int argc, const char *argv[] )
|
||||||
}
|
}
|
||||||
else if ( !strcmp( name, "mode" ) )
|
else if ( !strcmp( name, "mode" ) )
|
||||||
{
|
{
|
||||||
mode = !strcmp( value, "jpeg" )?ZMS_JPEG:ZMS_MPEG;
|
if ( !strcmp( value, "single" ) ) {
|
||||||
mode = !strcmp( value, "raw" )?ZMS_RAW:mode;
|
mode = StreamBase::SINGLE;
|
||||||
mode = !strcmp( value, "zip" )?ZMS_ZIP:mode;
|
} else if ( !strcmp( value, "stream" ) ) {
|
||||||
mode = !strcmp( value, "single" )?ZMS_SINGLE:mode;
|
mode = StreamBase::STREAM;
|
||||||
|
} else if ( !strcmp( value, "jpeg" ) ) {
|
||||||
|
type = StreamBase::JPEG;
|
||||||
|
// code for STREAM/SINGLE comes later.
|
||||||
|
} else if ( !strcmp( value, "raw" ) ) {
|
||||||
|
type = StreamBase::RAW;
|
||||||
|
|
||||||
|
} else if ( !strcmp( value, "zip" ) ) {
|
||||||
|
type = StreamBase::ZIP;
|
||||||
|
} else {
|
||||||
|
Warning( "Unsupported mode: (%s) defaulting to ", value );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( !strcmp( name, "format" ) )
|
else if ( !strcmp( name, "format" ) )
|
||||||
|
if ( !strcmp( value, "jpeg" ) ) {
|
||||||
|
type = StreamBase::JPEG;
|
||||||
|
} else if ( !strcmp( value, "raw" ) ) {
|
||||||
|
type = StreamBase::RAW;
|
||||||
|
} else if ( !strcmp( value, "zip" ) ) {
|
||||||
|
type = StreamBase::ZIP;
|
||||||
|
} else if ( !strcmp( value, "mpeg" ) ) {
|
||||||
|
type = StreamBase::MPEG;
|
||||||
strncpy( format, value, sizeof(format) );
|
strncpy( format, value, sizeof(format) );
|
||||||
|
} else {
|
||||||
|
Warning( "Unsupported format: (%s) defaulting to ", value );
|
||||||
|
strncpy( format, value, sizeof(format) );
|
||||||
|
}
|
||||||
else if ( !strcmp( name, "monitor" ) )
|
else if ( !strcmp( name, "monitor" ) )
|
||||||
monitor_id = atoi( value );
|
monitor_id = atoi( value );
|
||||||
else if ( !strcmp( name, "time" ) )
|
else if ( !strcmp( name, "time" ) )
|
||||||
|
@ -151,8 +175,8 @@ int main( int argc, const char *argv[] )
|
||||||
ttl = atoi(value);
|
ttl = atoi(value);
|
||||||
else if ( !strcmp( name, "replay" ) )
|
else if ( !strcmp( name, "replay" ) )
|
||||||
{
|
{
|
||||||
replay = !strcmp( value, "gapless" )?EventStream::MODE_ALL_GAPLESS:EventStream::MODE_SINGLE;
|
replay = !strcmp( value, "gapless" )?StreamBase::ALL_GAPLESS:StreamBase::SINGLE;
|
||||||
replay = !strcmp( value, "all" )?EventStream::MODE_ALL:replay;
|
replay = !strcmp( value, "all" )?StreamBase::ALL:replay;
|
||||||
}
|
}
|
||||||
else if ( !strcmp( name, "connkey" ) )
|
else if ( !strcmp( name, "connkey" ) )
|
||||||
connkey = atoi(value);
|
connkey = atoi(value);
|
||||||
|
@ -230,6 +254,19 @@ int main( int argc, const char *argv[] )
|
||||||
ValidateAccess( user, monitor_id );
|
ValidateAccess( user, monitor_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! mode ) {
|
||||||
|
if ( source == ZMS_MONITOR ) {
|
||||||
|
mode = StreamBase::STREAM;
|
||||||
|
} else {
|
||||||
|
// when getting from an event, if a frame_id is specified, then default to single, otherwise stream
|
||||||
|
if ( frame_id ) {
|
||||||
|
mode = StreamBase::SINGLE;
|
||||||
|
} else {
|
||||||
|
mode = StreamBase::STREAM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setbuf( stdout, 0 );
|
setbuf( stdout, 0 );
|
||||||
if ( nph )
|
if ( nph )
|
||||||
{
|
{
|
||||||
|
@ -269,28 +306,15 @@ int main( int argc, const char *argv[] )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mode == ZMS_JPEG )
|
stream.setStreamMode( mode );
|
||||||
{
|
stream.setStreamType( type );
|
||||||
stream.setStreamType( MonitorStream::STREAM_JPEG );
|
|
||||||
}
|
if ( type == StreamBase::MPEG )
|
||||||
else if ( mode == ZMS_RAW )
|
|
||||||
{
|
|
||||||
stream.setStreamType( MonitorStream::STREAM_RAW );
|
|
||||||
}
|
|
||||||
else if ( mode == ZMS_ZIP )
|
|
||||||
{
|
|
||||||
stream.setStreamType( MonitorStream::STREAM_ZIP );
|
|
||||||
}
|
|
||||||
else if ( mode == ZMS_SINGLE )
|
|
||||||
{
|
|
||||||
stream.setStreamType( MonitorStream::STREAM_SINGLE );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
stream.setStreamFormat( format );
|
stream.setStreamFormat( format );
|
||||||
stream.setStreamBitrate( bitrate );
|
stream.setStreamBitrate( bitrate );
|
||||||
stream.setStreamType( MonitorStream::STREAM_MPEG );
|
stream.setStreamType( type );
|
||||||
#else // HAVE_LIBAVCODEC
|
#else // HAVE_LIBAVCODEC
|
||||||
Error( "MPEG streaming of '%s' attempted while disabled", query );
|
Error( "MPEG streaming of '%s' attempted while disabled", query );
|
||||||
fprintf( stderr, "MPEG streaming is disabled.\nYou should configure with the --with-ffmpeg option and rebuild to use this functionality.\n" );
|
fprintf( stderr, "MPEG streaming is disabled.\nYou should configure with the --with-ffmpeg option and rebuild to use this functionality.\n" );
|
||||||
|
@ -317,16 +341,13 @@ int main( int argc, const char *argv[] )
|
||||||
{
|
{
|
||||||
stream.setStreamStart( event_id, frame_id );
|
stream.setStreamStart( event_id, frame_id );
|
||||||
}
|
}
|
||||||
if ( mode == ZMS_JPEG )
|
stream.setStreamMode( mode );
|
||||||
{
|
stream.setStreamType( type );
|
||||||
stream.setStreamType( EventStream::STREAM_JPEG );
|
if ( type == StreamBase::MPEG )
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
stream.setStreamFormat( format );
|
stream.setStreamFormat( format );
|
||||||
stream.setStreamBitrate( bitrate );
|
stream.setStreamBitrate( bitrate );
|
||||||
stream.setStreamType( EventStream::STREAM_MPEG );
|
|
||||||
#else // HAVE_LIBAVCODEC
|
#else // HAVE_LIBAVCODEC
|
||||||
Error( "MPEG streaming of '%s' attempted while disabled", query );
|
Error( "MPEG streaming of '%s' attempted while disabled", query );
|
||||||
fprintf( stderr, "MPEG streaming is disabled.\nYou should ensure the ffmpeg libraries are installed and detected and rebuild to use this functionality.\n" );
|
fprintf( stderr, "MPEG streaming is disabled.\nYou should ensure the ffmpeg libraries are installed and detected and rebuild to use this functionality.\n" );
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
zmstreamer - eyeZM video streamer
|
zmstreamer - eyeZM video streamer
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
zmstreamer -e <mode>
|
zmstreamer -e <mode>
|
||||||
zmstreamer -o <format>
|
zmstreamer -o <format>
|
||||||
|
@ -40,15 +40,15 @@ zmstreamer - eyeZM video streamer
|
||||||
zmstreamer -h
|
zmstreamer -h
|
||||||
zmstreamer -v
|
zmstreamer -v
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
*DEPRECIATED* The xml skin and all files associated with the xml skin are now
|
*DEPRECIATED* The xml skin and all files associated with the xml skin are now
|
||||||
depreciated. Please use the ZoneMinder API instead.
|
depreciated. Please use the ZoneMinder API instead.
|
||||||
|
|
||||||
This binary works in conjunction with the XML skin to stream video to iPhones
|
This binary works in conjunction with the XML skin to stream video to iPhones
|
||||||
running the eyeZm app.
|
running the eyeZm app.
|
||||||
|
|
||||||
=head1 OPTIONS
|
=head1 OPTIONS
|
||||||
|
|
||||||
-e <mode> - Specify output mode: mpeg/jpg/zip/single/raw.
|
-e <mode> - Specify output mode: mpeg/jpg/zip/single/raw.
|
||||||
-o <format> - Specify output format.
|
-o <format> - Specify output format.
|
||||||
|
@ -61,9 +61,9 @@ running the eyeZm app.
|
||||||
-i, -?, -h - Display usage information
|
-i, -?, -h - Display usage information
|
||||||
-v - Print the installed version of ZoneMinder
|
-v - Print the installed version of ZoneMinder
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -155,24 +155,28 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
// Set stream type
|
// Set stream type
|
||||||
StreamBase::StreamType streamtype;
|
StreamBase::StreamType streamtype;
|
||||||
|
StreamBase::StreamMode streammode = StreamBase::STREAM;
|
||||||
|
|
||||||
if (!strcasecmp("raw", mode))
|
if (!strcasecmp("raw", mode))
|
||||||
streamtype = MonitorStream::STREAM_RAW;
|
streamtype = StreamBase::RAW;
|
||||||
else if (!strcasecmp("mpeg", mode))
|
else if (!strcasecmp("mpeg", mode))
|
||||||
streamtype = MonitorStream::STREAM_MPEG;
|
streamtype = StreamBase::MPEG;
|
||||||
else if (!strcasecmp("jpg", mode))
|
else if (!strcasecmp("jpg", mode))
|
||||||
streamtype = MonitorStream::STREAM_JPEG;
|
streamtype = StreamBase::JPEG;
|
||||||
else if (!strcasecmp("single", mode))
|
else if (!strcasecmp("single", mode))
|
||||||
streamtype = MonitorStream::STREAM_SINGLE;
|
streammode = StreamBase::SINGLE;
|
||||||
else if (!strcasecmp("zip", mode))
|
else if (!strcasecmp("zip", mode))
|
||||||
streamtype = MonitorStream::STREAM_ZIP;
|
streamtype = StreamBase::ZIP;
|
||||||
|
else if (!strcasecmp("mpeg", mode))
|
||||||
|
streamtype = StreamBase::MPEG;
|
||||||
else
|
else
|
||||||
streamtype = MonitorStream::STREAM_MPEG;
|
streamtype = StreamBase::MPEG;
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
// Show stream parameters
|
// Show stream parameters
|
||||||
printf("Stream parameters:\n");
|
printf("Stream parameters:\n");
|
||||||
switch (streamtype) {
|
switch (streamtype) {
|
||||||
case MonitorStream::STREAM_MPEG:
|
case StreamBase::MPEG:
|
||||||
printf("Output mode (-e) = %s\n", "mpeg");
|
printf("Output mode (-e) = %s\n", "mpeg");
|
||||||
printf("Output format (-o) = %s\n", format);
|
printf("Output format (-o) = %s\n", format);
|
||||||
break;
|
break;
|
||||||
|
@ -213,7 +217,7 @@ int main(int argc, char** argv) {
|
||||||
stream.setStreamBuffer(buffer); // default = 0 (buffer)
|
stream.setStreamBuffer(buffer); // default = 0 (buffer)
|
||||||
stream.setStreamStart(id); // default = 0 (monitor_id)
|
stream.setStreamStart(id); // default = 0 (monitor_id)
|
||||||
stream.setStreamType(streamtype);
|
stream.setStreamType(streamtype);
|
||||||
if (streamtype == MonitorStream::STREAM_MPEG) {
|
if (streamtype == StreamBase::MPEG) {
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
if (debug) printf("HAVE_LIBAVCODEC is set\n");
|
if (debug) printf("HAVE_LIBAVCODEC is set\n");
|
||||||
stream.setStreamFormat(format); // default = "" (format)
|
stream.setStreamFormat(format); // default = "" (format)
|
||||||
|
|
|
@ -222,12 +222,12 @@
|
||||||
/**
|
/**
|
||||||
* A random string used in security hashing methods.
|
* A random string used in security hashing methods.
|
||||||
*/
|
*/
|
||||||
Configure::write('Security.salt', 'Q0MjGG2xRQEhJVQR85WhFJKI7f2St8RYMlVR7GNQ');
|
Configure::write('Security.salt', 'dhvuDdqOdgzivhu3Cr1pTAzt0z27NygqxSu7NiYw');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A random numeric string (digits only) used to encrypt/decrypt strings.
|
* A random numeric string (digits only) used to encrypt/decrypt strings.
|
||||||
*/
|
*/
|
||||||
Configure::write('Security.cipherSeed', '02670120062639232092038865362');
|
Configure::write('Security.cipherSeed', '38170258349803886784814175156');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply timestamps with the last modified time to static assets (js, css, images).
|
* Apply timestamps with the last modified time to static assets (js, css, images).
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e22c1563a51d86aac0d5054beee28b4afb60c802
|
Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5
|
Loading…
Reference in New Issue