Alexa Auto SDK  2.0.0
AudioStream.h
1 /*
2  * Copyright 2017-2019 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 
23 namespace aace {
24 namespace audio {
25 
26 class AudioStream {
27 public:
28  enum class Encoding {
29  UNKNOWN,
30  LPCM,
31  MP3,
32  OPUS
33  };
34 
35  virtual ~AudioStream();
36 
46  virtual ssize_t read( char* data, const size_t size ) = 0;
47 
55  virtual bool isClosed() = 0;
56 
63  virtual Encoding getEncoding();
64 };
65 
66 inline std::ostream& operator<<(std::ostream& stream, const AudioStream::Encoding& encoding) {
67  switch (encoding) {
68  case AudioStream::Encoding::UNKNOWN:
69  stream << "UNKNOWN";
70  break;
71  case AudioStream::Encoding::LPCM:
72  stream << "LPCM";
73  break;
74  case AudioStream::Encoding::MP3:
75  stream << "MP3";
76  break;
77  case AudioStream::Encoding::OPUS:
78  stream << "OPUS";
79  break;
80  }
81  return stream;
82 }
83 
84 } // aace::audio
85 } // aace
86 
87 #endif // AACE_AUDIO_AUDIO_STREAM_H
Definition: AddressBook.h:26

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