AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider Class Reference

#include <PooledMediaResourceProvider.h>

Inheritance diagram for alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider:
Collaboration graph
[legend]

Public Member Functions

 ~PooledMediaResourceProvider () override
 
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
 
std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface > > getSpeakers () const override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface
virtual ~PooledMediaResourceProviderInterface ()=default
 
- 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::shared_ptr< avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterfaceadaptMediaPlayerFactoryInterface (std::unique_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface > mediaPlayerFactory, std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface >> speakers)
 
static std::shared_ptr< avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterfacecreatePooledMediaResourceProviderInterface (std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface >> mediaPlayers, std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface >> speakers, const avsCommon::utils::mediaPlayer::Fingerprint &fingerprint={})
 

Detailed Description

Adapts the legacy MediaPlayerFactoryInterface (which provides only media players) to the PooledMediaResourceProviderInterface (which can also provide other associated media resources with the media players).

Constructor & Destructor Documentation

◆ ~PooledMediaResourceProvider()

alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::~PooledMediaResourceProvider ( )
override

Member Function Documentation

◆ acquireMediaPlayer()

std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::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.

◆ adaptMediaPlayerFactoryInterface()

static std::shared_ptr<avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface> alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::adaptMediaPlayerFactoryInterface ( std::unique_ptr< avsCommon::utils::mediaPlayer::MediaPlayerFactoryInterface mediaPlayerFactory,
std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface >>  speakers 
)
static

Adapts a legacy MediaPlayerFactoryInterface to a PooledMediaResourceProviderInterface, given the speakers associated with the players managed by the MediaPlayerFactoryInterface.

Parameters
mediaPlayerFactoryThe factory to adapt.
speakersThe ChannelVolumeInterfaces that the PooledMediaResourceProvider will return on getSpeakers().
Returns
A new PooledMediaResourceProviderInterface.

◆ addObserver()

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

◆ createPooledMediaResourceProviderInterface()

static std::shared_ptr<avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface> alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::createPooledMediaResourceProviderInterface ( std::vector< std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface >>  mediaPlayers,
std::vector< std::shared_ptr< avsCommon::sdkInterfaces::ChannelVolumeInterface >>  speakers,
const avsCommon::utils::mediaPlayer::Fingerprint fingerprint = {} 
)
static

Factory method that creates a PooledMediaResourceProviderInterface.

Parameters
mediaPlayersThe pooled media players to manage.
speakersThe ChannelVolumeInterfaces that the PooledMediaResourceProvider will return on getSpeakers().
fingerprintOptional fingerprint argument to send to AVS.
Returns
A new PooledMediaResourceProviderInterface.

◆ getFingerprint()

avsCommon::utils::mediaPlayer::Fingerprint alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::getFingerprint ( )
overridevirtual

◆ getSpeakers()

std::vector<std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface> > alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::getSpeakers ( ) const
overridevirtual

Gets all ChannelVolumeInterfaces associated with the media players managed by this instance.

Note
The number of channel volume interfaces is not guaranteed to match the number of media players managed by the instance.
Returns
A vector of pointers to ChannelVolumeInterfaces.

Implements alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProviderInterface.

◆ isMediaPlayerAvailable()

bool alexaClientSDK::avsCommon::utils::mediaPlayer::PooledMediaResourceProvider::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.

◆ releaseMediaPlayer()

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

◆ removeObserver()

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

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

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