SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
frame_with_timestamp_recorder.hpp
1
2// frame_with_timestamp_recorder.hpp
3// Created by greg on 2/19/25.
4// Copyright (C) 2025 Presage Security, Inc.
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 3 of the License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this program; if not, write to the Free Software Foundation,
18// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21// === standard library includes (if any) ===
22#include <condition_variable>
23// === third-party includes (if any) ===
24#include <grpc/grpc.h>
25#include <grpcpp/grpcpp.h>
26#include <grpcpp/impl/codegen/server_callback.h>
27#include <physiology/modules/rpc.h>
28// === local includes (if any) ===
29#include <smartspectra/cpp/physiology_service.pb.h>
30#include <smartspectra/container/background_container.hpp>
31#include <smartspectra/video_source/input_transformer.hpp>
32#include "reactor_with_wait_until_done.hpp"
33
34#pragma once
35namespace presage::smartspectra::grpc_bindings {
36template<container::settings::IntegrationMode TIntegrationMode>
37class FrameWithTimestampRecorder
38 : public ReactorWithWaitUntilDone<grpc::ServerReadReactor<presage::smartspectra::FrameWithTimestamp>> {
39public:
40 using BackgroundContainer =
42 presage::platform_independence::DeviceType::Cpu,
43 smartspectra::container::settings::OperationMode::Continuous,
44 TIntegrationMode
45 >;
46
47 FrameWithTimestampRecorder(std::shared_ptr<BackgroundContainer> container, video_source::InputTransformMode input_transform_mode);
48 void SwapContainer(std::shared_ptr<BackgroundContainer> new_container);
49 void OnReadDone(bool ok) override;
50 const BackgroundContainer* GetContainer() const { return this->container.get(); }
51private:
52 FrameWithTimestamp frame_with_timestamp;
53 std::shared_ptr<BackgroundContainer> container;
54 video_source::InputTransformer input_transformer;
55};
56} // namespace presage::smartspectra::grpc_bindings
Container for background thread processing.
Definition background_container.hpp:40
Definition reactor_with_wait_until_done.hpp:32
InputTransformMode
Transformation applied to frames prior to processing.
Definition input_transform.hpp:19