mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-27 16:58:31 -04:00
starting to rough in adding a frame to zmpacket
This commit is contained in:
1 parent
b9c57028c8
commit
b30e8953dd
6 files changed
+25
-20
No files matched your search
@@ -1,10 +1,9 @@
|
||||
#include "zm_analysis_thread.h"
|
||||
|
||||
|
||||
AnalysisThread::AnalysisThread( Monitor *p_monitor ) {
|
||||
AnalysisThread::AnalysisThread(Monitor *p_monitor) {
|
||||
monitor = p_monitor;
|
||||
terminate = false;
|
||||
sigemptyset( &block_set );
|
||||
sigemptyset(&block_set);
|
||||
}
|
||||
|
||||
AnalysisThread::~AnalysisThread() {
|
||||
@@ -16,11 +15,11 @@ int AnalysisThread::run() {
|
||||
unsigned int analysis_update_delay = monitor->GetAnalysisUpdateDelay();
|
||||
time_t last_analysis_update_time, cur_time;
|
||||
monitor->UpdateAdaptiveSkip();
|
||||
last_analysis_update_time = time( 0 );
|
||||
last_analysis_update_time = time(0);
|
||||
|
||||
while( !terminate ) {
|
||||
// Process the next image
|
||||
sigprocmask( SIG_BLOCK, &block_set, 0 );
|
||||
sigprocmask(SIG_BLOCK, &block_set, 0);
|
||||
|
||||
// Some periodic updates are required for variable capturing framerate
|
||||
if ( analysis_update_delay ) {
|
||||
@@ -33,12 +32,12 @@ int AnalysisThread::run() {
|
||||
}
|
||||
|
||||
if ( !monitor->Analyse() ) {
|
||||
usleep( monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE );
|
||||
usleep(monitor->Active()?ZM_SAMPLE_RATE:ZM_SUSPENDED_RATE);
|
||||
} else if ( analysis_rate ) {
|
||||
usleep( analysis_rate );
|
||||
usleep(analysis_rate);
|
||||
}
|
||||
|
||||
sigprocmask( SIG_UNBLOCK, &block_set, 0 );
|
||||
sigprocmask(SIG_UNBLOCK, &block_set, 0);
|
||||
}
|
||||
return 0;
|
||||
} // end in AnalysisThread::run()
|
||||
@@ -62,16 +62,6 @@
|
||||
#define MAP_LOCKED 0
|
||||
#endif
|
||||
|
||||
std::vector<std::string> split(const std::string &s, char delim) {
|
||||
std::vector<std::string> elems;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
while(std::getline(ss, item, delim)) {
|
||||
elems.push_back(trimSpaces(item));
|
||||
}
|
||||
return elems;
|
||||
}
|
||||
|
||||
Monitor::MonitorLink::MonitorLink( int p_id, const char *p_name ) : id( p_id ) {
|
||||
strncpy( name, p_name, sizeof(name) );
|
||||
|
||||
|
||||
@@ -44,3 +44,6 @@ ZMPacket::~ZMPacket() {
|
||||
zm_av_packet_unref( &packet );
|
||||
}
|
||||
|
||||
int ZMPacket::decode( AVCodecContext *ctx ) {
|
||||
}
|
||||
|
||||
@@ -32,9 +32,12 @@ class ZMPacket {
|
||||
public:
|
||||
|
||||
AVPacket packet;
|
||||
AVFrame *frame; // Theoretically only filled if needed.
|
||||
struct timeval timestamp;
|
||||
public:
|
||||
AVPacket *av_packet() { return &packet; }
|
||||
AVFrame *av_frame() { return frame; }
|
||||
int decode( AVCodecContext *ctx );
|
||||
ZMPacket( AVPacket *packet, struct timeval *timestamp );
|
||||
ZMPacket( AVPacket *packet );
|
||||
~ZMPacket();
|
||||
|
||||
@@ -100,6 +100,16 @@ bool startsWith( const std::string &haystack, const std::string &needle )
|
||||
return( haystack.substr( 0, needle.length() ) == needle );
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string &s, char delim) {
|
||||
std::vector<std::string> elems;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
while(std::getline(ss, item, delim)) {
|
||||
elems.push_back(trimSpaces(item));
|
||||
}
|
||||
return elems;
|
||||
}
|
||||
|
||||
StringVector split( const std::string &string, const std::string chars, int limit )
|
||||
{
|
||||
StringVector stringVector;
|
||||
|
||||
+2
-2
@@ -250,8 +250,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
Monitor::Function function = monitors[0]->GetFunction();
|
||||
if ( function == Monitor::MODECT || function == Monitor::MOCORD ) {
|
||||
Debug(1, "Starting an analysis thread for monitor (%d)", monitors[i]->Id() );
|
||||
analysis_threads[i] = new AnalysisThread( monitors[i] );
|
||||
Debug(1, "Starting an analysis thread for monitor (%d)", monitors[i]->Id());
|
||||
analysis_threads[i] = new AnalysisThread(monitors[i]);
|
||||
analysis_threads[i]->start();
|
||||
} else {
|
||||
analysis_threads[i] = NULL;
|
||||
|
||||
Reference in new issue
Block a user