blob: 7343b9b653ba9745905da3b682a63d6e123b179b [file] [log] [blame]
Kriti Dangef6be8f2020-11-05 11:58:19 +01001/*
2 * Copyright (C) 2020 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#include <map>
18#include <set>
19
20#include <system/audio.h>
21#include <utils/Log.h>
22#include <utils/String8.h>
23
24#include "AudioPolicyTestClient.h"
25
26namespace android {
27
28class AudioPolicyManagerTestClientForHdmi : public AudioPolicyManagerTestClient {
29public:
30 String8 getParameters(audio_io_handle_t /* ioHandle */, const String8& /* keys*/ ) override {
Mikhail Naganovd4c21aa2021-10-05 15:10:16 -070031 AudioParameter mAudioParameters;
32 std::string formats;
33 for (const auto& f : mSupportedFormats) {
34 if (!formats.empty()) formats += AUDIO_PARAMETER_VALUE_LIST_SEPARATOR;
35 formats += audio_format_to_string(f);
36 }
37 mAudioParameters.add(
38 String8(AudioParameter::keyStreamSupportedFormats),
39 String8(formats.c_str()));
40 mAudioParameters.addInt(String8(AudioParameter::keyStreamSupportedSamplingRates), 48000);
41 mAudioParameters.add(String8(AudioParameter::keyStreamSupportedChannels), String8(""));
Kriti Dangef6be8f2020-11-05 11:58:19 +010042 return mAudioParameters.toString();
43 }
44
45 void addSupportedFormat(audio_format_t format) override {
Mikhail Naganovd4c21aa2021-10-05 15:10:16 -070046 mSupportedFormats.insert(format);
Kriti Dangef6be8f2020-11-05 11:58:19 +010047 }
48
49private:
Mikhail Naganovd4c21aa2021-10-05 15:10:16 -070050 std::set<audio_format_t> mSupportedFormats;
Kriti Dangef6be8f2020-11-05 11:58:19 +010051};
52
Mikhail Naganovd4c21aa2021-10-05 15:10:16 -070053} // namespace android