nx_server_plugin_sdk 1.0 Server Plugin SDK

stream_writer.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/cloud_storage/i_codec_info.h>
6 #include <nx/sdk/cloud_storage/i_stream_writer.h>
7 #include <nx/sdk/helpers/ref_countable.h>
8 #include <nx/sdk/i_list.h>
9 #include <nx/sdk/result.h>
10
11 #include "data_manager.h"
12
13 namespace nx::vms_server_plugins::cloud_storage::stub {
14
15 class StreamWriter: public nx::sdk::RefCountable<nx::sdk::cloud_storage::IStreamWriter>
16 {
17 public:
18 StreamWriter(
19 const std::shared_ptr<DataManager>& dataManager,
20 const std::string& deviceId,
21 int streamIndex,
22 int64_t startTimeMs,
23 const nx::sdk::IList<nx::sdk::cloud_storage::ICodecInfo>* codecList,
24 const char* opaqueMetadata);
25
26 virtual nx::sdk::ErrorCode putData(const nx::sdk::cloud_storage::IMediaDataPacket* packet) override;
27 virtual nx::sdk::ErrorCode close(int64_t durationMs) override;
28 virtual int size() const override;
29 virtual const char* locationUrl() const override;
30
31 private:
32 std::shared_ptr<DataManager> m_dataManager;
33 std::unique_ptr<WritableMediaFile> m_mediaFile;
34 };
35
36 } // namespace nx::vms_server_plugins::cloud_storage::stub
nx::vms_server_plugins::cloud_storage::stub::StreamWriter
Definition: stream_writer.h:15
nx::vms_server_plugins::cloud_storage::stub::StreamWriter::locationUrl
virtual const char * locationUrl() const override
Definition: stream_writer.cpp:30
nx::vms_server_plugins::cloud_storage::stub::StreamWriter::close
virtual nx::sdk::ErrorCode close(int64_t durationMs) override
Definition: stream_writer.cpp:49
nx::sdk::cloud_storage::IMediaDataPacket
Definition: i_media_data_packet.h:17
nx::vms_server_plugins::cloud_storage::stub
Definition: data_manager.cpp:36
nx::vms_server_plugins::cloud_storage::stub::StreamWriter::putData
virtual nx::sdk::ErrorCode putData(const nx::sdk::cloud_storage::IMediaDataPacket *packet) override
Definition: stream_writer.cpp:35
nx::vms_server_plugins::cloud_storage::stub::StreamWriter::size
virtual int size() const override
Definition: stream_writer.cpp:63
nx::sdk::IList< nx::sdk::cloud_storage::ICodecInfo >
nx::sdk::RefCountable
Definition: ref_countable.h:83