Audio V4: Make device default wrapper device independent

Bug: 38184704
Test: compile
Change-Id: I077d2d6176ba5d60c1994345b3164641ed5b4608
Signed-off-by: Kevin Rocard <krocard@google.com>
This commit is contained in:
Kevin Rocard
2017-12-18 10:05:35 -08:00
parent 994705966e
commit e9e4e16564
38 changed files with 645 additions and 228 deletions

View File

@@ -0,0 +1,10 @@
cc_library_headers {
name: "android.hardware.audio.common.util@all-versions",
defaults: ["hidl_defaults"],
vendor_available: true,
vndk: {
enabled: true,
},
export_include_dirs: ["include"],
}

View File

@@ -0,0 +1,19 @@
/*
* 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 AUDIO_HAL_VERSION
#error "AUDIO_HAL_VERSION must be set before including this file."
#endif

View File

@@ -0,0 +1,49 @@
cc_library_shared {
name: "android.hardware.audio@2.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",
],
defaults: ["hidl_defaults"],
export_include_dirs: ["include"],
shared_libs: [
"libbase",
"libcutils",
"libfmq",
"libhardware",
"libhidlbase",
"libhidltransport",
"liblog",
"libutils",
"android.hardware.audio@2.0",
"android.hardware.audio.common@2.0",
"android.hardware.audio.common@2.0-util",
"android.hardware.audio.common-util",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"android.hardware.audio@all-versions-impl",
"libaudioclient_headers",
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
],
whole_static_libs: [
"libmedia_helper",
],
}

View 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 "device/2.0/default/Conversions.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/Conversions.impl.h>
#undef AUDIO_HAL_VERSION

View 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 "device/2.0/default/Device.h"
#include <HidlUtils.h>
#include "device/2.0/default/Conversions.h"
#include "device/2.0/default/StreamIn.h"
#include "device/2.0/default/StreamOut.h"
#include "device/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/Device.impl.h>
#undef AUDIO_HAL_VERSION

View 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 "device/2.0/default/DevicesFactory.h"
#include "device/2.0/default/Device.h"
#include "device/2.0/default/PrimaryDevice.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/DevicesFactory.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,3 @@
elaurent@google.com
krocard@google.com
mnaganov@google.com

View 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 "device/2.0/default/ParametersUtil.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/ParametersUtil.impl.h>
#undef AUDIO_HAL_VERSION

View 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 "device/2.0/default/PrimaryDevice.h"
#include "device/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/PrimaryDevice.impl.h>
#undef AUDIO_HAL_VERSION

View 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 "device/2.0/default/Stream.h"
#include "common/all-versions/default/EffectMap.h"
#include "device/2.0/default/Conversions.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/Stream.impl.h>
#undef AUDIO_HAL_VERSION

View 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 "device/2.0/default/StreamIn.h"
#include "device/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/StreamIn.impl.h>
#undef AUDIO_HAL_VERSION

View 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 "device/2.0/default/StreamOut.h"
#include "device/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/StreamOut.impl.h>
#undef AUDIO_HAL_VERSION

View 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_CONVERSIONS_H_
#define ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_
#include <android/hardware/audio/2.0/types.h>
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/Conversions.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_

View 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_V2_0_DEVICE_H
#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
#include <android/hardware/audio/2.0/IDevice.h>
#include "ParametersUtil.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/Device.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H

View 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_DEVICESFACTORY_H
#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
#include <android/hardware/audio/2.0/IDevicesFactory.h>
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/DevicesFactory.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H

View 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_PARAMETERS_UTIL_H_
#define ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_
#include <android/hardware/audio/2.0/types.h>
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/ParametersUtil.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_

View 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_V2_0_PRIMARYDEVICE_H
#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
#include <android/hardware/audio/2.0/IPrimaryDevice.h>
#include "Device.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/PrimaryDevice.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H

View 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_V2_0_STREAM_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
#include <android/hardware/audio/2.0/IStream.h>
#include "ParametersUtil.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/Stream.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H

View 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_V2_0_STREAMIN_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
#include <android/hardware/audio/2.0/IStreamIn.h>
#include "Device.h"
#include "Stream.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/StreamIn.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H

View 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_V2_0_STREAMOUT_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
#include <android/hardware/audio/2.0/IStreamOut.h>
#include "Device.h"
#include "Stream.h"
#define AUDIO_HAL_VERSION V2_0
#include <device/all-versions/default/StreamOut.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H

View File

@@ -1,21 +1,13 @@
cc_library_shared {
name: "android.hardware.audio@2.0-impl",
cc_library_headers {
name: "android.hardware.audio@all-versions-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",
],
defaults: ["hidl_defaults"],
export_include_dirs: ["include"],
shared_libs: [
"libbase",
"libcutils",
@@ -25,9 +17,6 @@ cc_library_shared {
"libhidltransport",
"liblog",
"libutils",
"android.hardware.audio@2.0",
"android.hardware.audio.common@2.0",
"android.hardware.audio.common@2.0-util",
"android.hardware.audio.common-util",
],
@@ -36,10 +25,6 @@ cc_library_shared {
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
"android.hardware.audio.common.util@all-versions",
],
whole_static_libs: [
"libmedia_helper",
],
}

View File

@@ -14,28 +14,24 @@
* limitations under the License.
*/
#ifndef android_hardware_audio_V2_0_Conversions_H_
#define android_hardware_audio_V2_0_Conversions_H_
#include <common/all-versions/IncludeGuard.h>
#include <string>
#include <android/hardware/audio/2.0/types.h>
#include <system/audio.h>
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::V2_0::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
std::string deviceAddressToHal(const DeviceAddress& address);
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // android_hardware_audio_V2_0_Conversions_H_

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
#include <stdio.h>
#include <common/all-versions/IncludeGuard.h>
#include "Conversions.h"
#include <stdio.h>
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
std::string deviceAddressToHal(const DeviceAddress& address) {
@@ -55,7 +55,7 @@ std::string deviceAddressToHal(const DeviceAddress& address) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,41 +14,37 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H
#include <common/all-versions/IncludeGuard.h>
#include <memory>
#include <hardware/audio.h>
#include <media/AudioParameter.h>
#include <android/hardware/audio/2.0/IDevice.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
#include "ParametersUtil.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::common::V2_0::AudioConfig;
using ::android::hardware::audio::common::V2_0::AudioHwSync;
using ::android::hardware::audio::common::V2_0::AudioInputFlag;
using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
using ::android::hardware::audio::common::V2_0::AudioPatchHandle;
using ::android::hardware::audio::common::V2_0::AudioPort;
using ::android::hardware::audio::common::V2_0::AudioPortConfig;
using ::android::hardware::audio::common::V2_0::AudioSource;
using ::android::hardware::audio::V2_0::DeviceAddress;
using ::android::hardware::audio::V2_0::IDevice;
using ::android::hardware::audio::V2_0::IStreamIn;
using ::android::hardware::audio::V2_0::IStreamOut;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
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::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -58,7 +54,7 @@ using ::android::sp;
struct Device : public IDevice, public ParametersUtil {
explicit Device(audio_hw_device_t* device);
// Methods from ::android::hardware::audio::V2_0::IDevice follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> initCheck() override;
Return<Result> setMasterVolume(float volume) override;
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
@@ -107,9 +103,7 @@ struct Device : public IDevice, public ParametersUtil {
};
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H

View File

@@ -14,7 +14,8 @@
* limitations under the License.
*/
#define LOG_TAG "DeviceHAL"
#include <common/all-versions/IncludeGuard.h>
//#define LOG_NDEBUG 0
#include <memory.h>
@@ -23,19 +24,13 @@
#include <android/log.h>
#include "Conversions.h"
#include "Device.h"
#include "HidlUtils.h"
#include "StreamIn.h"
#include "StreamOut.h"
#include "Util.h"
using ::android::hardware::audio::common::V2_0::HidlUtils;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
using ::android::hardware::audio::all_versions::implementation::isGainNormalized;
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
Device::Device(audio_hw_device_t* device) : mDevice(device) {}
@@ -82,7 +77,7 @@ int Device::halSetParameters(const char* keysAndValues) {
return mDevice->set_parameters(mDevice, keysAndValues);
}
// Methods from ::android::hardware::audio::V2_0::IDevice follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> Device::initCheck() {
return analyzeStatus("init_check", mDevice->init_check(mDevice));
}
@@ -288,7 +283,7 @@ Return<void> Device::debugDump(const hidl_handle& fd) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,24 +14,22 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
#include <common/all-versions/IncludeGuard.h>
#include <hardware/audio.h>
#include <android/hardware/audio/2.0/IDevicesFactory.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::V2_0::IDevice;
using ::android::hardware::audio::V2_0::IDevicesFactory;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -39,7 +37,7 @@ using ::android::hardware::hidl_string;
using ::android::sp;
struct DevicesFactory : public IDevicesFactory {
// Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override;
private:
@@ -50,9 +48,7 @@ struct DevicesFactory : public IDevicesFactory {
extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name);
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H

View File

@@ -14,20 +14,16 @@
* limitations under the License.
*/
#define LOG_TAG "DevicesFactoryHAL"
#include <common/all-versions/IncludeGuard.h>
#include <string.h>
#include <android/log.h>
#include "Device.h"
#include "DevicesFactory.h"
#include "PrimaryDevice.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
// static
@@ -77,7 +73,7 @@ out:
return rc;
}
// Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow.
// 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);
@@ -89,7 +85,8 @@ Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevi
if (device == IDevicesFactory::Device::PRIMARY) {
result = new PrimaryDevice(halDevice);
} else {
result = new ::android::hardware::audio::V2_0::implementation::Device(halDevice);
result = new ::android::hardware::audio::AUDIO_HAL_VERSION::implementation::Device(
halDevice);
}
retval = Result::OK;
} else if (halStatus == -EINVAL) {
@@ -105,7 +102,7 @@ IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* /* name */) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,24 +14,22 @@
* limitations under the License.
*/
#ifndef android_hardware_audio_V2_0_ParametersUtil_H_
#define android_hardware_audio_V2_0_ParametersUtil_H_
#include <common/all-versions/IncludeGuard.h>
#include <functional>
#include <memory>
#include <android/hardware/audio/2.0/types.h>
#include <hidl/HidlSupport.h>
#include <media/AudioParameter.h>
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
@@ -58,9 +56,7 @@ class ParametersUtil {
};
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // android_hardware_audio_V2_0_ParametersUtil_H_

View File

@@ -14,12 +14,12 @@
* limitations under the License.
*/
#include "ParametersUtil.h"
#include <common/all-versions/IncludeGuard.h>
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
/** Converts a status_t in Result according to the rules of AudioParameter::get*
@@ -159,7 +159,7 @@ Result ParametersUtil::setParams(const AudioParameter& param) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,36 +14,32 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
#include <common/all-versions/IncludeGuard.h>
#include <android/hardware/audio/2.0/IPrimaryDevice.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
#include "Device.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::common::V2_0::AudioConfig;
using ::android::hardware::audio::common::V2_0::AudioInputFlag;
using ::android::hardware::audio::common::V2_0::AudioMode;
using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
using ::android::hardware::audio::common::V2_0::AudioPort;
using ::android::hardware::audio::common::V2_0::AudioPortConfig;
using ::android::hardware::audio::common::V2_0::AudioSource;
using ::android::hardware::audio::V2_0::DeviceAddress;
using ::android::hardware::audio::V2_0::IDevice;
using ::android::hardware::audio::V2_0::IPrimaryDevice;
using ::android::hardware::audio::V2_0::IStreamIn;
using ::android::hardware::audio::V2_0::IStreamOut;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
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::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -53,7 +49,7 @@ using ::android::sp;
struct PrimaryDevice : public IPrimaryDevice {
explicit PrimaryDevice(audio_hw_device_t* device);
// Methods from ::android::hardware::audio::V2_0::IDevice follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> initCheck() override;
Return<Result> setMasterVolume(float volume) override;
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
@@ -83,7 +79,7 @@ struct PrimaryDevice : public IPrimaryDevice {
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
// Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
Return<Result> setVoiceVolume(float volume) override;
Return<Result> setMode(AudioMode mode) override;
Return<void> getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override;
@@ -102,9 +98,7 @@ struct PrimaryDevice : public IPrimaryDevice {
};
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H

View File

@@ -14,22 +14,19 @@
* limitations under the License.
*/
#define LOG_TAG "PrimaryDeviceHAL"
#include "PrimaryDevice.h"
#include "Util.h"
#include <common/all-versions/IncludeGuard.h>
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {}
PrimaryDevice::~PrimaryDevice() {}
// Methods from ::android::hardware::audio::V2_0::IDevice follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
Return<Result> PrimaryDevice::initCheck() {
return mDevice->initCheck();
}
@@ -118,9 +115,9 @@ Return<void> PrimaryDevice::debugDump(const hidl_handle& fd) {
return mDevice->debugDump(fd);
}
// Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
if (!isGainNormalized(volume)) {
if (!all_versions::implementation::isGainNormalized(volume)) {
ALOGW("Can not set a voice volume (%f) outside [0,1]", volume);
return Result::INVALID_ARGUMENTS;
}
@@ -192,7 +189,7 @@ Return<Result> PrimaryDevice::setHacEnabled(bool enabled) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,32 +14,28 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
#include <common/all-versions/IncludeGuard.h>
#include <vector>
#include <android/hardware/audio/2.0/IStream.h>
#include <hardware/audio.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
#include "ParametersUtil.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
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::V2_0::DeviceAddress;
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
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::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -56,7 +52,7 @@ struct Stream : public IStream, public ParametersUtil {
*/
static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */;
// Methods from ::android::hardware::audio::V2_0::IStream follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
@@ -178,9 +174,7 @@ Return<void> StreamMmap<T>::getMmapPosition(IStream::getMmapPosition_cb _hidl_cb
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
#include <inttypes.h>
#include <common/all-versions/IncludeGuard.h>
#define LOG_TAG "StreamHAL"
#include <inttypes.h>
#include <android/log.h>
#include <hardware/audio.h>
@@ -25,14 +25,10 @@
#include <utils/SortedVector.h>
#include <utils/Vector.h>
#include "Conversions.h"
#include "Stream.h"
#include "common/all-versions/default/EffectMap.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
Stream::Stream(audio_stream_t* stream) : mStream(stream) {}
@@ -82,7 +78,7 @@ int Stream::halSetParameters(const char* keysAndValues) {
return mStream->set_parameters(mStream, keysAndValues);
}
// Methods from ::android::hardware::audio::V2_0::IStream follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> Stream::getFrameSize() {
// Needs to be implemented by interface subclasses. But can't be declared as pure virtual,
// since interface subclasses implementation do not inherit from this class.
@@ -274,7 +270,7 @@ Return<Result> Stream::close() {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,37 +14,32 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
#include <common/all-versions/IncludeGuard.h>
#include <atomic>
#include <memory>
#include <android/hardware/audio/2.0/IStreamIn.h>
#include <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <utils/Thread.h>
#include "Device.h"
#include "Stream.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
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::AudioSource;
using ::android::hardware::audio::V2_0::DeviceAddress;
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::IStreamIn;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
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::AudioSource;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -58,7 +53,7 @@ struct StreamIn : public IStreamIn {
StreamIn(const sp<Device>& device, audio_stream_in_t* stream);
// Methods from ::android::hardware::audio::V2_0::IStream follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
@@ -85,7 +80,7 @@ struct StreamIn : public IStreamIn {
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> close() override;
// Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override;
Return<Result> setGain(float gain) override;
Return<void> prepareForReading(uint32_t frameSize, uint32_t framesCount,
@@ -117,9 +112,7 @@ struct StreamIn : public IStreamIn {
};
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H

View File

@@ -14,7 +14,8 @@
* limitations under the License.
*/
#define LOG_TAG "StreamInHAL"
#include <common/all-versions/IncludeGuard.h>
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_AUDIO
@@ -23,18 +24,16 @@
#include <utils/Trace.h>
#include <memory>
#include "StreamIn.h"
#include "Util.h"
using ::android::hardware::audio::V2_0::MessageQueueFlagBits;
using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits;
using ::android::hardware::audio::all_versions::implementation::isGainNormalized;
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::common::V2_0::ThreadInfo;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
namespace {
@@ -163,7 +162,7 @@ StreamIn::~StreamIn() {
mStream = nullptr;
}
// Methods from ::android::hardware::audio::V2_0::IStream follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> StreamIn::getFrameSize() {
return audio_stream_in_frame_size(mStream);
}
@@ -285,7 +284,7 @@ Return<Result> StreamIn::close() {
return Result::OK;
}
// Methods from ::android::hardware::audio::V2_0::IStreamIn follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
Return<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) {
int halSource;
Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource);
@@ -417,7 +416,7 @@ Return<void> StreamIn::getCapturePosition(getCapturePosition_cb _hidl_cb) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,39 +14,34 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
#include <common/all-versions/IncludeGuard.h>
#include <atomic>
#include <memory>
#include <android/hardware/audio/2.0/IStreamOut.h>
#include <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <utils/Thread.h>
#include "Device.h"
#include "Stream.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
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::V2_0::AudioDrain;
using ::android::hardware::audio::V2_0::DeviceAddress;
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::IStreamOut;
using ::android::hardware::audio::V2_0::IStreamOutCallback;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::V2_0::TimeSpec;
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::AUDIO_HAL_VERSION::AudioDrain;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
@@ -60,7 +55,7 @@ struct StreamOut : public IStreamOut {
StreamOut(const sp<Device>& device, audio_stream_out_t* stream);
// Methods from ::android::hardware::audio::V2_0::IStream follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> getFrameSize() override;
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
@@ -87,7 +82,7 @@ struct StreamOut : public IStreamOut {
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> close() override;
// Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
Return<uint32_t> getLatency() override;
Return<Result> setVolume(float left, float right) override;
Return<void> prepareForWriting(uint32_t frameSize, uint32_t framesCount,
@@ -131,9 +126,7 @@ struct StreamOut : public IStreamOut {
};
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H

View File

@@ -14,7 +14,8 @@
* limitations under the License.
*/
#define LOG_TAG "StreamOutHAL"
#include <common/all-versions/IncludeGuard.h>
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_AUDIO
@@ -24,16 +25,14 @@
#include <hardware/audio.h>
#include <utils/Trace.h>
#include "StreamOut.h"
#include "Util.h"
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::common::V2_0::ThreadInfo;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
using ::android::hardware::audio::all_versions::implementation::isGainNormalized;
namespace {
@@ -167,7 +166,7 @@ StreamOut::~StreamOut() {
mStream = nullptr;
}
// Methods from ::android::hardware::audio::V2_0::IStream follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
Return<uint64_t> StreamOut::getFrameSize() {
return audio_stream_out_frame_size(mStream);
}
@@ -273,7 +272,7 @@ Return<Result> StreamOut::close() {
return Result::OK;
}
// Methods from ::android::hardware::audio::V2_0::IStreamOut follow.
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
Return<uint32_t> StreamOut::getLatency() {
return mStream->get_latency(mStream);
}
@@ -514,7 +513,7 @@ Return<void> StreamOut::getMmapPosition(getMmapPosition_cb _hidl_cb) {
}
} // namespace implementation
} // namespace V2_0
} // namespace AUDIO_HAL_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H
#define ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H
#ifndef ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H
#define ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H
namespace android {
namespace hardware {
namespace audio {
namespace V2_0 {
namespace all_versions {
namespace implementation {
/** @return true if gain is between 0 and 1 included. */
@@ -29,9 +29,9 @@ constexpr bool isGainNormalized(float gain) {
}
} // namespace implementation
} // namespace V2_0
} // namespace all_versions
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H
#endif // ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H