AudioInputDescriptor.h revision 98cc191247388132b6fd8a4ecd07abd6e4c5a0ed
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 "AudioPort.h" 20#include <utils/Errors.h> 21#include <system/audio.h> 22#include <utils/SortedVector.h> 23 24namespace android { 25 26class IOProfile; 27class AudioMix; 28 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. 31class AudioInputDescriptor: public AudioPortConfig 32{ 33public: 34 AudioInputDescriptor(const sp<IOProfile>& profile); 35 void setIoHandle(audio_io_handle_t ioHandle); 36 37 status_t dump(int fd); 38 39 audio_port_handle_t mId; 40 audio_io_handle_t mIoHandle; // input handle 41 audio_devices_t mDevice; // current device this input is routed to 42 AudioMix *mPolicyMix; // non NULL when used by a dynamic policy 43 audio_patch_handle_t mPatchHandle; 44 uint32_t mRefCount; // number of AudioRecord clients using 45 // this input 46 uint32_t mOpenRefCount; 47 audio_source_t mInputSource; // input source selected by application 48 //(mediarecorder.h) 49 const sp<IOProfile> mProfile; // I/O profile this output derives from 50 SortedVector<audio_session_t> mSessions; // audio sessions attached to this input 51 bool mIsSoundTrigger; // used by a soundtrigger capture 52 53 virtual void toAudioPortConfig(struct audio_port_config *dstConfig, 54 const struct audio_port_config *srcConfig = NULL) const; 55 virtual sp<AudioPort> getAudioPort() const { return mProfile; } 56 void toAudioPort(struct audio_port *port) const; 57}; 58 59}; // namespace android 60