mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Audio V4: Implement the shim core 4.0 -> legacy
All the new files added are a copy of the 2.0 ones, with just the version 2 that was changed to 4. Due to the rollback on the retrocompatiblity breakage, the split of implementation is not strictly needed any more. This makes the current split in .impl.h and double include unnecessary complicated. This will need to be factorized in a future patch. Bug: 38184704 Test: compile Change-Id: I0d699ade7558ed68125b300f8522e2767ae1ee37 Merged-In: I0d699ade7558ed68125b300f8522e2767ae1ee37 Cherry-picked from master Signed-off-by: Kevin Rocard <krocard@google.com>
This commit is contained in:
@@ -28,6 +28,8 @@ namespace implementation {
|
||||
|
||||
typedef common::V2_0::AudioDevice AudioDeviceBitfield;
|
||||
typedef common::V2_0::AudioChannelMask AudioChannelBitfield;
|
||||
typedef common::V2_0::AudioOutputFlag AudioOutputFlagBitfield;
|
||||
typedef common::V2_0::AudioInputFlag AudioInputFlagBitfield;
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
|
||||
#define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
|
||||
|
||||
#include <android/hardware/audio/4.0/types.h>
|
||||
#include <android/hardware/audio/common/4.0/types.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -28,6 +28,8 @@ namespace implementation {
|
||||
|
||||
typedef hidl_bitfield<common::V4_0::AudioDevice> AudioDeviceBitfield;
|
||||
typedef hidl_bitfield<common::V4_0::AudioChannelMask> AudioChannelBitfield;
|
||||
typedef hidl_bitfield<common::V4_0::AudioOutputFlag> AudioOutputFlagBitfield;
|
||||
typedef hidl_bitfield<common::V4_0::AudioInputFlag> AudioInputFlagBitfield;
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V4_0
|
||||
|
||||
@@ -14,6 +14,10 @@ cc_library_shared {
|
||||
"StreamOut.cpp",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DAUDIO_HAL_VERSION_2_0",
|
||||
],
|
||||
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
export_include_dirs: ["include"],
|
||||
|
||||
53
audio/core/4.0/default/Android.bp
Normal file
53
audio/core/4.0/default/Android.bp
Normal file
@@ -0,0 +1,53 @@
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio@4.0-impl",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"Conversions.cpp",
|
||||
"Device.cpp",
|
||||
"DevicesFactory.cpp",
|
||||
"ParametersUtil.cpp",
|
||||
"PrimaryDevice.cpp",
|
||||
"Stream.cpp",
|
||||
"StreamIn.cpp",
|
||||
"StreamOut.cpp",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DAUDIO_HAL_VERSION_4_0",
|
||||
],
|
||||
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
export_include_dirs: ["include"],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libfmq",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.audio@4.0",
|
||||
"android.hardware.audio.common@4.0",
|
||||
"android.hardware.audio.common@4.0-util",
|
||||
"android.hardware.audio.common-util",
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
"android.hardware.audio.core@all-versions-impl",
|
||||
"libaudioclient_headers",
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
"libmedia_headers",
|
||||
],
|
||||
|
||||
whole_static_libs: [
|
||||
"libmedia_helper",
|
||||
],
|
||||
|
||||
}
|
||||
21
audio/core/4.0/default/Conversions.cpp
Normal file
21
audio/core/4.0/default/Conversions.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/4.0/default/Conversions.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Conversions.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
28
audio/core/4.0/default/Device.cpp
Normal file
28
audio/core/4.0/default/Device.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "DeviceHAL"
|
||||
|
||||
#include "core/4.0/default/Device.h"
|
||||
#include <HidlUtils.h>
|
||||
#include "core/4.0/default/Conversions.h"
|
||||
#include "core/4.0/default/StreamIn.h"
|
||||
#include "core/4.0/default/StreamOut.h"
|
||||
#include "core/all-versions/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Device.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
25
audio/core/4.0/default/DevicesFactory.cpp
Normal file
25
audio/core/4.0/default/DevicesFactory.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "DevicesFactoryHAL"
|
||||
|
||||
#include "core/4.0/default/DevicesFactory.h"
|
||||
#include "core/4.0/default/Device.h"
|
||||
#include "core/4.0/default/PrimaryDevice.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/DevicesFactory.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
21
audio/core/4.0/default/ParametersUtil.cpp
Normal file
21
audio/core/4.0/default/ParametersUtil.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/4.0/default/ParametersUtil.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/ParametersUtil.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
24
audio/core/4.0/default/PrimaryDevice.cpp
Normal file
24
audio/core/4.0/default/PrimaryDevice.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "PrimaryDeviceHAL"
|
||||
|
||||
#include "core/4.0/default/PrimaryDevice.h"
|
||||
#include "core/all-versions/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/PrimaryDevice.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
25
audio/core/4.0/default/Stream.cpp
Normal file
25
audio/core/4.0/default/Stream.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamHAL"
|
||||
|
||||
#include "core/4.0/default/Stream.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
#include "core/4.0/default/Conversions.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Stream.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
24
audio/core/4.0/default/StreamIn.cpp
Normal file
24
audio/core/4.0/default/StreamIn.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamInHAL"
|
||||
|
||||
#include "core/4.0/default/StreamIn.h"
|
||||
#include "core/all-versions/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/StreamIn.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
24
audio/core/4.0/default/StreamOut.cpp
Normal file
24
audio/core/4.0/default/StreamOut.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamOutHAL"
|
||||
|
||||
#include "core/4.0/default/StreamOut.h"
|
||||
#include "core/all-versions/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/StreamOut.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
|
||||
|
||||
#include <android/hardware/audio/4.0/types.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Conversions.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
|
||||
28
audio/core/4.0/default/include/core/4.0/default/Device.h
Normal file
28
audio/core/4.0/default/include/core/4.0/default/Device.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
|
||||
|
||||
#include <android/hardware/audio/4.0/IDevice.h>
|
||||
|
||||
#include "ParametersUtil.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Device.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
|
||||
|
||||
#include <android/hardware/audio/4.0/IDevicesFactory.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/DevicesFactory.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
|
||||
|
||||
#include <android/hardware/audio/4.0/types.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/ParametersUtil.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
|
||||
|
||||
#include <android/hardware/audio/4.0/IPrimaryDevice.h>
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/PrimaryDevice.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
|
||||
28
audio/core/4.0/default/include/core/4.0/default/Stream.h
Normal file
28
audio/core/4.0/default/include/core/4.0/default/Stream.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
|
||||
|
||||
#include <android/hardware/audio/4.0/IStream.h>
|
||||
|
||||
#include "ParametersUtil.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Stream.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
|
||||
29
audio/core/4.0/default/include/core/4.0/default/StreamIn.h
Normal file
29
audio/core/4.0/default/include/core/4.0/default/StreamIn.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
|
||||
|
||||
#include <android/hardware/audio/4.0/IStreamIn.h>
|
||||
|
||||
#include "Device.h"
|
||||
#include "Stream.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/StreamIn.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
|
||||
29
audio/core/4.0/default/include/core/4.0/default/StreamOut.h
Normal file
29
audio/core/4.0/default/include/core/4.0/default/StreamOut.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
|
||||
|
||||
#include <android/hardware/audio/4.0/IStreamOut.h>
|
||||
|
||||
#include "Device.h"
|
||||
#include "Stream.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/StreamOut.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
|
||||
@@ -1,7 +1,6 @@
|
||||
cc_library_headers {
|
||||
name: "android.hardware.audio.core@all-versions-impl",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
|
||||
#include <VersionUtils.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
@@ -39,6 +41,9 @@ using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioInputFlagBitfield;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::
|
||||
AudioOutputFlagBitfield;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
|
||||
@@ -51,6 +56,11 @@ using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::SourceMetadata;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::SinkMetadata;
|
||||
#endif
|
||||
|
||||
struct Device : public IDevice, public ParametersUtil {
|
||||
explicit Device(audio_hw_device_t* device);
|
||||
|
||||
@@ -64,12 +74,26 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
|
||||
Return<void> getInputBufferSize(const AudioConfig& config,
|
||||
getInputBufferSize_cb _hidl_cb) override;
|
||||
|
||||
// V2 openInputStream is called by V4 input stream thus present in both versions
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb);
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlag flags,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
openOutputStream_cb _hidl_cb) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
const SourceMetadata& sourceMetadata,
|
||||
openOutputStream_cb _hidl_cb) override;
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlag flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) override;
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
const SinkMetadata& sinkMetadata,
|
||||
openInputStream_cb _hidl_cb) override;
|
||||
#endif
|
||||
|
||||
Return<bool> supportsAudioPatches() override;
|
||||
Return<void> createAudioPatch(const hidl_vec<AudioPortConfig>& sources,
|
||||
const hidl_vec<AudioPortConfig>& sinks,
|
||||
@@ -77,12 +101,27 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
Return<Result> releaseAudioPatch(int32_t patch) override;
|
||||
Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
|
||||
Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
|
||||
Return<AudioHwSync> getHwAvSync() override;
|
||||
|
||||
Return<Result> setScreenState(bool turnedOn) override;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioHwSync> getHwAvSync() override;
|
||||
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> getHwAvSync(getHwAvSync_cb _hidl_cb) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> getMicrophones(getMicrophones_cb _hidl_cb) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#endif
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
|
||||
// Utility methods for extending interfaces.
|
||||
Result analyzeStatus(const char* funcName, int status);
|
||||
|
||||
@@ -147,7 +147,10 @@ Return<void> Device::getInputBufferSize(const AudioConfig& config, getInputBuffe
|
||||
}
|
||||
|
||||
Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlag flags,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
const SourceMetadata& /* sourceMetadata */,
|
||||
#endif
|
||||
openOutputStream_cb _hidl_cb) {
|
||||
audio_config_t halConfig;
|
||||
HidlUtils::audioConfigToHal(config, &halConfig);
|
||||
@@ -174,7 +177,7 @@ Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& dev
|
||||
}
|
||||
|
||||
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlag flags,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) {
|
||||
audio_config_t halConfig;
|
||||
HidlUtils::audioConfigToHal(config, &halConfig);
|
||||
@@ -201,6 +204,24 @@ Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi
|
||||
return Void();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
const SinkMetadata& sinkMetadata,
|
||||
openInputStream_cb _hidl_cb) {
|
||||
if (sinkMetadata.tracks.size() == 0) {
|
||||
// This should never happen, the framework must not create as stream
|
||||
// if there is no client
|
||||
ALOGE("openInputStream called without tracks connected");
|
||||
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr, AudioConfig());
|
||||
return Void();
|
||||
}
|
||||
// Pick the first one as the main until the legacy API is update
|
||||
AudioSource source = sinkMetadata.tracks[0].source;
|
||||
return openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<bool> Device::supportsAudioPatches() {
|
||||
return version() >= AUDIO_DEVICE_API_VERSION_3_0;
|
||||
}
|
||||
@@ -256,32 +277,72 @@ Return<Result> Device::setAudioPortConfig(const AudioPortConfig& config) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioHwSync> Device::getHwAvSync() {
|
||||
int halHwAvSync;
|
||||
Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync);
|
||||
return retval == Result::OK ? halHwAvSync : AUDIO_HW_SYNC_INVALID;
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> Device::getHwAvSync(getHwAvSync_cb _hidl_cb) {
|
||||
int halHwAvSync;
|
||||
Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync);
|
||||
_hidl_cb(retval, halHwAvSync);
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<Result> Device::setScreenState(bool turnedOn) {
|
||||
return setParam(AudioParameter::keyScreenState, turnedOn);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> Device::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl(keys, _hidl_cb);
|
||||
getParametersImpl({}, keys, _hidl_cb);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& parameters) {
|
||||
return setParametersImpl(parameters);
|
||||
return setParametersImpl({} /* context */, parameters);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> Device::getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl(context, keys, _hidl_cb);
|
||||
return Void();
|
||||
}
|
||||
Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) {
|
||||
return setParametersImpl(context, parameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> Device::debugDump(const hidl_handle& fd) {
|
||||
return debug(fd, {});
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> Device::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /* options */) {
|
||||
if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
|
||||
analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0]));
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> Device::getMicrophones(getMicrophones_cb _hidl_cb) {
|
||||
// TODO return device microphones
|
||||
_hidl_cb(Result::NOT_SUPPORTED, {});
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Device::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
auto key = connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect;
|
||||
return setParam(key, address);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace audio
|
||||
|
||||
@@ -37,11 +37,19 @@ using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
struct DevicesFactory : public IDevicesFactory {
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override;
|
||||
#endif
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> openDevice(const hidl_string& device, openDevice_cb _hidl_cb) override;
|
||||
Return<void> openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
static const char* deviceToString(IDevicesFactory::Device device);
|
||||
template <class DeviceShim, class Callback>
|
||||
Return<void> openDevice(const char* moduleName, Callback _hidl_cb);
|
||||
Return<void> openDevice(const char* moduleName, openDevice_cb _hidl_cb);
|
||||
|
||||
static int loadAudioInterface(const char* if_name, audio_hw_device_t** dev);
|
||||
};
|
||||
|
||||
|
||||
@@ -26,21 +26,54 @@ namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
// static
|
||||
const char* DevicesFactory::deviceToString(IDevicesFactory::Device device) {
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
|
||||
switch (device) {
|
||||
case IDevicesFactory::Device::PRIMARY:
|
||||
return AUDIO_HARDWARE_MODULE_ID_PRIMARY;
|
||||
return openDevice<PrimaryDevice>(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb);
|
||||
case IDevicesFactory::Device::A2DP:
|
||||
return AUDIO_HARDWARE_MODULE_ID_A2DP;
|
||||
return openDevice(AUDIO_HARDWARE_MODULE_ID_A2DP, _hidl_cb);
|
||||
case IDevicesFactory::Device::USB:
|
||||
return AUDIO_HARDWARE_MODULE_ID_USB;
|
||||
return openDevice(AUDIO_HARDWARE_MODULE_ID_USB, _hidl_cb);
|
||||
case IDevicesFactory::Device::R_SUBMIX:
|
||||
return AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX;
|
||||
return openDevice(AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX, _hidl_cb);
|
||||
case IDevicesFactory::Device::STUB:
|
||||
return AUDIO_HARDWARE_MODULE_ID_STUB;
|
||||
return openDevice(AUDIO_HARDWARE_MODULE_ID_STUB, _hidl_cb);
|
||||
}
|
||||
return nullptr;
|
||||
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr);
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> DevicesFactory::openDevice(const hidl_string& moduleName, openDevice_cb _hidl_cb) {
|
||||
if (moduleName == AUDIO_HARDWARE_MODULE_ID_PRIMARY) {
|
||||
return openDevice<PrimaryDevice>(moduleName.c_str(), _hidl_cb);
|
||||
}
|
||||
return openDevice(moduleName.c_str(), _hidl_cb);
|
||||
}
|
||||
Return<void> DevicesFactory::openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) {
|
||||
return openDevice<PrimaryDevice>(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> DevicesFactory::openDevice(const char* moduleName, openDevice_cb _hidl_cb) {
|
||||
return openDevice<implementation::Device>(moduleName, _hidl_cb);
|
||||
}
|
||||
|
||||
template <class DeviceShim, class Callback>
|
||||
Return<void> DevicesFactory::openDevice(const char* moduleName, Callback _hidl_cb) {
|
||||
audio_hw_device_t* halDevice;
|
||||
Result retval(Result::INVALID_ARGUMENTS);
|
||||
sp<DeviceShim> result;
|
||||
int halStatus = loadAudioInterface(moduleName, &halDevice);
|
||||
if (halStatus == OK) {
|
||||
result = new DeviceShim(halDevice);
|
||||
retval = Result::OK;
|
||||
} else if (halStatus == -EINVAL) {
|
||||
retval = Result::NOT_INITIALIZED;
|
||||
}
|
||||
_hidl_cb(retval, result);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -73,30 +106,6 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
|
||||
Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
|
||||
audio_hw_device_t* halDevice;
|
||||
Result retval(Result::INVALID_ARGUMENTS);
|
||||
sp<IDevice> result;
|
||||
const char* moduleName = deviceToString(device);
|
||||
if (moduleName != nullptr) {
|
||||
int halStatus = loadAudioInterface(moduleName, &halDevice);
|
||||
if (halStatus == OK) {
|
||||
if (device == IDevicesFactory::Device::PRIMARY) {
|
||||
result = new PrimaryDevice(halDevice);
|
||||
} else {
|
||||
result = new ::android::hardware::audio::AUDIO_HAL_VERSION::implementation::Device(
|
||||
halDevice);
|
||||
}
|
||||
retval = Result::OK;
|
||||
} else if (halStatus == -EINVAL) {
|
||||
retval = Result::NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
_hidl_cb(retval, result);
|
||||
return Void();
|
||||
}
|
||||
|
||||
IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* /* name */) {
|
||||
return new DevicesFactory();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::hardware::hidl_string;
|
||||
@@ -37,16 +38,18 @@ class ParametersUtil {
|
||||
public:
|
||||
Result getParam(const char* name, bool* value);
|
||||
Result getParam(const char* name, int* value);
|
||||
Result getParam(const char* name, String8* value);
|
||||
Result getParam(const char* name, String8* value, AudioParameter context = {});
|
||||
void getParametersImpl(
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
const hidl_vec<ParameterValue>& context, const hidl_vec<hidl_string>& keys,
|
||||
std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb);
|
||||
std::unique_ptr<AudioParameter> getParams(const AudioParameter& keys);
|
||||
Result setParam(const char* name, bool value);
|
||||
Result setParam(const char* name, int value);
|
||||
Result setParam(const char* name, const char* value);
|
||||
Result setParametersImpl(const hidl_vec<ParameterValue>& parameters);
|
||||
Result setParam(const char* name, float value);
|
||||
Result setParametersImpl(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters);
|
||||
Result setParams(const AudioParameter& param);
|
||||
Result setParam(const char* name, const DeviceAddress& address);
|
||||
|
||||
protected:
|
||||
virtual ~ParametersUtil() {}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#include <core/all-versions/default/Conversions.h>
|
||||
#include <system/audio.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -62,18 +64,20 @@ Result ParametersUtil::getParam(const char* name, int* value) {
|
||||
return getHalStatusToResult(params->getInt(halName, *value));
|
||||
}
|
||||
|
||||
Result ParametersUtil::getParam(const char* name, String8* value) {
|
||||
Result ParametersUtil::getParam(const char* name, String8* value, AudioParameter context) {
|
||||
const String8 halName(name);
|
||||
AudioParameter keys;
|
||||
keys.addKey(halName);
|
||||
std::unique_ptr<AudioParameter> params = getParams(keys);
|
||||
context.addKey(halName);
|
||||
std::unique_ptr<AudioParameter> params = getParams(context);
|
||||
return getHalStatusToResult(params->get(halName, *value));
|
||||
}
|
||||
|
||||
void ParametersUtil::getParametersImpl(
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
const hidl_vec<ParameterValue>& context, const hidl_vec<hidl_string>& keys,
|
||||
std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb) {
|
||||
AudioParameter halKeys;
|
||||
for (auto& pair : context) {
|
||||
halKeys.add(String8(pair.key.c_str()), String8(pair.value.c_str()));
|
||||
}
|
||||
for (size_t i = 0; i < keys.size(); ++i) {
|
||||
halKeys.addKey(String8(keys[i].c_str()));
|
||||
}
|
||||
@@ -120,19 +124,28 @@ Result ParametersUtil::setParam(const char* name, int value) {
|
||||
return setParams(param);
|
||||
}
|
||||
|
||||
Result ParametersUtil::setParam(const char* name, const char* value) {
|
||||
Result ParametersUtil::setParam(const char* name, float value) {
|
||||
AudioParameter param;
|
||||
param.add(String8(name), String8(value));
|
||||
param.addFloat(String8(name), value);
|
||||
return setParams(param);
|
||||
}
|
||||
|
||||
Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& parameters) {
|
||||
Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) {
|
||||
AudioParameter params;
|
||||
for (auto& pair : context) {
|
||||
params.add(String8(pair.key.c_str()), String8(pair.value.c_str()));
|
||||
}
|
||||
for (size_t i = 0; i < parameters.size(); ++i) {
|
||||
params.add(String8(parameters[i].key.c_str()), String8(parameters[i].value.c_str()));
|
||||
}
|
||||
return setParams(params);
|
||||
}
|
||||
Result ParametersUtil::setParam(const char* name, const DeviceAddress& address) {
|
||||
AudioParameter params(String8(deviceAddressToHal(address).c_str()));
|
||||
params.addInt(String8(name), int(address.device));
|
||||
return setParams(params);
|
||||
}
|
||||
|
||||
Result ParametersUtil::setParams(const AudioParameter& param) {
|
||||
int halStatus = halSetParameters(param.toString().string());
|
||||
|
||||
@@ -59,12 +59,24 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
|
||||
Return<void> getInputBufferSize(const AudioConfig& config,
|
||||
getInputBufferSize_cb _hidl_cb) override;
|
||||
|
||||
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlag flags,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
const SourceMetadata& sourceMetadata,
|
||||
#endif
|
||||
openOutputStream_cb _hidl_cb) override;
|
||||
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlag flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) override;
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb);
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
const SinkMetadata& sinkMetadata,
|
||||
openInputStream_cb _hidl_cb) override;
|
||||
#endif
|
||||
|
||||
Return<bool> supportsAudioPatches() override;
|
||||
Return<void> createAudioPatch(const hidl_vec<AudioPortConfig>& sources,
|
||||
const hidl_vec<AudioPortConfig>& sinks,
|
||||
@@ -72,12 +84,27 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
Return<Result> releaseAudioPatch(int32_t patch) override;
|
||||
Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
|
||||
Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
|
||||
Return<AudioHwSync> getHwAvSync() override;
|
||||
|
||||
Return<Result> setScreenState(bool turnedOn) override;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioHwSync> getHwAvSync() override;
|
||||
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> getHwAvSync(getHwAvSync_cb _hidl_cb) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> getMicrophones(getMicrophones_cb _hidl_cb) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#endif
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
|
||||
Return<Result> setVoiceVolume(float volume) override;
|
||||
@@ -91,6 +118,15 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
Return<void> getHacEnabled(getHacEnabled_cb _hidl_cb) override;
|
||||
Return<Result> setHacEnabled(bool enabled) override;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<Result> setBtScoHeadsetDebugName(const hidl_string& name) override;
|
||||
Return<void> getBtHfpEnabled(getBtHfpEnabled_cb _hidl_cb) override;
|
||||
Return<Result> setBtHfpEnabled(bool enabled) override;
|
||||
Return<Result> setBtHfpSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<Result> setBtHfpVolume(float volume) override;
|
||||
Return<Result> updateRotation(IPrimaryDevice::Rotation rotation) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
sp<Device> mDevice;
|
||||
|
||||
|
||||
@@ -60,17 +60,35 @@ Return<void> PrimaryDevice::getInputBufferSize(const AudioConfig& config,
|
||||
return mDevice->getInputBufferSize(config, _hidl_cb);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlag flags,
|
||||
const AudioConfig& config,
|
||||
AudioOutputFlagBitfield flags,
|
||||
openOutputStream_cb _hidl_cb) {
|
||||
return mDevice->openOutputStream(ioHandle, device, config, flags, _hidl_cb);
|
||||
}
|
||||
|
||||
Return<void> PrimaryDevice::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlag flags,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) {
|
||||
return mDevice->openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
AudioOutputFlagBitfield flags,
|
||||
const SourceMetadata& sourceMetadata,
|
||||
openOutputStream_cb _hidl_cb) {
|
||||
return mDevice->openOutputStream(ioHandle, device, config, flags, sourceMetadata, _hidl_cb);
|
||||
}
|
||||
|
||||
Return<void> PrimaryDevice::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
const SinkMetadata& sinkMetadata,
|
||||
openInputStream_cb _hidl_cb) {
|
||||
return mDevice->openInputStream(ioHandle, device, config, flags, sinkMetadata, _hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<bool> PrimaryDevice::supportsAudioPatches() {
|
||||
return mDevice->supportsAudioPatches();
|
||||
@@ -94,14 +112,15 @@ Return<Result> PrimaryDevice::setAudioPortConfig(const AudioPortConfig& config)
|
||||
return mDevice->setAudioPortConfig(config);
|
||||
}
|
||||
|
||||
Return<AudioHwSync> PrimaryDevice::getHwAvSync() {
|
||||
return mDevice->getHwAvSync();
|
||||
}
|
||||
|
||||
Return<Result> PrimaryDevice::setScreenState(bool turnedOn) {
|
||||
return mDevice->setScreenState(turnedOn);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioHwSync> PrimaryDevice::getHwAvSync() {
|
||||
return mDevice->getHwAvSync();
|
||||
}
|
||||
|
||||
Return<void> PrimaryDevice::getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) {
|
||||
return mDevice->getParameters(keys, _hidl_cb);
|
||||
@@ -114,6 +133,26 @@ Return<Result> PrimaryDevice::setParameters(const hidl_vec<ParameterValue>& para
|
||||
Return<void> PrimaryDevice::debugDump(const hidl_handle& fd) {
|
||||
return mDevice->debugDump(fd);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> PrimaryDevice::getHwAvSync(getHwAvSync_cb _hidl_cb) {
|
||||
return mDevice->getHwAvSync(_hidl_cb);
|
||||
}
|
||||
Return<void> PrimaryDevice::getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) {
|
||||
return mDevice->getParameters(context, keys, _hidl_cb);
|
||||
}
|
||||
Return<Result> PrimaryDevice::setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) {
|
||||
return mDevice->setParameters(context, parameters);
|
||||
}
|
||||
Return<void> PrimaryDevice::getMicrophones(getMicrophones_cb _hidl_cb) {
|
||||
return mDevice->getMicrophones(_hidl_cb);
|
||||
}
|
||||
Return<Result> PrimaryDevice::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mDevice->setConnectedState(address, connected);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
|
||||
Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
|
||||
@@ -188,6 +227,35 @@ Return<Result> PrimaryDevice::setHacEnabled(bool enabled) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_HAC, enabled);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<Result> PrimaryDevice::setBtScoHeadsetDebugName(const hidl_string& name) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_BT_SCO_HEADSET_NAME, name.c_str());
|
||||
}
|
||||
Return<void> PrimaryDevice::getBtHfpEnabled(getBtHfpEnabled_cb _hidl_cb) {
|
||||
bool enabled;
|
||||
Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_HFP_ENABLE, &enabled);
|
||||
_hidl_cb(retval, enabled);
|
||||
return Void();
|
||||
}
|
||||
Return<Result> PrimaryDevice::setBtHfpEnabled(bool enabled) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_ENABLE, enabled);
|
||||
}
|
||||
Return<Result> PrimaryDevice::setBtHfpSampleRate(uint32_t sampleRateHz) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_SET_SAMPLING_RATE, int(sampleRateHz));
|
||||
}
|
||||
Return<Result> PrimaryDevice::setBtHfpVolume(float volume) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_VOLUME, volume);
|
||||
}
|
||||
Return<Result> PrimaryDevice::updateRotation(IPrimaryDevice::Rotation rotation) {
|
||||
// legacy API expects the rotation in degree
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_ROTATION, int(rotation) * 90);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> PrimaryDevice::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
|
||||
return mDevice->debug(fd, options);
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace audio
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
|
||||
#include <VersionUtils.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
@@ -32,6 +34,7 @@ namespace implementation {
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
@@ -57,11 +60,15 @@ struct Stream : public IStream, public ParametersUtil {
|
||||
Return<uint64_t> getFrameCount() override;
|
||||
Return<uint64_t> getBufferSize() override;
|
||||
Return<uint32_t> getSampleRate() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
|
||||
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<AudioChannelMask> getChannelMask() override;
|
||||
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
|
||||
Return<Result> setChannelMask(AudioChannelMask mask) override;
|
||||
#endif
|
||||
Return<void> getSupportedSampleRates(AudioFormat format, getSupportedSampleRates_cb _hidl_cb);
|
||||
Return<void> getSupportedChannelMasks(AudioFormat format, getSupportedChannelMasks_cb _hidl_cb);
|
||||
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<AudioChannelBitfield> getChannelMask() override;
|
||||
Return<Result> setChannelMask(AudioChannelBitfield mask) override;
|
||||
Return<AudioFormat> getFormat() override;
|
||||
Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
|
||||
Return<Result> setFormat(AudioFormat format) override;
|
||||
@@ -69,20 +76,34 @@ struct Stream : public IStream, public ParametersUtil {
|
||||
Return<Result> addEffect(uint64_t effectId) override;
|
||||
Return<Result> removeEffect(uint64_t effectId) override;
|
||||
Return<Result> standby() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioDevice> getDevice() override;
|
||||
Return<Result> setDevice(const DeviceAddress& address) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
|
||||
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> getDevices(getDevices_cb _hidl_cb) override;
|
||||
Return<Result> setDevices(const hidl_vec<DeviceAddress>& devices) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) override;
|
||||
#endif
|
||||
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
|
||||
Return<Result> start() override;
|
||||
Return<Result> stop() override;
|
||||
Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
|
||||
Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
|
||||
Return<Result> close() override;
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#endif
|
||||
|
||||
// Utility methods for extending interfaces.
|
||||
static Result analyzeStatus(const char* funcName, int status);
|
||||
static Result analyzeStatus(const char* funcName, int status,
|
||||
|
||||
@@ -100,9 +100,22 @@ Return<uint32_t> Stream::getSampleRate() {
|
||||
return mStream->get_sample_rate(mStream);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
|
||||
return getSupportedSampleRates(getFormat(), _hidl_cb);
|
||||
}
|
||||
Return<void> Stream::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return getSupportedChannelMasks(getFormat(), _hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> Stream::getSupportedSampleRates(AudioFormat format,
|
||||
getSupportedSampleRates_cb _hidl_cb) {
|
||||
AudioParameter context;
|
||||
context.addInt(String8(AUDIO_PARAMETER_STREAM_FORMAT), int(format));
|
||||
String8 halListValue;
|
||||
Result result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue);
|
||||
Result result =
|
||||
getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context);
|
||||
hidl_vec<uint32_t> sampleRates;
|
||||
SortedVector<uint32_t> halSampleRates;
|
||||
if (result == Result::OK) {
|
||||
@@ -110,7 +123,36 @@ Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb
|
||||
samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator);
|
||||
sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size());
|
||||
}
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
_hidl_cb(sampleRates);
|
||||
#endif
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
_hidl_cb(result, sampleRates);
|
||||
#endif
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Stream::getSupportedChannelMasks(AudioFormat format,
|
||||
getSupportedChannelMasks_cb _hidl_cb) {
|
||||
AudioParameter context;
|
||||
context.addInt(String8(AUDIO_PARAMETER_STREAM_FORMAT), int(format));
|
||||
String8 halListValue;
|
||||
Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context);
|
||||
hidl_vec<AudioChannelBitfield> channelMasks;
|
||||
SortedVector<audio_channel_mask_t> halChannelMasks;
|
||||
if (result == Result::OK) {
|
||||
halChannelMasks =
|
||||
channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator);
|
||||
channelMasks.resize(halChannelMasks.size());
|
||||
for (size_t i = 0; i < halChannelMasks.size(); ++i) {
|
||||
channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]);
|
||||
}
|
||||
}
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
_hidl_cb(channelMasks);
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
_hidl_cb(result, channelMasks);
|
||||
#endif
|
||||
return Void();
|
||||
}
|
||||
|
||||
@@ -118,28 +160,11 @@ Return<Result> Stream::setSampleRate(uint32_t sampleRateHz) {
|
||||
return setParam(AudioParameter::keySamplingRate, static_cast<int>(sampleRateHz));
|
||||
}
|
||||
|
||||
Return<AudioChannelMask> Stream::getChannelMask() {
|
||||
return AudioChannelMask(mStream->get_channels(mStream));
|
||||
Return<AudioChannelBitfield> Stream::getChannelMask() {
|
||||
return AudioChannelBitfield(mStream->get_channels(mStream));
|
||||
}
|
||||
|
||||
Return<void> Stream::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
String8 halListValue;
|
||||
Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue);
|
||||
hidl_vec<AudioChannelMask> channelMasks;
|
||||
SortedVector<audio_channel_mask_t> halChannelMasks;
|
||||
if (result == Result::OK) {
|
||||
halChannelMasks =
|
||||
channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator);
|
||||
channelMasks.resize(halChannelMasks.size());
|
||||
for (size_t i = 0; i < halChannelMasks.size(); ++i) {
|
||||
channelMasks[i] = AudioChannelMask(halChannelMasks[i]);
|
||||
}
|
||||
}
|
||||
_hidl_cb(channelMasks);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Stream::setChannelMask(AudioChannelMask mask) {
|
||||
Return<Result> Stream::setChannelMask(AudioChannelBitfield mask) {
|
||||
return setParam(AudioParameter::keyChannels, static_cast<int>(mask));
|
||||
}
|
||||
|
||||
@@ -171,7 +196,7 @@ Return<void> Stream::getAudioProperties(getAudioProperties_cb _hidl_cb) {
|
||||
uint32_t halSampleRate = mStream->get_sample_rate(mStream);
|
||||
audio_channel_mask_t halMask = mStream->get_channels(mStream);
|
||||
audio_format_t halFormat = mStream->get_format(mStream);
|
||||
_hidl_cb(halSampleRate, AudioChannelMask(halMask), AudioFormat(halFormat));
|
||||
_hidl_cb(halSampleRate, AudioChannelBitfield(halMask), AudioFormat(halFormat));
|
||||
return Void();
|
||||
}
|
||||
|
||||
@@ -200,48 +225,73 @@ Return<Result> Stream::standby() {
|
||||
return analyzeStatus("standby", mStream->standby(mStream));
|
||||
}
|
||||
|
||||
Return<Result> Stream::setHwAvSync(uint32_t hwAvSync) {
|
||||
return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioDevice> Stream::getDevice() {
|
||||
int device;
|
||||
int device = 0;
|
||||
Result retval = getParam(AudioParameter::keyRouting, &device);
|
||||
return retval == Result::OK ? static_cast<AudioDevice>(device) : AudioDevice::NONE;
|
||||
}
|
||||
|
||||
Return<Result> Stream::setDevice(const DeviceAddress& address) {
|
||||
char* halDeviceAddress = audio_device_address_to_parameter(
|
||||
static_cast<audio_devices_t>(address.device), deviceAddressToHal(address).c_str());
|
||||
AudioParameter params((String8(halDeviceAddress)));
|
||||
free(halDeviceAddress);
|
||||
params.addInt(String8(AudioParameter::keyRouting),
|
||||
static_cast<audio_devices_t>(address.device));
|
||||
return setParams(params);
|
||||
return setParam(AudioParameter::keyRouting, address);
|
||||
}
|
||||
|
||||
Return<void> Stream::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl({} /* context */, keys, _hidl_cb);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& parameters) {
|
||||
return setParametersImpl({} /* context */, parameters);
|
||||
}
|
||||
|
||||
Return<Result> Stream::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return setParam(
|
||||
connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect,
|
||||
deviceAddressToHal(address).c_str());
|
||||
address);
|
||||
}
|
||||
|
||||
Return<Result> Stream::setHwAvSync(uint32_t hwAvSync) {
|
||||
return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
|
||||
}
|
||||
|
||||
Return<void> Stream::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl(keys, _hidl_cb);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& parameters) {
|
||||
return setParametersImpl(parameters);
|
||||
}
|
||||
|
||||
Return<void> Stream::debugDump(const hidl_handle& fd) {
|
||||
if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
|
||||
analyzeStatus("dump", mStream->dump(mStream, fd->data[0]));
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> Stream::getDevices(getDevices_cb _hidl_cb) {
|
||||
int device = 0;
|
||||
Result retval = getParam(AudioParameter::keyRouting, &device);
|
||||
hidl_vec<DeviceAddress> devices;
|
||||
if (retval == Result::OK) {
|
||||
devices.resize(1);
|
||||
devices[0].device = static_cast<AudioDevice>(device);
|
||||
}
|
||||
_hidl_cb(retval, devices);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Stream::setDevices(const hidl_vec<DeviceAddress>& devices) {
|
||||
// FIXME: can the legacy API set multiple device with address ?
|
||||
if (devices.size() > 1) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
DeviceAddress address;
|
||||
if (devices.size() == 1) {
|
||||
address = devices[0];
|
||||
} else {
|
||||
address.device = AudioDevice::NONE;
|
||||
}
|
||||
return setParam(AudioParameter::keyRouting, address);
|
||||
}
|
||||
Return<void> Stream::getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl(context, keys, _hidl_cb);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) {
|
||||
return setParametersImpl(context, parameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<Result> Stream::start() {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
@@ -269,6 +319,19 @@ Return<Result> Stream::close() {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Return<void> Stream::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /* options */) {
|
||||
if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
|
||||
analyzeStatus("dump", mStream->dump(mStream, fd->data[0]));
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> Stream::debugDump(const hidl_handle& fd) {
|
||||
return debug(fd, {} /* options */);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace audio
|
||||
|
||||
@@ -58,11 +58,15 @@ struct StreamIn : public IStreamIn {
|
||||
Return<uint64_t> getFrameCount() override;
|
||||
Return<uint64_t> getBufferSize() override;
|
||||
Return<uint32_t> getSampleRate() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
|
||||
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<AudioChannelMask> getChannelMask() override;
|
||||
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
|
||||
Return<Result> setChannelMask(AudioChannelMask mask) override;
|
||||
#endif
|
||||
Return<void> getSupportedSampleRates(AudioFormat format, getSupportedSampleRates_cb _hidl_cb);
|
||||
Return<void> getSupportedChannelMasks(AudioFormat format, getSupportedChannelMasks_cb _hidl_cb);
|
||||
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<AudioChannelBitfield> getChannelMask() override;
|
||||
Return<Result> setChannelMask(AudioChannelBitfield mask) override;
|
||||
Return<AudioFormat> getFormat() override;
|
||||
Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
|
||||
Return<Result> setFormat(AudioFormat format) override;
|
||||
@@ -70,16 +74,30 @@ struct StreamIn : public IStreamIn {
|
||||
Return<Result> addEffect(uint64_t effectId) override;
|
||||
Return<Result> removeEffect(uint64_t effectId) override;
|
||||
Return<Result> standby() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioDevice> getDevice() override;
|
||||
Return<Result> setDevice(const DeviceAddress& address) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
|
||||
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> getDevices(getDevices_cb _hidl_cb) override;
|
||||
Return<Result> setDevices(const hidl_vec<DeviceAddress>& devices) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) override;
|
||||
#endif
|
||||
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
|
||||
Return<Result> close() override;
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#endif
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
|
||||
Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override;
|
||||
Return<Result> setGain(float gain) override;
|
||||
@@ -91,6 +109,10 @@ struct StreamIn : public IStreamIn {
|
||||
Return<Result> stop() override;
|
||||
Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
|
||||
Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> updateSinkMetadata(const SinkMetadata& sinkMetadata) override;
|
||||
Return<void> getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) override;
|
||||
#endif
|
||||
|
||||
static Result getCapturePositionImpl(audio_stream_in_t* stream, uint64_t* frames,
|
||||
uint64_t* time);
|
||||
|
||||
@@ -179,23 +179,33 @@ Return<uint32_t> StreamIn::getSampleRate() {
|
||||
return mStreamCommon->getSampleRate();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
|
||||
}
|
||||
Return<void> StreamIn::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedSampleRates(_hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> StreamIn::getSupportedChannelMasks(AudioFormat format,
|
||||
getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(format, _hidl_cb);
|
||||
}
|
||||
Return<void> StreamIn::getSupportedSampleRates(AudioFormat format,
|
||||
getSupportedSampleRates_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedSampleRates(format, _hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setSampleRate(uint32_t sampleRateHz) {
|
||||
return mStreamCommon->setSampleRate(sampleRateHz);
|
||||
}
|
||||
|
||||
Return<AudioChannelMask> StreamIn::getChannelMask() {
|
||||
Return<AudioChannelBitfield> StreamIn::getChannelMask() {
|
||||
return mStreamCommon->getChannelMask();
|
||||
}
|
||||
|
||||
Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setChannelMask(AudioChannelMask mask) {
|
||||
Return<Result> StreamIn::setChannelMask(AudioChannelBitfield mask) {
|
||||
return mStreamCommon->setChannelMask(mask);
|
||||
}
|
||||
|
||||
@@ -227,6 +237,15 @@ Return<Result> StreamIn::standby() {
|
||||
return mStreamCommon->standby();
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setHwAvSync(uint32_t hwAvSync) {
|
||||
return mStreamCommon->setHwAvSync(hwAvSync);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mStreamCommon->setConnectedState(address, connected);
|
||||
}
|
||||
|
||||
Return<AudioDevice> StreamIn::getDevice() {
|
||||
return mStreamCommon->getDevice();
|
||||
}
|
||||
@@ -235,14 +254,6 @@ Return<Result> StreamIn::setDevice(const DeviceAddress& address) {
|
||||
return mStreamCommon->setDevice(address);
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mStreamCommon->setConnectedState(address, connected);
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setHwAvSync(uint32_t hwAvSync) {
|
||||
return mStreamCommon->setHwAvSync(hwAvSync);
|
||||
}
|
||||
|
||||
Return<void> StreamIn::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
return mStreamCommon->getParameters(keys, _hidl_cb);
|
||||
}
|
||||
@@ -254,6 +265,24 @@ Return<Result> StreamIn::setParameters(const hidl_vec<ParameterValue>& parameter
|
||||
Return<void> StreamIn::debugDump(const hidl_handle& fd) {
|
||||
return mStreamCommon->debugDump(fd);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> StreamIn::getDevices(getDevices_cb _hidl_cb) {
|
||||
return mStreamCommon->getDevices(_hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setDevices(const hidl_vec<DeviceAddress>& devices) {
|
||||
return mStreamCommon->setDevices(devices);
|
||||
}
|
||||
Return<void> StreamIn::getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
return mStreamCommon->getParameters(context, keys, _hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) {
|
||||
return mStreamCommon->setParameters(context, parameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<Result> StreamIn::start() {
|
||||
return mStreamMmap->start();
|
||||
@@ -415,6 +444,21 @@ Return<void> StreamIn::getCapturePosition(getCapturePosition_cb _hidl_cb) {
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> StreamIn::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
|
||||
return mStreamCommon->debug(fd, options);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> StreamIn::updateSinkMetadata(const SinkMetadata& /*sinkMetadata*/) {
|
||||
return Void(); // TODO: propagate to legacy
|
||||
}
|
||||
|
||||
Return<void> StreamIn::getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) {
|
||||
_hidl_cb(Result::NOT_SUPPORTED, {}); // TODO: retrieve from legacy
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace audio
|
||||
|
||||
@@ -60,11 +60,15 @@ struct StreamOut : public IStreamOut {
|
||||
Return<uint64_t> getFrameCount() override;
|
||||
Return<uint64_t> getBufferSize() override;
|
||||
Return<uint32_t> getSampleRate() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
|
||||
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<AudioChannelMask> getChannelMask() override;
|
||||
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
|
||||
Return<Result> setChannelMask(AudioChannelMask mask) override;
|
||||
#endif
|
||||
Return<void> getSupportedSampleRates(AudioFormat format, getSupportedSampleRates_cb _hidl_cb);
|
||||
Return<void> getSupportedChannelMasks(AudioFormat format, getSupportedChannelMasks_cb _hidl_cb);
|
||||
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
|
||||
Return<AudioChannelBitfield> getChannelMask() override;
|
||||
Return<Result> setChannelMask(AudioChannelBitfield mask) override;
|
||||
Return<AudioFormat> getFormat() override;
|
||||
Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
|
||||
Return<Result> setFormat(AudioFormat format) override;
|
||||
@@ -72,16 +76,30 @@ struct StreamOut : public IStreamOut {
|
||||
Return<Result> addEffect(uint64_t effectId) override;
|
||||
Return<Result> removeEffect(uint64_t effectId) override;
|
||||
Return<Result> standby() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<AudioDevice> getDevice() override;
|
||||
Return<Result> setDevice(const DeviceAddress& address) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
|
||||
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> getDevices(getDevices_cb _hidl_cb) override;
|
||||
Return<Result> setDevices(const hidl_vec<DeviceAddress>& devices) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) override;
|
||||
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) override;
|
||||
#endif
|
||||
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
|
||||
Return<Result> close() override;
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#endif
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
|
||||
Return<uint32_t> getLatency() override;
|
||||
Return<Result> setVolume(float left, float right) override;
|
||||
@@ -102,6 +120,10 @@ struct StreamOut : public IStreamOut {
|
||||
Return<Result> stop() override;
|
||||
Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
|
||||
Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> updateSourceMetadata(const SourceMetadata& sourceMetadata) override;
|
||||
Return<Result> selectPresentation(int32_t presentationId, int32_t programId) override;
|
||||
#endif
|
||||
|
||||
static Result getPresentationPositionImpl(audio_stream_out_t* stream, uint64_t* frames,
|
||||
TimeSpec* timeStamp);
|
||||
|
||||
@@ -183,23 +183,33 @@ Return<uint32_t> StreamOut::getSampleRate() {
|
||||
return mStreamCommon->getSampleRate();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<void> StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
|
||||
}
|
||||
Return<void> StreamOut::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedSampleRates(_hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> StreamOut::getSupportedChannelMasks(AudioFormat format,
|
||||
getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(format, _hidl_cb);
|
||||
}
|
||||
Return<void> StreamOut::getSupportedSampleRates(AudioFormat format,
|
||||
getSupportedSampleRates_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedSampleRates(format, _hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setSampleRate(uint32_t sampleRateHz) {
|
||||
return mStreamCommon->setSampleRate(sampleRateHz);
|
||||
}
|
||||
|
||||
Return<AudioChannelMask> StreamOut::getChannelMask() {
|
||||
Return<AudioChannelBitfield> StreamOut::getChannelMask() {
|
||||
return mStreamCommon->getChannelMask();
|
||||
}
|
||||
|
||||
Return<void> StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setChannelMask(AudioChannelMask mask) {
|
||||
Return<Result> StreamOut::setChannelMask(AudioChannelBitfield mask) {
|
||||
return mStreamCommon->setChannelMask(mask);
|
||||
}
|
||||
|
||||
@@ -231,6 +241,15 @@ Return<Result> StreamOut::standby() {
|
||||
return mStreamCommon->standby();
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setHwAvSync(uint32_t hwAvSync) {
|
||||
return mStreamCommon->setHwAvSync(hwAvSync);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
Return<Result> StreamOut::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mStreamCommon->setConnectedState(address, connected);
|
||||
}
|
||||
|
||||
Return<AudioDevice> StreamOut::getDevice() {
|
||||
return mStreamCommon->getDevice();
|
||||
}
|
||||
@@ -239,14 +258,6 @@ Return<Result> StreamOut::setDevice(const DeviceAddress& address) {
|
||||
return mStreamCommon->setDevice(address);
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mStreamCommon->setConnectedState(address, connected);
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setHwAvSync(uint32_t hwAvSync) {
|
||||
return mStreamCommon->setHwAvSync(hwAvSync);
|
||||
}
|
||||
|
||||
Return<void> StreamOut::getParameters(const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) {
|
||||
return mStreamCommon->getParameters(keys, _hidl_cb);
|
||||
@@ -259,6 +270,25 @@ Return<Result> StreamOut::setParameters(const hidl_vec<ParameterValue>& paramete
|
||||
Return<void> StreamOut::debugDump(const hidl_handle& fd) {
|
||||
return mStreamCommon->debugDump(fd);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> StreamOut::getDevices(getDevices_cb _hidl_cb) {
|
||||
return mStreamCommon->getDevices(_hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setDevices(const hidl_vec<DeviceAddress>& devices) {
|
||||
return mStreamCommon->setDevices(devices);
|
||||
}
|
||||
Return<void> StreamOut::getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
getParameters_cb _hidl_cb) {
|
||||
return mStreamCommon->getParameters(context, keys, _hidl_cb);
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<ParameterValue>& parameters) {
|
||||
return mStreamCommon->setParameters(context, parameters);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<Result> StreamOut::close() {
|
||||
if (mIsClosed) return Result::INVALID_STATE;
|
||||
@@ -512,6 +542,19 @@ Return<void> StreamOut::getMmapPosition(getMmapPosition_cb _hidl_cb) {
|
||||
return mStreamMmap->getMmapPosition(_hidl_cb);
|
||||
}
|
||||
|
||||
Return<void> StreamOut::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
|
||||
return mStreamCommon->debug(fd, options);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
Return<void> StreamOut::updateSourceMetadata(const SourceMetadata& /*sourceMetadata*/) {
|
||||
return Void(); // TODO: propagate to legacy
|
||||
}
|
||||
Return<Result> StreamOut::selectPresentation(int32_t /*presentationId*/, int32_t /*programId*/) {
|
||||
return Result::NOT_SUPPORTED; // TODO: propagate to legacy
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace audio
|
||||
|
||||
Reference in New Issue
Block a user