mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 02:42:35 +00:00
Audio V4: Make common helper version independent
The implementation uses the version provided by macro. Bug: 38184704 Test: compile Change-Id: Ib5565bdf77ed9e42fc8271a4317eb88681aefcd5 Signed-off-by: Kevin Rocard <krocard@google.com>
This commit is contained in:
@@ -44,6 +44,7 @@ LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.audio@2.0 \
|
||||
android.hardware.audio.common@2.0 \
|
||||
android.hardware.audio.common@2.0-util \
|
||||
android.hardware.audio.common-util \
|
||||
|
||||
LOCAL_HEADER_LIBRARIES := \
|
||||
libaudioclient_headers \
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "StreamOut.h"
|
||||
#include "Util.h"
|
||||
|
||||
using ::android::hardware::audio::common::V2_0::HidlUtils;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#include "Conversions.h"
|
||||
#include "EffectMap.h"
|
||||
#include "Stream.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
|
||||
47
audio/common/2.0/default/Android.bp
Normal file
47
audio/common/2.0/default/Android.bp
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// 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.
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio.common@2.0-util",
|
||||
defaults: ["hidl_defaults"],
|
||||
vendor_available: true,
|
||||
vndk: {
|
||||
enabled: true,
|
||||
},
|
||||
srcs: [
|
||||
"HidlUtils.cpp",
|
||||
],
|
||||
|
||||
export_include_dirs: ["."],
|
||||
|
||||
static_libs: [
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libhidlbase",
|
||||
"android.hardware.audio.common-util",
|
||||
"android.hardware.audio.common@2.0",
|
||||
],
|
||||
export_shared_lib_headers: [
|
||||
"android.hardware.audio.common-util"
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
],
|
||||
}
|
||||
21
audio/common/2.0/default/HidlUtils.cpp
Normal file
21
audio/common/2.0/default/HidlUtils.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 "HidlUtils.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <common/all-versions/default/HidlUtils.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
26
audio/common/2.0/default/HidlUtils.h
Normal file
26
audio/common/2.0/default/HidlUtils.h
Normal file
@@ -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_V2_0_Hidl_Utils_H_
|
||||
#define android_hardware_audio_V2_0_Hidl_Utils_H_
|
||||
|
||||
#include <android/hardware/audio/common/2.0/types.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <common/all-versions/default/HidlUtils.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // android_hardware_audio_V2_0_Hidl_Utils_H_
|
||||
@@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio.common@2.0-util",
|
||||
name: "android.hardware.audio.common-util",
|
||||
defaults: ["hidl_defaults"],
|
||||
vendor_available: true,
|
||||
vndk: {
|
||||
@@ -22,16 +22,14 @@ cc_library_shared {
|
||||
},
|
||||
srcs: [
|
||||
"EffectMap.cpp",
|
||||
"HidlUtils.cpp",
|
||||
],
|
||||
|
||||
export_include_dirs: ["."],
|
||||
export_include_dirs: ["include"],
|
||||
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libhidlbase",
|
||||
"android.hardware.audio.common@2.0",
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "EffectMap.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef android_hardware_audio_V2_0_EffectMap_H_
|
||||
#define android_hardware_audio_V2_0_EffectMap_H_
|
||||
#ifndef android_hardware_audio_common_EffectMap_H_
|
||||
#define android_hardware_audio_common_EffectMap_H_
|
||||
|
||||
#include <mutex>
|
||||
|
||||
@@ -43,4 +43,4 @@ class EffectMap : public Singleton<EffectMap> {
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // android_hardware_audio_V2_0_EffectMap_H_
|
||||
#endif // android_hardware_audio_common_EffectMap_H_
|
||||
@@ -14,24 +14,28 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef android_hardware_audio_V2_0_Hidl_Utils_H_
|
||||
#define android_hardware_audio_V2_0_Hidl_Utils_H_
|
||||
#ifndef AUDIO_HAL_VERSION
|
||||
#error "AUDIO_HAL_VERSION must be set before including this file."
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <android/hardware/audio/common/2.0/types.h>
|
||||
#include <system/audio.h>
|
||||
|
||||
using ::android::hardware::audio::common::V2_0::AudioConfig;
|
||||
using ::android::hardware::audio::common::V2_0::AudioGain;
|
||||
using ::android::hardware::audio::common::V2_0::AudioGainConfig;
|
||||
using ::android::hardware::audio::common::V2_0::AudioOffloadInfo;
|
||||
using ::android::hardware::audio::common::V2_0::AudioPort;
|
||||
using ::android::hardware::audio::common::V2_0::AudioPortConfig;
|
||||
using ::android::hardware::audio::common::V2_0::Uuid;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGain;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOffloadInfo;
|
||||
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::Uuid;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace common {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
|
||||
class HidlUtils {
|
||||
public:
|
||||
@@ -62,6 +66,8 @@ class HidlUtils {
|
||||
static void uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid);
|
||||
};
|
||||
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace common
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // android_hardware_audio_V2_0_Hidl_Utils_H_
|
||||
@@ -14,23 +14,29 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_HAL_VERSION
|
||||
#error "AUDIO_HAL_VERSION must be set before including this file."
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "HidlUtils.h"
|
||||
|
||||
using ::android::hardware::audio::common::V2_0::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::V2_0::AudioDevice;
|
||||
using ::android::hardware::audio::common::V2_0::AudioFormat;
|
||||
using ::android::hardware::audio::common::V2_0::AudioGainMode;
|
||||
using ::android::hardware::audio::common::V2_0::AudioMixLatencyClass;
|
||||
using ::android::hardware::audio::common::V2_0::AudioPortConfigMask;
|
||||
using ::android::hardware::audio::common::V2_0::AudioPortRole;
|
||||
using ::android::hardware::audio::common::V2_0::AudioPortType;
|
||||
using ::android::hardware::audio::common::V2_0::AudioSource;
|
||||
using ::android::hardware::audio::common::V2_0::AudioStreamType;
|
||||
using ::android::hardware::audio::common::V2_0::AudioUsage;
|
||||
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::AudioGainMode;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMixLatencyClass;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfigMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortRole;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortType;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioStreamType;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioUsage;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace common {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
|
||||
void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
|
||||
config->sampleRateHz = halConfig.sample_rate;
|
||||
@@ -333,4 +339,8 @@ void HidlUtils::uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid) {
|
||||
memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
|
||||
}
|
||||
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace common
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -31,6 +31,7 @@ cc_library_shared {
|
||||
"libhidltransport",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.audio.common-util",
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.audio.common@2.0-util",
|
||||
"android.hardware.audio.effect@2.0",
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "Conversions.h"
|
||||
#include "HidlUtils.h"
|
||||
|
||||
using ::android::hardware::audio::common::V2_0::HidlUtils;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "Conversions.h"
|
||||
#include "Effect.h"
|
||||
#include "EffectMap.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
|
||||
@@ -34,17 +34,19 @@
|
||||
#include "BassBoostEffect.h"
|
||||
#include "Conversions.h"
|
||||
#include "DownmixEffect.h"
|
||||
#include "EffectsFactory.h"
|
||||
#include "HidlUtils.h"
|
||||
#include "Effect.h"
|
||||
#include "EffectMap.h"
|
||||
#include "EffectsFactory.h"
|
||||
#include "EnvironmentalReverbEffect.h"
|
||||
#include "EqualizerEffect.h"
|
||||
#include "HidlUtils.h"
|
||||
#include "LoudnessEnhancerEffect.h"
|
||||
#include "NoiseSuppressionEffect.h"
|
||||
#include "PresetReverbEffect.h"
|
||||
#include "VirtualizerEffect.h"
|
||||
#include "VisualizerEffect.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
|
||||
using ::android::hardware::audio::common::V2_0::HidlUtils;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
|
||||
Reference in New Issue
Block a user