Jean-Michel Trivi | 56ec4ff | 2015-01-23 16:45:18 -0800 | [diff] [blame] | 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 | |
François Gaffie | ad3183e | 2015-03-18 16:55:35 +0100 | [diff] [blame^] | 17 | #pragma once |
| 18 | |
| 19 | #include "Ports.h" |
| 20 | #include <utils/Errors.h> |
| 21 | #include <system/audio.h> |
| 22 | #include <utils/SortedVector.h> |
| 23 | |
Jean-Michel Trivi | 56ec4ff | 2015-01-23 16:45:18 -0800 | [diff] [blame] | 24 | namespace android { |
| 25 | |
François Gaffie | ad3183e | 2015-03-18 16:55:35 +0100 | [diff] [blame^] | 26 | class IOProfile; |
| 27 | class AudioMix; |
| 28 | |
Jean-Michel Trivi | 56ec4ff | 2015-01-23 16:45:18 -0800 | [diff] [blame] | 29 | // descriptor for audio inputs. Used to maintain current configuration of each opened audio input |
| 30 | // and keep track of the usage of this input. |
| 31 | class AudioInputDescriptor: public AudioPortConfig |
| 32 | { |
| 33 | public: |
| 34 | AudioInputDescriptor(const sp<IOProfile>& profile); |
| 35 | |
| 36 | status_t dump(int fd); |
| 37 | |
| 38 | audio_port_handle_t mId; |
| 39 | audio_io_handle_t mIoHandle; // input handle |
| 40 | audio_devices_t mDevice; // current device this input is routed to |
| 41 | AudioMix *mPolicyMix; // non NULL when used by a dynamic policy |
| 42 | audio_patch_handle_t mPatchHandle; |
| 43 | uint32_t mRefCount; // number of AudioRecord clients using |
| 44 | // this input |
| 45 | uint32_t mOpenRefCount; |
| 46 | audio_source_t mInputSource; // input source selected by application |
| 47 | //(mediarecorder.h) |
| 48 | const sp<IOProfile> mProfile; // I/O profile this output derives from |
| 49 | SortedVector<audio_session_t> mSessions; // audio sessions attached to this input |
| 50 | bool mIsSoundTrigger; // used by a soundtrigger capture |
| 51 | |
| 52 | virtual void toAudioPortConfig(struct audio_port_config *dstConfig, |
| 53 | const struct audio_port_config *srcConfig = NULL) const; |
| 54 | virtual sp<AudioPort> getAudioPort() const { return mProfile; } |
| 55 | void toAudioPort(struct audio_port *port) const; |
| 56 | }; |
| 57 | |
| 58 | }; // namespace android |