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)