mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-06-08 02:29:40 +08:00
Add aidl defines
This commit is contained in:
parent
f4fe8dd0d7
commit
ec972e5099
@ -1,5 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.16.3)
|
||||
|
||||
set(CMAKE_CXX_COMPILER_VERSION 20)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
# NDK Settings
|
||||
#add_compile_definitions(ANDROID_ABI=arm64-v8a)
|
||||
|
@ -3,6 +3,14 @@
|
||||
#include "essential.h"
|
||||
#include "viper/constants.h"
|
||||
#include "ViperContext.h"
|
||||
#include <aidl/android/hardware/audio/effect/Descriptor.h>
|
||||
#include <aidl/android/hardware/audio/effect/IEffect.h>
|
||||
#include <aidl/android/media/audio/common/AudioUuid.h>
|
||||
#include <android/binder_status.h>
|
||||
|
||||
using aidl::android::hardware::audio::effect::Descriptor;
|
||||
using aidl::android::hardware::audio::effect::IEffect;
|
||||
using aidl::android::media::audio::common::AudioUuid;
|
||||
|
||||
extern "C" {
|
||||
struct ViperHandle {
|
||||
@ -82,23 +90,30 @@ static int32_t viperLibraryGetDescriptor(const effect_uuid_t *uuid, effect_descr
|
||||
|
||||
extern "C"
|
||||
__attribute__((visibility("default")))
|
||||
int createEffect() {
|
||||
binder_exception_t createEffect(const AudioUuid *audio_uuid, std::shared_ptr<IEffect> *instance) {
|
||||
VIPER_LOGD("createEffect called");
|
||||
return -3;
|
||||
return EX_ILLEGAL_ARGUMENT;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
__attribute__((visibility("default")))
|
||||
int destroyEffect() {
|
||||
binder_exception_t destroyEffect(const std::shared_ptr<IEffect> &instanceSp) {
|
||||
VIPER_LOGD("destroyEffect called");
|
||||
return -5;
|
||||
return EX_ILLEGAL_STATE;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
__attribute__((visibility("default")))
|
||||
int queryEffect() {
|
||||
//extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) {
|
||||
// if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizer()) {
|
||||
// LOG(ERROR) << __func__ << "uuid not supported";
|
||||
// return EX_ILLEGAL_ARGUMENT;
|
||||
// }
|
||||
// *_aidl_return = VisualizerImpl::kDescriptor;
|
||||
// return EX_NONE;
|
||||
//}
|
||||
|
||||
extern "C" binder_exception_t queryEffect(const AudioUuid *audio_uuid, Descriptor *descriptor) {
|
||||
VIPER_LOGD("queryEffect called");
|
||||
return -3;
|
||||
return EX_ILLEGAL_ARGUMENT;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
89
src/include/aidl/android/hardware/audio/effect/Descriptor.h
Normal file
89
src/include/aidl/android/hardware/audio/effect/Descriptor.h
Normal file
@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <aidl/android/hardware/audio/effect/Flags.h>
|
||||
#include <aidl/android/media/audio/common/AudioUuid.h>
|
||||
|
||||
namespace aidl::android::hardware::audio::effect {
|
||||
class Descriptor {
|
||||
public:
|
||||
class Identity {
|
||||
public:
|
||||
::aidl::android::media::audio::common::AudioUuid type;
|
||||
::aidl::android::media::audio::common::AudioUuid uuid;
|
||||
std::optional<::aidl::android::media::audio::common::AudioUuid> proxy;
|
||||
|
||||
inline bool operator==(const Identity& _rhs) const {
|
||||
return std::tie(type, uuid, proxy) == std::tie(_rhs.type, _rhs.uuid, _rhs.proxy);
|
||||
}
|
||||
inline bool operator<(const Identity& _rhs) const {
|
||||
return std::tie(type, uuid, proxy) < std::tie(_rhs.type, _rhs.uuid, _rhs.proxy);
|
||||
}
|
||||
inline bool operator!=(const Identity& _rhs) const {
|
||||
return !(*this == _rhs);
|
||||
}
|
||||
inline bool operator>(const Identity& _rhs) const {
|
||||
return _rhs < *this;
|
||||
}
|
||||
inline bool operator>=(const Identity& _rhs) const {
|
||||
return !(*this < _rhs);
|
||||
}
|
||||
inline bool operator<=(const Identity& _rhs) const {
|
||||
return !(_rhs < *this);
|
||||
}
|
||||
};
|
||||
class Common {
|
||||
public:
|
||||
::aidl::android::hardware::audio::effect::Descriptor::Identity id;
|
||||
::aidl::android::hardware::audio::effect::Flags flags;
|
||||
int32_t cpuLoad = 0;
|
||||
int32_t memoryUsage = 0;
|
||||
std::string name;
|
||||
std::string implementor;
|
||||
|
||||
inline bool operator==(const Common& _rhs) const {
|
||||
return std::tie(id, flags, cpuLoad, memoryUsage, name, implementor) == std::tie(_rhs.id, _rhs.flags, _rhs.cpuLoad, _rhs.memoryUsage, _rhs.name, _rhs.implementor);
|
||||
}
|
||||
inline bool operator<(const Common& _rhs) const {
|
||||
return std::tie(id, flags, cpuLoad, memoryUsage, name, implementor) < std::tie(_rhs.id, _rhs.flags, _rhs.cpuLoad, _rhs.memoryUsage, _rhs.name, _rhs.implementor);
|
||||
}
|
||||
inline bool operator!=(const Common& _rhs) const {
|
||||
return !(*this == _rhs);
|
||||
}
|
||||
inline bool operator>(const Common& _rhs) const {
|
||||
return _rhs < *this;
|
||||
}
|
||||
inline bool operator>=(const Common& _rhs) const {
|
||||
return !(*this < _rhs);
|
||||
}
|
||||
inline bool operator<=(const Common& _rhs) const {
|
||||
return !(_rhs < *this);
|
||||
}
|
||||
};
|
||||
::aidl::android::hardware::audio::effect::Descriptor::Common common;
|
||||
/*::aidl::android::hardware::audio::effect::Capability capability;*/
|
||||
|
||||
inline bool operator==(const Descriptor& _rhs) const {
|
||||
return std::tie(common/*, capability*/) == std::tie(_rhs.common/*, _rhs.capability*/);
|
||||
}
|
||||
inline bool operator<(const Descriptor& _rhs) const {
|
||||
return std::tie(common/*, capability*/) < std::tie(_rhs.common/*, _rhs.capability*/);
|
||||
}
|
||||
inline bool operator!=(const Descriptor& _rhs) const {
|
||||
return !(*this == _rhs);
|
||||
}
|
||||
inline bool operator>(const Descriptor& _rhs) const {
|
||||
return _rhs < *this;
|
||||
}
|
||||
inline bool operator>=(const Descriptor& _rhs) const {
|
||||
return !(*this < _rhs);
|
||||
}
|
||||
inline bool operator<=(const Descriptor& _rhs) const {
|
||||
return !(_rhs < *this);
|
||||
}
|
||||
};
|
||||
} // namespace aidl::android::hardware::audio::effect
|
72
src/include/aidl/android/hardware/audio/effect/Flags.h
Normal file
72
src/include/aidl/android/hardware/audio/effect/Flags.h
Normal file
@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace aidl::android::hardware::audio::effect {
|
||||
class Flags {
|
||||
public:
|
||||
enum class Type : int8_t {
|
||||
INSERT = 0,
|
||||
AUXILIARY = 1,
|
||||
REPLACE = 2,
|
||||
PRE_PROC = 3,
|
||||
POST_PROC = 4,
|
||||
};
|
||||
|
||||
enum class Insert : int8_t {
|
||||
ANY = 0,
|
||||
FIRST = 1,
|
||||
LAST = 2,
|
||||
EXCLUSIVE = 3,
|
||||
};
|
||||
|
||||
enum class Volume : int8_t {
|
||||
NONE = 0,
|
||||
CTRL = 1,
|
||||
IND = 2,
|
||||
MONITOR = 3,
|
||||
};
|
||||
|
||||
enum class HardwareAccelerator : int8_t {
|
||||
NONE = 0,
|
||||
SIMPLE = 1,
|
||||
TUNNEL = 2,
|
||||
};
|
||||
|
||||
::aidl::android::hardware::audio::effect::Flags::Type type = ::aidl::android::hardware::audio::effect::Flags::Type::INSERT;
|
||||
::aidl::android::hardware::audio::effect::Flags::Insert insert = ::aidl::android::hardware::audio::effect::Flags::Insert::ANY;
|
||||
::aidl::android::hardware::audio::effect::Flags::Volume volume = ::aidl::android::hardware::audio::effect::Flags::Volume::NONE;
|
||||
::aidl::android::hardware::audio::effect::Flags::HardwareAccelerator hwAcceleratorMode = ::aidl::android::hardware::audio::effect::Flags::HardwareAccelerator::NONE;
|
||||
bool offloadIndication = false;
|
||||
bool deviceIndication = false;
|
||||
bool audioModeIndication = false;
|
||||
bool audioSourceIndication = false;
|
||||
bool bypass = false;
|
||||
bool sinkMetadataIndication = false;
|
||||
bool sourceMetadataIndication = false;
|
||||
|
||||
inline bool operator==(const Flags& _rhs) const {
|
||||
return std::tie(type, insert, volume, hwAcceleratorMode, offloadIndication, deviceIndication, audioModeIndication, audioSourceIndication, bypass, sinkMetadataIndication, sourceMetadataIndication) == std::tie(_rhs.type, _rhs.insert, _rhs.volume, _rhs.hwAcceleratorMode, _rhs.offloadIndication, _rhs.deviceIndication, _rhs.audioModeIndication, _rhs.audioSourceIndication, _rhs.bypass, _rhs.sinkMetadataIndication, _rhs.sourceMetadataIndication);
|
||||
}
|
||||
inline bool operator<(const Flags& _rhs) const {
|
||||
return std::tie(type, insert, volume, hwAcceleratorMode, offloadIndication, deviceIndication, audioModeIndication, audioSourceIndication, bypass, sinkMetadataIndication, sourceMetadataIndication) < std::tie(_rhs.type, _rhs.insert, _rhs.volume, _rhs.hwAcceleratorMode, _rhs.offloadIndication, _rhs.deviceIndication, _rhs.audioModeIndication, _rhs.audioSourceIndication, _rhs.bypass, _rhs.sinkMetadataIndication, _rhs.sourceMetadataIndication);
|
||||
}
|
||||
inline bool operator!=(const Flags& _rhs) const {
|
||||
return !(*this == _rhs);
|
||||
}
|
||||
inline bool operator>(const Flags& _rhs) const {
|
||||
return _rhs < *this;
|
||||
}
|
||||
inline bool operator>=(const Flags& _rhs) const {
|
||||
return !(*this < _rhs);
|
||||
}
|
||||
inline bool operator<=(const Flags& _rhs) const {
|
||||
return !(_rhs < *this);
|
||||
}
|
||||
};
|
||||
} // namespace aidl::android::hardware::audio::effect
|
12
src/include/aidl/android/hardware/audio/effect/IEffect.h
Normal file
12
src/include/aidl/android/hardware/audio/effect/IEffect.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace aidl::android::hardware::audio::effect {
|
||||
class IEffect {
|
||||
};
|
||||
} // namespace aidl::android::hardware::audio::effect
|
37
src/include/aidl/android/media/audio/common/AudioUuid.h
Normal file
37
src/include/aidl/android/media/audio/common/AudioUuid.h
Normal file
@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace aidl::android::media::audio::common {
|
||||
class AudioUuid {
|
||||
public:
|
||||
int32_t timeLow = 0;
|
||||
int32_t timeMid = 0;
|
||||
int32_t timeHiAndVersion = 0;
|
||||
int32_t clockSeq = 0;
|
||||
std::vector<uint8_t> node;
|
||||
|
||||
inline bool operator==(const AudioUuid& _rhs) const {
|
||||
return std::tie(timeLow, timeMid, timeHiAndVersion, clockSeq, node) == std::tie(_rhs.timeLow, _rhs.timeMid, _rhs.timeHiAndVersion, _rhs.clockSeq, _rhs.node);
|
||||
}
|
||||
inline bool operator<(const AudioUuid& _rhs) const {
|
||||
return std::tie(timeLow, timeMid, timeHiAndVersion, clockSeq, node) < std::tie(_rhs.timeLow, _rhs.timeMid, _rhs.timeHiAndVersion, _rhs.clockSeq, _rhs.node);
|
||||
}
|
||||
inline bool operator!=(const AudioUuid& _rhs) const {
|
||||
return !(*this == _rhs);
|
||||
}
|
||||
inline bool operator>(const AudioUuid& _rhs) const {
|
||||
return _rhs < *this;
|
||||
}
|
||||
inline bool operator>=(const AudioUuid& _rhs) const {
|
||||
return !(*this < _rhs);
|
||||
}
|
||||
inline bool operator<=(const AudioUuid& _rhs) const {
|
||||
return !(_rhs < *this);
|
||||
}
|
||||
};
|
||||
} // namespace aidl::android::media::audio::common
|
Loading…
x
Reference in New Issue
Block a user