Fixed vaapi filter not working with newer ffmpeg

Added pico neo 3 and pico 4 profiles with switching
Removed gles requirements
This commit is contained in:
PLYSHKA
2023-05-21 14:16:12 +05:00
parent b3d07bb4d7
commit 32bbfbff5a
4 changed files with 146 additions and 32 deletions
+49 -17
View File
@@ -36,6 +36,7 @@
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#include <openxr/openxr_platform.h>
#include <sys/system_properties.h>
#ifndef NDEBUG
#include "utils/backtrace.h"
@@ -408,36 +409,67 @@ void application::initialize()
// TODO get it from application info
xr_actionset = xr::actionset(xr_instance, "actions", "Actions");
std::vector<XrActionSuggestedBinding> bindings;
for (const auto & [name, type]: oculus_touch)
{
std::string name_without_slashes = std::string(name).substr(1);
// TODO better way to handle bindings for different vendors/flavors of vendor
char model_chararr[PROP_VALUE_MAX+1];
__system_property_get("ro.product.model", model_chararr);
std::string model_string(model_chararr);
for (char & i: name_without_slashes)
if (model_string == "Oculus Quest 2") {
spdlog::info("Suggesting Oculus Quest 2 bindings");
std::vector<XrActionSuggestedBinding> touch_controller_bindings;
for (const auto & [name, type]: oculus_touch)
{
if (i == '/')
i = '_';
process_binding_action(touch_controller_bindings, name, type);
}
auto a = xr_actionset.create_action(type, name_without_slashes);
actions.emplace_back(a, type, name);
if (type == XR_ACTION_TYPE_POSE_INPUT)
xr_instance.suggest_bindings("/interaction_profiles/oculus/touch_controller", touch_controller_bindings);
} else if (model_string == "Pico Neo 3") {
spdlog::info("Suggesting Pico Neo 3 bindings");
std::vector<XrActionSuggestedBinding> pico_neo_3_bindings;
for (const auto & [name, type]: pico_neo_3)
{
action_spaces.push_back(xr_session.create_action_space(a));
process_binding_action(pico_neo_3_bindings, name, type);
}
bindings.push_back({a, xr_instance.string_to_path(name)});
xr_instance.suggest_bindings("/interaction_profiles/bytedance/pico_neo3_controller", pico_neo_3_bindings);
} else if (model_string == "Pico 4") {
spdlog::info("Suggesting Pico 4 bindings");
std::vector<XrActionSuggestedBinding> pico_4_bindings;
for (const auto & [name, type]: pico_4)
{
process_binding_action(pico_4_bindings, name, type);
}
xr_instance.suggest_bindings("/interaction_profiles/bytedance/pico4_controller", pico_4_bindings);
} else {
spdlog::error("Couldn't find any compatible suggested bindings");
}
xr_instance.suggest_bindings("/interaction_profiles/oculus/touch_controller", bindings);
xr_session.attach_actionsets({xr_actionset});
interaction_profile_changed();
}
void application::process_binding_action(std::vector<XrActionSuggestedBinding> & bindings,
const char *name,
const XrActionType &type) {
std::string name_without_slashes = std::string(name).substr(1);
for (char & i: name_without_slashes)
{
if (i == '/')
i = '_';
}
auto a = xr_actionset.create_action(type, name_without_slashes);
actions.emplace_back(a, type, name);
if (type == XR_ACTION_TYPE_POSE_INPUT)
{
action_spaces.push_back(xr_session.create_action_space(a));
}
bindings.push_back({a, xr_instance.string_to_path(name)});
}
std::pair<XrAction, XrActionType> application::get_action(const std::string & requested_name)
{
for (const auto & [action, type, name]: instance_->actions)
+81
View File
@@ -171,6 +171,83 @@ class application
{"/user/hand/right/input/thumbstick/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbstick/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbrest/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
};
static inline const std::pair<const char *, XrActionType> pico_neo_3[] = {
{"/user/hand/left/output/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
{"/user/hand/right/output/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
{"/user/hand/left/input/grip/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/left/input/aim/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/right/input/grip/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/right/input/aim/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/left/input/x/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/x/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/y/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/y/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/squeeze/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/left/input/trigger/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/left/input/trigger/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/thumbstick", XR_ACTION_TYPE_VECTOR2F_INPUT},
{"/user/hand/left/input/thumbstick/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/thumbstick/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/thumbrest/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/a/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/a/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/b/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/b/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/squeeze/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/right/input/trigger/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/right/input/trigger/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbstick", XR_ACTION_TYPE_VECTOR2F_INPUT},
{"/user/hand/right/input/thumbstick/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbstick/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbrest/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/menu/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/system/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/menu/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/system/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
};
static inline const std::pair<const char *, XrActionType> pico_4[] = {
{"/user/hand/left/output/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
{"/user/hand/right/output/haptic", XR_ACTION_TYPE_VIBRATION_OUTPUT},
{"/user/hand/left/input/grip/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/left/input/aim/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/right/input/grip/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/right/input/aim/pose", XR_ACTION_TYPE_POSE_INPUT},
{"/user/hand/left/input/x/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/x/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/y/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/y/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/squeeze/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/squeeze/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/left/input/trigger/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/left/input/trigger/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/thumbstick", XR_ACTION_TYPE_VECTOR2F_INPUT},
{"/user/hand/left/input/thumbstick/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/thumbstick/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/thumbrest/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/a/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/a/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/b/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/b/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/squeeze/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/squeeze/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/right/input/trigger/value", XR_ACTION_TYPE_FLOAT_INPUT},
{"/user/hand/right/input/trigger/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbstick", XR_ACTION_TYPE_VECTOR2F_INPUT},
{"/user/hand/right/input/thumbstick/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbstick/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/right/input/thumbrest/touch", XR_ACTION_TYPE_BOOLEAN_INPUT},
{"/user/hand/left/input/menu/click", XR_ACTION_TYPE_BOOLEAN_INPUT},
};
bool session_running = false;
@@ -247,6 +324,10 @@ public:
void run();
void process_binding_action(std::vector<XrActionSuggestedBinding> & bindings,
const char * name,
const XrActionType & type);
static void push_scene(std::shared_ptr<scene>);
template <typename T, typename... Args>