1 /*
2  * Copyright (C) 2015 The Android Open Source Project
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  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "AudioCollections.h"
20 #include <utils/String8.h>
21 #include <utils/Vector.h>
22 #include <utils/RefBase.h>
23 #include <utils/Errors.h>
24 
25 namespace android
26 {
27 
28 class AudioPort;
29 class DeviceDescriptor;
30 
31 typedef enum {
32     AUDIO_ROUTE_MUX = 0,
33     AUDIO_ROUTE_MIX = 1
34 } audio_route_type_t;
35 
36 class AudioRoute  : public virtual RefBase
37 {
38 public:
AudioRoute(audio_route_type_t type)39     AudioRoute(audio_route_type_t type) : mType(type) {}
40 
setSources(const AudioPortVector & sources)41     void setSources(const AudioPortVector &sources) { mSources = sources; }
getSources()42     const AudioPortVector &getSources() const { return mSources; }
43 
setSink(const sp<AudioPort> & sink)44     void setSink(const sp<AudioPort> &sink) { mSink = sink; }
getSink()45     const sp<AudioPort> &getSink() const { return mSink; }
46 
getType()47     audio_route_type_t getType() const { return mType; }
48 
49     void dump(int fd, int spaces) const;
50 
51 private:
52     AudioPortVector mSources;
53     sp<AudioPort> mSink;
54     audio_route_type_t mType;
55 
56 };
57 
58 }; // namespace android
59