AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Classes | Typedefs | Functions | Variables
alexaClientSDK::mediaPlayer::android Namespace Reference

Namespaces

 test
 

Classes

class  AndroidSLESMediaPlayer
 
class  AndroidSLESMediaQueue
 
class  AndroidSLESSpeaker
 
class  DecoderInterface
 
class  FFmpegAttachmentInputController
 
class  FFmpegDecoder
 
class  FFmpegDeleter
 
class  FFmpegInputControllerInterface
 
class  FFmpegStreamInputController
 
class  FFmpegUrlInputController
 
class  PlaybackConfiguration
 

Typedefs

using LayoutMask = int64_t
 The layout mask representing which channels should be enabled. More...
 
using MediaPlayerState = avsCommon::utils::mediaPlayer::MediaPlayerState
 
FFMpeg FFmpegDeleter specializations.
using AVInputFormatDeleter = FFmpegDeleter< AVInputFormat >
 
using AVDictionaryDeleter = FFmpegDeleter< AVDictionary >
 
using AVContextDeleter = FFmpegDeleter< AVCodecContext >
 
using AVIOContextDeleter = FFmpegDeleter< AVIOContext >
 
using AVFormatContextDeleter = FFmpegDeleter< AVFormatContext >
 
using AVPacketDeleter = FFmpegDeleter< AVPacket >
 
using AVFrameDeleter = FFmpegDeleter< AVFrame >
 
using SwrContextDeleter = FFmpegDeleter< SwrContext >
 
using AVFilterGraphDeleter = FFmpegDeleter< AVFilterGraph >
 
using AVFilterContextDeleter = FFmpegDeleter< AVFilterContext >
 

Functions

std::ostream & operator<< (std::ostream &stream, const FFmpegInputControllerInterface::Result &result)
 
std::ostream & operator<< (std::ostream &stream, const PlaybackConfiguration::SampleFormat &format)
 
static SLuint32 convertSampleSize (PlaybackConfiguration::SampleFormat format)
 
static SLuint32 convertLayout (PlaybackConfiguration::ChannelLayout layout)
 
SLDataFormat_PCM convertFormat (const PlaybackConfiguration &playbackConfiguration)
 
void prefetchStatusCallback (SLPrefetchStatusItf caller, void *pContext, SLuint32 event)
 
static void queueCallback (SLAndroidSimpleBufferQueueItf slQueue, void *mediaQueue)
 
static AVSampleFormat convertFormat (PlaybackConfiguration::SampleFormat format)
 
static LayoutMask convertLayout (PlaybackConfiguration::ChannelLayout layout)
 
static int shouldInterrupt (void *decoderPtr)
 
std::ostream & operator<< (std::ostream &stream, const FFmpegDecoder::DecodingState state)
 

Variables

static constexpr size_t SAMPLE_RATE_HZ = 48000
 The playback audio sample rate in HZ. More...
 
static constexpr size_t NUMBER_OF_CHANNELS = 2
 The number of channels. More...
 
static constexpr size_t SAMPLE_SIZE_BITS = 16
 The playback audio sample size in bits. More...
 
static constexpr size_t SAMPLE_SIZE_BYTES = SAMPLE_SIZE_BITS / 8
 The playback audio sample size in bytes. More...
 
static constexpr int DECIBELL_TO_MILLIBELL_MULT = 100
 Multiplier to convert dB to mB. More...
 
static std::atomic< MediaPlayerInterface::SourceIdg_id {1}
 A counter used to increment the source id when a new source is set. More...
 
static SLDataLocator_AndroidSimpleBufferQueue DATA_LOCATOR
 The data locator used to configure the android media player to use a buffer queue. More...
 
constexpr AndroidSLESMediaQueue::Byte PCM_UNSIGNED_SILENCE = 0x80
 
constexpr AndroidSLESMediaQueue::Byte PCM_SIGNED_SILENCE = 0x0
 Represents the most significant byte of silence for signed samples. More...
 
const float CONVERSION_FACTOR = 20.0
 Conversion factor used to convert the avs volume level to millibel. More...
 
static const auto AVS_VOLUME_RANGE = AVS_SET_VOLUME_MAX - AVS_SET_VOLUME_MIN
 The AVS volume range. More...
 
static constexpr SLmillibel DEVICE_MAX_VOLUME = 0
 Assert that the AVS maximum volume is greater than the minimum volume. More...
 
static constexpr SLmillibel DEVICE_MIN_VOLUME = SL_MILLIBEL_MIN
 There is no predefined minimum value. Use the minimum value allowed by the SLmillibel type. More...
 
static const std::chrono::milliseconds READ_TIMEOUT {10}
 Timeout for read operations. More...
 
static constexpr int BUFFER_SIZE {4096}
 Buffers will be the size of a regular page. More...
 
static constexpr unsigned int BYTE_TO_BITS {8u}
 The size of a byte in bits. More...
 
static const int EMPTY_FLAGS = 0
 Use no special flags during av_dict_copy. More...
 
static constexpr int NO_FLAGS {0}
 Represent scenario where there is no flag enabled. More...
 
static constexpr int NO_ALIGNMENT {1}
 For av_samples_get_buffer_size we want to disable alignment to avoid empty samples (see ACSDK-1890). More...
 
static const std::chrono::milliseconds INITIALIZE_TIMEOUT {200}
 
static const int NO_ERROR = 0
 Constant representing a "no error" return value for FFmpeg callback methods. More...
 
static constexpr int BUFFER_SIZE {4096}
 Buffers will be the size of a regular page. More...
 
static const auto INVALID_DURATION = std::chrono::milliseconds(-1)
 Define invalid duration. More...
 
static const char * USER_AGENT_OPTION {"user_agent"}
 This string represents the FFmpeg HTTP User-Agent option key. More...
 
static const char * RECONNECT_OPTION {"reconnect"}
 This string represents the FFmpeg option to reconnect when the connection is dropped during streaming. More...
 
static const char * TRUE_BOOLEAN_OPTION {"1"}
 This string represents setting a boolean option to TRUE. More...
 
static constexpr int NO_FLAGS {0}
 Represent scenario where there is no flag enabled. More...
 
static const size_t DEFAULT_SAMPLE_RATE {48000}
 Default playback sample rate is 48kHz. More...
 
static const PlaybackConfiguration::ChannelLayout DEFAULT_LAYOUT {PlaybackConfiguration::ChannelLayout::LAYOUT_STEREO}
 Default channel layout is stereo. More...
 
static const PlaybackConfiguration::SampleFormat DEFAULT_SAMPLE_FORMAT {PlaybackConfiguration::SampleFormat::SIGNED_16}
 Default sample format is signed 16. More...
 

Typedef Documentation

◆ AVContextDeleter

◆ AVDictionaryDeleter

◆ AVFilterContextDeleter

◆ AVFilterGraphDeleter

◆ AVFormatContextDeleter

◆ AVFrameDeleter

◆ AVInputFormatDeleter

◆ AVIOContextDeleter

◆ AVPacketDeleter

◆ LayoutMask

The layout mask representing which channels should be enabled.

◆ MediaPlayerState

◆ SwrContextDeleter

Function Documentation

◆ convertFormat() [1/2]

static AVSampleFormat alexaClientSDK::mediaPlayer::android::convertFormat ( PlaybackConfiguration::SampleFormat  format)
static

◆ convertFormat() [2/2]

SLDataFormat_PCM alexaClientSDK::mediaPlayer::android::convertFormat ( const PlaybackConfiguration playbackConfiguration)

◆ convertLayout() [1/2]

static LayoutMask alexaClientSDK::mediaPlayer::android::convertLayout ( PlaybackConfiguration::ChannelLayout  layout)
static

◆ convertLayout() [2/2]

static SLuint32 alexaClientSDK::mediaPlayer::android::convertLayout ( PlaybackConfiguration::ChannelLayout  layout)
static

◆ convertSampleSize()

static SLuint32 alexaClientSDK::mediaPlayer::android::convertSampleSize ( PlaybackConfiguration::SampleFormat  format)
static

◆ operator<<() [1/3]

std::ostream& alexaClientSDK::mediaPlayer::android::operator<< ( std::ostream &  stream,
const FFmpegInputControllerInterface::Result result 
)
inline

Write a FFmpegInputControllerInterface::Result value to the given stream.

Parameters
streamThe stream to write the value to.
resultThe value to write to the stream as a string.
Returns
The stream that was passed in and written to.

◆ operator<<() [2/3]

std::ostream& alexaClientSDK::mediaPlayer::android::operator<< ( std::ostream &  stream,
const PlaybackConfiguration::SampleFormat format 
)
inline

◆ operator<<() [3/3]

std::ostream& alexaClientSDK::mediaPlayer::android::operator<< ( std::ostream &  stream,
const FFmpegDecoder::DecodingState  state 
)

◆ prefetchStatusCallback()

void alexaClientSDK::mediaPlayer::android::prefetchStatusCallback ( SLPrefetchStatusItf  caller,
void *  pContext,
SLuint32  event 
)

◆ queueCallback()

static void alexaClientSDK::mediaPlayer::android::queueCallback ( SLAndroidSimpleBufferQueueItf  slQueue,
void *  mediaQueue 
)
static

◆ shouldInterrupt()

static int alexaClientSDK::mediaPlayer::android::shouldInterrupt ( void *  decoderPtr)
static

Variable Documentation

◆ AVS_VOLUME_RANGE

const auto alexaClientSDK::mediaPlayer::android::AVS_VOLUME_RANGE = AVS_SET_VOLUME_MAX - AVS_SET_VOLUME_MIN
static

The AVS volume range.

◆ BUFFER_SIZE [1/2]

constexpr int alexaClientSDK::mediaPlayer::android::BUFFER_SIZE {4096}
static

Buffers will be the size of a regular page.

◆ BUFFER_SIZE [2/2]

constexpr int alexaClientSDK::mediaPlayer::android::BUFFER_SIZE {4096}
static

Buffers will be the size of a regular page.

◆ BYTE_TO_BITS

constexpr unsigned int alexaClientSDK::mediaPlayer::android::BYTE_TO_BITS {8u}
static

The size of a byte in bits.

◆ CONVERSION_FACTOR

const float alexaClientSDK::mediaPlayer::android::CONVERSION_FACTOR = 20.0

Conversion factor used to convert the avs volume level to millibel.

◆ DATA_LOCATOR

SLDataLocator_AndroidSimpleBufferQueue alexaClientSDK::mediaPlayer::android::DATA_LOCATOR
static
Initial value:
= {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE,
static const auto NUMBER_OF_BUFFERS
Definition: AndroidSLESBufferQueueTest.cpp:40

The data locator used to configure the android media player to use a buffer queue.

◆ DECIBELL_TO_MILLIBELL_MULT

constexpr int alexaClientSDK::mediaPlayer::android::DECIBELL_TO_MILLIBELL_MULT = 100
static

Multiplier to convert dB to mB.

◆ DEFAULT_LAYOUT

const PlaybackConfiguration::ChannelLayout alexaClientSDK::mediaPlayer::android::DEFAULT_LAYOUT {PlaybackConfiguration::ChannelLayout::LAYOUT_STEREO}
static

Default channel layout is stereo.

◆ DEFAULT_SAMPLE_FORMAT

const PlaybackConfiguration::SampleFormat alexaClientSDK::mediaPlayer::android::DEFAULT_SAMPLE_FORMAT {PlaybackConfiguration::SampleFormat::SIGNED_16}
static

Default sample format is signed 16.

◆ DEFAULT_SAMPLE_RATE

const size_t alexaClientSDK::mediaPlayer::android::DEFAULT_SAMPLE_RATE {48000}
static

Default playback sample rate is 48kHz.

◆ DEVICE_MAX_VOLUME

constexpr SLmillibel alexaClientSDK::mediaPlayer::android::DEVICE_MAX_VOLUME = 0
static

Assert that the AVS maximum volume is greater than the minimum volume.

The expected maximum device volume. OpenSL ES determines that device max volume is 0 or above. For android, the max value is 0. For simplicity. we based our conversion on that assumption.

◆ DEVICE_MIN_VOLUME

constexpr SLmillibel alexaClientSDK::mediaPlayer::android::DEVICE_MIN_VOLUME = SL_MILLIBEL_MIN
static

There is no predefined minimum value. Use the minimum value allowed by the SLmillibel type.

◆ EMPTY_FLAGS

const int alexaClientSDK::mediaPlayer::android::EMPTY_FLAGS = 0
static

Use no special flags during av_dict_copy.

◆ g_id

std::atomic<MediaPlayerInterface::SourceId> alexaClientSDK::mediaPlayer::android::g_id {1}
static

A counter used to increment the source id when a new source is set.

◆ INITIALIZE_TIMEOUT

const std::chrono::milliseconds alexaClientSDK::mediaPlayer::android::INITIALIZE_TIMEOUT {200}
static

Represent the timeout for the initialization step.

The timeout value should be long enough to avoid interrupting a normal initialization but it shouldn't sacrifice the user perception in case something goes wrong and we require to restart the initialization.

◆ INVALID_DURATION

const auto alexaClientSDK::mediaPlayer::android::INVALID_DURATION = std::chrono::milliseconds(-1)
static

Define invalid duration.

◆ NO_ALIGNMENT

constexpr int alexaClientSDK::mediaPlayer::android::NO_ALIGNMENT {1}
static

For av_samples_get_buffer_size we want to disable alignment to avoid empty samples (see ACSDK-1890).

◆ NO_ERROR

const int alexaClientSDK::mediaPlayer::android::NO_ERROR = 0
static

Constant representing a "no error" return value for FFmpeg callback methods.

◆ NO_FLAGS [1/2]

constexpr int alexaClientSDK::mediaPlayer::android::NO_FLAGS {0}
static

Represent scenario where there is no flag enabled.

◆ NO_FLAGS [2/2]

constexpr int alexaClientSDK::mediaPlayer::android::NO_FLAGS {0}
static

Represent scenario where there is no flag enabled.

◆ NUMBER_OF_CHANNELS

constexpr size_t alexaClientSDK::mediaPlayer::android::NUMBER_OF_CHANNELS = 2
static

The number of channels.

◆ PCM_SIGNED_SILENCE

constexpr AndroidSLESMediaQueue::Byte alexaClientSDK::mediaPlayer::android::PCM_SIGNED_SILENCE = 0x0

Represents the most significant byte of silence for signed samples.

◆ PCM_UNSIGNED_SILENCE

constexpr AndroidSLESMediaQueue::Byte alexaClientSDK::mediaPlayer::android::PCM_UNSIGNED_SILENCE = 0x80

Represents the most significant byte of silence for unsigned samples. Since we only support UNSIGNED_8, this byte can be used as silence representation. For samples with 2+ bytes, shift this value by the number of extra bits.

◆ READ_TIMEOUT

const std::chrono::milliseconds alexaClientSDK::mediaPlayer::android::READ_TIMEOUT {10}
static

Timeout for read operations.

◆ RECONNECT_OPTION

const char* alexaClientSDK::mediaPlayer::android::RECONNECT_OPTION {"reconnect"}
static

This string represents the FFmpeg option to reconnect when the connection is dropped during streaming.

◆ SAMPLE_RATE_HZ

constexpr size_t alexaClientSDK::mediaPlayer::android::SAMPLE_RATE_HZ = 48000
static

The playback audio sample rate in HZ.

◆ SAMPLE_SIZE_BITS

constexpr size_t alexaClientSDK::mediaPlayer::android::SAMPLE_SIZE_BITS = 16
static

The playback audio sample size in bits.

◆ SAMPLE_SIZE_BYTES

constexpr size_t alexaClientSDK::mediaPlayer::android::SAMPLE_SIZE_BYTES = SAMPLE_SIZE_BITS / 8
static

The playback audio sample size in bytes.

◆ TRUE_BOOLEAN_OPTION

const char* alexaClientSDK::mediaPlayer::android::TRUE_BOOLEAN_OPTION {"1"}
static

This string represents setting a boolean option to TRUE.

◆ USER_AGENT_OPTION

const char* alexaClientSDK::mediaPlayer::android::USER_AGENT_OPTION {"user_agent"}
static

This string represents the FFmpeg HTTP User-Agent option key.

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