Eric Laurent | 1c333e2 | 2014-05-20 10:48:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2014, The Android Open Source Project |
| 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #ifndef INCLUDING_FROM_AUDIOFLINGER_H |
| 19 | #error This header file should only be included from AudioFlinger.h |
| 20 | #endif |
| 21 | |
| 22 | class PatchPanel : public RefBase { |
| 23 | public: |
| 24 | PatchPanel(const sp<AudioFlinger>& audioFlinger); |
| 25 | virtual ~PatchPanel(); |
| 26 | |
| 27 | /* List connected audio ports and their attributes */ |
| 28 | status_t listAudioPorts(unsigned int *num_ports, |
| 29 | struct audio_port *ports); |
| 30 | |
| 31 | /* Get supported attributes for a given audio port */ |
| 32 | status_t getAudioPort(struct audio_port *port); |
| 33 | |
| 34 | /* Create a patch between several source and sink ports */ |
| 35 | status_t createAudioPatch(const struct audio_patch *patch, |
| 36 | audio_patch_handle_t *handle); |
| 37 | |
| 38 | /* Release a patch */ |
| 39 | status_t releaseAudioPatch(audio_patch_handle_t handle); |
| 40 | |
| 41 | /* List connected audio devices and they attributes */ |
| 42 | status_t listAudioPatches(unsigned int *num_patches, |
| 43 | struct audio_patch *patches); |
| 44 | |
| 45 | /* Set audio port configuration */ |
| 46 | status_t setAudioPortConfig(const struct audio_port_config *config); |
| 47 | |
| 48 | class Patch { |
| 49 | public: |
| 50 | Patch(const struct audio_patch *patch) : |
| 51 | mAudioPatch(*patch), mHandle(0), mHalHandle(0) {} |
| 52 | |
| 53 | struct audio_patch mAudioPatch; |
| 54 | audio_patch_handle_t mHandle; |
| 55 | audio_patch_handle_t mHalHandle; |
| 56 | }; |
| 57 | private: |
| 58 | const wp<AudioFlinger> mAudioFlinger; |
| 59 | SortedVector <Patch *> mPatches; |
| 60 | }; |