blob: a9d93d103e969976b3ac24a2d213bd616feea09e [file] [log] [blame]
Jean-Michel Trivi56ec4ff2015-01-23 16:45:18 -08001/*
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 Gaffiead3183e2015-03-18 16:55:35 +010017#pragma once
18
19#include "Ports.h"
20#include "Devices.h"
21#include <utils/String8.h>
22#include <system/audio.h>
23
Jean-Michel Trivi56ec4ff2015-01-23 16:45:18 -080024namespace android {
25
26class 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.
33class IOProfile : public AudioPort
34{
35public:
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