#include <stdexcept>
#include <string.h>
#include <memory>
#ifndef SYSTEM_LIBDIR
#define SYSTEM_LIBDIR
#endif
namespace {
constexpr const char* opengl_es1_cm_driver_path = SYSTEM_LIBDIR "/anbox/angle/libGLESv1_CM.so";
constexpr const char* opengl_es2_driver_path = SYSTEM_LIBDIR "/anbox/angle/libGLESv2.so";
constexpr const char* egl_driver_path = SYSTEM_LIBDIR "/anbox/angle/libEGL.so";
}
class MinimalPlatformAudioProcessor : public AudioProcessor {
public:
MinimalPlatformAudioProcessor() {}
~MinimalPlatformAudioProcessor() override = default;
size_t process_data(const uint8_t* data, size_t size) override;
};
size_t MinimalPlatformAudioProcessor::process_data(const uint8_t* data, size_t size) {
(void) data;
(void) size;
return 0;
}
class MinimalPlatformInputProcessor : public InputProcessor {
public:
MinimalPlatformInputProcessor() {}
~MinimalPlatformInputProcessor() override = default;
};
int MinimalPlatformInputProcessor::read_event(
AnboxInputEvent* event,
int timeout = -1) {
(void) event;
(void) timeout;
return 0;
}
(void) event;
return 0;
}
class MinimalGraphicsProcessor : public GraphicsProcessor {
public:
MinimalGraphicsProcessor() {}
~MinimalGraphicsProcessor() override = default;
};
public:
graphics_processor_(std::make_unique<MinimalGraphicsProcessor>()),
audio_processor_(std::make_unique<MinimalPlatformAudioProcessor>()),
input_processor_(std::make_unique<MinimalPlatformInputProcessor>()) {
(void) configuration;
}
~MinimalPlatform() override = default;
GraphicsProcessor* graphics_processor() override;
AudioProcessor* audio_processor() override;
InputProcessor* input_processor() override;
bool ready() const override;
int wait_until_ready() override;
private:
const std::unique_ptr<MinimalGraphicsProcessor> graphics_processor_;
const std::unique_ptr<MinimalPlatformAudioProcessor> audio_processor_;
const std::unique_ptr<MinimalPlatformInputProcessor> input_processor_;
};
GraphicsProcessor* MinimalPlatform::graphics_processor() {
return graphics_processor_.get();
}
AudioProcessor* MinimalPlatform::audio_processor() {
return audio_processor_.get();
}
InputProcessor* MinimalPlatform::input_processor() {
return input_processor_.get();
}
bool MinimalPlatform::ready() const {
return true;
}
int MinimalPlatform::wait_until_ready() {
return 0;
}
if (!data)
return -EINVAL;
auto provide_str_value = [data, data_size](const char* value) -> int {
const size_t value_size = strlen(value);
if (value_size > data_size)
return -ENOMEM;
if (value)
memcpy(data, reinterpret_cast<const void*>(value), value_size);
return 0;
};
switch (key) {
return provide_str_value(egl_driver_path);
return provide_str_value(opengl_es1_cm_driver_path);
return provide_str_value(opengl_es2_driver_path);
return -ENOMEM;
break;
}
return -ENOMEM;
break;
}
default:
return -EINVAL;
}
return 0;
}
}
The audio input/output format from anbox.
AnboxDisplaySpec2 describes properties of the virtual display Anbox creates for rendering.
AnboxPlatformConfigurationKey
AnboxPlatformConfigurationKey specifies configuration items which allow to influence the behavior and...
@ OPENGL_ES1_CM_DRIVER_PATH
@ AUDIO_FORMAT_PCM_16_BIT