Fix FILE Monitor type.

pull/3646/head
Isaac Connor 2022-12-08 15:33:57 -05:00
parent 9024b57171
commit 0390d0e6f4
2 changed files with 15 additions and 0 deletions

View File

@ -69,6 +69,12 @@ void FileCamera::Initialise() {
void FileCamera::Terminate() {
}
int FileCamera::PrimeCapture() {
getVideoStream();
Info("Priming capture from %s", path.c_str());
return 1;
}
int FileCamera::PreCapture() {
struct stat statbuf = {};
if (stat(path.c_str(), &statbuf) < 0) {
@ -87,6 +93,13 @@ int FileCamera::PreCapture() {
}
int FileCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
if (!zm_packet->image) {
zm_packet->image = new Image(width, height, colours, subpixelorder);
}
zm_packet->keyframe = 1;
zm_packet->codec_type = AVMEDIA_TYPE_VIDEO;
zm_packet->packet->stream_index = mVideoStreamId;
zm_packet->stream = mVideoStream;
return zm_packet->image->ReadJpeg(path, colours, subpixelorder) ? 1 : -1;
}

View File

@ -43,6 +43,8 @@ class FileCamera : public Camera {
void Initialise();
void Terminate();
int PrimeCapture() override;
int PreCapture() override;
int Capture(std::shared_ptr<ZMPacket> &p) override;
int PostCapture() override;