AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
CaptionTimingAdapter.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_CAPTIONS_IMPLEMENTATION_INCLUDE_CAPTIONS_CAPTIONTIMINGADAPTER_H_
17 #define ALEXA_CLIENT_SDK_CAPTIONS_IMPLEMENTATION_INCLUDE_CAPTIONS_CAPTIONTIMINGADAPTER_H_
18 
19 #include <atomic>
20 #include <thread>
21 #include <vector>
22 
26 
28 #include "SystemClockDelay.h"
29 #include "TimingAdapterFactory.h"
30 
31 namespace alexaClientSDK {
32 namespace captions {
33 
38 public:
46  std::shared_ptr<CaptionPresenterInterface> presenter,
47  std::shared_ptr<DelayInterface> delayInterface);
48 
52  virtual ~CaptionTimingAdapter() override;
53 
56  virtual void queueForDisplay(const CaptionFrame& captionFrame, bool autostart) override;
57  virtual void reset() override;
58  virtual void start() override;
59  virtual void stop() override;
60  virtual void pause() override;
62 
63 private:
68  void presentCaptionFramesJob();
69 
73  void startCaptionFramesJob();
74 
76  std::shared_ptr<CaptionPresenterInterface> m_presenter;
77 
79  std::mutex m_mutex;
80 
82  size_t m_currentCaptionFrameIndex;
83 
85  bool m_isCurrentlyPresenting;
86 
88  bool m_mediaHasBeenPaused;
89 
91  std::vector<captions::CaptionFrame> m_captionFrames;
92 
94  std::thread m_thread;
95 
97  std::string m_threadMoniker;
98 
100  std::shared_ptr<DelayInterface> m_delayInterface;
101 };
102 
103 } // namespace captions
104 } // namespace alexaClientSDK
105 
106 #endif // ALEXA_CLIENT_SDK_CAPTIONS_IMPLEMENTATION_INCLUDE_CAPTIONS_CAPTIONTIMINGADAPTER_H_
Definition: CaptionTimingAdapterInterface.h:32
virtual void pause() override
Definition: CaptionTimingAdapter.cpp:183
CaptionTimingAdapter(std::shared_ptr< CaptionPresenterInterface > presenter, std::shared_ptr< DelayInterface > delayInterface)
Definition: CaptionTimingAdapter.cpp:43
Definition: CaptionFrame.h:33
virtual void reset() override
Definition: CaptionTimingAdapter.cpp:68
virtual ~CaptionTimingAdapter() override
Definition: CaptionTimingAdapter.cpp:54
virtual void queueForDisplay(const CaptionFrame &captionFrame, bool autostart) override
Definition: CaptionTimingAdapter.cpp:86
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual void stop() override
Definition: CaptionTimingAdapter.cpp:176
Definition: CaptionTimingAdapter.h:37
virtual void start() override
Definition: CaptionTimingAdapter.cpp:168

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