Zao SDK for Jetson / libzep API リファレンス  1.0.0.0 (2023-05-08)
NvSourceInterface.hpp
1 #ifndef ZEP_VIDEO_NV_SOURCE_INTERFACE_HPP_
2 #define ZEP_VIDEO_NV_SOURCE_INTERFACE_HPP_
3 
4 #include <future>
5 #include <memory>
6 #include <vector>
7 
8 #include "../SourceStreamInterface.hpp"
9 #include "../StreamInterface.hpp"
10 #include "../TimestampInterface.hpp"
11 #include "NvBufferInterface.hpp"
12 #include "VideoFormat.hpp"
13 
14 // 前方宣言
15 struct v4l2_buffer;
16 class NvBuffer;
17 namespace v4l2 {
18 struct VideoFormat;
19 }
20 
21 namespace zep {
22 namespace video {
23 
24 class NvSourceCallbackInterface;
25 
30  public:
36  virtual void SetAcceptableFormats(
37  const std::vector<VideoFormat>& formats) = 0;
38 
46  virtual bool GetDecidedFormat(VideoFormat& format) const noexcept = 0;
47 
56  virtual std::shared_future<VideoFormat> GetFormatDecisionStatus()
57  const noexcept = 0;
58 
59  virtual std::unique_ptr<NvBufferInterface> DequeueBuffer() = 0;
60  virtual bool QueueBuffer(std::unique_ptr<NvBufferInterface> buffer) = 0;
61 
66  virtual void SendStatistics(/*TODO*/) = 0;
67 
77  virtual void RegisterCallback(
78  const std::shared_ptr<NvSourceCallbackInterface>& listener,
79  bool use_weak_ptr = false) = 0;
80 
89  virtual void RegisterCallback(
90  std::unique_ptr<NvSourceCallbackInterface>&& listener) = 0;
91 
92  virtual ~NvSourceInterface() noexcept = default;
93 };
94 
101  public:
105  enum class EventType {
107  kUnknown = 0,
108 
110  kDisconnected,
111 
113  kUnlinked,
114 
116  kFailedFormatNegotiation,
117  };
118 
128  virtual bool OnRequestSourceFormat(const VideoFormat& format) = 0;
129 
136  virtual void OnNotifySourceEvent(EventType type, const std::string& message) {
137  }
138 
139  virtual ~NvSourceCallbackInterface() noexcept = default;
140 };
141 
142 } // namespace video
143 } // namespace zep
144 
145 #endif // ZEP_VIDEO_NV_SOURCE_INTERFACE_HPP_
ソース側ストリーム機能インターフェース
Definition: SourceStreamInterface.hpp:9
ZEP SDK用名前空間
Definition: FactoryInterface.hpp:10
Definition: NvSourceInterface.hpp:17
エンドポイント側のストリーム機能インターフェース
Definition: StreamInterface.hpp:13
virtual void OnNotifySourceEvent(EventType type, const std::string &message)
エラーなどのイベントが発生した時に呼び出されるコールバック。
Definition: NvSourceInterface.hpp:136
映像のフォーマット情報
Definition: VideoFormat.hpp:15
ソース側ストリーム機能の共通コールバックインターフェース
Definition: SourceStreamInterface.hpp:25
EventType
イベントの種類
Definition: NvSourceInterface.hpp:105
NVIDIA Multimedia APIを利用した映像ソース機能インターフェース
Definition: NvSourceInterface.hpp:29
ストリーム機能の共通コールバックインターフェース
Definition: StreamInterface.hpp:29
NVIDIA Multimedia APIを利用した映像ソース機能の コールバックインターフェース
Definition: NvSourceInterface.hpp:99