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