AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
BlockAudioEncoderInterface.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDK_AUDIOENCODERINTERFACES_BLOCKAUDIOENCODERINTERFACE_H_
17 #define ACSDK_AUDIOENCODERINTERFACES_BLOCKAUDIOENCODERINTERFACE_H_
18 
19 #include <memory>
20 #include <vector>
21 
23 
24 namespace alexaClientSDK {
25 namespace audioEncoderInterfaces {
26 
58 public:
62  using Byte = unsigned char;
63 
67  using Bytes = std::vector<Byte>;
68 
82  virtual bool init(avsCommon::utils::AudioFormat inputFormat) = 0;
83 
90  virtual size_t getInputFrameSize() = 0;
91 
100  virtual size_t getOutputFrameSize() = 0;
101 
116  virtual bool requiresFullyRead() = 0;
117 
128 
137  virtual std::string getAVSFormatName() = 0;
138 
152  virtual bool start(Bytes& preamble) = 0;
153 
173  virtual bool processSamples(Bytes::const_iterator begin, Bytes::const_iterator end, Bytes& buffer) = 0;
174 
184  virtual bool flush(Bytes& buffer) = 0;
185 
191  virtual void close() = 0;
192 
196  virtual ~BlockAudioEncoderInterface() = default;
197 };
198 
199 } // namespace audioEncoderInterfaces
200 } // namespace alexaClientSDK
201 
202 #endif // ACSDK_AUDIOENCODERINTERFACES_BLOCKAUDIOENCODERINTERFACE_H_
std::vector< Byte > Bytes
Byte array data type for encoding output.
Definition: BlockAudioEncoderInterface.h:67
virtual avsCommon::utils::AudioFormat getAudioFormat()=0
Return output audio format.
virtual size_t getOutputFrameSize()=0
Provide maximum output frame size.
::std::string string
Definition: gtest-port.h:1097
virtual bool flush(Bytes &buffer)=0
Flush buffered data if any.
virtual bool init(avsCommon::utils::AudioFormat inputFormat)=0
Pre-initialize the encoder.
unsigned char Byte
Byte data type.
Definition: BlockAudioEncoderInterface.h:62
virtual bool start(Bytes &preamble)=0
Start the encoding session.
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Block audio encoder interface.
Definition: BlockAudioEncoderInterface.h:57
virtual bool processSamples(Bytes::const_iterator begin, Bytes::const_iterator end, Bytes &buffer)=0
Encode a block of audio.
virtual bool requiresFullyRead()=0
Return if input must contain full frame.
virtual std::string getAVSFormatName()=0
AVS format name for encoded audio.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0