AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MediaPlayerState.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_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_MEDIAPLAYER_MEDIAPLAYERSTATE_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_MEDIAPLAYER_MEDIAPLAYERSTATE_H_
18 
20 
21 #include <chrono>
22 #include <string>
23 
24 namespace alexaClientSDK {
25 namespace avsCommon {
26 namespace utils {
27 namespace mediaPlayer {
28 
29 const std::chrono::milliseconds DURATION_UNKNOWN = std::chrono::milliseconds(-1);
30 
41  }
42 
45  protectionScheme(protectionScheme),
46  clearLead(clearLead) {
47  }
48 
55  bool operator==(const MediaPlayerProtection& other) const {
56  return (protectionScheme == other.protectionScheme && clearLead == other.clearLead);
57  }
58 
60  bool isProtected() const {
61  return protectionScheme.size() != 0;
62  }
63 
69 
74  bool clearLead;
75  };
76 
80  MediaPlayerState() : offset(std::chrono::milliseconds::zero()), duration(DURATION_UNKNOWN) {
81  }
82 
86  MediaPlayerState(std::chrono::milliseconds offsetInMs, std::chrono::milliseconds duration_ = DURATION_UNKNOWN) :
87  offset(offsetInMs),
88  duration(duration_) {
89  }
90 
95  std::chrono::milliseconds offsetInMs,
96  const MediaPlayerProtection& mediaPlayerProtection_,
97  std::chrono::milliseconds duration_ = DURATION_UNKNOWN) :
98  offset(offsetInMs),
99  duration(duration_),
100  mediaPlayerProtection(mediaPlayerProtection_) {
101  }
102 
107  std::chrono::milliseconds offsetInMs,
108  const MediaPlayerProtection& mediaPlayerProtection_,
109  const std::string& playlistType_,
110  std::chrono::milliseconds duration_ = DURATION_UNKNOWN) :
111  offset(offsetInMs),
112  duration(duration_),
113  mediaPlayerProtection(mediaPlayerProtection_),
114  playlistType(playlistType_) {
115  }
116 
118  std::chrono::milliseconds offset;
119 
121  std::chrono::milliseconds duration;
122 
125 
131 
138  bool operator==(const MediaPlayerState& other) const {
139  return offset == other.offset && duration == other.duration &&
140  mediaPlayerProtection == other.mediaPlayerProtection && playlistType == other.playlistType;
141  }
142 };
143 
151 inline std::ostream& operator<<(
152  std::ostream& stream,
154  stream << "MediaPlayerProtection: isProtected=" << std::boolalpha << mediaPlayerProtection.isProtected();
155  if (mediaPlayerProtection.isProtected()) {
156  stream << ",protectionScheme=" << mediaPlayerProtection.protectionScheme << ",clearLead=" << std::boolalpha
157  << mediaPlayerProtection.clearLead;
158  }
159  return stream;
160 }
161 
162 } // namespace mediaPlayer
163 } // namespace utils
164 } // namespace avsCommon
165 } // namespace alexaClientSDK
166 
167 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_MEDIAPLAYER_MEDIAPLAYERSTATE_H_
bool operator==(const MediaPlayerProtection &other) const
Definition: MediaPlayerState.h:55
::std::string string
Definition: gtest-port.h:1097
bool operator==(const MediaPlayerState &other) const
Definition: MediaPlayerState.h:138
Definition: CapabilityConfiguration.h:190
Optional< std::string > playlistType
Definition: MediaPlayerState.h:130
std::chrono::milliseconds duration
Duration.
Definition: MediaPlayerState.h:121
MediaPlayerProtection(const std::string &protectionScheme, bool clearLead)
Constructor.
Definition: MediaPlayerState.h:44
MediaPlayerState(std::chrono::milliseconds offsetInMs, const MediaPlayerProtection &mediaPlayerProtection_, std::chrono::milliseconds duration_=DURATION_UNKNOWN)
Definition: MediaPlayerState.h:94
bool isProtected() const
Is the track protected.
Definition: MediaPlayerState.h:60
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
MediaPlayerState(std::chrono::milliseconds offsetInMs, std::chrono::milliseconds duration_=DURATION_UNKNOWN)
Definition: MediaPlayerState.h:86
MediaPlayerProtection()
Default Constructor.
Definition: MediaPlayerState.h:40
std::chrono::milliseconds offset
Offset in milliseconds.
Definition: MediaPlayerState.h:118
Optional< MediaPlayerProtection > mediaPlayerProtection
Optional: MediaPlayerProtection information.
Definition: MediaPlayerState.h:124
std::ostream & operator<<(std::ostream &stream, const ErrorType &errorType)
Definition: ErrorTypes.h:158
const std::chrono::milliseconds DURATION_UNKNOWN
Definition: MediaPlayerState.h:29
MediaPlayerState(std::chrono::milliseconds offsetInMs, const MediaPlayerProtection &mediaPlayerProtection_, const std::string &playlistType_, std::chrono::milliseconds duration_=DURATION_UNKNOWN)
Definition: MediaPlayerState.h:106

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