AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PlaybackConfiguration.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 #ifndef ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_PLAYBACKCONFIGURATION_H_
16 #define ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_PLAYBACKCONFIGURATION_H_
17 
18 #include <cstddef>
19 #include <cstdint>
20 
21 namespace alexaClientSDK {
22 namespace mediaPlayer {
23 namespace android {
24 
41 public:
45  enum class ChannelLayout {
50  };
51 
57  enum class SampleFormat { UNSIGNED_8 = 8, SIGNED_16 = 16, SIGNED_32 = 32 };
58 
64  inline bool isLittleEndian() const;
65 
71  inline size_t sampleRate() const;
72 
78  inline SampleFormat sampleFormat() const;
79 
85  inline ChannelLayout channelLayout() const;
86 
92  inline size_t numberChannels() const;
93 
97  inline size_t sampleSizeBytes() const;
98 
102  ~PlaybackConfiguration() = default;
103 
108 
113  const bool isLittleEndian,
114  const size_t sampleRate,
115  const ChannelLayout layout,
116  const SampleFormat sampleFormat);
117 
118 private:
120  static size_t layoutToChannels(ChannelLayout layout);
121 
123  const bool m_isLittleEndian;
124 
126  const size_t m_sampleRate;
127 
129  const SampleFormat m_sampleFormat;
130 
132  const ChannelLayout m_layout;
133 
135  const size_t m_numberChannels;
136 };
137 
139  return m_isLittleEndian;
140 }
141 
143  return m_sampleRate;
144 }
145 
147  return m_sampleFormat;
148 }
149 
151  return m_numberChannels;
152 }
153 
155  constexpr size_t byteSize = 8;
156  return static_cast<size_t>(m_sampleFormat) / byteSize;
157 }
158 
160  return m_layout;
161 }
162 
163 inline std::ostream& operator<<(std::ostream& stream, const PlaybackConfiguration::SampleFormat& format) {
164  switch (format) {
166  return stream << "UNSIGNED_8";
168  return stream << "SIGNED_16";
170  return stream << "SIGNED_32";
171  }
172  return stream << "INVALID";
173 }
174 
175 } // namespace android
176 } // namespace mediaPlayer
177 } // namespace alexaClientSDK
178 
179 #endif // ALEXA_CLIENT_SDK_MEDIAPLAYER_ANDROIDSLESMEDIAPLAYER_INCLUDE_ANDROIDSLESMEDIAPLAYER_PLAYBACKCONFIGURATION_H_
size_t sampleSizeBytes() const
Definition: PlaybackConfiguration.h:154
ChannelLayout
Definition: PlaybackConfiguration.h:45
std::ostream & operator<<(std::ostream &stream, const FFmpegInputControllerInterface::Result &result)
Definition: FFmpegInputControllerInterface.h:86
bool isLittleEndian() const
Definition: PlaybackConfiguration.h:138
SampleFormat sampleFormat() const
Definition: PlaybackConfiguration.h:146
SampleFormat
Definition: PlaybackConfiguration.h:57
ChannelLayout channelLayout() const
Definition: PlaybackConfiguration.h:159
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
size_t numberChannels() const
Definition: PlaybackConfiguration.h:150
size_t sampleRate() const
Definition: PlaybackConfiguration.h:142

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