Alexa Auto SDK  2.3.1
AudioStream.h
1 /*
2  * Copyright 2017-2020 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 AACE_AUDIO_AUDIO_STREAM_H
17 #define AACE_AUDIO_AUDIO_STREAM_H
18 
19 #include <iostream>
20 #include <vector>
21 #include <string>
22 
23 #include "AudioFormat.h"
24 
27 namespace aace {
28 namespace audio {
29 
30 class AudioStreamProperty;
31 
32 class AudioStream {
33 public:
34  using AudioFormat = aace::audio::AudioFormat;
35  using Encoding = AudioFormat::Encoding;
36 
40  enum class MediaType {
42  MPEG,
43 
45  WAV,
46 
48  UNKNOWN
49  };
50 
51  virtual ~AudioStream();
52 
62  virtual ssize_t read(char* data, const size_t size) = 0;
63 
71  virtual bool isClosed() = 0;
72 
81  virtual Encoding getEncoding();
82 
88  virtual AudioFormat getAudioFormat();
89 
96  virtual MediaType getMediaType();
97 
103  virtual std::vector<AudioStreamProperty> getProperties();
104 };
105 
110 public:
117  AudioStreamProperty(const std::string& key, const std::string& value) : m_key{key}, m_value{value} {
118  }
119 
126  *this = other;
127  }
128 
134  AudioStreamProperty& operator=(const AudioStreamProperty& other) = default;
135 
139  std::string getKey() {
140  return m_key;
141  }
142 
146  std::string getValue() {
147  return m_value;
148  }
149 
150 private:
151  std::string m_key;
152  std::string m_value;
153 };
154 
155 } // namespace audio
156 } // namespace aace
157 
158 #endif // AACE_AUDIO_AUDIO_STREAM_H
AudioStreamProperty(const std::string &key, const std::string &value)
Definition: AudioStream.h:117
Definition: AudioStream.h:109
AudioStreamProperty(const AudioStreamProperty &other)
Definition: AudioStream.h:125
Definition: AddressBook.h:26
std::string getValue()
Definition: AudioStream.h:146
std::string getKey()
Definition: AudioStream.h:139

Alexa Auto SDK 2.3.1 - Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0