Home | History | Annotate | Download | only in include
      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 <system/audio.h>
     20 #include <utils/Errors.h>
     21 #include <utils/KeyedVector.h>
     22 #include <utils/RefBase.h>
     23 #include <RoutingStrategy.h>
     24 #include <AudioPatch.h>
     25 
     26 namespace android {
     27 
     28 class SwAudioOutputDescriptor;
     29 class HwAudioOutputDescriptor;
     30 class DeviceDescriptor;
     31 
     32 class AudioSourceDescriptor: public RefBase
     33 {
     34 public:
     35     AudioSourceDescriptor(const sp<DeviceDescriptor> device, const audio_attributes_t *attributes,
     36                           uid_t uid) :
     37         mDevice(device), mAttributes(*attributes), mUid(uid) {}
     38     virtual ~AudioSourceDescriptor() {}
     39 
     40     audio_patch_handle_t getHandle() const { return mPatchDesc->mHandle; }
     41 
     42     status_t    dump(int fd);
     43 
     44     const sp<DeviceDescriptor> mDevice;
     45     const audio_attributes_t mAttributes;
     46     uid_t mUid;
     47     sp<AudioPatch> mPatchDesc;
     48     wp<SwAudioOutputDescriptor> mSwOutput;
     49     wp<HwAudioOutputDescriptor> mHwOutput;
     50 };
     51 
     52 class AudioSourceCollection :
     53         public DefaultKeyedVector< audio_patch_handle_t, sp<AudioSourceDescriptor> >
     54 {
     55 public:
     56     status_t dump(int fd) const;
     57 };
     58 
     59 }; // namespace android
     60