Implement new zms parameters frames= which is the # of frames to send when in streaming mode. The idea is to replicate single mode, but allowing for other intermediate images, like Waiting for Connection etc. type=single should only ever send 1 single image.

pull/3804/head
Isaac Connor 2024-01-04 11:37:49 -05:00
parent 6f40293e93
commit 8617c09f16
3 changed files with 10 additions and 0 deletions

View File

@ -846,6 +846,9 @@ void MonitorStream::runStream() {
static_cast<int64>(std::chrono::duration_cast<Microseconds>(ttl).count()));
break;
}
if (frames_to_send > 0 && frame_count >= frames_to_send) {
break;
}
} // end while ! zm_terminate
if (buffered_playback) {

View File

@ -139,6 +139,7 @@ protected:
int last_frame_count; // Used in calculating actual_fps from frame_count - last_frame_count
int frame_mod;
int frames_to_send;
TimePoint last_frame_sent;
SystemTimePoint last_frame_timestamp;
@ -192,6 +193,7 @@ public:
frame_count(0),
last_frame_count(0),
frame_mod(1),
frames_to_send(-1),
got_command(false),
temp_img_buffer(nullptr),
temp_img_buffer_size(0)
@ -241,6 +243,7 @@ public:
void setStreamQueue(int p_connkey) {
connkey = p_connkey;
}
void setFramesToSend(int p_frames_to_send) { frames_to_send = p_frames_to_send; }
bool sendTextFrame(const char *text);
virtual void openComms();
virtual void closeComms();

View File

@ -60,6 +60,7 @@ int main(int argc, const char *argv[], char **envp) {
time_t event_time = 0;
uint64_t event_id = 0;
unsigned int frame_id = 1;
int frames_to_send = -1;
unsigned int scale = 100;
unsigned int rate = 100;
double maxfps = 10.0;
@ -152,6 +153,8 @@ int main(int argc, const char *argv[], char **envp) {
} else if ( !strcmp(name, "frame") ) {
frame_id = strtoull(value, nullptr, 10);
source = ZMS_EVENT;
} else if ( !strcmp(name, "frames") ) {
frames_to_send = strtoll(value, nullptr, 10);
} else if ( !strcmp(name, "scale") ) {
scale = atoi(value);
} else if ( !strcmp(name, "rate") ) {
@ -279,6 +282,7 @@ int main(int argc, const char *argv[], char **envp) {
stream.setStreamTTL(ttl);
stream.setStreamQueue(connkey);
stream.setStreamBuffer(playback_buffer);
stream.setFramesToSend(frames_to_send);
stream.setStreamStart(monitor_id);
stream.setStreamFrameType(analysis_frames ? StreamBase::FRAME_ANALYSIS: StreamBase::FRAME_NORMAL);