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 "Devices.h" |
| 21 | #include <utils/String8.h> |
| 22 | #include <system/audio.h> |
| 23 | |
Jean-Michel Trivi | 56ec4ff | 2015-01-23 16:45:18 -0800 | [diff] [blame] | 24 | namespace android { |
| 25 | |
| 26 | class HwModule; |
| 27 | |
| 28 | // the IOProfile class describes the capabilities of an output or input stream. |
| 29 | // It is currently assumed that all combination of listed parameters are supported. |
| 30 | // It is used by the policy manager to determine if an output or input is suitable for |
| 31 | // a given use case, open/close it accordingly and connect/disconnect audio tracks |
| 32 | // to/from it. |
| 33 | class IOProfile : public AudioPort |
| 34 | { |
| 35 | public: |
| 36 | IOProfile(const String8& name, audio_port_role_t role, const sp<HwModule>& module); |
| 37 | virtual ~IOProfile(); |
| 38 | |
| 39 | // This method is used for both output and input. |
| 40 | // If parameter updatedSamplingRate is non-NULL, it is assigned the actual sample rate. |
| 41 | // For input, flags is interpreted as audio_input_flags_t. |
| 42 | // TODO: merge audio_output_flags_t and audio_input_flags_t. |
| 43 | bool isCompatibleProfile(audio_devices_t device, |
| 44 | String8 address, |
| 45 | uint32_t samplingRate, |
| 46 | uint32_t *updatedSamplingRate, |
| 47 | audio_format_t format, |
| 48 | audio_channel_mask_t channelMask, |
| 49 | uint32_t flags) const; |
| 50 | |
| 51 | void dump(int fd); |
| 52 | void log(); |
| 53 | |
| 54 | DeviceVector mSupportedDevices; // supported devices |
| 55 | // (devices this output can be routed to) |
| 56 | }; |
| 57 | |
| 58 | }; // namespace android |