16 #ifndef ACSDKEXTERNALMEDIAPLAYER_EXTERNALMEDIAPLAYER_H_ 17 #define ACSDKEXTERNALMEDIAPLAYER_EXTERNALMEDIAPLAYER_H_ 24 #include <unordered_map> 63 namespace acsdkExternalMediaPlayer {
83 ,
public std::enable_shared_from_this<ExternalMediaPlayer> {
87 std::unordered_map<std::string, std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface>>;
91 std::unordered_map<std::string, std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface>>;
95 std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface> (*)(
96 std::shared_ptr<alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface>,
97 std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> mediaPlayer,
98 std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface> speaker,
99 std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager,
100 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
101 std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
102 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
103 std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface> externalMediaPlayer);
117 static std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerInterface>
137 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
138 std::shared_ptr<certifiedSender::CertifiedSender> certifiedMessageSender,
139 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
140 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionSender,
141 std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> playbackRouter,
145 std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier,
146 std::shared_ptr<acsdkStartupManagerInterfaces::StartupNotifierInterface> startupNotifier,
147 std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface>
148 renderPlayerInfoCardsProviderRegistrar,
149 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>
metricRecorder);
177 std::shared_ptr<acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface>
178 audioPipelineFactory,
179 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
180 std::shared_ptr<certifiedSender::CertifiedSender> certifiedMessageSender,
184 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
185 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionSender,
186 std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> playbackRouter,
190 std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier,
191 std::shared_ptr<acsdkStartupManagerInterfaces::StartupNotifierInterface> startupNotifier,
192 std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface>
193 renderPlayerInfoCardsProviderRegistrar,
194 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>
metricRecorder,
195 std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager);
230 const std::vector<acsdkExternalMediaPlayerInterfaces::DiscoveredPlayerInfo>& addedPlayers,
231 const std::unordered_set<std::string>& removedLocalPlayerIds)
override;
233 std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface> adapterHandler)
236 std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface> adapterHandler)
239 const std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface> observer)
242 const std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface> observer)
254 std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsObserverInterface> observer)
override;
260 bool localSeekTo(std::chrono::milliseconds location,
bool fromStart)
override;
275 std::map<std::string, std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface>>
287 struct LocalPlayerIdHandler {
289 std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface> adapterHandler;
309 static std::shared_ptr<ExternalMediaPlayer> create(
310 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
311 std::shared_ptr<certifiedSender::CertifiedSender> certifiedMessageSender,
312 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
313 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionSender,
314 std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> playbackRouter,
318 std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier,
319 std::shared_ptr<acsdkStartupManagerInterfaces::StartupNotifierInterface> startupNotifier,
320 std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsProviderRegistrarInterface>
321 renderPlayerInfoCardsProviderRegistrar,
322 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>
metricRecorder);
340 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
341 std::shared_ptr<certifiedSender::CertifiedSender> certifiedMessageSender,
342 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
343 std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionSender,
344 std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> playbackRouter,
345 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>
metricRecorder);
366 std::shared_ptr<acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface>
367 audioPipelineFactory,
368 std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
369 std::shared_ptr<avsCommon::sdkInterfaces::SpeakerManagerInterface> speakerManager);
377 std::string provideSessionState(std::vector<acsdkExternalMediaPlayerInterfaces::AdapterState> adapterStates);
385 std::string providePlaybackState(std::vector<acsdkExternalMediaPlayerInterfaces::AdapterState> adapterStates);
395 bool parseDirectivePayload(std::shared_ptr<DirectiveInfo> info, rapidjson::Document* document);
403 void removeDirective(std::shared_ptr<DirectiveInfo> info);
407 void doShutdown()
override;
415 void sendReportDiscoveredPlayersEvent(
416 const std::vector<acsdkExternalMediaPlayerInterfaces::DiscoveredPlayerInfo>& discoveredPlayers);
426 void sendAuthorizationCompleteEvent(
427 const std::unordered_map<std::string, std::string>& authorized,
428 const std::unordered_set<std::string>& deauthorized);
436 void setHandlingCompleted(std::shared_ptr<DirectiveInfo> info);
448 void sendExceptionEncounteredAndReportFailed(
449 std::shared_ptr<DirectiveInfo> info,
477 void executeProvideState(
479 bool sendToken =
false,
480 unsigned int stateRequestToken = 0);
490 bool preprocessDirective(std::shared_ptr<DirectiveInfo> info, rapidjson::Document* document);
508 void handleAuthorizeDiscoveredPlayers(
509 std::shared_ptr<DirectiveInfo> info,
543 void handlePlayControl(
544 std::shared_ptr<DirectiveInfo> info,
570 void notifyObservers(
582 void notifyObservers(
595 void notifyObservers(
604 void notifyRenderPlayerInfoCardsObservers();
610 std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> m_metricRecorder;
613 std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
616 std::shared_ptr<certifiedSender::CertifiedSender> m_certifiedMessageSender;
619 std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
623 std::shared_ptr<avsCommon::sdkInterfaces::PlaybackRouterInterface> m_playbackRouter;
626 std::mutex m_authorizedMutex;
629 std::unordered_map<std::string, LocalPlayerIdHandler> m_authorizedAdapters;
632 std::map<std::string, std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterInterface>>
640 std::mutex m_inFocusAdapterMutex;
643 std::shared_ptr<AuthorizedSender> m_authorizedSender;
646 std::mutex m_observersMutex;
649 std::unordered_set<std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaPlayerObserverInterface>>
653 std::shared_ptr<avsCommon::sdkInterfaces::RenderPlayerInfoCardsObserverInterface> m_renderPlayerObserver;
657 std::queue<std::pair<std::string, std::string>> m_eventQueue;
661 std::shared_ptr<DirectiveInfo> info,
665 static std::unordered_map<
667 std::pair<acsdkExternalMediaPlayerInterfaces::RequestType, ExternalMediaPlayer::DirectiveHandler>>
668 m_directiveToHandlerMap;
671 std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;
674 std::unordered_set<std::shared_ptr<acsdkExternalMediaPlayerInterfaces::ExternalMediaAdapterHandlerInterface>>
678 std::unordered_set<std::string> m_reportedDiscoveredPlayers;
682 std::unordered_map<std::string, acsdkExternalMediaPlayerInterfaces::DiscoveredPlayerInfo>
683 m_unreportedPlayersToReportAtStartup;
686 std::mutex m_onStartupHasBeenCalledMutex;
689 bool m_onStartupHasBeenCalled;
692 std::shared_ptr<alexaClientSDK::avsCommon::sdkInterfaces::FocusManagerInterface> m_focusManager;
706 #endif // ACSDKEXTERNALMEDIAPLAYER_EXTERNALMEDIAPLAYER_H_ Definition: AudioFocusAnnotation.h:25
Definition: CapabilityAgent.h:47
Definition: CapabilityConfigurationInterface.h:32
Definition: NamespaceAndName.h:32
::std::string string
Definition: gtest-port.h:1097
ContextRequestError
Definition: ContextRequesterInterface.h:40
Single-thread executor implementation.
Definition: Executor.h:45
Definition: EndpointCapabilitiesRegistrarInterface.h:35
Definition: RequiresShutdown.h:32
ExceptionErrorType
Definition: ExceptionErrorType.h:28
Definition: RequiresStartupInterface.h:25
PlaybackButton
Enumeration class for supported playback buttons.
Definition: PlaybackButtons.h:26
Definition: FocusManagerInterface.h:54
Definition: LocalPlaybackHandlerInterface.h:30
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
Definition: Optional.h:32
Definition: DefaultEndpointAnnotation.h:26
Definition: Annotated.h:35
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
PlaybackOperation
Definition: LocalPlaybackHandlerInterface.h:40
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
type
Definition: upload.py:443
PlaybackToggle
Definition: PlaybackButtons.h:46
tuple message
Definition: gtest_output_test.py:331
Definition: RenderPlayerInfoCardsProviderInterface.h:30
action
Definition: upload.py:393
Definition: PlaybackHandlerInterface.h:29