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
|
|
|
|
|
2021-02-04 11:47:28 +08:00
|
|
|
#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);
|
2021-02-22 21:15:36 +08:00
|
|
|
void processCommand(const CmdMsg *msg) override;
|
2020-07-25 03:27:05 +08:00
|
|
|
void SingleImage(int scale=100);
|
|
|
|
void SingleImageRaw(int scale=100);
|
2019-05-03 21:04:31 +08:00
|
|
|
#ifdef HAVE_ZLIB_H
|
2020-07-25 03:27:05 +08:00
|
|
|
void SingleImageZip(int scale=100);
|
2019-05-03 21:04:31 +08:00
|
|
|
#endif
|
2017-04-11 09:57:31 +08:00
|
|
|
|
|
|
|
public:
|
2018-04-12 23:29:35 +08:00
|
|
|
MonitorStream() :
|
2021-01-16 03:43:07 +08:00
|
|
|
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
|
|
|
}
|
2020-11-02 06:15:17 +08:00
|
|
|
void runStream() override;
|
2017-04-11 09:57:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ZM_MONITORSTREAM_H
|