zoneminder/src/zm_monitorstream.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.3 KiB
C
Raw Normal View History

2017-04-11 09:57:31 +08:00
//
// ZoneMinder MonitorStream Class Interfaces, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
#ifndef ZM_MONITORSTREAM_H
#define ZM_MONITORSTREAM_H
#include "zm_stream.h"
#include <sys/time.h>
2017-04-11 09:57:31 +08:00
class MonitorStream : public StreamBase {
protected:
typedef struct SwapImage {
bool valid;
struct timeval timestamp;
char file_name[PATH_MAX];
} SwapImage;
private:
SwapImage *temp_image_buffer;
int temp_image_buffer_count;
int temp_read_index;
int temp_write_index;
protected:
time_t ttl;
int playback_buffer;
bool delayed;
int frame_count;
protected:
2020-07-25 03:27:05 +08:00
bool checkSwapPath(const char *path, bool create_path);
bool sendFrame(const char *filepath, struct timeval *timestamp);
bool sendFrame(Image *image, struct timeval *timestamp);
void processCommand(const CmdMsg *msg) override;
2020-07-25 03:27:05 +08:00
void SingleImage(int scale=100);
void SingleImageRaw(int scale=100);
#ifdef HAVE_ZLIB_H
2020-07-25 03:27:05 +08:00
void SingleImageZip(int scale=100);
#endif
2017-04-11 09:57:31 +08:00
public:
2018-04-12 23:29:35 +08:00
MonitorStream() :
temp_image_buffer(nullptr),
temp_image_buffer_count(0),
temp_read_index(0),
temp_write_index(0),
ttl(0),
playback_buffer(0),
delayed(false),
frame_count(0) {
2017-04-11 09:57:31 +08:00
}
2020-07-25 03:27:05 +08:00
void setStreamBuffer(int p_playback_buffer) {
2017-04-11 09:57:31 +08:00
playback_buffer = p_playback_buffer;
}
2020-07-25 03:27:05 +08:00
void setStreamTTL(time_t p_ttl) {
2017-04-11 09:57:31 +08:00
ttl = p_ttl;
}
2020-07-25 03:27:05 +08:00
bool setStreamStart(int monitor_id) {
return loadMonitor(monitor_id);
2017-04-11 09:57:31 +08:00
}
void runStream() override;
2017-04-11 09:57:31 +08:00
};
#endif // ZM_MONITORSTREAM_H