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 <set>
6 
7 #include "stream_parser.h"
8 
9 #include <nx/sdk/analytics/helpers/consuming_device_agent.h>
10 #include <nx/sdk/analytics/i_object_metadata_packet.h>
11 
12 #include <nx/kit/json.h>
13 
14 namespace nx {
15 namespace vms_server_plugins {
16 namespace analytics {
17 namespace stub {
18 namespace object_streamer {
19 
21 {
22 public:
23  DeviceAgent(const nx::sdk::IDeviceInfo* deviceInfo, std::string pluginHomeDir);
24  virtual ~DeviceAgent() override;
25 
26 protected:
27  virtual std::string manifestString() const override;
28 
29  virtual bool pushCompressedVideoFrame(
30  const nx::sdk::analytics::ICompressedVideoPacket* videoFrame) override;
31 
32  virtual void doSetNeededMetadataTypes(
33  nx::sdk::Result<void>* outValue,
34  const nx::sdk::analytics::IMetadataTypes* neededMetadataTypes) override;
35 
37 
38 private:
39  std::vector<nx::sdk::Ptr<nx::sdk::analytics::IMetadataPacket>> generateMetadata(
40  int frameNumber,
41  int64_t frameTimestampUs,
42  int64_t durationUs);
43 
44  nx::sdk::Uuid obtainObjectTrackIdFromRef(const std::string& objectTrackIdRef);
45 
46  sdk::Ptr<sdk::ISettingsResponse> makeSettingsResponse(
47  const std::string& manifestFilePath,
48  const std::string& streamFilePath) const;
49 
50  void reportIssues(const Issues& issues) const;
51 
52 private:
53  StreamInfo m_streamInfo;
54  std::set<std::string> m_disabledObjectTypeIds;
55  int m_frameNumber = 0;
56  int m_maxFrameNumber = 0;
57  std::map<std::string, nx::sdk::Uuid> m_trackIdByRef;
58 
59  int64_t m_lastFrameTimestampUs = -1;
60  std::string m_pluginHomeDir;
61  bool m_isInitialSettings = true;
62 };
63 
64 } // namespace object_streamer
65 } // namespace stub
66 } // namespace analytics
67 } // namespace vms_server_plugins
68 } // namespace nx
virtual nx::sdk::Result< const nx::sdk::ISettingsResponse * > settingsReceived() override
Definition: device_agent.cpp:177
Definition: i_compressed_video_packet.h:34
Definition: ptr.h:18
Definition: consuming_device_agent.h:38
Definition: i_metadata_types.h:13
Definition: result.h:81
Definition: uuid.h:22
Definition: i_device_info.h:14
Definition: result.h:47
Definition: apple_utils.h:6
virtual bool pushCompressedVideoFrame(const nx::sdk::analytics::ICompressedVideoPacket *videoFrame) override
Definition: device_agent.cpp:49