AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <FFmpegDecoder.h>
Public Member Functions | |
bool | shouldInterruptFFmpeg () |
DecoderInterface method overrides. | |
std::pair< Status, size_t > | read (Byte *buffer, size_t size) override |
void | abort () override |
Public Member Functions inherited from alexaClientSDK::mediaPlayer::android::DecoderInterface | |
virtual | ~DecoderInterface ()=default |
Static Public Member Functions | |
static std::unique_ptr< FFmpegDecoder > | create (std::unique_ptr< FFmpegInputControllerInterface > inputController, const PlaybackConfiguration &outputConfig, const avsCommon::utils::mediaPlayer::SourceConfig &config=avsCommon::utils::mediaPlayer::emptySourceConfig()) |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const DecodingState state) |
Friend relationship to allow accessing State to convert it to a string for logging. More... | |
Additional Inherited Members | |
Public Types inherited from alexaClientSDK::mediaPlayer::android::DecoderInterface | |
enum | Status { Status::OK, Status::DONE, Status::ERROR } |
Represent the decoder read status. More... | |
using | Byte = uint8_t |
Represents one byte of data. More... | |
Class responsible for decoding and re-sampling the audio from an input controller.
The decoding is performed on demand. Every time the read
method is called, the decoder will read the input, and decode it until the provided buffer is full.
Decoding is done when the DecodingState
is equal to DONE or INVALID.
abort()
method.
|
overridevirtual |
Abort the decoding process.
This method can be called in parallel with read
. The read
will fail in this case. Future reads will also fail.
Implements alexaClientSDK::mediaPlayer::android::DecoderInterface.
|
static |
Creates a new decoder buffer queue that reads input data using the given controller.
inputController | The controller used to retrieve input data. |
outputConfig | The decoder output configuration. |
nullptr
otherwise.
|
overridevirtual |
Fill buffer with decoded audio data.
[out] | Buffer | where the data will be copied to. |
size | The buffer size in number of bytes. |
Implements alexaClientSDK::mediaPlayer::android::DecoderInterface.
bool alexaClientSDK::mediaPlayer::android::FFmpegDecoder::shouldInterruptFFmpeg | ( | ) |
Callback function used by FFmpeg to check when a blocking operation should be interrupted.
We interrupt FFmpeg in two different scenarios:
FFmpegDecoder
state is INVALID
(usually due to a call to abort
).EAGAIN
as expected. If an EAGAIN
occurs during avformat_find_stream_info
, the method gets stuck. Thus, this method will interrupt FFmpeg if initialization is taking too long.true
if FFmpeg should be interrupted; false otherwise.
|
friend |
Friend relationship to allow accessing State to convert it to a string for logging.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0