Zao SDK for Jetson / libzep API Reference
Loading...
Searching...
No Matches
PcmSourceInterface.hpp
1/*
2 * Copyright (c) 2022-2023, Soliton Systems K.K. All rights reserved.
3 * Use in source and binary forms, with or without modification,
4 * is permitted provided that the following a condition is met:
5 *
6 * Use is permitted only in accordance with the terms and
7 * conditions set forth in the Software License Agreement available
8 * at https://zao-sdk.org/license-agreement/.
9 */
10#ifndef ZEP_AUDIO_PCM_SOURCE_INTERFACE_HPP_
11#define ZEP_AUDIO_PCM_SOURCE_INTERFACE_HPP_
12
13#include <future>
14#include <memory>
15#include <string>
16#include <vector>
17#include <zep/audio/PcmBufferWriter.hpp>
18
19#include "../SourceStreamInterface.hpp"
20#include "../StreamInterface.hpp"
21#include "PcmFormat.hpp"
22
23namespace zep {
24
25class TimestampInterface;
26
27namespace audio {
28
29class PcmSourceCallbackInterface;
30
34class PcmSourceInterface : public StreamInterface,
35 public SourceStreamInterface {
36 public:
45 virtual void SetAcceptableFormats(const std::vector<PcmFormat>& formats) = 0;
46
54 virtual bool GetDecidedFormat(PcmFormat& format) const noexcept = 0;
55
64 virtual std::shared_future<PcmFormat> GetFormatDecisionStatus()
65 const noexcept = 0;
66
72 virtual std::weak_ptr<PcmBufferPoolWriterInterface> GetPcmBufferPool() = 0;
73
78 virtual void SendStatistics(/*TODO*/) = 0;
79
89 virtual void RegisterCallback(
90 const std::shared_ptr<PcmSourceCallbackInterface>& listener,
91 bool use_weak_ptr = false) = 0;
92
101 virtual void RegisterCallback(
102 std::unique_ptr<PcmSourceCallbackInterface>&& listener) = 0;
103
104 virtual ~PcmSourceInterface() noexcept = default;
105};
106
112 public:
116 enum class EventType {
118 kUnknown = 0,
119
121 kDisconnected,
122
124 kUnlinked,
125
127 kEncodeError,
128
130 kFailedFormatNegotiation,
131 };
132
142 virtual bool OnRequestSourceFormat(const PcmFormat& format) = 0;
143
155 virtual void OnDecideSourceFormat(const PcmFormat* format) = 0;
156
163 virtual void OnNotifySourceEvent(EventType type, const std::string& message) {
164 }
165
166 virtual ~PcmSourceCallbackInterface() noexcept = default;
167};
168
169} // namespace audio
170} // namespace zep
171
172#endif // ZEP_AUDIO_PCM_SOURCE_INTERFACE_HPP_
Common callback interface for source-side stream functions.
Definition SourceStreamInterface.hpp:34
Common callback interface for stream functions.
Definition StreamInterface.hpp:38
PCM buffer pool writer interface.
Definition PcmBufferPoolWriterInterface.hpp:21
PCM audio format.
Definition PcmFormat.hpp:22
Callback interface for voice source functionality with PCM.
Definition PcmSourceInterface.hpp:110
EventType
Event Type.
Definition PcmSourceInterface.hpp:115
virtual bool OnRequestSourceFormat(const PcmFormat &format)=0
フォーマット決定要求時に呼び出されるコールバック。
virtual void OnNotifySourceEvent(EventType type, const std::string &message)
エラーなどのイベントが発生した時に呼び出されるコールバック。
Definition PcmSourceInterface.hpp:163
virtual void OnDecideSourceFormat(const PcmFormat *format)=0
フォーマットが決定された時に呼び出されるコールバック。
Audio source function interface with PCM.
Definition PcmSourceInterface.hpp:35
virtual std::shared_future< PcmFormat > GetFormatDecisionStatus() const noexcept=0
フォーマット決定状態を取得するshared_futureを取得する。
virtual void SetAcceptableFormats(const std::vector< PcmFormat > &formats)=0
送信可能なフォーマット一覧を提示する。
virtual void SendStatistics()=0
Sending statistics.
virtual bool GetDecidedFormat(PcmFormat &format) const noexcept=0
決定したフォーマットを取得する。
virtual std::weak_ptr< PcmBufferPoolWriterInterface > GetPcmBufferPool()=0
Get the write side interface of the PCM buffer pool.
Namespace for ZEP SDK.
Definition FactoryInterface.hpp:19