Zao SDK for Jetson / libzep API リファレンス  1.0.0.0 (2023-05-08)
PcmSinkInterface.hpp
1 #ifndef ZEP_AUDIO_PCM_SINK_INTERFACE_HPP_
2 #define ZEP_AUDIO_PCM_SINK_INTERFACE_HPP_
3 
4 #include <future>
5 #include <memory>
6 #include <string>
7 #include <vector>
8 #include <zep/audio/PcmBufferWriter.hpp>
9 
10 #include "../SinkStreamInterface.hpp"
11 #include "../StreamInterface.hpp"
12 #include "PcmFormat.hpp"
13 
14 namespace zep {
15 namespace audio {
16 
17 class PcmSinkCallbackInterface;
18 
23  public:
32  virtual void SetAcceptableFormats(const std::vector<PcmFormat>& formats) = 0;
33 
41  virtual bool GetDecidedFormat(PcmFormat& format) const noexcept = 0;
42 
51  virtual std::shared_future<PcmFormat> GetFormatDecisionStatus()
52  const noexcept = 0;
53 
63  virtual void RegisterCallback(
64  const std::shared_ptr<PcmSinkCallbackInterface>& listener,
65  bool use_weak_ptr = false) = 0;
66 
75  virtual void RegisterCallback(
76  std::unique_ptr<PcmSinkCallbackInterface>&& listener) = 0;
77 
78  virtual ~PcmSinkInterface() noexcept = default;
79 };
80 
86  public:
90  enum class EventType {
92  kUnknown = 0,
93 
95  kDisconnected,
96 
98  kUnlinked,
99 
101  kDecodeError,
102 
104  kFailedFormatNegotiation,
105  };
106 
116  virtual bool OnRequestSinkFormat(const PcmFormat& format) = 0;
117 
124  virtual void OnNotifySinkEvent(EventType type, const std::string& message) {}
125 
130  virtual std::weak_ptr<PcmBufferPoolWriterInterface>
131  OnRequestPcmBufferPool() = 0;
132 
133  virtual ~PcmSinkCallbackInterface() noexcept = default;
134 };
135 
136 } // namespace audio
137 } // namespace zep
138 
139 #endif // ZEP_AUDIO_PCM_SINK_INTERFACE_HPP_
virtual bool GetDecidedFormat(PcmFormat &format) const noexcept=0
決定したフォーマットを取得する。
virtual void OnNotifySinkEvent(EventType type, const std::string &message)
エラーなどのイベントが発生した時に呼び出されるコールバック。
Definition: PcmSinkInterface.hpp:124
ZEP SDK用名前空間
Definition: FactoryInterface.hpp:10
エンドポイント側のストリーム機能インターフェース
Definition: StreamInterface.hpp:13
EventType
イベントの種類
Definition: PcmSinkInterface.hpp:90
PCM音声のフォーマット
Definition: PcmFormat.hpp:13
シンク側ストリーム機能の共通コールバックインターフェース
Definition: SinkStreamInterface.hpp:17
PCMによる音声シンク機能インターフェース
Definition: PcmSinkInterface.hpp:22
シンク側ストリーム機能インターフェース
Definition: SinkStreamInterface.hpp:9
virtual void RegisterCallback(const std::shared_ptr< PcmSinkCallbackInterface > &listener, bool use_weak_ptr=false)=0
コールバックの送信先をshared_ptrまたはweak_ptrで登録する
virtual void SetAcceptableFormats(const std::vector< PcmFormat > &formats)=0
受信可能なフォーマット一覧を提示する。
ストリーム機能の共通コールバックインターフェース
Definition: StreamInterface.hpp:29
PCMによる音声シンク機能のコールバックインターフェース
Definition: PcmSinkInterface.hpp:84
virtual std::shared_future< PcmFormat > GetFormatDecisionStatus() const noexcept=0
フォーマット決定状態を取得するshared_futureを取得する。