mirror of
https://github.com/AndroidAudioMods/ViPERFX_RE.git
synced 2025-09-19 04:16:04 +08:00
More stupid stuff
This commit is contained in:
@ -3,11 +3,32 @@
|
||||
#include <string>
|
||||
#include <dlfcn.h>
|
||||
|
||||
void AidlVersions::init() {
|
||||
char tmp[128];
|
||||
|
||||
AidlVersions::AidlVersions() {
|
||||
ALOGD("AidlVersions::init()");
|
||||
findAndroidHardwareAudioCommonVersion();
|
||||
findAndroidHardwareAudioEffectVersion();
|
||||
findAndroidHardwareCommonVersion();
|
||||
findAndroidHardwareCommonFmqVersion();
|
||||
findAndroidMediaAudioCommonTypesVersion();
|
||||
findAndroidMediaAudioEraserTypesVersion();
|
||||
}
|
||||
|
||||
void AidlVersions::findAndroidHardwareAudioCommonVersion() {
|
||||
char tmp[128];
|
||||
for (uint32_t i = ANDROID_HARDWARE_AUDIO_COMMON_MAX_VERSION; i > 0; i--) {
|
||||
snprintf(tmp, sizeof(tmp), "android.hardware.audio.common-V%u-ndk.so", i);
|
||||
void *handle = dlopen(tmp, RTLD_LAZY);
|
||||
if (handle) {
|
||||
ALOGD("Found android.hardware.audio.common-V%u-ndk.so", i);
|
||||
androidHardwareAudioCommonVersion = i;
|
||||
dlclose(handle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AidlVersions::findAndroidHardwareAudioEffectVersion() {
|
||||
char tmp[128];
|
||||
for (uint32_t i = ANDROID_HARDWARE_AUDIO_EFFECT_MAX_VERSION; i > 0; i--) {
|
||||
snprintf(tmp, sizeof(tmp), "android.hardware.audio.effect-V%u-ndk.so", i);
|
||||
void *handle = dlopen(tmp, RTLD_LAZY);
|
||||
@ -21,7 +42,10 @@ void AidlVersions::init() {
|
||||
if (androidHardwareAudioEffectVersion == 0) {
|
||||
ALOGE("Failed to find android.hardware.audio.effect version!");
|
||||
}
|
||||
}
|
||||
|
||||
void AidlVersions::findAndroidHardwareCommonVersion() {
|
||||
char tmp[128];
|
||||
for (uint32_t i = ANDROID_HARDWARE_COMMON_MAX_VERSION; i > 0; i--) {
|
||||
snprintf(tmp, sizeof(tmp), "android.hardware.common-V%u-ndk.so", i);
|
||||
void *handle = dlopen(tmp, RTLD_LAZY);
|
||||
@ -35,7 +59,10 @@ void AidlVersions::init() {
|
||||
if (androidHardwareCommonVersion == 0) {
|
||||
ALOGE("Failed to find android.hardware.common version!");
|
||||
}
|
||||
}
|
||||
|
||||
void AidlVersions::findAndroidHardwareCommonFmqVersion() {
|
||||
char tmp[128];
|
||||
for (uint32_t i = ANDROID_HARDWARE_COMMON_FMQ_MAX_VERSION; i > 0; i--) {
|
||||
snprintf(tmp, sizeof(tmp), "android.hardware.common.fmq-V%u-ndk.so", i);
|
||||
void *handle = dlopen(tmp, RTLD_LAZY);
|
||||
@ -49,7 +76,10 @@ void AidlVersions::init() {
|
||||
if (androidHardwareCommonFmqVersion == 0) {
|
||||
ALOGE("Failed to find android.hardware.common.fmq version!");
|
||||
}
|
||||
}
|
||||
|
||||
void AidlVersions::findAndroidMediaAudioCommonTypesVersion() {
|
||||
char tmp[128];
|
||||
for (uint32_t i = ANDROID_MEDIA_AUDIO_COMMON_TYPES_MAX_VERSION; i > 0; i--) {
|
||||
snprintf(tmp, sizeof(tmp), "android.media.audio.common.types-V%u-ndk.so", i);
|
||||
void *handle = dlopen(tmp, RTLD_LAZY);
|
||||
@ -65,7 +95,7 @@ void AidlVersions::init() {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((constructor))
|
||||
void aidl_versions_init() {
|
||||
AidlVersions::init();
|
||||
void AidlVersions::findAndroidMediaAudioEraserTypesVersion() {
|
||||
char tmp[128];
|
||||
// TODO
|
||||
}
|
||||
|
@ -4,19 +4,31 @@
|
||||
|
||||
class AidlVersions {
|
||||
public:
|
||||
const static uint32_t ANDROID_HARDWARE_AUDIO_COMMON_MAX_VERSION = 1;
|
||||
const static uint32_t ANDROID_HARDWARE_AUDIO_EFFECT_MAX_VERSION = 3;
|
||||
const static uint32_t ANDROID_HARDWARE_COMMON_MAX_VERSION = 1;
|
||||
const static uint32_t ANDROID_HARDWARE_COMMON_FMQ_MAX_VERSION = 1;
|
||||
const static uint32_t ANDROID_MEDIA_AUDIO_COMMON_TYPES_MAX_VERSION = 4;
|
||||
const static uint32_t ANDROID_MEDIA_AUDIO_ERASER_TYPES_MAX_VERSION = 1;
|
||||
const static uint32_t ANDROID_HARDWARE_AUDIO_COMMON_MAX_VERSION = 5;
|
||||
const static uint32_t ANDROID_HARDWARE_AUDIO_EFFECT_MAX_VERSION = 4;
|
||||
const static uint32_t ANDROID_HARDWARE_COMMON_MAX_VERSION = 3;
|
||||
const static uint32_t ANDROID_HARDWARE_COMMON_FMQ_MAX_VERSION = 2;
|
||||
const static uint32_t ANDROID_MEDIA_AUDIO_COMMON_TYPES_MAX_VERSION = 5;
|
||||
const static uint32_t ANDROID_MEDIA_AUDIO_ERASER_TYPES_MAX_VERSION = 2;
|
||||
|
||||
static void init();
|
||||
uint32_t androidHardwareAudioCommonVersion = 0;
|
||||
uint32_t androidHardwareAudioEffectVersion = 0;
|
||||
uint32_t androidHardwareCommonVersion = 0;
|
||||
uint32_t androidHardwareCommonFmqVersion = 0;
|
||||
uint32_t androidMediaAudioCommonTypesVersion = 0;
|
||||
uint32_t androidMediaAudioEraserTypesVersion = 0;
|
||||
|
||||
static inline uint32_t androidHardwareAudioCommonVersion = 0;
|
||||
static inline uint32_t androidHardwareAudioEffectVersion = 0;
|
||||
static inline uint32_t androidHardwareCommonVersion = 0;
|
||||
static inline uint32_t androidHardwareCommonFmqVersion = 0;
|
||||
static inline uint32_t androidMediaAudioCommonTypesVersion = 0;
|
||||
static inline uint32_t androidMediaAudioEraserTypesVersion = 0;
|
||||
static inline AidlVersions &instance() {
|
||||
static AidlVersions instance;
|
||||
return instance;
|
||||
}
|
||||
private:
|
||||
AidlVersions();
|
||||
|
||||
void findAndroidHardwareAudioCommonVersion();
|
||||
void findAndroidHardwareAudioEffectVersion();
|
||||
void findAndroidHardwareCommonVersion();
|
||||
void findAndroidHardwareCommonFmqVersion();
|
||||
void findAndroidMediaAudioCommonTypesVersion();
|
||||
void findAndroidMediaAudioEraserTypesVersion();
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
return !(_rhs < *this);
|
||||
}
|
||||
private:
|
||||
uint32_t version = AidlVersions::androidMediaAudioCommonTypesVersion;
|
||||
uint32_t version = AidlVersions::instance().androidMediaAudioCommonTypesVersion;
|
||||
v1::AudioUuid *uuid_v1 = (v1::AudioUuid *) this;
|
||||
};
|
||||
} // namespace android::media::audio::common
|
||||
|
Reference in New Issue
Block a user