IOProfile.h revision f129b03fa583d4cc26fd9c9171b8fb3b0ed8d4f4
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 "DeviceDescriptor.h"
21#include <utils/String8.h>
22#include <system/audio.h>
23
24namespace 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);
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_format_t *updatedFormat,
49                             audio_channel_mask_t channelMask,
50                             audio_channel_mask_t *updatedChannelMask,
51                             uint32_t flags) const;
52
53    void dump(int fd);
54    void log();
55
56    DeviceVector  mSupportedDevices; // supported devices
57                                     // (devices this output can be routed to)
58};
59
60}; // namespace android
61