nx_metadata_sdk 1.0 Metadata SDK

device_agent.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <nx/sdk/analytics/helpers/consuming_device_agent.h>
6 #include <nx/sdk/helpers/uuid_helper.h>
7
8 #include "engine.h"
9
10 namespace nx {
11 namespace vms_server_plugins {
12 namespace analytics {
13 namespace sample {
14
15 class DeviceAgent: public nx::sdk::analytics::ConsumingDeviceAgent
16 {
17 public:
18 DeviceAgent(const nx::sdk::IDeviceInfo* deviceInfo);
19 virtual ~DeviceAgent() override;
20
21 protected:
22 virtual std::string manifestString() const override;
23
24 virtual bool pushUncompressedVideoFrame(
25 const nx::sdk::analytics::IUncompressedVideoFrame* videoFrame) override;
26
27 virtual bool pullMetadataPackets(
28 std::vector<nx::sdk::analytics::IMetadataPacket*>* metadataPackets) override;
29
30 virtual void doSetNeededMetadataTypes(
31 nx::sdk::Result<void>* outValue,
32 const nx::sdk::analytics::IMetadataTypes* neededMetadataTypes) override;
33
34 private:
35 nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket> generateEventMetadataPacket();
36 nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket> generateObjectMetadataPacket();
37
38 private:
39 const std::string kHelloWorldObjectType = "nx.sample.helloWorld";
40 const std::string kNewTrackEventType = "nx.sample.newTrack";
41
43 static constexpr int kTrackFrameCount = 256;
44
45 private:
46 nx::sdk::Uuid m_trackId = nx::sdk::UuidHelper::randomUuid();
47 int m_frameIndex = 0;
48 int m_trackIndex = 0;
51 int64_t m_lastVideoFrameTimestampUs = 0;
52 };
53
54 } // namespace sample
55 } // namespace analytics
56 } // namespace vms_server_plugins
57 } // namespace nx
nx::vms_server_plugins::analytics::sample::DeviceAgent::manifestString
virtual std::string manifestString() const override
Definition: device_agent.cpp:38
nx::sdk::Ptr
Definition: ptr.h:18
nx::sdk::analytics::ConsumingDeviceAgent
Definition: consuming_device_agent.h:38
nx::sdk::analytics::IMetadataTypes
Definition: i_metadata_types.h:13
nx::sdk::Result< void >
Definition: result.h:81
nx::sdk::Uuid
Definition: uuid.h:22
nx::sdk::IDeviceInfo
Definition: i_device_info.h:14
nx::vms_server_plugins::analytics::sample::DeviceAgent::pushUncompressedVideoFrame
virtual bool pushUncompressedVideoFrame(const nx::sdk::analytics::IUncompressedVideoFrame *videoFrame) override
Definition: device_agent.cpp:66
nx
Definition: apple_utils.h:6
nx::vms_server_plugins::analytics::sample::DeviceAgent
Definition: device_agent.h:15
nx::vms_server_plugins::analytics::sample::DeviceAgent::DeviceAgent
DeviceAgent(const nx::sdk::IDeviceInfo *deviceInfo)
Definition: device_agent.cpp:24
nx::sdk::analytics::IUncompressedVideoFrame
Definition: i_uncompressed_video_frame.h:73