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

Namespaces

 android
 
 test
 

Classes

class  AttachmentReaderSource
 
class  BaseStreamSource
 
class  IStreamSource
 
class  MediaPlayer
 
class  Normalizer
 
class  OffsetManager
 
class  PipelineInterface
 
class  PooledMediaPlayerFactory
 
class  SourceInterface
 
class  SourceObserverInterface
 

Typedefs

typedef std::vector< avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::TagKeyValueTypeVectorOfTags
 
using MediaPlayerState = avsCommon::utils::mediaPlayer::MediaPlayerState
 

Functions

static const std::string TAG ("PooledMediaPlayerFactory")
 
avsCommon::utils::mediaPlayer::ErrorType gerrorToErrorType (const GError *error, bool remoteResource)
 
static const std::string TAG ("AttachmentReaderSource")
 String to identify log entries originating from this file. More...
 
static const unsigned int CHUNK_SIZE (4096)
 The number of bytes read from the attachment with each read in the read loop. More...
 
static const std::string TAG ("BaseStreamSource")
 String to identify log entries originating from this file. More...
 
static std::string getCapsString (const AudioFormat &audioFormat)
 
static avsCommon::utils::mediaPlayer::ErrorType gstCoreErrorToErrorType (const GstCoreError &error)
 
static avsCommon::utils::mediaPlayer::ErrorType gstLibraryErrorToErrorType (const GstLibraryError &error)
 
static avsCommon::utils::mediaPlayer::ErrorType gstResourceErrorToErrorType (const GstResourceError &error, bool remoteResource)
 
static avsCommon::utils::mediaPlayer::ErrorType gstStreamErrorToErrorType (const GstStreamError &error)
 
static const std::string TAG ("IStreamSource")
 String to identify log entries originating from this file. More...
 
static const unsigned int CHUNK_SIZE (4096)
 The number of bytes read from the attachment with each read in the read loop. More...
 
static const std::string TAG ("MediaPlayer")
 String to identify log entries originating from this file. More...
 
static const unsigned int TIMEOUT_ZERO_NANOSECONDS (0)
 Timeout value for calls to gst_element_get_state() calls. More...
 
static void collectOneTag (const GstTagList *tagList, const gchar *tag, gpointer pointerToMutableVectorOfTags)
 
static short gainInsideLimit (short gain)
 
static const std::string TAG ("Normalizer")
 String to identify log entries originating from this file. More...
 
static const std::string TAG ("OffsetManager")
 String to identify log entries originating from this file. More...
 

Variables

static const guint RETRY_INTERVALS_MILLISECONDS [] = {0, 10, 10, 10, 20, 20, 50, 100}
 The interval to wait (in milliseconds) between successive attempts to read audio data when none is available. More...
 
static const std::string MEDIAPLAYER_CONFIGURATION_ROOT_KEY = "gstreamerMediaPlayer"
 
static const std::string MEDIAPLAYER_AUDIO_SINK_KEY = "audioSink"
 The key in our config file to set the audioSink. More...
 
static const std::string MEDIAPLAYER_OUTPUT_CONVERSION_ROOT_KEY = "outputConversion"
 The key in our config file to find the output conversion type. More...
 
static const std::unordered_map< std::string, int > MEDIAPLAYER_ACCEPTED_KEYS
 
static std::atomic< MediaPlayer::SourceIdg_id {1}
 A counter used to increment the source id when a new source is set. More...
 
static const MediaPlayer::SourceId ERROR_SOURCE_ID = MediaPlayer::ERROR
 A link to MediaPlayerInterface::ERROR. More...
 
static const guint UNQUEUED_CALLBACK = guint(0)
 A value to indicate an unqueued callback. g_idle_add() only returns ids >= 0. More...
 
static const int8_t GST_SET_VOLUME_MIN = 0
 GStreamer Volume Element Minimum. More...
 
static const int8_t GST_SET_VOLUME_MAX = 1
 GStreamer Volume Element Maximum. More...
 
static const gdouble GST_CONTROL_VOLUME_FACTOR = 1000
 GStreamer Timed Volume Control Element factor. More...
 
static const gdouble VOLUME_ZERO = 0.0000001
 Represents the zero volume to avoid the actual 0.0 value. Used as a fix for GStreamer crashing on 0 volume for PCM. More...
 
static const int MIN_EQUALIZER_LEVEL = -24
 Mimimum level for equalizer bands. More...
 
static const int MAX_EQUALIZER_LEVEL = 12
 Maximum level for equalizer bands. More...
 
static char GSTREAMER_BASS_BAND_NAME [] = "band0"
 The GStreamer property name for the frequency band 100 Hz. More...
 
static char GSTREAMER_MIDRANGE_BAND_NAME [] = "band1"
 The GStreamer property name for the frequency band 1.1 kHz. More...
 
static char GSTREAMER_TREBLE_BAND_NAME [] = "band2"
 The GStreamer property name for the frequency band 11 kHz. More...
 
static constexpr size_t NUM_OF_CONTENT_READERS = 2
 

Typedef Documentation

◆ MediaPlayerState

◆ VectorOfTags

Function Documentation

◆ CHUNK_SIZE() [1/2]

static const unsigned int alexaClientSDK::mediaPlayer::CHUNK_SIZE ( 4096  )
static

The number of bytes read from the attachment with each read in the read loop.

◆ CHUNK_SIZE() [2/2]

static const unsigned int alexaClientSDK::mediaPlayer::CHUNK_SIZE ( 4096  )
static

The number of bytes read from the attachment with each read in the read loop.

◆ collectOneTag()

static void alexaClientSDK::mediaPlayer::collectOneTag ( const GstTagList *  tagList,
const gchar *  tag,
gpointer  pointerToMutableVectorOfTags 
)
static

Processes tags found in the tagList. Called through gst_tag_list_foreach.

Parameters
tagListList of tags to iterate over.
tagA specific tag from the tag list.
pointerToMutableVectorOfTagsPointer to VectorOfTags. Use push_back to preserve order.

◆ gainInsideLimit()

static short alexaClientSDK::mediaPlayer::gainInsideLimit ( short  gain)
inlinestatic

◆ gerrorToErrorType()

avsCommon::utils::mediaPlayer::ErrorType alexaClientSDK::mediaPlayer::gerrorToErrorType ( const GError *  error,
bool  remoteResource 
)

Convert a GStreamer GError to an ErrorType.

Parameters
errorThe GError to convert.
remoteResourceIndicates whether it should be for a resource that is remote.
Returns
The converted ErrorType.

◆ getCapsString()

static std::string alexaClientSDK::mediaPlayer::getCapsString ( const AudioFormat audioFormat)
static

Method that returns a string to be used in CAPS negotiation (generating right PADS between gstreamer elements based on audio data.) For raw PCM data without header audioFormat information needs to be passed explicitly for a mediaplayer to interpret the audio bytes.

◆ gstCoreErrorToErrorType()

static avsCommon::utils::mediaPlayer::ErrorType alexaClientSDK::mediaPlayer::gstCoreErrorToErrorType ( const GstCoreError &  error)
static

◆ gstLibraryErrorToErrorType()

static avsCommon::utils::mediaPlayer::ErrorType alexaClientSDK::mediaPlayer::gstLibraryErrorToErrorType ( const GstLibraryError &  error)
static

◆ gstResourceErrorToErrorType()

static avsCommon::utils::mediaPlayer::ErrorType alexaClientSDK::mediaPlayer::gstResourceErrorToErrorType ( const GstResourceError &  error,
bool  remoteResource 
)
static

◆ gstStreamErrorToErrorType()

static avsCommon::utils::mediaPlayer::ErrorType alexaClientSDK::mediaPlayer::gstStreamErrorToErrorType ( const GstStreamError &  error)
static

◆ TAG() [1/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "AttachmentReaderSource"  )
static

String to identify log entries originating from this file.

◆ TAG() [2/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "BaseStreamSource"  )
static

String to identify log entries originating from this file.

◆ TAG() [3/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "IStreamSource"  )
static

String to identify log entries originating from this file.

◆ TAG() [4/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "MediaPlayer"  )
static

String to identify log entries originating from this file.

◆ TAG() [5/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "Normalizer"  )
static

String to identify log entries originating from this file.

◆ TAG() [6/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "OffsetManager"  )
static

String to identify log entries originating from this file.

◆ TAG() [7/7]

static const std::string alexaClientSDK::mediaPlayer::TAG ( "PooledMediaPlayerFactory"  )
static

◆ TIMEOUT_ZERO_NANOSECONDS()

static const unsigned int alexaClientSDK::mediaPlayer::TIMEOUT_ZERO_NANOSECONDS ( )
static

Timeout value for calls to gst_element_get_state() calls.

Variable Documentation

◆ ERROR_SOURCE_ID

const MediaPlayer::SourceId alexaClientSDK::mediaPlayer::ERROR_SOURCE_ID = MediaPlayer::ERROR
static

◆ g_id

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

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

◆ GST_CONTROL_VOLUME_FACTOR

const gdouble alexaClientSDK::mediaPlayer::GST_CONTROL_VOLUME_FACTOR = 1000
static

GStreamer Timed Volume Control Element factor.

◆ GST_SET_VOLUME_MAX

const int8_t alexaClientSDK::mediaPlayer::GST_SET_VOLUME_MAX = 1
static

GStreamer Volume Element Maximum.

◆ GST_SET_VOLUME_MIN

const int8_t alexaClientSDK::mediaPlayer::GST_SET_VOLUME_MIN = 0
static

GStreamer Volume Element Minimum.

◆ GSTREAMER_BASS_BAND_NAME

char alexaClientSDK::mediaPlayer::GSTREAMER_BASS_BAND_NAME[] = "band0"
static

The GStreamer property name for the frequency band 100 Hz.

◆ GSTREAMER_MIDRANGE_BAND_NAME

char alexaClientSDK::mediaPlayer::GSTREAMER_MIDRANGE_BAND_NAME[] = "band1"
static

The GStreamer property name for the frequency band 1.1 kHz.

◆ GSTREAMER_TREBLE_BAND_NAME

char alexaClientSDK::mediaPlayer::GSTREAMER_TREBLE_BAND_NAME[] = "band2"
static

The GStreamer property name for the frequency band 11 kHz.

◆ MAX_EQUALIZER_LEVEL

const int alexaClientSDK::mediaPlayer::MAX_EQUALIZER_LEVEL = 12
static

Maximum level for equalizer bands.

◆ MEDIAPLAYER_ACCEPTED_KEYS

const std::unordered_map<std::string, int> alexaClientSDK::mediaPlayer::MEDIAPLAYER_ACCEPTED_KEYS
static
Initial value:
= {{"rate", G_TYPE_INT},
{"format", G_TYPE_STRING},
{"channels", G_TYPE_INT}}

The acceptable conversion keys to find in the config file Key strings are mapped to gstreamer capabilities documented here: https://gstreamer.freedesktop.org/documentation/design/mediatype-audio-raw.html

◆ MEDIAPLAYER_AUDIO_SINK_KEY

const std::string alexaClientSDK::mediaPlayer::MEDIAPLAYER_AUDIO_SINK_KEY = "audioSink"
static

The key in our config file to set the audioSink.

◆ MEDIAPLAYER_CONFIGURATION_ROOT_KEY

const std::string alexaClientSDK::mediaPlayer::MEDIAPLAYER_CONFIGURATION_ROOT_KEY = "gstreamerMediaPlayer"
static

◆ MEDIAPLAYER_OUTPUT_CONVERSION_ROOT_KEY

const std::string alexaClientSDK::mediaPlayer::MEDIAPLAYER_OUTPUT_CONVERSION_ROOT_KEY = "outputConversion"
static

The key in our config file to find the output conversion type.

◆ MIN_EQUALIZER_LEVEL

const int alexaClientSDK::mediaPlayer::MIN_EQUALIZER_LEVEL = -24
static

Mimimum level for equalizer bands.

◆ NUM_OF_CONTENT_READERS

constexpr size_t alexaClientSDK::mediaPlayer::NUM_OF_CONTENT_READERS = 2
staticconstexpr

Number of readers for UrlContentToAttachmentConverter. We have 2 readers to have an additional parked reader, to ensure that the whole of SDS buffer is conserved until the seek() is called.

◆ RETRY_INTERVALS_MILLISECONDS

const guint alexaClientSDK::mediaPlayer::RETRY_INTERVALS_MILLISECONDS[] = {0, 10, 10, 10, 20, 20, 50, 100}
static

The interval to wait (in milliseconds) between successive attempts to read audio data when none is available.

◆ UNQUEUED_CALLBACK

const guint alexaClientSDK::mediaPlayer::UNQUEUED_CALLBACK = guint(0)
static

A value to indicate an unqueued callback. g_idle_add() only returns ids >= 0.

◆ VOLUME_ZERO

const gdouble alexaClientSDK::mediaPlayer::VOLUME_ZERO = 0.0000001
static

Represents the zero volume to avoid the actual 0.0 value. Used as a fix for GStreamer crashing on 0 volume for PCM.

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