AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory Class Reference

#include <PooledMediaPlayerFactory.h>

Inheritance diagram for alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory:
Collaboration graph
[legend]

Public Member Functions

virtual ~PooledMediaPlayerFactory ()
 
PooledMediaResourceProviderInterface methods.
avsCommon::utils::mediaPlayer::Fingerprint getFingerprint () override
 
std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterfaceacquireMediaPlayer () override
 
bool releaseMediaPlayer (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > mediaPlayer) override
 
bool isMediaPlayerAvailable () override
 
void addObserver (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface > observer) override
 
void removeObserver (std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface > observer) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface
virtual ~MediaPlayerFactoryInterface ()=default
 
virtual bool releaseMediaPlayer (std::shared_ptr< MediaPlayerInterface > mediaPlayer)=0
 
virtual void addObserver (std::shared_ptr< MediaPlayerFactoryObserverInterface > observer)=0
 
virtual void removeObserver (std::shared_ptr< MediaPlayerFactoryObserverInterface > observer)=0
 

Static Public Member Functions

static std::unique_ptr< PooledMediaPlayerFactorycreate (const std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface >> &pool, const avsCommon::utils::mediaPlayer::Fingerprint &fingerprint={})
 

Protected Member Functions

 PooledMediaPlayerFactory (const std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface >> &mediaPlayerPool, const avsCommon::utils::mediaPlayer::Fingerprint &fingerprint={})
 
void notifyObservers ()
 

Protected Attributes

std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > > m_availablePlayerPool
 The collection of available players. More...
 
std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > > m_inUsePlayerPool
 The collection of players in use. More...
 
std::unordered_set< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface > > m_observers
 
avsCommon::utils::mediaPlayer::Fingerprint m_fingerprint
 MediaPlayer version information. More...
 

Detailed Description

Implementation of MediaPlayerFactoryInterface that manages a pool of pre-created instances of MediaPlayerInterface

Constructor & Destructor Documentation

◆ ~PooledMediaPlayerFactory()

alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::~PooledMediaPlayerFactory ( )
virtual

◆ PooledMediaPlayerFactory()

alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::PooledMediaPlayerFactory ( const std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface >> &  mediaPlayerPool,
const avsCommon::utils::mediaPlayer::Fingerprint fingerprint = {} 
)
protected

Constructor used to create a PooledMediaPlayerFactory from a pre-created set of players and their associated speakers, channel volumes, and equalizers.

Parameters
mediaPlayerPoolPre-created collection of MediaPlayers.
fingerprintOptional fingerprint argument to send to AVS.

Member Function Documentation

◆ acquireMediaPlayer()

std::shared_ptr< MediaPlayerInterface > alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::acquireMediaPlayer ( )
overridevirtual

Acquire an instance of a MediaPlayerInterface, if available.

Returns
an instance of of MediaPlayerInterface, or nullptr if none available.

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface.

◆ addObserver()

void alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::addObserver ( std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface observer)
override

◆ create()

std::unique_ptr< PooledMediaPlayerFactory > alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::create ( const std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface >> &  pool,
const avsCommon::utils::mediaPlayer::Fingerprint fingerprint = {} 
)
static

Create a PooledMediaPlayerFactory from a pre-created set of Players.

Deprecated:
Use adaptMediaPlayerFactoryInterface.
Parameters
poolpre-created collection of MediaPlayers. Ownership is not transferred.

◆ getFingerprint()

Fingerprint alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::getFingerprint ( )
overridevirtual

◆ isMediaPlayerAvailable()

bool alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::isMediaPlayerAvailable ( )
overridevirtual

Returns true if a MediaPlayerInterface instance is available (i.e. if a call to acquireMediaPlayer would return a valid Player) The return value is valid until the next call to acquireMediaPlayer() or releaseMediaPlayer()

Returns
true if a MediaPlayerInterface instance is available.

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface.

◆ notifyObservers()

void alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::notifyObservers ( )
protected

Synchronously notify all observers that a player is available

◆ releaseMediaPlayer()

bool alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::releaseMediaPlayer ( std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface mediaPlayer)
override

◆ removeObserver()

void alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::removeObserver ( std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface observer)
override

Member Data Documentation

◆ m_availablePlayerPool

std::vector<std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> > alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::m_availablePlayerPool
protected

The collection of available players.

◆ m_fingerprint

avsCommon::utils::mediaPlayer::Fingerprint alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::m_fingerprint
protected

MediaPlayer version information.

◆ m_inUsePlayerPool

std::vector<std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> > alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::m_inUsePlayerPool
protected

The collection of players in use.

◆ m_observers

std::unordered_set<std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerFactoryObserverInterface> > alexaClientSDK::mediaPlayer::PooledMediaPlayerFactory::m_observers
protected

The collection of ChannelVolumeInterfaces associated with the media players managed by this factory.. Factory observers


The documentation for this class was generated from the following files:

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