Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7e2a61cda | ||
|
|
2696fa3b24 | ||
|
|
5d0b87afce | ||
|
|
b383aa4c20 | ||
|
|
a67673327b | ||
|
|
c4265d80a5 | ||
|
|
dd874eea4b | ||
|
|
b9c1320823 | ||
|
|
833e405060 | ||
|
|
e6c8488283 | ||
|
|
505de3d625 | ||
|
|
631025a513 | ||
|
|
a0bddec054 | ||
|
|
c0dc193247 | ||
|
|
aa3a1808f8 | ||
|
|
07bc8c9bac | ||
|
|
2375775a9c | ||
|
|
e23b571d7e | ||
|
|
7e014a7a33 | ||
|
|
c4e6cd623e | ||
|
|
6553036a73 | ||
|
|
a4201481aa | ||
|
|
209acc793d | ||
|
|
f77e6e669c | ||
|
|
16076a05c8 | ||
|
|
3c91e4eca8 | ||
|
|
1635bdabce | ||
|
|
4908f50a00 | ||
|
|
442e09dcfc | ||
|
|
855539fab0 | ||
|
|
ba39b4da0b | ||
|
|
13ff9231f0 | ||
|
|
1696512385 | ||
|
|
4604b061d7 |
+1
-1
@@ -106,6 +106,6 @@ SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp11
|
||||
Standard: Latest
|
||||
TabWidth: 8
|
||||
UseTab: ForIndentation
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run clang-format style check for C/C++/Protobuf programs.
|
||||
uses: jidicula/clang-format-action@v4.13.0
|
||||
uses: jidicula/clang-format-action@2c659fea724e981e94741c0e7db663982cd7d3f4
|
||||
with:
|
||||
clang-format-version: '18'
|
||||
clang-format-version: '21'
|
||||
check-path: ${{ matrix.path }}
|
||||
|
||||
@@ -49,7 +49,7 @@ systemctl enable --now avahi-daemon
|
||||
- On your headset, run WiVRn from the App Library. If you are using a Quest and you have installed it from an APK instead of the Meta Store, it will be in the "unknown sources" section.
|
||||
- You should now see your computer in the list: click connect, the screen will show "Connection ready. Start a VR application on **your computer's name**".
|
||||
|
||||
You can now start an OpenXR application on your computer. For Steam games, you will also need to set the launch options to be able to use WiVRn:
|
||||
You can now start an OpenXR application on your computer. For Steam games, you may also need to set the launch options to be able to use WiVRn. If nothing related to Steam is displayed in the dashboard or wivrn-server output, then your system does not require it.
|
||||
- Right-click on the game you want to play in VR in Steam and click "Properties".
|
||||
- In the "General" tab, set the launch options to the value given in the dashboard.
|
||||
|
||||
|
||||
@@ -1674,8 +1674,7 @@ void application::run()
|
||||
#else
|
||||
void application::run()
|
||||
{
|
||||
struct sigaction act
|
||||
{};
|
||||
struct sigaction act{};
|
||||
act.sa_handler = [](int) {
|
||||
instance().exit_requested = true;
|
||||
};
|
||||
|
||||
+16
-6
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <glm/glm.hpp>
|
||||
#include <imgui.h>
|
||||
@@ -26,7 +27,7 @@
|
||||
namespace constants::gui
|
||||
{
|
||||
// Minimum distance between a GUI layer and a fingertip/controller to register a click
|
||||
constexpr float min_pointer_distance = -0.1;
|
||||
constexpr float min_pointer_distance = -0.02;
|
||||
|
||||
// Font to use (desktop only)
|
||||
constexpr const char font_name[] = "Noto Sans";
|
||||
@@ -41,9 +42,10 @@ constexpr float scroll_ratio = 10;
|
||||
// Threshold on the trigger value to register a click
|
||||
constexpr float trigger_click_thd = 0.8;
|
||||
|
||||
// Thresholds on the distance between the fingertip and GUI layers
|
||||
constexpr float fingertip_distance_hovering_thd = 0.15;
|
||||
constexpr float fingertip_distance_touching_thd = 0.0;
|
||||
// Thresholds on the distance between the fingertip and GUI layers (positive: in front of the GUI, negative: behind the GUI)
|
||||
constexpr float fingertip_distance_hovering_thd = 0.15; // Max distance to have the cursor hovering
|
||||
constexpr float fingertip_distance_touching_thd = -0.01; // Max distance to register a click
|
||||
constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI
|
||||
|
||||
// Minimum scroll value to enable a controller
|
||||
constexpr float scroll_value_thd = 0.01;
|
||||
@@ -67,7 +69,14 @@ constexpr uint32_t pointer_color_border = 0xff000000;
|
||||
namespace constants::lobby
|
||||
{
|
||||
// Position and orientation of the GUI layers
|
||||
constexpr float gui_pitch = -0.2;
|
||||
constexpr auto gui_pitches = std::to_array<std::pair<float, float>>({
|
||||
{-90, -90},
|
||||
{-50, -90},
|
||||
{-30, -12},
|
||||
{30, -12},
|
||||
{50, 78},
|
||||
{90, 78},
|
||||
});
|
||||
constexpr float keyboard_pitch = -0.6;
|
||||
constexpr glm::vec3 popup_position = {0, 0, 0.05};
|
||||
constexpr glm::vec3 keyboard_position = {0, -0.3, 0.1};
|
||||
@@ -76,7 +85,8 @@ constexpr glm::vec3 keyboard_position = {0, -0.3, 0.1};
|
||||
constexpr float near_plane = 0.02;
|
||||
|
||||
// Recenter gesture thresholds
|
||||
constexpr float recenter_cosangle_min = 0.8;
|
||||
constexpr float recenter_cos_palm_angle_min = 0.7;
|
||||
constexpr float recenter_cos_fingertip_angle_max = 0.3;
|
||||
constexpr float recenter_distance_up = 0.3;
|
||||
constexpr float recenter_distance_front = 0.2;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ glm::quat cubic_spline(const glm::quat & a, const glm::quat & vb, const glm::qua
|
||||
td * (t3 - t2) * va);
|
||||
}
|
||||
|
||||
template <auto components::node::*Field>
|
||||
template <auto components::node::* Field>
|
||||
void apply_track(entt::registry & scene, const components::animation_track_impl<Field> & track, float current_time)
|
||||
{
|
||||
entt::entity target = track.target;
|
||||
|
||||
@@ -146,7 +146,7 @@ static bool in_viewport(const imgui_context::viewport & viewport, ImVec2 positio
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool window_intersects_viewport(ImGuiWindow * window, imgui_context::viewport & viewport)
|
||||
static bool window_intersects_viewport(ImGuiWindow * window, const imgui_context::viewport & viewport)
|
||||
{
|
||||
ImRect w{window->Pos.x, window->Pos.y, window->Pos.x + window->Size.x, window->Pos.y + window->Size.y};
|
||||
ImRect v(viewport.vp_origin.x, viewport.vp_origin.y, viewport.vp_origin.x + viewport.vp_size.x, viewport.vp_origin.y + viewport.vp_size.y);
|
||||
@@ -1005,6 +1005,58 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_context::end_frame()
|
||||
return quads;
|
||||
}
|
||||
|
||||
std::vector<imgui_context::viewport> imgui_context::windows()
|
||||
{
|
||||
std::vector<imgui_context::viewport> w;
|
||||
|
||||
ImGuiWindow * modal_popup = ImGui::GetTopMostAndVisiblePopupModal();
|
||||
|
||||
for (const imgui_context::viewport & layer: layers_)
|
||||
{
|
||||
if (layer.space != xr::spaces::world)
|
||||
continue;
|
||||
|
||||
ImRect v(layer.vp_origin.x, layer.vp_origin.y, layer.vp_origin.x + layer.vp_size.x, layer.vp_origin.y + layer.vp_size.y);
|
||||
|
||||
for (ImGuiWindow * window: context->Windows)
|
||||
{
|
||||
if (not window->Active or window->Hidden /*or window->ParentWindowInBeginStack != nullptr*/)
|
||||
continue;
|
||||
|
||||
if (modal_popup != nullptr and window != modal_popup and not layer.always_show_cursor)
|
||||
continue;
|
||||
|
||||
if (not window_intersects_viewport(window, layer))
|
||||
continue;
|
||||
|
||||
// The window intersects the viewport: compute the window position in the real world
|
||||
ImVec2 max = ImMin(v.Max, window->Pos + window->Size);
|
||||
ImVec2 min = ImMax(v.Min, window->Pos);
|
||||
ImVec2 center = (min + max) / 2;
|
||||
|
||||
w.push_back(viewport{
|
||||
.space = layer.space,
|
||||
.position = layer.position +
|
||||
glm::mat3_cast(layer.orientation) *
|
||||
glm::vec3(
|
||||
((center.x - layer.vp_origin.x) / layer.vp_size.x - 0.5) * layer.size.x,
|
||||
(-(center.y - layer.vp_origin.y) / layer.vp_size.y + 0.5) * layer.size.y,
|
||||
0),
|
||||
.orientation = layer.orientation,
|
||||
.size = {
|
||||
(max.x - min.x) * layer.size.x / layer.vp_size.x,
|
||||
(max.y - min.y) * layer.size.y / layer.vp_size.y,
|
||||
},
|
||||
.vp_origin = {min.x, min.y},
|
||||
.vp_size = {max.x - min.x, max.y - min.y},
|
||||
.always_show_cursor = layer.always_show_cursor,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void imgui_context::vibrate_on_hover()
|
||||
{
|
||||
if (ImGui::IsItemHovered())
|
||||
|
||||
@@ -216,6 +216,8 @@ public:
|
||||
return layers_;
|
||||
}
|
||||
|
||||
std::vector<viewport> windows();
|
||||
|
||||
viewport & layer(ImVec2 position);
|
||||
|
||||
void new_frame(XrTime display_time);
|
||||
|
||||
@@ -174,7 +174,7 @@ struct animation_track_base
|
||||
interpolation_t interpolation;
|
||||
};
|
||||
|
||||
template <auto node::*Field>
|
||||
template <auto node::* Field>
|
||||
struct animation_track_impl : animation_track_base
|
||||
{
|
||||
static const constexpr auto field = Field;
|
||||
|
||||
+340
-36
@@ -31,6 +31,7 @@
|
||||
#include "render/scene_components.h"
|
||||
#include "stream.h"
|
||||
#include "utils/files.h"
|
||||
#include "utils/glm_cast.h"
|
||||
#include "utils/i18n.h"
|
||||
#include "wivrn_client.h"
|
||||
#include "wivrn_discover.h"
|
||||
@@ -84,14 +85,38 @@ static const std::array supported_depth_formats{
|
||||
vk::Format::eX8D24UnormPack32,
|
||||
};
|
||||
|
||||
static float interpolate(float x, std::span<const std::pair<float, float>> arr)
|
||||
{
|
||||
assert(arr.size() >= 1);
|
||||
|
||||
if (x <= arr[0].first)
|
||||
return arr[0].second;
|
||||
|
||||
if (x >= arr.back().first)
|
||||
return arr.back().second;
|
||||
|
||||
for (size_t i = 0; i + 1 < arr.size(); i++)
|
||||
{
|
||||
assert(arr[i].first <= arr[i + 1].first);
|
||||
if (arr[i].first <= x and x < arr[i + 1].first)
|
||||
{
|
||||
auto t = (x - arr[i].first) / (arr[i + 1].first - arr[i].first);
|
||||
return std::lerp(arr[i].second, arr[i + 1].second, t);
|
||||
}
|
||||
}
|
||||
|
||||
return arr[0].second; // Should never happen
|
||||
}
|
||||
|
||||
static glm::quat compute_gui_orientation(glm::vec3 head_position, glm::vec3 new_gui_position)
|
||||
{
|
||||
using constants::lobby::gui_pitch;
|
||||
|
||||
glm::vec3 gui_direction = new_gui_position - head_position;
|
||||
|
||||
float gui_yaw = atan2(gui_direction.x, gui_direction.z) + M_PI;
|
||||
|
||||
float eye_gaze_elevation = atan2(gui_direction.y, glm::length(glm::vec2(gui_direction.x, gui_direction.z)));
|
||||
float gui_pitch = interpolate(eye_gaze_elevation * 180 / M_PI, constants::lobby::gui_pitches) * M_PI / 180;
|
||||
|
||||
return glm::quat(cos(gui_yaw / 2), 0, sin(gui_yaw / 2), 0) * glm::quat(cos(gui_pitch / 2), sin(gui_pitch / 2), 0, 0);
|
||||
}
|
||||
|
||||
@@ -403,27 +428,59 @@ void scenes::lobby::connect(const configuration::server_data & data)
|
||||
data.manual);
|
||||
}
|
||||
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints)
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(
|
||||
xr::spaces space,
|
||||
const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints,
|
||||
const std::pair<glm::vec3, glm::quat> & head_pose)
|
||||
{
|
||||
if (recentering_context and std::get<0>(*recentering_context) != space)
|
||||
return std::nullopt;
|
||||
|
||||
if (not joints)
|
||||
if (joints)
|
||||
{
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||
const auto palm_y = glm::rotate(glm_cast(palm.pose.orientation), glm::vec3(0, 1, 0));
|
||||
|
||||
const auto & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||
const auto & o = palm.pose.orientation;
|
||||
const auto & p = palm.pose.position;
|
||||
glm::quat q{o.w, o.x, o.y, o.z};
|
||||
glm::vec3 v{p.x, p.y, p.z};
|
||||
for (XrHandJointEXT index: {
|
||||
XR_HAND_JOINT_INDEX_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_INDEX_DISTAL_EXT,
|
||||
|
||||
if (glm::dot(q * glm::vec3(0, 1, 0), glm::vec3(0, -1, 0)) > constants::lobby::recenter_cosangle_min)
|
||||
{
|
||||
recentering_context.emplace(space, glm::vec3{}, 0);
|
||||
return v + glm::vec3(0, constants::lobby::recenter_distance_up, 0) + q * glm::vec3(0, 0, -constants::lobby::recenter_distance_front);
|
||||
XR_HAND_JOINT_MIDDLE_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_MIDDLE_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_MIDDLE_DISTAL_EXT,
|
||||
|
||||
XR_HAND_JOINT_RING_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_RING_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_RING_DISTAL_EXT,
|
||||
|
||||
XR_HAND_JOINT_LITTLE_PROXIMAL_EXT,
|
||||
XR_HAND_JOINT_LITTLE_INTERMEDIATE_EXT,
|
||||
XR_HAND_JOINT_LITTLE_DISTAL_EXT,
|
||||
})
|
||||
{
|
||||
const auto fingertip_y = glm::rotate(glm_cast((*joints)[index].first.pose.orientation), glm::vec3(0, 1, 0));
|
||||
|
||||
if (glm::dot(palm_y, fingertip_y) < constants::lobby::recenter_cos_fingertip_angle_max)
|
||||
{
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
const auto q = glm_cast(palm.pose.orientation);
|
||||
const auto x = glm_cast(palm.pose.position);
|
||||
|
||||
// Make the up vector orthogonal to forward
|
||||
const glm::vec3 forward = glm::rotate(head_pose.second, glm::vec3{0, 0, -1});
|
||||
const glm::vec3 up = glm::normalize(glm::vec3{0, 1, 0} - forward * glm::dot(forward, {0, 1, 0}));
|
||||
|
||||
// Y is pointing to the back of the hand
|
||||
if (glm::dot(q * glm::vec3(0, -1, 0), up) > constants::lobby::recenter_cos_palm_angle_min)
|
||||
{
|
||||
recentering_context.emplace(space, glm::vec3{}, 0);
|
||||
return x + glm::rotate(q, glm::vec3{0, -constants::lobby::recenter_distance_up, -constants::lobby::recenter_distance_front});
|
||||
}
|
||||
}
|
||||
|
||||
recentering_context.reset();
|
||||
@@ -535,14 +592,21 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_d
|
||||
// One step is usually enough, the solution will continuously improve in the next frames
|
||||
glm::vec3 gui_position = imgui_ctx->layers()[0].position;
|
||||
float eps = 0.01;
|
||||
glm::vec3 obj = f(gui_position);
|
||||
glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps;
|
||||
|
||||
glm::mat3 jacobian{obj_dx, obj_dy, obj_dz};
|
||||
glm::vec3 obj;
|
||||
int n_iter = 0;
|
||||
do
|
||||
{
|
||||
obj = f(gui_position);
|
||||
glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps;
|
||||
|
||||
gui_position -= glm::inverse(jacobian) * obj;
|
||||
glm::mat3 jacobian{obj_dx, obj_dy, obj_dz};
|
||||
|
||||
gui_position -= 0.01 * glm::inverse(jacobian) * obj;
|
||||
n_iter++;
|
||||
} while (glm::length(obj) > 0.0001 and n_iter < 1000);
|
||||
|
||||
return gui_position;
|
||||
}
|
||||
@@ -584,6 +648,240 @@ static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
|
||||
return glm::vec4(normal, -glm::dot(p, normal) - margin);
|
||||
}
|
||||
|
||||
static void stick_finger_to_gui(std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT> & hand, const std::vector<imgui_context::viewport> & layers)
|
||||
{
|
||||
// Move XR_HAND_JOINT_INDEX_{TIP,DISTAL,INTERMEDIATE,PROXIMAL}_EXT so that:
|
||||
// - Only the X rotation changes for distal and intermediate (relative to the parent bone)
|
||||
// - Only the X and Y rotation change for the proximal
|
||||
// - The orientation of the tip is the same as the distal
|
||||
// - The position stays constant in the frame of the parent bone
|
||||
// - The position of the tip is on the closest imgui window (considering the tip radius)
|
||||
// - The rotation on X for the index proximal is limited to [-90, +30]
|
||||
// - The rotation on Y for the index proximal is limited to [-30, +30]
|
||||
// - The rotation on X for the index intermediate are equal and limited to [-90, 0]
|
||||
|
||||
// Convert from OpenXR types to glm
|
||||
glm::vec3 tip_x{
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose.position.z};
|
||||
|
||||
// Compute the target position of the tip
|
||||
std::vector<std::pair<glm::vec3, float>> intersections; // Target position of the finger tip, distance to the GUI plane
|
||||
for (const imgui_context::viewport & layer: layers)
|
||||
{
|
||||
// Ignore layers that are not absolutely positionned
|
||||
if (layer.space != xr::spaces::world)
|
||||
continue;
|
||||
|
||||
// Compute all vectors in the reference frame of the GUI plane
|
||||
// The normal of the GUI plane is +Z, the tip points toward -Z
|
||||
auto M = glm::mat3_cast(layer.orientation); // plane-to-world transform
|
||||
glm::vec3 ray_start = glm::transpose(M) * (tip_x - layer.position);
|
||||
|
||||
// Ignore this layer if the tip is outside the limits
|
||||
if (std::abs(ray_start.x) > layer.size.x / 2)
|
||||
continue;
|
||||
|
||||
if (std::abs(ray_start.y) > layer.size.y / 2)
|
||||
continue;
|
||||
|
||||
float distance = ray_start.z; // Positive when the point is in front of the plane
|
||||
|
||||
// Not near the plane: ignore
|
||||
if (distance > 0 or distance < constants::gui::fingertip_distance_stick_thd)
|
||||
continue;
|
||||
|
||||
glm::vec3 target_position = tip_x + M * glm::vec3{0, 0, -distance};
|
||||
|
||||
intersections.emplace_back(target_position, std::abs(distance));
|
||||
}
|
||||
|
||||
if (intersections.empty())
|
||||
return;
|
||||
|
||||
auto [target_position, distance] = *std::ranges::min_element(intersections, {}, &std::pair<glm::vec3, float>::second);
|
||||
|
||||
// Convert from OpenXR to glm
|
||||
glm::vec3 distal_x{
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.position.z};
|
||||
glm::vec3 intermediate_x{
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.position.z};
|
||||
glm::vec3 proximal_x{
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.position.z};
|
||||
glm::vec3 metacarpal_x{
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.position.x,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.position.y,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.position.z};
|
||||
glm::quat distal_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose.orientation.z);
|
||||
glm::quat intermediate_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose.orientation.z);
|
||||
glm::quat proximal_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation.z);
|
||||
glm::quat metacarpal_q = glm::quat::wxyz(
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.w,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.x,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.y,
|
||||
hand[XR_HAND_JOINT_INDEX_METACARPAL_EXT].first.pose.orientation.z);
|
||||
|
||||
// Get relative positions and orientations
|
||||
const auto rel_tip_x = glm::rotate(glm::conjugate(distal_q), tip_x - distal_x);
|
||||
// relative tip orientation is always identity
|
||||
|
||||
const auto rel_distal_x = glm::rotate(glm::conjugate(intermediate_q), distal_x - intermediate_x);
|
||||
const auto rel_distal_q = glm::conjugate(intermediate_q) * distal_q;
|
||||
const auto rel_distal_θ = glm::eulerAngles(rel_distal_q);
|
||||
|
||||
const auto rel_intermediate_x = glm::rotate(glm::conjugate(proximal_q), intermediate_x - proximal_x);
|
||||
const auto rel_intermediate_q = glm::conjugate(proximal_q) * intermediate_q;
|
||||
const auto rel_intermediate_θ = glm::eulerAngles(rel_intermediate_q);
|
||||
|
||||
const auto rel_proximal_x = glm::rotate(glm::conjugate(metacarpal_q), proximal_x - metacarpal_x);
|
||||
const auto rel_proximal_q = glm::conjugate(metacarpal_q) * proximal_q;
|
||||
const auto rel_proximal_θ = glm::eulerAngles(rel_proximal_q);
|
||||
|
||||
// Forward kinematics
|
||||
auto f = [&](float proximal_θx, float proximal_θy, float intermediate_θx, float distal_θx) -> glm::vec3 {
|
||||
// Compute the absolute tip position
|
||||
const glm::quat new_rel_proximal_q = glm::quat(glm::vec3(proximal_θx, proximal_θy, rel_proximal_θ.z));
|
||||
const glm::quat new_rel_intermediate_q = glm::quat(glm::vec3(intermediate_θx, rel_intermediate_θ.y, rel_intermediate_θ.z));
|
||||
const glm::quat new_rel_distal_q = glm::quat(glm::vec3(distal_θx, rel_distal_θ.y, rel_distal_θ.z));
|
||||
|
||||
const glm::quat proximal_q = metacarpal_q * new_rel_proximal_q;
|
||||
const glm::quat intermediate_q = proximal_q * new_rel_intermediate_q;
|
||||
const glm::quat distal_q = intermediate_q * new_rel_distal_q;
|
||||
|
||||
const glm::vec3 tip_x = metacarpal_x +
|
||||
glm::rotate(metacarpal_q, rel_proximal_x) +
|
||||
glm::rotate(proximal_q, rel_intermediate_x) +
|
||||
glm::rotate(intermediate_q, rel_distal_x) +
|
||||
glm::rotate(distal_q, rel_tip_x);
|
||||
|
||||
return tip_x - target_position;
|
||||
};
|
||||
|
||||
// Inverse kinematics solver for the tip position
|
||||
float proximal_θx = rel_proximal_θ.x;
|
||||
float proximal_θy = rel_proximal_θ.y;
|
||||
float intermediate_θx = rel_intermediate_θ.x;
|
||||
float distal_θx = rel_distal_θ.x;
|
||||
|
||||
glm::vec3 objective = f(proximal_θx, proximal_θy, intermediate_θx, distal_θx);
|
||||
float eps = 0.01; // 10 milliradian ~ 0.57 deg
|
||||
int n = 0;
|
||||
|
||||
while (glm::length(objective) > 1e-4 and n++ < 1000)
|
||||
{
|
||||
glm::vec3 dobj_1 = (f(proximal_θx + eps, proximal_θy, intermediate_θx, distal_θx) - objective) / eps;
|
||||
glm::vec3 dobj_2 = (f(proximal_θx, proximal_θy + eps, intermediate_θx, distal_θx) - objective) / eps;
|
||||
glm::vec3 dobj_3 = (f(proximal_θx, proximal_θy, intermediate_θx + eps, distal_θx) - objective) / eps;
|
||||
glm::vec3 dobj_4 = (f(proximal_θx, proximal_θy, intermediate_θx, distal_θx + eps) - objective) / eps;
|
||||
|
||||
glm::mat4x3 jacobian(dobj_1, dobj_2, dobj_3, dobj_4);
|
||||
glm::mat3x4 jacobian_transpose = glm::transpose(jacobian);
|
||||
|
||||
glm::vec4 direction = -glm::normalize(jacobian_transpose * objective);
|
||||
glm::vec4 delta = 10 * direction * glm::length(objective);
|
||||
|
||||
float tmp = (delta.z + delta.w) / 2;
|
||||
delta.z = delta.w = tmp;
|
||||
|
||||
proximal_θx = std::clamp<float>(proximal_θx + delta.x, -M_PI / 2, M_PI / 6);
|
||||
proximal_θy = std::clamp<float>(proximal_θy + delta.y, -M_PI / 6, M_PI / 6);
|
||||
intermediate_θx = std::clamp<float>(intermediate_θx + delta.z, -M_PI / 2, 0);
|
||||
distal_θx = std::clamp<float>(distal_θx + delta.w, -M_PI / 2, 0);
|
||||
|
||||
objective = f(proximal_θx, proximal_θy, intermediate_θx, distal_θx);
|
||||
}
|
||||
|
||||
// Fill in the modified bones
|
||||
const glm::vec3 new_rel_proximal_θ(proximal_θx, proximal_θy, rel_proximal_θ.z);
|
||||
const glm::vec3 new_rel_intermediate_θ(intermediate_θx, rel_intermediate_θ.y, rel_intermediate_θ.z);
|
||||
const glm::vec3 new_rel_distal_θ(distal_θx, rel_distal_θ.y, rel_distal_θ.z);
|
||||
|
||||
const glm::quat new_rel_proximal_q = glm::quat(new_rel_proximal_θ);
|
||||
const glm::quat new_rel_intermediate_q = glm::quat(new_rel_intermediate_θ);
|
||||
const glm::quat new_rel_distal_q = glm::quat(new_rel_distal_θ);
|
||||
|
||||
proximal_q = metacarpal_q * new_rel_proximal_q;
|
||||
intermediate_q = proximal_q * new_rel_intermediate_q;
|
||||
distal_q = intermediate_q * new_rel_distal_q;
|
||||
|
||||
intermediate_x = proximal_x + glm::rotate(proximal_q, rel_intermediate_x);
|
||||
distal_x = intermediate_x + glm::rotate(intermediate_q, rel_distal_x);
|
||||
tip_x = distal_x + glm::rotate(distal_q, rel_tip_x);
|
||||
|
||||
hand[XR_HAND_JOINT_INDEX_PROXIMAL_EXT].first.pose.orientation = {
|
||||
proximal_q.x,
|
||||
proximal_q.y,
|
||||
proximal_q.z,
|
||||
proximal_q.w,
|
||||
};
|
||||
hand[XR_HAND_JOINT_INDEX_INTERMEDIATE_EXT].first.pose = {
|
||||
.orientation = {
|
||||
intermediate_q.x,
|
||||
intermediate_q.y,
|
||||
intermediate_q.z,
|
||||
intermediate_q.w,
|
||||
},
|
||||
.position = {
|
||||
intermediate_x.x,
|
||||
intermediate_x.y,
|
||||
intermediate_x.z,
|
||||
},
|
||||
};
|
||||
hand[XR_HAND_JOINT_INDEX_DISTAL_EXT].first.pose = {
|
||||
.orientation = {
|
||||
distal_q.x,
|
||||
distal_q.y,
|
||||
distal_q.z,
|
||||
distal_q.w,
|
||||
},
|
||||
.position = {
|
||||
distal_x.x,
|
||||
distal_x.y,
|
||||
distal_x.z,
|
||||
},
|
||||
};
|
||||
hand[XR_HAND_JOINT_INDEX_TIP_EXT].first.pose = {
|
||||
.orientation = {
|
||||
distal_q.x,
|
||||
distal_q.y,
|
||||
distal_q.z,
|
||||
distal_q.w,
|
||||
},
|
||||
.position = {
|
||||
tip_x.x,
|
||||
tip_x.y,
|
||||
tip_x.z,
|
||||
},
|
||||
};
|
||||
|
||||
// Translate the whole hand if we cannot find an exact solution
|
||||
for (auto & hand_joint: hand)
|
||||
{
|
||||
hand_joint.first.pose.position.x -= objective.x;
|
||||
hand_joint.first.pose.position.y -= objective.y;
|
||||
hand_joint.first.pose.position.z -= objective.z;
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
{
|
||||
if (async_session.valid() && async_session.poll() == utils::future_status::ready)
|
||||
@@ -651,6 +949,8 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
}
|
||||
|
||||
session.begin_frame();
|
||||
renderer->debug_draw_clear();
|
||||
|
||||
#if WIVRN_FEATURE_RENDERDOC
|
||||
renderdoc_begin(*vk_instance);
|
||||
#endif
|
||||
@@ -674,25 +974,32 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
|
||||
if (left_hand and right_hand)
|
||||
{
|
||||
auto windows = imgui_ctx->windows();
|
||||
|
||||
auto left = left_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
if (left and xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
stick_finger_to_gui(*left, windows);
|
||||
hide_left_controller = true;
|
||||
}
|
||||
|
||||
auto right = right_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
if (right and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
stick_finger_to_gui(*right, windows);
|
||||
hide_right_controller = true;
|
||||
}
|
||||
|
||||
hand_model::apply(world, left, right);
|
||||
|
||||
if (left and xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_left_controller = true;
|
||||
if (not new_gui_position and head_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, left, *head_position);
|
||||
|
||||
if (right and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_right_controller = true;
|
||||
|
||||
if (not new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, left);
|
||||
|
||||
if (not new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, right);
|
||||
if (not new_gui_position and head_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, right, *head_position);
|
||||
}
|
||||
|
||||
if (head_position && new_gui_position)
|
||||
if (head_position and new_gui_position)
|
||||
{
|
||||
move_gui(head_position->first, *new_gui_position);
|
||||
}
|
||||
@@ -736,7 +1043,6 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
}
|
||||
#endif
|
||||
|
||||
renderer->debug_draw_clear();
|
||||
std::vector<std::pair<int, XrCompositionLayerQuad>> imgui_layers = draw_gui(frame_state.predictedDisplayTime);
|
||||
|
||||
#if WIVRN_CLIENT_DEBUG_MENU
|
||||
@@ -763,8 +1069,6 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
|
||||
renderer::animate(world, frame_state.predictedDisplayPeriod * 1.0e-9);
|
||||
|
||||
assert(renderer);
|
||||
|
||||
world.get<components::node>(lobby_entity).visible = not application::get_config().passthrough_enabled;
|
||||
|
||||
render_start(application::get_config().passthrough_enabled, frame_state.predictedDisplayTime);
|
||||
|
||||
@@ -238,7 +238,7 @@ class lobby : public scene_impl<lobby>
|
||||
void connect(const configuration::server_data & data);
|
||||
std::unique_ptr<wivrn_session> connect_to_session(wivrn_discover::service service, bool manual_connection);
|
||||
|
||||
std::optional<glm::vec3> check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints);
|
||||
std::optional<glm::vec3> check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints, const std::pair<glm::vec3, glm::quat> & head_pose);
|
||||
std::optional<glm::vec3> check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position);
|
||||
std::optional<glm::vec3> check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation);
|
||||
|
||||
|
||||
@@ -304,6 +304,10 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
return info;
|
||||
}());
|
||||
|
||||
self->network_session->send_control(from_headset::session_state_changed{
|
||||
.state = application::get_session_state(),
|
||||
});
|
||||
|
||||
if (self->instance.has_extension(XR_KHR_VISIBILITY_MASK_EXTENSION_NAME))
|
||||
{
|
||||
for (uint8_t view = 0; view < view_count; ++view)
|
||||
|
||||
@@ -262,7 +262,7 @@ private:
|
||||
struct subplot
|
||||
{
|
||||
std::string title;
|
||||
float scenes::stream::global_metric::*data;
|
||||
float scenes::stream::global_metric::* data;
|
||||
};
|
||||
std::vector<subplot> subplots;
|
||||
const char * unit;
|
||||
|
||||
@@ -223,7 +223,7 @@ void scenes::stream::gui_performance_metrics()
|
||||
for (const auto & [subtitle, data]: subplots)
|
||||
{
|
||||
getter_data gdata{
|
||||
.data = (uintptr_t) & (global_metrics.data()->*data),
|
||||
.data = (uintptr_t)&(global_metrics.data()->*data),
|
||||
.stride = sizeof(global_metric),
|
||||
.multiplier = multiplier,
|
||||
};
|
||||
@@ -260,57 +260,57 @@ void scenes::stream::gui_performance_metrics()
|
||||
ImPlot::SetupAxesLimits(0, metrics.size() - 1, min_v * 1e3f, axis_scale[n] * 1e3f, ImGuiCond_Always);
|
||||
|
||||
getter_data getter_encode_begin{
|
||||
.data = (uintptr_t) & (metrics.data()->encode_begin),
|
||||
.data = (uintptr_t)&(metrics.data()->encode_begin),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_encode_end{
|
||||
.data = (uintptr_t) & (metrics.data()->encode_end),
|
||||
.data = (uintptr_t)&(metrics.data()->encode_end),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_send_begin{
|
||||
.data = (uintptr_t) & (metrics.data()->send_begin),
|
||||
.data = (uintptr_t)&(metrics.data()->send_begin),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_send_end{
|
||||
.data = (uintptr_t) & (metrics.data()->send_end),
|
||||
.data = (uintptr_t)&(metrics.data()->send_end),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_received_first_packet{
|
||||
.data = (uintptr_t) & (metrics.data()->received_first_packet),
|
||||
.data = (uintptr_t)&(metrics.data()->received_first_packet),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_received_last_packet{
|
||||
.data = (uintptr_t) & (metrics.data()->received_last_packet),
|
||||
.data = (uintptr_t)&(metrics.data()->received_last_packet),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_sent_to_decoder{
|
||||
.data = (uintptr_t) & (metrics.data()->sent_to_decoder),
|
||||
.data = (uintptr_t)&(metrics.data()->sent_to_decoder),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_received_from_decoder{
|
||||
.data = (uintptr_t) & (metrics.data()->received_from_decoder),
|
||||
.data = (uintptr_t)&(metrics.data()->received_from_decoder),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_blitted{
|
||||
.data = (uintptr_t) & (metrics.data()->blitted),
|
||||
.data = (uintptr_t)&(metrics.data()->blitted),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_displayed{
|
||||
.data = (uintptr_t) & (metrics.data()->displayed),
|
||||
.data = (uintptr_t)&(metrics.data()->displayed),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
getter_data getter_predicted{
|
||||
.data = (uintptr_t) & (metrics.data()->predicted_display),
|
||||
.data = (uintptr_t)&(metrics.data()->predicted_display),
|
||||
.stride = sizeof(decoder_metric),
|
||||
.multiplier = 1e3f};
|
||||
|
||||
@@ -626,7 +626,14 @@ void scenes::stream::gui_applications()
|
||||
auto btn = _("Start");
|
||||
ImGui::SetCursorPos(ImGui::GetWindowSize() - ImGui::CalcTextSize(btn.c_str()) - ImVec2(50, 50));
|
||||
if (ImGui::Button(btn.c_str()))
|
||||
{
|
||||
network_session->send_control(from_headset::get_application_list{
|
||||
.language = application::get_messages_info().language,
|
||||
.country = application::get_messages_info().country,
|
||||
.variant = application::get_messages_info().variant,
|
||||
});
|
||||
gui_status = gui_status::application_launcher;
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
ImGui::PopStyleVar(3);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "utils/named_thread.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <uni_algo/case.h>
|
||||
|
||||
@@ -78,6 +77,9 @@ void scenes::stream::operator()(to_headset::video_stream_description && desc)
|
||||
void scenes::stream::operator()(to_headset::refresh_rate_change && rate)
|
||||
{
|
||||
session.set_refresh_rate(rate.fps);
|
||||
std::shared_lock lock(decoder_mutex);
|
||||
if (video_stream_description)
|
||||
video_stream_description->fps = rate.fps;
|
||||
}
|
||||
|
||||
void scenes::stream::operator()(to_headset::timesync_query && query)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2025 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,6 +16,27 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "rectangle_partitionner.h"
|
||||
#pragma once
|
||||
|
||||
#include "moc_rectangle_partitionner.cpp"
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
inline glm::quat glm_cast(const XrQuaternionf & q)
|
||||
{
|
||||
return glm::quat::wxyz(q.w, q.x, q.y, q.z);
|
||||
}
|
||||
|
||||
inline XrQuaternionf glm_cast(const glm::quat & q)
|
||||
{
|
||||
return XrQuaternionf(q.w, q.x, q.y, q.z);
|
||||
}
|
||||
|
||||
inline glm::vec3 glm_cast(const XrVector3f & v)
|
||||
{
|
||||
return glm::vec3(v.x, v.y, v.z);
|
||||
}
|
||||
|
||||
inline XrVector3f glm_cast(const glm::vec3 & v)
|
||||
{
|
||||
return XrVector3f(v.x, v.y, v.z);
|
||||
}
|
||||
@@ -15,7 +15,6 @@ add_executable(wivrn-dashboard
|
||||
dashboard_utils.cpp
|
||||
escape_string.cpp
|
||||
settings.cpp
|
||||
rectangle_partitionner.cpp
|
||||
adb.cpp
|
||||
apk_installer.cpp
|
||||
firewall.cpp
|
||||
@@ -28,11 +27,16 @@ target_sources(wivrn-dashboard PRIVATE ${DBUS_INTERFACE_SRC})
|
||||
|
||||
set_source_files_properties(../images/wivrn.svg PROPERTIES QT_RESOURCE_ALIAS qml/wivrn.svg)
|
||||
|
||||
set_source_files_properties(qml/DashboardSettings.qml PROPERTIES
|
||||
QT_QML_SINGLETON_TYPE TRUE
|
||||
)
|
||||
|
||||
qt_add_qml_module(wivrn-dashboard
|
||||
URI io.github.wivrn.wivrn
|
||||
QML_FILES
|
||||
qml/Main.qml
|
||||
qml/ApkInstallPage.qml
|
||||
qml/DashboardSettings.qml
|
||||
qml/SettingsPage.qml
|
||||
qml/HeadsetsPage.qml
|
||||
qml/HeadsetStatsPage.qml
|
||||
@@ -51,7 +55,6 @@ qt_add_qml_module(wivrn-dashboard
|
||||
qml/Github.svg
|
||||
)
|
||||
|
||||
|
||||
configure_file(gui_config.h.in gui_config.h)
|
||||
configure_file(io.github.wivrn.wivrn.desktop.in io.github.wivrn.wivrn.desktop)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtCore
|
||||
|
||||
Settings {
|
||||
property bool first_run: true
|
||||
property bool show_system_checks: true
|
||||
property string last_run_version: ""
|
||||
|
||||
property bool adb_custom: false
|
||||
property string adb_location: ""
|
||||
}
|
||||
|
||||
+8
-17
@@ -42,15 +42,6 @@ Kirigami.ApplicationWindow {
|
||||
|
||||
onClosing: Qt.quit()
|
||||
|
||||
Core.Settings {
|
||||
id: settings
|
||||
property alias first_run: root.first_run
|
||||
property alias last_run_version: root.last_run_version
|
||||
property bool show_system_checks: true
|
||||
}
|
||||
property bool first_run: true
|
||||
property string last_run_version
|
||||
|
||||
width: 900
|
||||
height: 800
|
||||
|
||||
@@ -76,10 +67,10 @@ Kirigami.ApplicationWindow {
|
||||
if (value == WivrnServer.FailedToStart)
|
||||
message_failed_to_start.visible = true;
|
||||
|
||||
if (root.first_run && started) {
|
||||
if (DashboardSettings.first_run && started) {
|
||||
console.log("First run");
|
||||
root.pageStack.push(Qt.createComponent("WizardPage.qml").createObject());
|
||||
root.first_run = false;
|
||||
DashboardSettings.first_run = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,8 +100,8 @@ Kirigami.ApplicationWindow {
|
||||
if (WivrnServer.serverStatus == WivrnServer.Stopped)
|
||||
WivrnServer.start_server();
|
||||
|
||||
if (root.last_run_version != ApkInstaller.currentVersion) {
|
||||
root.last_run_version = ApkInstaller.currentVersion;
|
||||
if (DashboardSettings.last_run_version != ApkInstaller.currentVersion) {
|
||||
DashboardSettings.last_run_version = ApkInstaller.currentVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +121,7 @@ Kirigami.ApplicationWindow {
|
||||
text: i18n("Avahi daemon is not installed")
|
||||
type: Kirigami.MessageType.Warning
|
||||
showCloseButton: true
|
||||
visible: settings.show_system_checks && !Avahi.installed
|
||||
visible: DashboardSettings.show_system_checks && !Avahi.installed
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
@@ -138,7 +129,7 @@ Kirigami.ApplicationWindow {
|
||||
text: i18n("Avahi daemon is not started")
|
||||
type: Kirigami.MessageType.Warning
|
||||
showCloseButton: true
|
||||
visible: settings.show_system_checks && Avahi.installed && !Avahi.running
|
||||
visible: DashboardSettings.show_system_checks && Avahi.installed && !Avahi.running
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
visible: Avahi.canStart
|
||||
@@ -154,7 +145,7 @@ Kirigami.ApplicationWindow {
|
||||
// type: Kirigami.MessageType.Warning
|
||||
type: Kirigami.MessageType.Information
|
||||
showCloseButton: true
|
||||
visible: settings.show_system_checks && !WivrnServer.capSysNice
|
||||
visible: DashboardSettings.show_system_checks && !WivrnServer.capSysNice
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Fix it")
|
||||
@@ -168,7 +159,7 @@ Kirigami.ApplicationWindow {
|
||||
text: i18n("Firewall may not allow port 9757")
|
||||
type: Kirigami.MessageType.Warning
|
||||
showCloseButton: true
|
||||
visible: settings.show_system_checks && Firewall.needSetup
|
||||
visible: DashboardSettings.show_system_checks && Firewall.needSetup
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Fix it")
|
||||
|
||||
+97
-186
@@ -15,18 +15,12 @@ Kirigami.ScrollablePage {
|
||||
|
||||
flickable.interactive: false // Make sure the Kirigami.ScrollablePage does not eat the vertical mouse dragging events
|
||||
|
||||
property bool allowUpdates: false // ignore onXXX events until document is loaded
|
||||
|
||||
Settings {
|
||||
id: config
|
||||
}
|
||||
|
||||
Core.Settings {
|
||||
property alias adb_custom: settings.adb_custom
|
||||
property alias adb_location: settings.adb_location
|
||||
property alias show_system_checks: show_system_checks.checked
|
||||
}
|
||||
property bool adb_custom
|
||||
property string adb_location
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
@@ -35,7 +29,7 @@ Kirigami.ScrollablePage {
|
||||
|
||||
Controls.CheckBox {
|
||||
id: manual_foveation
|
||||
checked: true
|
||||
checked: config.scale != -1
|
||||
Layout.row: 0
|
||||
Layout.column: 0
|
||||
text: i18nc("automatic foveation setup", "Manual foveation")
|
||||
@@ -105,155 +99,59 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
return Number.fromLocaleString(text);
|
||||
}
|
||||
|
||||
onValueModified: config.bitrate = value
|
||||
}
|
||||
|
||||
Controls.ComboBox {
|
||||
id: encoder_layout
|
||||
Kirigami.FormData.label: i18n("Encoder layout:")
|
||||
model: [
|
||||
{
|
||||
label: i18nc("encoder preset", "Automatic"),
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Manual"),
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Default preset"),
|
||||
value: [
|
||||
{
|
||||
width: 0.5,
|
||||
height: 1,
|
||||
offset_x: 0,
|
||||
offset_y: 0
|
||||
},
|
||||
{
|
||||
width: 0.5,
|
||||
height: 1,
|
||||
offset_x: 0.5,
|
||||
offset_y: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Low latency preset"),
|
||||
value: [
|
||||
{
|
||||
width: 0.5,
|
||||
height: 1,
|
||||
offset_x: 0.5,
|
||||
offset_y: 0,
|
||||
encoder: 'x264',
|
||||
codec: 'h264'
|
||||
},
|
||||
{
|
||||
width: 0.5,
|
||||
height: 1,
|
||||
offset_x: 0,
|
||||
offset_y: 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: i18nc("encoder preset", "Safe preset"),
|
||||
value: [
|
||||
{
|
||||
width: 1,
|
||||
height: 1,
|
||||
offset_x: 0,
|
||||
offset_y: 0
|
||||
}]
|
||||
Kirigami.InlineMessage {
|
||||
Layout.fillWidth: true
|
||||
text: i18n("The current encoder configuration is not supported")
|
||||
type: Kirigami.MessageType.Information
|
||||
visible: !config.simpleConfig
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: i18n("Reset")
|
||||
onTriggered: config.encoder = Settings.EncoderAuto
|
||||
}
|
||||
]
|
||||
textRole: "label"
|
||||
valueRole: "value"
|
||||
onCurrentValueChanged: {
|
||||
if (currentValue)
|
||||
{
|
||||
config.set_encoder_preset(currentValue);
|
||||
partitionner.currentIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
text: i18n("To add a new encoder, split an existing encoder by clicking near an edge.\nDrag an edge to resize or remove encoders.")
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RectanglePartitionner {
|
||||
id: partitionner
|
||||
implicitWidth: 600
|
||||
implicitHeight: 300
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
settings: config
|
||||
onCodecChanged: {
|
||||
for (var i = 0; i < codec_combo.model.length; i++) {
|
||||
if (codec_combo.model[i].name == codec)
|
||||
codec_combo.currentIndex = i;
|
||||
}
|
||||
}
|
||||
onEncoderChanged: {
|
||||
for (var i = 0; i < encoder_combo.model.length; i++) {
|
||||
if (encoder_combo.model[i].name == encoder)
|
||||
encoder_combo.currentIndex = i;
|
||||
}
|
||||
}
|
||||
onEncoderLayoutChanged: encoder_layout.currentIndex = 1 // Manual layout
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Kirigami.FormData.label: i18n("Encoder:")
|
||||
enabled: partitionner.selected
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
enabled: config.simpleConfig
|
||||
Controls.ComboBox {
|
||||
id: encoder_combo
|
||||
model: [
|
||||
// Keep it in sync with rectangle_partitionner.h (encoder_name_from_setting)
|
||||
{
|
||||
name: "auto",
|
||||
label: i18nc("automatic encoder setup", "Auto"),
|
||||
codecs: "auto"
|
||||
encoder: Settings.EncoderAuto
|
||||
},
|
||||
{
|
||||
name: "nvenc",
|
||||
label: i18n("nvenc (NVIDIA GPUs)"),
|
||||
codecs: "auto,h264,h265,av1"
|
||||
encoder: Settings.Nvenc
|
||||
},
|
||||
{
|
||||
name: "vaapi",
|
||||
label: i18n("vaapi (AMD and Intel GPUs)"),
|
||||
codecs: "auto,h264,h265,av1"
|
||||
encoder: Settings.Vaapi
|
||||
},
|
||||
{
|
||||
name: "x264",
|
||||
label: i18n("x264 (software encoding)"),
|
||||
codecs: "h264"
|
||||
},
|
||||
{
|
||||
name: "vulkan",
|
||||
label: i18n("Vulkan (Vulkan Video)"),
|
||||
codecs: "h264"
|
||||
encoder: Settings.Vulkan
|
||||
},
|
||||
{
|
||||
label: i18n("x264 (software encoding)"),
|
||||
encoder: Settings.X264
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: if (settings.allowUpdates) {config.encoder = model[currentIndex].encoder}
|
||||
textRole: "label"
|
||||
onCurrentIndexChanged: {
|
||||
partitionner.encoder = encoder_combo.model[currentIndex].name;
|
||||
|
||||
// Check if the currently selected codec is supported by the new encoder
|
||||
var supported_codecs = model[currentIndex].codecs.split(",");
|
||||
var current_codec = codec_combo.model[codec_combo.currentIndex].name;
|
||||
|
||||
if (!supported_codecs.includes(current_codec)) {
|
||||
for (var i = 0; i < codec_combo.model.length; i++) {
|
||||
if (supported_codecs.includes(codec_combo.model[i].name)) {
|
||||
codec_combo.currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: config
|
||||
function onEncoderChanged() {
|
||||
var encoder = config.encoder;
|
||||
var i = encoder_combo.model.findIndex( item => item.encoder == encoder)
|
||||
if (i > -1)
|
||||
encoder_combo.currentIndex = i
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,44 +160,63 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
}
|
||||
|
||||
Controls.ComboBox {
|
||||
id: codec_combo
|
||||
RowLayout {
|
||||
Kirigami.FormData.label: i18n("Codec:")
|
||||
enabled: partitionner.selected
|
||||
visible: encoder_layout.currentIndex > 0
|
||||
model: [
|
||||
// Keep it in sync with rectangle_partitionner.h (codec_name_from_setting)
|
||||
{
|
||||
name: "auto",
|
||||
label: i18nc("automatic codec setup", "Auto")
|
||||
},
|
||||
{
|
||||
name: "h264",
|
||||
label: i18n("H.264")
|
||||
},
|
||||
{
|
||||
name: "h265",
|
||||
label: i18n("H.265")
|
||||
},
|
||||
{
|
||||
name: "av1",
|
||||
label: i18n("AV1")
|
||||
Controls.ComboBox {
|
||||
id: codec_combo
|
||||
enabled: config.simpleConfig && config.encoder != Settings.EncoderAuto
|
||||
model: [
|
||||
{
|
||||
label: i18nc("automatic codec setup", "Auto"),
|
||||
codec: Settings.CodecAuto
|
||||
},
|
||||
{
|
||||
label: i18n("H.264"),
|
||||
codec: Settings.H264
|
||||
},
|
||||
{
|
||||
label: i18n("H.265"),
|
||||
codec: Settings.H265
|
||||
},
|
||||
{
|
||||
label: i18n("AV1"),
|
||||
codec: Settings.Av1
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: if (settings.allowUpdates) {config.codec = model[currentIndex].codec}
|
||||
textRole: "label"
|
||||
|
||||
delegate: Controls.ItemDelegate {
|
||||
required property string label
|
||||
required property var codec
|
||||
|
||||
width: codec_combo.width
|
||||
text: i18n(label)
|
||||
highlighted: ListView.isCurrentItem
|
||||
enabled: config.allowedCodecs.includes(codec)
|
||||
}
|
||||
]
|
||||
textRole: "label"
|
||||
onCurrentIndexChanged: partitionner.codec = model[currentIndex].name
|
||||
|
||||
delegate: Controls.ItemDelegate {
|
||||
required property string label
|
||||
required property string name
|
||||
|
||||
width: codec_combo.width
|
||||
text: i18n(label)
|
||||
highlighted: ListView.isCurrentItem
|
||||
enabled: encoder_combo.model[encoder_combo.currentIndex].codecs.split(",").includes(name)
|
||||
Connections {
|
||||
target: config
|
||||
function onCodecChanged() {
|
||||
var codec = config.codec;
|
||||
var i = codec_combo.model.findIndex( item => item.codec == codec)
|
||||
if (i > -1)
|
||||
codec_combo.currentIndex = i
|
||||
}
|
||||
}
|
||||
}
|
||||
Controls.CheckBox {
|
||||
enabled: config.can10bit
|
||||
text: i18n("10-bits")
|
||||
checked: config.tenbit
|
||||
onCheckedChanged: config.tenbit = checked
|
||||
}
|
||||
Kirigami.ContextualHelpButton {
|
||||
toolTipText: i18n("10-bit encoding improves image quality but is not supported by all codecs and hardware")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Kirigami.Separator {
|
||||
Kirigami.FormData.isSection: true
|
||||
}
|
||||
@@ -349,7 +266,7 @@ Kirigami.ScrollablePage {
|
||||
enabled: adb_custom.checked
|
||||
Controls.TextField {
|
||||
id: adb_location
|
||||
placeholderText: settings.adb_location
|
||||
placeholderText: DashboardSettings.adb_location
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Controls.Button {
|
||||
@@ -449,44 +366,36 @@ Kirigami.ScrollablePage {
|
||||
Component.onCompleted: {
|
||||
openvr_libs.init()
|
||||
config.load(WivrnServer);
|
||||
// If bitrate was manually set higher, keep the limit
|
||||
bitrate.to = Math.max(bitrate.to, config.bitrate)
|
||||
bitrate.value = config.bitrate
|
||||
settings.allowUpdates = true;
|
||||
settings.load();
|
||||
}
|
||||
|
||||
function save() {
|
||||
config.bitrate = bitrate.value * 1000000;
|
||||
config.scale = manual_foveation.checked ? 1 - scale_slider.value / 100.0 : -1;
|
||||
config.manualEncoders = encoder_layout.currentIndex > 0;
|
||||
let openvr = openvr_combobox.model.get(openvr_combobox.currentIndex)
|
||||
if (openvr.is_custom) {
|
||||
config.openvr = openvr_text.text;
|
||||
} else {
|
||||
config.openvr = openvr.value
|
||||
}
|
||||
settings.adb_custom = adb_custom.checked;
|
||||
settings.adb_location = adb_location.text;
|
||||
Adb.setPath(adb_custom.checked ? adb_location.text : "adb");
|
||||
DashboardSettings.adb_custom = adb_custom.checked;
|
||||
DashboardSettings.adb_location = adb_location.text;
|
||||
Adb.setPath(DashboardSettings.adb_custom.checked ? adb_location.text : "adb");
|
||||
|
||||
DashboardSettings.show_system_checks = show_system_checks.checked;
|
||||
|
||||
config.debugGui = debug_gui.checked;
|
||||
config.steamVrLh = steamvr_lh.checked;
|
||||
}
|
||||
|
||||
function load() {
|
||||
bitrate.value = config.bitrate / 1000000;
|
||||
|
||||
if (config.scale > 0) {
|
||||
scale_slider.value = Math.round(100 - config.scale * 100);
|
||||
manual_foveation.checked = true;
|
||||
} else {
|
||||
scale_slider.value = 50;
|
||||
manual_foveation.checked = false;
|
||||
}
|
||||
|
||||
if (config.manualEncoders) {
|
||||
// auto_encoders.checked = false;
|
||||
encoder_layout.currentIndex = 1;
|
||||
} else {
|
||||
// auto_encoders.checked = true;
|
||||
encoder_layout.currentIndex = 0;
|
||||
}
|
||||
|
||||
debug_gui.checked = config.debugGui;
|
||||
@@ -494,8 +403,10 @@ Kirigami.ScrollablePage {
|
||||
|
||||
openvr_combobox.load()
|
||||
|
||||
adb_custom.checked = settings.adb_custom;
|
||||
adb_location.text = settings.adb_location;
|
||||
adb_custom.checked = DashboardSettings.adb_custom;
|
||||
adb_location.text = DashboardSettings.adb_location;
|
||||
|
||||
show_system_checks.checked = DashboardSettings.show_system_checks;
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
|
||||
@@ -1,935 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KLocalization>
|
||||
#include <PlatformTheme>
|
||||
#include <QApplication>
|
||||
#include <QCursor>
|
||||
#include <QObject>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QPen>
|
||||
#include <QQuickPaintedItem>
|
||||
#include <platformtheme.h>
|
||||
#include <qqmlengine.h>
|
||||
|
||||
#include "settings.h"
|
||||
#include <ranges>
|
||||
|
||||
enum class side
|
||||
{
|
||||
top,
|
||||
bottom,
|
||||
left,
|
||||
right
|
||||
};
|
||||
|
||||
struct edge
|
||||
{
|
||||
side edge_side;
|
||||
int rectangle_index;
|
||||
|
||||
bool operator==(const edge & other) const noexcept
|
||||
{
|
||||
return edge_side == other.edge_side and rectangle_index == other.rectangle_index;
|
||||
}
|
||||
|
||||
double position = 0;
|
||||
double min = std::numeric_limits<double>::max();
|
||||
double max = std::numeric_limits<double>::lowest();
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
const double split_edge_threshold = 0.05;
|
||||
const double move_edge_threshold = 0.02;
|
||||
const double magnetism_threshold = 0.05;
|
||||
const int num_subdiv = 20;
|
||||
const double epsilon = 1.0 / (2 * num_subdiv);
|
||||
|
||||
QRectF rectangle_from_encoder(const encoder & enc)
|
||||
{
|
||||
QRectF r;
|
||||
r.setX(enc.offset_x);
|
||||
r.setY(enc.offset_y);
|
||||
r.setWidth(enc.width);
|
||||
r.setHeight(enc.height);
|
||||
return r;
|
||||
}
|
||||
|
||||
int hovered_rectangle(QPointF position, const std::vector<encoder> & encoders)
|
||||
{
|
||||
for (const auto [i, enc]: std::views::enumerate(encoders))
|
||||
{
|
||||
if (rectangle_from_encoder(enc).contains(position))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Qt::CursorShape get_cursor_shape(QPointF position, const std::vector<encoder> & rectangles)
|
||||
{
|
||||
for (const encoder & i: rectangles)
|
||||
{
|
||||
QRectF r = rectangle_from_encoder(i);
|
||||
if (r.contains(position))
|
||||
{
|
||||
QPointF rel_pos = position - r.topLeft();
|
||||
double dx = std::min(rel_pos.x(), r.width() - rel_pos.x());
|
||||
double dy = std::min(rel_pos.y(), r.height() - rel_pos.y());
|
||||
|
||||
if (dx < move_edge_threshold and position.x() >= epsilon and position.x() <= 1 - epsilon)
|
||||
return Qt::SizeHorCursor;
|
||||
else if (dy < move_edge_threshold and position.y() >= epsilon and position.y() <= 1 - epsilon)
|
||||
return Qt::SizeVerCursor;
|
||||
else if (dx < split_edge_threshold and position.y() >= epsilon and position.y() <= 1 - epsilon)
|
||||
return Qt::SplitVCursor;
|
||||
else if (dy < split_edge_threshold and position.x() >= epsilon and position.x() <= 1 - epsilon)
|
||||
return Qt::SplitHCursor;
|
||||
else
|
||||
return Qt::ArrowCursor;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Qt::ArrowCursor;
|
||||
}
|
||||
|
||||
std::vector<edge> horizontal_edges(const std::vector<encoder> & rectangles)
|
||||
{
|
||||
std::vector<edge> edges;
|
||||
|
||||
for (const auto & [i, enc]: std::views::enumerate(rectangles))
|
||||
{
|
||||
if (enc.top() > epsilon)
|
||||
{
|
||||
edges.emplace_back(side::top, i, enc.top(), enc.left(), enc.right());
|
||||
}
|
||||
|
||||
if (rectangles[i].bottom() < 1 - epsilon)
|
||||
{
|
||||
edges.emplace_back(side::bottom, i, enc.bottom(), enc.left(), enc.right());
|
||||
}
|
||||
}
|
||||
|
||||
return edges;
|
||||
}
|
||||
|
||||
std::vector<edge> vertical_edges(const std::vector<encoder> & rectangles)
|
||||
{
|
||||
std::vector<edge> edges;
|
||||
|
||||
for (const auto & [i, enc]: std::views::enumerate(rectangles))
|
||||
{
|
||||
if (enc.left() > epsilon)
|
||||
{
|
||||
edges.emplace_back(side::left, i, enc.left(), enc.top(), enc.bottom());
|
||||
}
|
||||
|
||||
if (enc.right() < 1 - epsilon)
|
||||
{
|
||||
edges.emplace_back(side::right, i, enc.right(), enc.top(), enc.bottom());
|
||||
}
|
||||
}
|
||||
|
||||
return edges;
|
||||
}
|
||||
|
||||
std::vector<std::vector<edge>> partition_edges(std::vector<edge> edges)
|
||||
{
|
||||
auto comp = [](const edge & a, const edge & b) {
|
||||
if (a.position < b.position)
|
||||
return true;
|
||||
if (a.position > b.position)
|
||||
return false;
|
||||
|
||||
if (a.min < b.min)
|
||||
return true;
|
||||
if (a.min > b.min)
|
||||
return false;
|
||||
|
||||
if (a.max < b.max)
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
std::ranges::sort(edges, comp);
|
||||
|
||||
std::vector<std::vector<edge>> partitionned;
|
||||
|
||||
double current_position = std::numeric_limits<double>::lowest();
|
||||
double current_max = 0;
|
||||
|
||||
for (auto & e: edges)
|
||||
{
|
||||
if (e.position != current_position)
|
||||
{
|
||||
current_position = e.position;
|
||||
current_max = e.max;
|
||||
partitionned.push_back({e});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.min >= current_max)
|
||||
{
|
||||
// All the following edges will be after the last partition
|
||||
current_max = e.max;
|
||||
partitionned.push_back({e});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the edge to the current partition
|
||||
current_max = std::max(current_max, e.max);
|
||||
partitionned.back().push_back(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return partitionned;
|
||||
}
|
||||
|
||||
std::vector<edge> hovered_edges(QPointF position, const std::vector<std::vector<edge>> & partitionned_edges, bool horizontal)
|
||||
{
|
||||
if (horizontal)
|
||||
position = position.transposed();
|
||||
|
||||
for (const auto & edge_list: partitionned_edges)
|
||||
{
|
||||
for (const auto & edge: edge_list)
|
||||
{
|
||||
if (std::abs(position.x() - edge.position) < move_edge_threshold and position.y() >= edge.min and position.y() <= edge.max)
|
||||
{
|
||||
return edge_list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
bool assert_rectangle_list_is_partition(const std::vector<encoder> & rectangles)
|
||||
{
|
||||
return true;
|
||||
|
||||
bool ok = true;
|
||||
|
||||
QRectF bounding_box{0, 0, 1, 1};
|
||||
|
||||
for (const auto & i: rectangles)
|
||||
{
|
||||
if (i.width < 0 or i.height < 0)
|
||||
{
|
||||
qDebug() << "Invalid rectangle" /*<< i*/;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<double> rectangle_y_boundaries;
|
||||
for (auto & i: rectangles)
|
||||
{
|
||||
rectangle_y_boundaries.push_back(i.top());
|
||||
rectangle_y_boundaries.push_back(i.bottom());
|
||||
}
|
||||
|
||||
for (double y: rectangle_y_boundaries)
|
||||
{
|
||||
if (y < bounding_box.top())
|
||||
continue;
|
||||
if (y >= bounding_box.bottom())
|
||||
continue;
|
||||
|
||||
qDebug() << "Checking line" << y;
|
||||
std::vector<std::pair<double, double>> horizontal_segments;
|
||||
for (const auto & i: rectangles)
|
||||
{
|
||||
if (y >= i.top() and y < i.bottom())
|
||||
{
|
||||
horizontal_segments.emplace_back(i.left(), i.right());
|
||||
qDebug() << " Adding segment" << i.left() << "-" << i.right();
|
||||
}
|
||||
}
|
||||
|
||||
std::ranges::sort(horizontal_segments);
|
||||
|
||||
if (horizontal_segments.empty())
|
||||
{
|
||||
qDebug() << "Line" << y << "empty";
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (horizontal_segments.front().first != bounding_box.left())
|
||||
{
|
||||
qDebug() << "Line" << y << "does not start at the left of the bounding box" << (horizontal_segments.front().first - bounding_box.left());
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (horizontal_segments.back().second != bounding_box.right())
|
||||
{
|
||||
qDebug() << "Last rectangle of line" << y << "does not end at the right of the bounding box" << (horizontal_segments.back().second - bounding_box.right());
|
||||
ok = false;
|
||||
}
|
||||
|
||||
for (int i = 1; i < horizontal_segments.size(); ++i)
|
||||
{
|
||||
if (horizontal_segments[i - 1].second < horizontal_segments[i].first)
|
||||
{
|
||||
qDebug() << "Overlap in line" << y << (horizontal_segments[i - 1].second - horizontal_segments[i].first);
|
||||
ok = false;
|
||||
}
|
||||
else if (horizontal_segments[i - 1].second > horizontal_segments[i].first)
|
||||
{
|
||||
qDebug() << "Gap in line" << y << (horizontal_segments[i - 1].second - horizontal_segments[i].first);
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class RectanglePartitionner : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
Q_PROPERTY(Settings * settings READ settings WRITE setSettings NOTIFY settingsChanged)
|
||||
Q_PROPERTY(bool selected READ selected NOTIFY selectedChanged)
|
||||
Q_PROPERTY(QString encoder READ encoder WRITE setEncoder NOTIFY encoderChanged)
|
||||
Q_PROPERTY(QString codec READ codec WRITE setCodec NOTIFY codecChanged)
|
||||
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
|
||||
|
||||
int m_currentIndex = -1;
|
||||
Settings * m_settings = nullptr;
|
||||
|
||||
std::vector<edge> selection;
|
||||
std::vector<edge> hovered;
|
||||
|
||||
double min_drag_position;
|
||||
double max_drag_position;
|
||||
|
||||
QLine split_line;
|
||||
QRect split_clip_rect;
|
||||
Qt::CursorShape cursor_shape = Qt::ArrowCursor;
|
||||
|
||||
enum class mouse_event_type
|
||||
{
|
||||
move,
|
||||
press,
|
||||
release
|
||||
};
|
||||
|
||||
Kirigami::Platform::PlatformTheme theme;
|
||||
|
||||
public:
|
||||
RectanglePartitionner(QQuickItem * parent = nullptr) :
|
||||
QQuickPaintedItem(parent),
|
||||
theme(this)
|
||||
{
|
||||
setFlag(ItemHasContents);
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
setAcceptHoverEvents(true);
|
||||
|
||||
theme.setColorSet(Kirigami::Platform::PlatformTheme::View);
|
||||
setFillColor(theme.backgroundColor());
|
||||
|
||||
connect(&theme, &Kirigami::Platform::PlatformTheme::colorsChanged, this, [&]() {
|
||||
setFillColor(theme.backgroundColor());
|
||||
update();
|
||||
});
|
||||
|
||||
// connect(this, &QQuickItem::enabledChanged, this, [&](){
|
||||
// if (isEnabled())
|
||||
// theme.setColorGroup(Kirigami::Platform::PlatformTheme::Active);
|
||||
// else
|
||||
// theme.setColorGroup(Kirigami::Platform::PlatformTheme::Disabled);
|
||||
// });
|
||||
}
|
||||
|
||||
int currentIndex() const
|
||||
{
|
||||
return m_currentIndex;
|
||||
}
|
||||
|
||||
bool selected() const
|
||||
{
|
||||
return m_currentIndex >= 0 and m_currentIndex < m_settings->encoders().size();
|
||||
}
|
||||
|
||||
void setCurrentIndex(int value)
|
||||
{
|
||||
if (m_currentIndex != value)
|
||||
{
|
||||
m_currentIndex = value;
|
||||
currentIndexChanged(value);
|
||||
selectedChanged(selected());
|
||||
encoderChanged(encoder());
|
||||
codecChanged(codec());
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
Settings * settings() const
|
||||
{
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
void onEncodersChanged()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void setSettings(Settings * value)
|
||||
{
|
||||
if (m_settings != value)
|
||||
{
|
||||
if (m_settings)
|
||||
disconnect(m_settings, &Settings::encodersChanged, this, &RectanglePartitionner::onEncodersChanged);
|
||||
|
||||
settingsChanged(m_settings = value);
|
||||
|
||||
if (m_settings)
|
||||
connect(m_settings, &Settings::encodersChanged, this, &RectanglePartitionner::onEncodersChanged);
|
||||
}
|
||||
}
|
||||
|
||||
QString encoder() const
|
||||
{
|
||||
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= m_settings->encoders().size())
|
||||
return "";
|
||||
|
||||
return QString::fromStdString(Settings::encoder_from_id(m_settings->encoders()[m_currentIndex].name));
|
||||
}
|
||||
|
||||
QString codec() const
|
||||
{
|
||||
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= m_settings->encoders().size())
|
||||
return "";
|
||||
|
||||
return QString::fromStdString(Settings::codec_from_id(m_settings->encoders()[m_currentIndex].codec));
|
||||
}
|
||||
|
||||
void setEncoder(QString value)
|
||||
{
|
||||
qDebug() << "Setting encoder to " << value;
|
||||
auto encoders = m_settings->encoders();
|
||||
auto converted_value = Settings::encoder_id_from_string(value.toStdString());
|
||||
|
||||
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= encoders.size())
|
||||
return;
|
||||
|
||||
if (encoders[m_currentIndex].name == converted_value)
|
||||
return;
|
||||
|
||||
encoders[m_currentIndex].name = converted_value;
|
||||
m_settings->set_encoders(encoders);
|
||||
update();
|
||||
encoderLayoutChanged();
|
||||
}
|
||||
|
||||
void setCodec(QString value)
|
||||
{
|
||||
qDebug() << "Setting codec to " << value;
|
||||
auto encoders = m_settings->encoders();
|
||||
auto converted_value = Settings::codec_id_from_string(value.toStdString());
|
||||
|
||||
if (not m_settings or m_currentIndex < 0 or m_currentIndex >= encoders.size())
|
||||
return;
|
||||
|
||||
if (encoders[m_currentIndex].codec == converted_value)
|
||||
return;
|
||||
|
||||
encoders[m_currentIndex].codec = Settings::codec_id_from_string(value.toStdString());
|
||||
m_settings->set_encoders(encoders);
|
||||
update();
|
||||
encoderLayoutChanged();
|
||||
}
|
||||
|
||||
QRect frameRect()
|
||||
{
|
||||
return {0, 0, (int)width() - 1, (int)height() - 1};
|
||||
}
|
||||
|
||||
QPointF from_position(QPoint position)
|
||||
{
|
||||
auto r = frameRect();
|
||||
|
||||
return QPointF{
|
||||
std::clamp(double(position.x() - r.x()) / (r.width() - 1), 0., 1.),
|
||||
std::clamp(double(position.y() - r.y()) / (r.height() - 1), 0., 1.),
|
||||
};
|
||||
}
|
||||
|
||||
QPoint to_position(QPointF position)
|
||||
{
|
||||
auto r = frameRect();
|
||||
|
||||
return QPoint(
|
||||
std::round(r.x() + position.x() * (r.width() - 1)),
|
||||
std::round(r.y() + position.y() * (r.height() - 1)));
|
||||
}
|
||||
|
||||
QRect to_position(QRectF position)
|
||||
{
|
||||
return QRect{to_position(position.topLeft()), to_position(position.bottomRight())};
|
||||
}
|
||||
|
||||
QRect rectangle_position(int index)
|
||||
{
|
||||
return to_position(rectangle_from_encoder(m_settings->encoders().at(index)));
|
||||
}
|
||||
|
||||
// Keep it in sync with SettingsPage.qml (codec_combo.model)
|
||||
QString codec_name_from_setting(QString value)
|
||||
{
|
||||
if (value == "h264")
|
||||
return i18n("H.264");
|
||||
if (value == "h265")
|
||||
return i18n("H.265");
|
||||
if (value == "av1")
|
||||
return i18n("AV1");
|
||||
|
||||
return i18nc("automatic codec setup", "Auto");
|
||||
}
|
||||
|
||||
// Keep it in sync with SettingsPage.qml (encoder_combo.model)
|
||||
QString encoder_name_from_setting(QString value)
|
||||
{
|
||||
if (value == "nvenc")
|
||||
return i18n("nvenc");
|
||||
if (value == "vaapi")
|
||||
return i18n("vaapi");
|
||||
if (value == "x264")
|
||||
return i18n("x264");
|
||||
if (value == "vulkan")
|
||||
return i18n("Vulkan");
|
||||
|
||||
return i18nc("automatic encoder setup", "Auto");
|
||||
}
|
||||
|
||||
// BEGIN Painting functions
|
||||
void paint_single_rectangle_border(QPainter * painter, const ::encoder & enc)
|
||||
{
|
||||
QRectF r = rectangle_from_encoder(enc);
|
||||
QRect rect = to_position(r);
|
||||
|
||||
QPen pen = painter->pen();
|
||||
painter->setPen(QPen{theme.disabledTextColor()});
|
||||
painter->drawRect(rect);
|
||||
painter->setPen(pen);
|
||||
}
|
||||
|
||||
void paint_single_rectangle(QPainter * painter, const ::encoder & enc, bool selected)
|
||||
{
|
||||
QRectF r = rectangle_from_encoder(enc);
|
||||
QRect rect = to_position(r);
|
||||
|
||||
if (selected)
|
||||
{
|
||||
painter->fillRect(rect.adjusted(1, 1, 0, 0), theme.focusColor());
|
||||
}
|
||||
|
||||
QString codec = QString::fromStdString(Settings::codec_from_id(enc.codec));
|
||||
QString encoder = QString::fromStdString(Settings::encoder_from_id(enc.name));
|
||||
|
||||
QFont font = painter->font();
|
||||
QFont font2 = font;
|
||||
|
||||
font2.setPixelSize(24);
|
||||
|
||||
QString text = QString("%1\n%2").arg(encoder_name_from_setting(encoder), codec_name_from_setting(codec));
|
||||
|
||||
QFontMetrics metrics{font2};
|
||||
QSize size = metrics.size(0, text);
|
||||
|
||||
if (double ratio = std::max((double)size.width() / rect.width(), (double)size.height() / rect.height()); ratio > 1)
|
||||
{
|
||||
int pixel_size = font2.pixelSize() / ratio;
|
||||
if (pixel_size > 0)
|
||||
font2.setPixelSize(pixel_size);
|
||||
}
|
||||
|
||||
QPen pen = painter->pen();
|
||||
|
||||
painter->setPen(QPen{theme.textColor()});
|
||||
painter->setFont(font2);
|
||||
painter->drawText(rect, Qt::AlignCenter, text);
|
||||
painter->setFont(font);
|
||||
painter->setPen(pen);
|
||||
}
|
||||
|
||||
void paint(QPainter * painter) override
|
||||
{
|
||||
if (not m_settings)
|
||||
return;
|
||||
|
||||
for (auto [i, enc]: std::views::enumerate(m_settings->encoders()))
|
||||
{
|
||||
bool is_selected = i == m_currentIndex and isEnabled();
|
||||
paint_single_rectangle(painter, enc, is_selected);
|
||||
}
|
||||
|
||||
if (not hovered.empty() and selection.empty())
|
||||
{
|
||||
for (auto & enc: m_settings->encoders())
|
||||
{
|
||||
paint_single_rectangle_border(painter, enc);
|
||||
}
|
||||
|
||||
painter->setPen(QPen(Qt::blue, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
|
||||
auto r = frameRect();
|
||||
|
||||
QList<QLine> lines;
|
||||
lines.reserve(hovered.size());
|
||||
for (const edge & i: hovered)
|
||||
{
|
||||
QLineF line;
|
||||
switch (i.edge_side)
|
||||
{
|
||||
case side::top:
|
||||
case side::bottom:
|
||||
line = QLineF(i.min, i.position, i.max, i.position);
|
||||
break;
|
||||
|
||||
case side::left:
|
||||
case side::right:
|
||||
line = QLineF(i.position, i.min, i.position, i.max);
|
||||
break;
|
||||
}
|
||||
|
||||
int x1 = std::round(r.x() + line.x1() * (r.width() - 1));
|
||||
int x2 = std::round(r.x() + line.x2() * (r.width() - 1));
|
||||
|
||||
int y1 = std::round(r.y() + line.y1() * (r.height() - 1));
|
||||
int y2 = std::round(r.y() + line.y2() * (r.height() - 1));
|
||||
|
||||
lines.emplace_back(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
painter->drawLines(lines);
|
||||
|
||||
auto horz_partitionned = partition_edges(horizontal_edges(m_settings->encoders()));
|
||||
auto vert_partitionned = partition_edges(vertical_edges(m_settings->encoders()));
|
||||
}
|
||||
else if ((cursor_shape == Qt::SplitHCursor or cursor_shape == Qt::SplitVCursor) and not split_line.isNull())
|
||||
{
|
||||
auto now = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||
|
||||
QPen pen(theme.disabledTextColor(), 2, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
pen.setDashPattern({5, 5});
|
||||
pen.setDashOffset(-now * 15);
|
||||
painter->setPen(pen);
|
||||
|
||||
painter->setClipping(true);
|
||||
painter->setClipRect(split_clip_rect.adjusted(1, 1, 0, 0));
|
||||
painter->drawLine(split_line);
|
||||
painter->setClipping(false);
|
||||
update();
|
||||
|
||||
for (auto & enc: m_settings->encoders())
|
||||
{
|
||||
paint_single_rectangle_border(painter, enc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto & enc: m_settings->encoders())
|
||||
{
|
||||
paint_single_rectangle_border(painter, enc);
|
||||
}
|
||||
}
|
||||
}
|
||||
// END Painting functions
|
||||
|
||||
// BEGIN Mouse callbacks
|
||||
void mouseMoveEvent(QMouseEvent * event) override
|
||||
{
|
||||
auto pos = event->position().toPoint();
|
||||
|
||||
auto encoders = m_settings->encoders();
|
||||
|
||||
if (not selection.empty())
|
||||
{
|
||||
double position;
|
||||
|
||||
if (selection.front().edge_side == side::top or selection.front().edge_side == side::bottom)
|
||||
position = from_position(pos).y();
|
||||
else
|
||||
position = from_position(pos).x();
|
||||
|
||||
position = std::clamp(position, min_drag_position, max_drag_position);
|
||||
position = std::round(position * num_subdiv) / num_subdiv; // magnetism
|
||||
|
||||
for (edge & e: selection)
|
||||
{
|
||||
switch (e.edge_side)
|
||||
{
|
||||
case side::top:
|
||||
encoders[e.rectangle_index].set_top(position);
|
||||
break;
|
||||
|
||||
case side::bottom:
|
||||
encoders[e.rectangle_index].set_bottom(position);
|
||||
break;
|
||||
|
||||
case side::left:
|
||||
encoders[e.rectangle_index].set_left(position);
|
||||
break;
|
||||
|
||||
case side::right:
|
||||
encoders[e.rectangle_index].set_right(position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
m_settings->set_encoders(encoders);
|
||||
encoderLayoutChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void hoverMoveEvent(QHoverEvent * event) override
|
||||
{
|
||||
if (not m_settings)
|
||||
return;
|
||||
|
||||
QPoint pos = event->position().toPoint();
|
||||
|
||||
const auto & encoders = m_settings->encoders();
|
||||
|
||||
hovered.clear();
|
||||
|
||||
if (auto horz_edges = hovered_edges(from_position(pos), partition_edges(horizontal_edges(encoders)), true); not horz_edges.empty())
|
||||
{
|
||||
hovered = std::move(horz_edges);
|
||||
update();
|
||||
}
|
||||
else if (auto vert_edges = hovered_edges(from_position(pos), partition_edges(vertical_edges(encoders)), false); not vert_edges.empty())
|
||||
{
|
||||
hovered = std::move(vert_edges);
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = hovered_rectangle(from_position(pos), encoders);
|
||||
}
|
||||
|
||||
Qt::CursorShape new_cursor = get_cursor_shape(from_position(pos), encoders);
|
||||
if (new_cursor != cursor_shape)
|
||||
{
|
||||
update();
|
||||
cursor_shape = new_cursor;
|
||||
setCursor(QCursor(new_cursor));
|
||||
}
|
||||
|
||||
if (cursor_shape == Qt::SplitHCursor)
|
||||
{
|
||||
int n = hovered_rectangle(from_position(pos), encoders);
|
||||
|
||||
double x = std::round(from_position(pos).x() * num_subdiv) / num_subdiv; // magnetism
|
||||
int px = to_position({x, 0}).x();
|
||||
|
||||
split_line = {px, rectangle_position(n).top(), px, rectangle_position(n).bottom()};
|
||||
split_clip_rect = rectangle_position(n);
|
||||
update();
|
||||
}
|
||||
else if (cursor_shape == Qt::SplitVCursor)
|
||||
{
|
||||
int n = hovered_rectangle(from_position(pos), encoders);
|
||||
|
||||
double y = std::round(from_position(pos).y() * num_subdiv) / num_subdiv; // magnetism
|
||||
int py = to_position({0, y}).y();
|
||||
|
||||
split_line = {rectangle_position(n).left(), py, rectangle_position(n).right(), py};
|
||||
split_clip_rect = rectangle_position(n);
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
split_line = {0, 0, 0, 0};
|
||||
split_clip_rect = {0, 0, 0, 0};
|
||||
}
|
||||
}
|
||||
|
||||
void mousePressEvent(QMouseEvent * event) override
|
||||
{
|
||||
if (not m_settings)
|
||||
return;
|
||||
|
||||
selection.clear();
|
||||
split_line = {0, 0, 0, 0};
|
||||
auto encoders = m_settings->encoders();
|
||||
|
||||
if (auto horz_edges = hovered_edges(from_position(event->pos()), partition_edges(horizontal_edges(encoders)), true); not horz_edges.empty())
|
||||
{
|
||||
selection = std::move(horz_edges);
|
||||
}
|
||||
else if (auto vert_edges = hovered_edges(from_position(event->pos()), partition_edges(vertical_edges(encoders)), false); not vert_edges.empty())
|
||||
{
|
||||
selection = std::move(vert_edges);
|
||||
}
|
||||
else if (int n = hovered_rectangle(from_position(event->pos()), encoders); n >= 0)
|
||||
{
|
||||
::encoder & hovered = encoders[n];
|
||||
|
||||
// Compute distance to edges
|
||||
auto pos = from_position(event->pos());
|
||||
|
||||
double dx = std::min(pos.x() - hovered.left(), hovered.right() - pos.x());
|
||||
double dy = std::min(pos.y() - hovered.top(), hovered.bottom() - pos.y());
|
||||
|
||||
if (dx < split_edge_threshold)
|
||||
{
|
||||
qDebug() << "Splitting rectangle " << n << " vertically";
|
||||
double y = std::round(pos.y() * num_subdiv) / num_subdiv; // magnetism
|
||||
|
||||
// Split vertically
|
||||
::encoder new_rectangle = hovered;
|
||||
|
||||
hovered.set_bottom(y);
|
||||
new_rectangle.set_top(hovered.bottom());
|
||||
|
||||
encoders.push_back(new_rectangle);
|
||||
update();
|
||||
m_settings->set_encoders(encoders);
|
||||
encoderLayoutChanged();
|
||||
|
||||
if (not assert_rectangle_list_is_partition(encoders))
|
||||
abort();
|
||||
}
|
||||
else if (dy < split_edge_threshold)
|
||||
{
|
||||
qDebug() << "Splitting rectangle " << n << " horizontally";
|
||||
double x = std::round(pos.x() * num_subdiv) / num_subdiv; // magnetism
|
||||
|
||||
// Split horizontally
|
||||
::encoder new_rectangle = hovered;
|
||||
|
||||
hovered.set_right(x);
|
||||
new_rectangle.set_left(hovered.right());
|
||||
|
||||
encoders.push_back(new_rectangle);
|
||||
update();
|
||||
m_settings->set_encoders(encoders);
|
||||
encoderLayoutChanged();
|
||||
|
||||
if (not assert_rectangle_list_is_partition(encoders))
|
||||
abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Selecting rectangle " << n;
|
||||
setCurrentIndex(n);
|
||||
}
|
||||
}
|
||||
|
||||
if (not selection.empty())
|
||||
{
|
||||
hovered.clear();
|
||||
|
||||
min_drag_position = std::numeric_limits<double>::lowest();
|
||||
max_drag_position = std::numeric_limits<double>::max();
|
||||
|
||||
for (auto & e: selection)
|
||||
{
|
||||
switch (e.edge_side)
|
||||
{
|
||||
case side::top:
|
||||
max_drag_position = std::min(max_drag_position, encoders[e.rectangle_index].bottom());
|
||||
break;
|
||||
case side::bottom:
|
||||
min_drag_position = std::max(min_drag_position, encoders[e.rectangle_index].top());
|
||||
break;
|
||||
case side::left:
|
||||
max_drag_position = std::min(max_drag_position, encoders[e.rectangle_index].right());
|
||||
break;
|
||||
case side::right:
|
||||
min_drag_position = std::max(min_drag_position, encoders[e.rectangle_index].left());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mouseReleaseEvent(QMouseEvent * event) override
|
||||
{
|
||||
if (not m_settings)
|
||||
return;
|
||||
|
||||
selection.clear();
|
||||
auto encoders = m_settings->encoders();
|
||||
|
||||
// Delete empty rectangles
|
||||
bool changed = false;
|
||||
for (int i = 0; i < encoders.size();)
|
||||
{
|
||||
if (encoders[i].width <= 0.0001 or encoders[i].height <= 0.0001) // TODO configurable thresholds
|
||||
{
|
||||
qDebug() << "Removing rectangle " << i;
|
||||
encoders.erase(encoders.begin() + i);
|
||||
changed = true;
|
||||
|
||||
if (m_currentIndex > i)
|
||||
m_currentIndex--;
|
||||
else if (m_currentIndex == i)
|
||||
{
|
||||
m_currentIndex = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
if (not assert_rectangle_list_is_partition(encoders))
|
||||
abort();
|
||||
|
||||
m_settings->set_encoders(encoders);
|
||||
setCurrentIndex(m_currentIndex);
|
||||
update();
|
||||
encoderLayoutChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void hoverLeaveEvent(QHoverEvent * event) override
|
||||
{
|
||||
hovered.clear();
|
||||
split_line = {0, 0, 0, 0};
|
||||
split_clip_rect = {0, 0, 0, 0};
|
||||
update();
|
||||
}
|
||||
// END Mouse callbacks
|
||||
|
||||
Q_SIGNALS:
|
||||
void settingsChanged(Settings *);
|
||||
void selectedChanged(bool);
|
||||
void encoderChanged(QString);
|
||||
void codecChanged(QString);
|
||||
void currentIndexChanged(int);
|
||||
|
||||
void encoderLayoutChanged();
|
||||
};
|
||||
+400
-263
@@ -24,90 +24,112 @@
|
||||
#include "wivrn_server.h"
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QPointF>
|
||||
#include <QRectF>
|
||||
#include <QSizeF>
|
||||
#include <cassert>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <qqmlintegration.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::vector<std::pair<encoder::encoder_name, std::string>> encoder_ids{
|
||||
{encoder::encoder_name::nvenc, "nvenc"},
|
||||
{encoder::encoder_name::vaapi, "vaapi"},
|
||||
{encoder::encoder_name::x264, "x264"},
|
||||
{encoder::encoder_name::vulkan, "vulkan"},
|
||||
const std::vector<std::pair<Settings::encoder_name, std::string>> encoder_ids{
|
||||
{Settings::encoder_name::Nvenc, "nvenc"},
|
||||
{Settings::encoder_name::Vaapi, "vaapi"},
|
||||
{Settings::encoder_name::X264, "x264"},
|
||||
{Settings::encoder_name::Vulkan, "vulkan"},
|
||||
};
|
||||
|
||||
const std::vector<std::pair<encoder::video_codec, std::string>> codec_ids{
|
||||
{encoder::video_codec::h264, "h264"},
|
||||
{encoder::video_codec::h264, "avc"},
|
||||
{encoder::video_codec::h265, "h265"},
|
||||
{encoder::video_codec::h265, "hevc"},
|
||||
{encoder::video_codec::av1, "av1"},
|
||||
{encoder::video_codec::av1, "AV1"},
|
||||
const std::vector<std::tuple<Settings::video_codec, std::string>> codec_ids{
|
||||
{Settings::video_codec::H264, "h264"},
|
||||
{Settings::video_codec::H264, "avc"},
|
||||
{Settings::video_codec::H265, "h265"},
|
||||
{Settings::video_codec::H265, "hevc"},
|
||||
{Settings::video_codec::Av1, "av1"},
|
||||
{Settings::video_codec::Av1, "AV1"},
|
||||
};
|
||||
|
||||
bool can10bit(Settings::video_codec c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case Settings::CodecAuto:
|
||||
case Settings::H264:
|
||||
return false;
|
||||
case Settings::H265:
|
||||
case Settings::Av1:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::optional<encoder::encoder_name> Settings::encoder_id_from_string(std::string_view s)
|
||||
Settings::encoder_name Settings::encoder_id_from_string(std::string_view s)
|
||||
{
|
||||
for (auto & [i, j]: encoder_ids)
|
||||
{
|
||||
if (j == s)
|
||||
return i;
|
||||
}
|
||||
return std::nullopt;
|
||||
return Settings::encoder_name::EncoderAuto;
|
||||
}
|
||||
|
||||
std::optional<encoder::video_codec> Settings::codec_id_from_string(std::string_view s)
|
||||
Settings::video_codec Settings::codec_id_from_string(std::string_view s)
|
||||
{
|
||||
for (auto & [i, j]: codec_ids)
|
||||
{
|
||||
if (j == s)
|
||||
return i;
|
||||
}
|
||||
return std::nullopt;
|
||||
return Settings::video_codec::CodecAuto;
|
||||
}
|
||||
|
||||
const std::string & Settings::encoder_from_id(std::optional<encoder::encoder_name> id)
|
||||
const std::string & Settings::encoder_from_id(Settings::encoder_name id)
|
||||
{
|
||||
static const std::string default_value = "auto";
|
||||
if (not id)
|
||||
return default_value;
|
||||
|
||||
for (auto & [i, j]: encoder_ids)
|
||||
{
|
||||
if (i == *id)
|
||||
if (i == id)
|
||||
return j;
|
||||
}
|
||||
|
||||
return default_value;
|
||||
}
|
||||
|
||||
const std::string & Settings::codec_from_id(std::optional<encoder::video_codec> id)
|
||||
const std::string & Settings::codec_from_id(Settings::video_codec id)
|
||||
{
|
||||
static const std::string default_value = "auto";
|
||||
if (not id)
|
||||
return default_value;
|
||||
|
||||
for (auto & [i, j]: codec_ids)
|
||||
{
|
||||
if (i == *id)
|
||||
if (i == id)
|
||||
return j;
|
||||
}
|
||||
|
||||
return default_value;
|
||||
}
|
||||
|
||||
void Settings::emitAllChanged()
|
||||
{
|
||||
simpleConfigChanged();
|
||||
encoderChanged();
|
||||
codecChanged();
|
||||
tenbitChanged();
|
||||
bitrateChanged();
|
||||
scaleChanged();
|
||||
tcpOnlyChanged();
|
||||
applicationChanged();
|
||||
openvrChanged();
|
||||
debugGuiChanged();
|
||||
steamVrLhChanged();
|
||||
}
|
||||
|
||||
void Settings::load(const wivrn_server * server)
|
||||
{
|
||||
// Encoders configuration
|
||||
nlohmann::json json_doc;
|
||||
try
|
||||
{
|
||||
auto conf = server->jsonConfiguration();
|
||||
json_doc = nlohmann::json::parse(conf.toUtf8());
|
||||
m_jsonSettings = nlohmann::json::parse(conf.toUtf8());
|
||||
emitAllChanged();
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
@@ -115,260 +137,375 @@ void Settings::load(const wivrn_server * server)
|
||||
restore_defaults();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<encoder> new_encoders;
|
||||
bool Settings::simpleConfig() const
|
||||
{
|
||||
// Simple configuration: either unset, or all encoders + codecs are the same
|
||||
try
|
||||
{
|
||||
nlohmann::json json_encoders;
|
||||
|
||||
if (json_doc.contains("encoders"))
|
||||
auto it = m_jsonSettings.find("encoders");
|
||||
if (it == m_jsonSettings.end())
|
||||
return true;
|
||||
std::optional<encoder_name> encoder;
|
||||
std::optional<video_codec> codec;
|
||||
for (const auto & item: *it)
|
||||
{
|
||||
json_encoders = json_doc["encoders"];
|
||||
set_manualEncoders(true);
|
||||
}
|
||||
else if (json_doc.contains("encoders.disabled"))
|
||||
{
|
||||
json_encoders = json_doc["encoders.disabled"];
|
||||
set_manualEncoders(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_manualEncoders(false);
|
||||
}
|
||||
|
||||
for (auto & i: json_encoders)
|
||||
{
|
||||
encoder enc;
|
||||
enc.name = encoder_id_from_string(i.value("encoder", "auto"));
|
||||
enc.codec = codec_id_from_string(i.value("codec", "auto"));
|
||||
enc.width = i.value("width", 1.0);
|
||||
enc.height = i.value("height", 1.0);
|
||||
enc.offset_x = i.value("offset_x", 0.0);
|
||||
enc.offset_y = i.value("offset_y", 0.0);
|
||||
enc.group = i.value("group", 0); // TODO: handle groups
|
||||
new_encoders.push_back(enc);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// QMessageBox msgbox{QMessageBox::Information, tr("Invalid settings"), tr("The encoder configuration is invalid, the default values will be restored."), QMessageBox::Close, this};
|
||||
// msgbox.exec();
|
||||
|
||||
new_encoders.clear();
|
||||
}
|
||||
set_encoders(new_encoders);
|
||||
|
||||
if (encoders().empty())
|
||||
{
|
||||
set_manualEncoders(false);
|
||||
std::vector<encoder> new_encoders;
|
||||
new_encoders.push_back(encoder{
|
||||
.width = 1,
|
||||
.height = 1,
|
||||
.offset_x = 0,
|
||||
.offset_y = 0,
|
||||
});
|
||||
set_encoders(new_encoders);
|
||||
}
|
||||
|
||||
// Foveation
|
||||
try
|
||||
{
|
||||
if (json_doc.contains("scale"))
|
||||
{
|
||||
set_scale(json_doc.value("scale", 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
set_scale(-1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
set_scale(-1);
|
||||
}
|
||||
|
||||
// Bitrate
|
||||
try
|
||||
{
|
||||
set_bitrate(json_doc.value("bitrate", 50'000'000));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
set_bitrate(50'000'000);
|
||||
}
|
||||
|
||||
// Automatically started application
|
||||
std::vector<std::string> application;
|
||||
try
|
||||
{
|
||||
if (json_doc["application"].is_array())
|
||||
application = json_doc.value<std::vector<std::string>>("application", {});
|
||||
else if (json_doc["application"].is_string())
|
||||
application.push_back(json_doc["application"]);
|
||||
|
||||
set_application(escape_string(application));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
set_application("");
|
||||
}
|
||||
|
||||
// Advanced options (debug window, steamvr_lh)
|
||||
try
|
||||
{
|
||||
set_debugGui(json_doc.value("debug-gui", false));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
set_debugGui(false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
set_steamVrLh(json_doc.value("use-steamvr-lh", false));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
set_steamVrLh(false);
|
||||
}
|
||||
|
||||
// OpenVR compat library
|
||||
try
|
||||
{
|
||||
if (auto it = json_doc.find("openvr-compat-path"); it != json_doc.end())
|
||||
{
|
||||
if (it->is_null())
|
||||
set_openvr("-");
|
||||
if (auto it = item.find("encoder"); it != item.end())
|
||||
{
|
||||
auto e = encoder_id_from_string(std::string(*it));
|
||||
if (encoder and e != encoder)
|
||||
return false;
|
||||
encoder = e;
|
||||
}
|
||||
else
|
||||
set_openvr(QString::fromStdString(*it));
|
||||
{
|
||||
encoder = encoder_name::EncoderAuto;
|
||||
}
|
||||
|
||||
if (auto it = item.find("codec"); it != item.end())
|
||||
{
|
||||
auto e = codec_id_from_string(std::string(*it));
|
||||
if (codec and e != codec)
|
||||
return false;
|
||||
codec = e;
|
||||
}
|
||||
else
|
||||
{
|
||||
codec = video_codec::CodecAuto;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Settings::encoder_name Settings::encoder() const
|
||||
{
|
||||
try
|
||||
{
|
||||
auto it = m_jsonSettings.find("encoders");
|
||||
if (it == m_jsonSettings.end())
|
||||
return encoder_name::EncoderAuto;
|
||||
for (const auto & item: *it)
|
||||
{
|
||||
set_openvr("");
|
||||
if (auto it = item.find("encoder"); it != item.end())
|
||||
return encoder_id_from_string(std::string(*it));
|
||||
return encoder_name::EncoderAuto;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
set_openvr("");
|
||||
}
|
||||
return encoder_name::EncoderAuto;
|
||||
}
|
||||
|
||||
void Settings::set_encoder(const encoder_name & value)
|
||||
{
|
||||
auto old = encoder();
|
||||
auto old_codec = codec();
|
||||
switch (value)
|
||||
{
|
||||
case EncoderAuto:
|
||||
m_jsonSettings.erase("encoders");
|
||||
break;
|
||||
case Nvenc:
|
||||
case Vaapi:
|
||||
case Vulkan: {
|
||||
auto & enc = m_jsonSettings["encoders"] = nlohmann::json::array();
|
||||
for (float offset: {0.f, 0.5f})
|
||||
{
|
||||
auto obj = nlohmann::json::object({
|
||||
{"width", 0.5},
|
||||
{"encoder", encoder_from_id(value)},
|
||||
});
|
||||
if (offset)
|
||||
obj["offset_x"] = offset;
|
||||
if (value == Vulkan)
|
||||
obj["codec"] = "h264";
|
||||
enc.push_back(obj);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case encoder_name::X264:
|
||||
m_jsonSettings["encoders"] =
|
||||
nlohmann::json::parse(R"([{"encoder": "x264", "codec": "h264"}])");
|
||||
break;
|
||||
}
|
||||
if (value != old)
|
||||
{
|
||||
encoderChanged();
|
||||
if (not can10bit())
|
||||
set_tenbit(false);
|
||||
}
|
||||
if (old_codec != codec())
|
||||
codecChanged();
|
||||
simpleConfigChanged();
|
||||
}
|
||||
|
||||
Settings::video_codec Settings::codec() const
|
||||
{
|
||||
try
|
||||
{
|
||||
auto it = m_jsonSettings.find("encoders");
|
||||
if (it == m_jsonSettings.end())
|
||||
return video_codec::CodecAuto;
|
||||
for (const auto & item: *it)
|
||||
{
|
||||
if (auto it = item.find("codec"); it != item.end())
|
||||
return codec_id_from_string(std::string(*it));
|
||||
return video_codec::CodecAuto;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
return video_codec::CodecAuto;
|
||||
}
|
||||
|
||||
void Settings::set_codec(const video_codec & value)
|
||||
{
|
||||
auto old = codec();
|
||||
auto it = m_jsonSettings.find("encoders");
|
||||
if (it == m_jsonSettings.end() or not it->is_array())
|
||||
return;
|
||||
for (auto & item: *it)
|
||||
{
|
||||
if (not item.is_object())
|
||||
continue;
|
||||
if (value == CodecAuto)
|
||||
item.erase("codec");
|
||||
else
|
||||
item["codec"] = codec_from_id(value);
|
||||
}
|
||||
if (value != old)
|
||||
{
|
||||
if (::can10bit(value) != ::can10bit(old))
|
||||
set_tenbit(::can10bit(value));
|
||||
codecChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::tenbit() const
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_jsonSettings.value("bit-depth", 8) == 10;
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::set_tenbit(const bool & value)
|
||||
{
|
||||
auto old = tenbit();
|
||||
m_jsonSettings["bit-depth"] = value ? 10 : 8;
|
||||
if (value != old)
|
||||
tenbitChanged();
|
||||
}
|
||||
|
||||
int Settings::bitrate() const
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_jsonSettings.value("bitrate", 50'000'000) / 1'000'000;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return 50;
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::set_bitrate(const int & value)
|
||||
{
|
||||
auto old = bitrate();
|
||||
m_jsonSettings["bitrate"] = value * 1'000'000;
|
||||
if (old != value)
|
||||
bitrateChanged();
|
||||
}
|
||||
|
||||
float Settings::scale() const
|
||||
{
|
||||
// Foveation
|
||||
auto it = m_jsonSettings.find("scale");
|
||||
if (it != m_jsonSettings.end() and it->is_number())
|
||||
return *it;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Settings::set_scale(const float & value)
|
||||
{
|
||||
auto old = scale();
|
||||
if (value == -1)
|
||||
m_jsonSettings.erase("scale");
|
||||
else
|
||||
m_jsonSettings["scale"] = value;
|
||||
if (old != value)
|
||||
scaleChanged();
|
||||
}
|
||||
|
||||
QString Settings::application() const
|
||||
{
|
||||
// Automatically started application
|
||||
try
|
||||
{
|
||||
std::vector<std::string> application;
|
||||
auto it = m_jsonSettings.find("application");
|
||||
if (it == m_jsonSettings.end())
|
||||
return "";
|
||||
if (it->is_array())
|
||||
application = *it;
|
||||
else if (it->is_string())
|
||||
application.push_back(*it);
|
||||
|
||||
return escape_string(application);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::set_application(const QString & value)
|
||||
{
|
||||
auto old = application();
|
||||
if (value.isEmpty())
|
||||
m_jsonSettings.erase("application");
|
||||
else
|
||||
m_jsonSettings["application"] = unescape_string(value);
|
||||
if (old != value)
|
||||
applicationChanged();
|
||||
}
|
||||
|
||||
bool Settings::debugGui() const
|
||||
{
|
||||
// Advanced options (debug window, steamvr_lh)
|
||||
auto it = m_jsonSettings.find("debug-gui");
|
||||
if (it != m_jsonSettings.end() and it->is_boolean())
|
||||
return *it;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::set_debugGui(const bool & value)
|
||||
{
|
||||
auto old = debugGui();
|
||||
m_jsonSettings["debug-gui"] = value;
|
||||
if (old != value)
|
||||
debugGuiChanged();
|
||||
}
|
||||
|
||||
bool Settings::steamVrLh() const
|
||||
{
|
||||
auto it = m_jsonSettings.find("use-steamvr-lh");
|
||||
if (it != m_jsonSettings.end() and it->is_boolean())
|
||||
return *it;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::set_steamVrLh(const bool & value)
|
||||
{
|
||||
auto old = steamVrLh();
|
||||
m_jsonSettings["use-steamvr-lh"] = value;
|
||||
if (old != value)
|
||||
steamVrLhChanged();
|
||||
}
|
||||
|
||||
bool Settings::tcpOnly() const
|
||||
{
|
||||
auto it = m_jsonSettings.find("tcp-only");
|
||||
if (it != m_jsonSettings.end() and it->is_boolean())
|
||||
return *it;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::set_tcpOnly(const bool & value)
|
||||
{
|
||||
auto old = tcpOnly();
|
||||
m_jsonSettings["tcp-only"] = value;
|
||||
if (old != value)
|
||||
tcpOnlyChanged();
|
||||
}
|
||||
|
||||
QString Settings::openvr() const
|
||||
{
|
||||
// OpenVR compat library
|
||||
if (auto it = m_jsonSettings.find("openvr-compat-path"); it != m_jsonSettings.end())
|
||||
{
|
||||
if (it->is_null())
|
||||
return "-";
|
||||
if (it->is_string())
|
||||
return QString::fromStdString(*it);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void Settings::set_openvr(const QString & value)
|
||||
{
|
||||
auto old = openvr();
|
||||
if (value == "-")
|
||||
m_jsonSettings["openvr-compat-path"] = nullptr;
|
||||
else if (value == "")
|
||||
m_jsonSettings.erase("openvr-compat-path");
|
||||
else
|
||||
m_jsonSettings["openvr-compat-path"] = value.toStdString();
|
||||
if (old != value)
|
||||
tcpOnlyChanged();
|
||||
}
|
||||
|
||||
QList<Settings::video_codec> Settings::allowedCodecs() const
|
||||
{
|
||||
switch (encoder())
|
||||
{
|
||||
case encoder_name::EncoderAuto:
|
||||
return {video_codec::CodecAuto};
|
||||
case encoder_name::Nvenc:
|
||||
case encoder_name::Vaapi:
|
||||
return {
|
||||
video_codec::CodecAuto,
|
||||
video_codec::H264,
|
||||
video_codec::H265,
|
||||
video_codec::Av1,
|
||||
};
|
||||
case encoder_name::Vulkan:
|
||||
return {
|
||||
video_codec::CodecAuto,
|
||||
video_codec::H264,
|
||||
video_codec::H265,
|
||||
};
|
||||
case encoder_name::X264:
|
||||
return {
|
||||
video_codec::H264,
|
||||
};
|
||||
}
|
||||
return {video_codec::CodecAuto};
|
||||
}
|
||||
|
||||
bool Settings::can10bit() const
|
||||
{
|
||||
return ::can10bit(codec());
|
||||
}
|
||||
|
||||
void Settings::save(wivrn_server * server)
|
||||
{
|
||||
nlohmann::json json_doc;
|
||||
try
|
||||
{
|
||||
auto conf = server->jsonConfiguration();
|
||||
json_doc = nlohmann::json::parse(conf.toUtf8());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
// Remove all optional keys that might not be overwritten
|
||||
auto it = json_doc.find("scale");
|
||||
if (it != json_doc.end())
|
||||
json_doc.erase(it);
|
||||
|
||||
it = json_doc.find("encoders.disabled");
|
||||
if (it != json_doc.end())
|
||||
json_doc.erase(it);
|
||||
|
||||
it = json_doc.find("encoders");
|
||||
if (it != json_doc.end())
|
||||
json_doc.erase(it);
|
||||
|
||||
it = json_doc.find("application");
|
||||
if (it != json_doc.end())
|
||||
json_doc.erase(it);
|
||||
|
||||
if (scale() > 0)
|
||||
json_doc["scale"] = scale();
|
||||
|
||||
json_doc["bitrate"] = bitrate();
|
||||
|
||||
std::vector<nlohmann::json> encoders;
|
||||
|
||||
for (auto & enc: m_encoders)
|
||||
{
|
||||
nlohmann::json encoder;
|
||||
|
||||
if (auto value = encoder_from_id(enc.name); value != "auto")
|
||||
encoder["encoder"] = value;
|
||||
if (auto value = codec_from_id(enc.codec); value != "auto")
|
||||
encoder["codec"] = value;
|
||||
encoder["width"] = enc.width;
|
||||
encoder["height"] = enc.height;
|
||||
encoder["offset_x"] = enc.offset_x;
|
||||
encoder["offset_y"] = enc.offset_y;
|
||||
|
||||
// TODO encoder groups
|
||||
|
||||
encoders.push_back(encoder);
|
||||
}
|
||||
|
||||
std::ranges::stable_sort(encoders, [](const nlohmann::json & i, const nlohmann::json & j) {
|
||||
double size_i = i.value("width", 0.0) * i.value("height", 0.0);
|
||||
double size_j = j.value("width", 0.0) * j.value("height", 0.0);
|
||||
return size_i < size_j;
|
||||
});
|
||||
|
||||
if (manualEncoders())
|
||||
json_doc["encoders"] = encoders;
|
||||
else
|
||||
json_doc["encoders.disabled"] = encoders;
|
||||
|
||||
if (application() != "")
|
||||
json_doc["application"] = unescape_string(application());
|
||||
|
||||
json_doc["debug-gui"] = debugGui();
|
||||
json_doc["use-steamvr-lh"] = steamVrLh();
|
||||
|
||||
if (openvr() == "-")
|
||||
json_doc["openvr-compat-path"] = nullptr;
|
||||
else if (openvr() == "")
|
||||
json_doc.erase("openvr-compat-path");
|
||||
else
|
||||
json_doc["openvr-compat-path"] = openvr().toStdString();
|
||||
|
||||
server->setJsonConfiguration(QString::fromStdString(json_doc.dump(2)));
|
||||
server->setJsonConfiguration(QString::fromStdString(m_jsonSettings.dump(2)));
|
||||
}
|
||||
|
||||
void Settings::restore_defaults()
|
||||
{
|
||||
set_encoders({});
|
||||
set_encoderPassthrough({});
|
||||
set_bitrate(50'000'000);
|
||||
set_scale(-1);
|
||||
set_application("");
|
||||
set_debugGui(false);
|
||||
set_steamVrLh(false);
|
||||
set_tcpOnly(false);
|
||||
}
|
||||
|
||||
void Settings::set_encoder_preset(QJSValue preset)
|
||||
{
|
||||
QJSEngine engine;
|
||||
const QJsonArray json_encoders = engine.fromScriptValue<QJsonValue>(preset).toArray();
|
||||
|
||||
std::vector<encoder> encoders;
|
||||
for (const QJsonValue & json_encoder_value: json_encoders)
|
||||
{
|
||||
QJsonObject json_encoder = json_encoder_value.toObject();
|
||||
|
||||
encoders.push_back(encoder{
|
||||
.name = encoder_id_from_string(json_encoder["encoder"].toString("auto").toStdString()),
|
||||
.width = json_encoder["width"].toDouble(),
|
||||
.height = json_encoder["height"].toDouble(),
|
||||
.offset_x = json_encoder["offset_x"].toDouble(),
|
||||
.offset_y = json_encoder["offset_y"].toDouble(),
|
||||
.codec = codec_id_from_string(json_encoder["codec"].toString("auto").toStdString()),
|
||||
});
|
||||
}
|
||||
|
||||
set_manualEncoders(true);
|
||||
set_encoders(encoders);
|
||||
m_jsonSettings.erase("encoders");
|
||||
m_jsonSettings.erase("encoder-passthrough");
|
||||
m_jsonSettings.erase("scale");
|
||||
m_jsonSettings.erase("bitrate");
|
||||
m_jsonSettings.erase("application");
|
||||
m_jsonSettings.erase("debug-gui");
|
||||
m_jsonSettings.erase("use-steamvr-lh");
|
||||
m_jsonSettings.erase("tcp-only");
|
||||
m_jsonSettings.erase("application");
|
||||
emitAllChanged();
|
||||
}
|
||||
|
||||
bool Settings::flatpak() const
|
||||
|
||||
+49
-95
@@ -26,114 +26,63 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <qqmlintegration.h>
|
||||
|
||||
#define SETTER_GETTER_NOTIFY(type, prop_name) \
|
||||
private: \
|
||||
type m_##prop_name; \
|
||||
\
|
||||
public: \
|
||||
const type & prop_name() const \
|
||||
{ \
|
||||
return m_##prop_name; \
|
||||
} \
|
||||
void set_##prop_name(const type & value) \
|
||||
{ \
|
||||
m_##prop_name = value; \
|
||||
prop_name##Changed(value); \
|
||||
} \
|
||||
Q_SIGNALS: \
|
||||
void prop_name##Changed(const type &);
|
||||
#define SETTER_GETTER_NOTIFY(type, prop_name) \
|
||||
public: \
|
||||
type prop_name() const; \
|
||||
void set_##prop_name(const type & value); \
|
||||
Q_SIGNALS: \
|
||||
void prop_name##Changed();
|
||||
|
||||
class wivrn_server;
|
||||
|
||||
struct encoder
|
||||
{
|
||||
enum class video_codec
|
||||
{
|
||||
h264,
|
||||
h265,
|
||||
av1,
|
||||
};
|
||||
|
||||
enum class encoder_name
|
||||
{
|
||||
nvenc,
|
||||
vaapi,
|
||||
x264,
|
||||
vulkan
|
||||
};
|
||||
|
||||
std::optional<encoder_name> name;
|
||||
double width;
|
||||
double height;
|
||||
double offset_x;
|
||||
double offset_y;
|
||||
std::optional<int> group;
|
||||
std::optional<video_codec> codec;
|
||||
std::map<std::string, std::string> options;
|
||||
std::optional<std::string> device;
|
||||
|
||||
double top() const
|
||||
{
|
||||
return offset_y;
|
||||
}
|
||||
void set_top(double value)
|
||||
{
|
||||
height = bottom() - value;
|
||||
offset_y = value;
|
||||
}
|
||||
|
||||
double bottom() const
|
||||
{
|
||||
return offset_y + height;
|
||||
}
|
||||
void set_bottom(double value)
|
||||
{
|
||||
height = value - top();
|
||||
}
|
||||
|
||||
double left() const
|
||||
{
|
||||
return offset_x;
|
||||
}
|
||||
void set_left(double value)
|
||||
{
|
||||
width = right() - value;
|
||||
offset_x = value;
|
||||
}
|
||||
|
||||
double right() const
|
||||
{
|
||||
return offset_x + width;
|
||||
}
|
||||
void set_right(double value)
|
||||
{
|
||||
width = value - left();
|
||||
}
|
||||
};
|
||||
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
public:
|
||||
enum encoder_name
|
||||
{
|
||||
EncoderAuto,
|
||||
Nvenc,
|
||||
Vaapi,
|
||||
X264,
|
||||
Vulkan,
|
||||
};
|
||||
Q_ENUM(encoder_name)
|
||||
|
||||
Q_PROPERTY(bool manualEncoders READ manualEncoders WRITE set_manualEncoders NOTIFY manualEncodersChanged)
|
||||
Q_PROPERTY(std::vector<encoder> encoders READ encoders WRITE set_encoders NOTIFY encodersChanged)
|
||||
Q_PROPERTY(encoder encoderPassthrough READ encoderPassthrough WRITE set_encoderPassthrough NOTIFY encoderPassthroughChanged)
|
||||
enum video_codec
|
||||
{
|
||||
CodecAuto,
|
||||
H264,
|
||||
H265,
|
||||
Av1,
|
||||
};
|
||||
Q_ENUM(video_codec)
|
||||
|
||||
Q_PROPERTY(bool simpleConfig READ simpleConfig NOTIFY simpleConfigChanged)
|
||||
Q_PROPERTY(encoder_name encoder READ encoder WRITE set_encoder NOTIFY encoderChanged)
|
||||
Q_PROPERTY(video_codec codec READ codec WRITE set_codec NOTIFY codecChanged)
|
||||
Q_PROPERTY(QList<video_codec> allowedCodecs READ allowedCodecs NOTIFY encoderChanged)
|
||||
Q_PROPERTY(bool can10bit READ can10bit NOTIFY codecChanged)
|
||||
Q_PROPERTY(bool tenbit READ tenbit WRITE set_tenbit NOTIFY tenbitChanged)
|
||||
Q_PROPERTY(int bitrate READ bitrate WRITE set_bitrate NOTIFY bitrateChanged)
|
||||
Q_PROPERTY(float scale READ scale WRITE set_scale NOTIFY scaleChanged)
|
||||
|
||||
Q_PROPERTY(bool tcpOnly READ tcpOnly WRITE set_tcpOnly NOTIFY tcpOnlyChanged)
|
||||
Q_PROPERTY(QString application READ application WRITE set_application NOTIFY applicationChanged)
|
||||
Q_PROPERTY(QString openvr READ openvr WRITE set_openvr NOTIFY openvrChanged)
|
||||
|
||||
Q_PROPERTY(bool debugGui READ debugGui WRITE set_debugGui NOTIFY debugGuiChanged)
|
||||
Q_PROPERTY(bool steamVrLh READ steamVrLh WRITE set_steamVrLh NOTIFY steamVrLhChanged)
|
||||
Q_PROPERTY(bool tcpOnly READ tcpOnly WRITE set_tcpOnly NOTIFY tcpOnlyChanged)
|
||||
Q_PROPERTY(QString openvr READ openvr WRITE set_openvr NOTIFY openvrChanged)
|
||||
|
||||
Q_PROPERTY(bool flatpak READ flatpak CONSTANT)
|
||||
Q_PROPERTY(bool debug_gui_supported READ debug_gui CONSTANT)
|
||||
Q_PROPERTY(bool steamvr_lh_supported READ steamvr_lh CONSTANT)
|
||||
|
||||
SETTER_GETTER_NOTIFY(bool, manualEncoders)
|
||||
SETTER_GETTER_NOTIFY(std::vector<encoder>, encoders)
|
||||
SETTER_GETTER_NOTIFY(encoder, encoderPassthrough)
|
||||
SETTER_GETTER_NOTIFY(bool, simpleConfig)
|
||||
SETTER_GETTER_NOTIFY(encoder_name, encoder)
|
||||
SETTER_GETTER_NOTIFY(video_codec, codec)
|
||||
SETTER_GETTER_NOTIFY(bool, tenbit)
|
||||
SETTER_GETTER_NOTIFY(int, bitrate)
|
||||
SETTER_GETTER_NOTIFY(float, scale)
|
||||
SETTER_GETTER_NOTIFY(QString, application)
|
||||
@@ -141,6 +90,9 @@ class Settings : public QObject
|
||||
SETTER_GETTER_NOTIFY(bool, steamVrLh)
|
||||
SETTER_GETTER_NOTIFY(bool, tcpOnly)
|
||||
SETTER_GETTER_NOTIFY(QString, openvr)
|
||||
private:
|
||||
nlohmann::json m_jsonSettings = nlohmann::json::object();
|
||||
void emitAllChanged();
|
||||
|
||||
public:
|
||||
Settings(QObject * parent = nullptr) :
|
||||
@@ -149,16 +101,18 @@ public:
|
||||
Q_INVOKABLE void load(const wivrn_server * server);
|
||||
Q_INVOKABLE void save(wivrn_server * server);
|
||||
Q_INVOKABLE void restore_defaults();
|
||||
Q_INVOKABLE void set_encoder_preset(QJSValue preset);
|
||||
|
||||
QList<video_codec> allowedCodecs() const;
|
||||
bool can10bit() const;
|
||||
|
||||
bool flatpak() const;
|
||||
bool debug_gui() const;
|
||||
bool steamvr_lh() const;
|
||||
|
||||
static std::optional<encoder::encoder_name> encoder_id_from_string(std::string_view s);
|
||||
static std::optional<encoder::video_codec> codec_id_from_string(std::string_view s);
|
||||
static const std::string & encoder_from_id(std::optional<encoder::encoder_name> id);
|
||||
static const std::string & codec_from_id(std::optional<encoder::video_codec> id);
|
||||
static encoder_name encoder_id_from_string(std::string_view s);
|
||||
static video_codec codec_id_from_string(std::string_view s);
|
||||
static const std::string & encoder_from_id(encoder_name id);
|
||||
static const std::string & codec_from_id(video_codec id);
|
||||
};
|
||||
|
||||
#undef SETTER_GETTER_NOTIFY
|
||||
|
||||
@@ -10,6 +10,7 @@ It also requires at least one encoder:
|
||||
|
||||
* For nvenc (Nvidia), it requires cuda and nvidia driver
|
||||
* For vaapi (AMD/Intel), it requires ffmpeg with vaapi and libdrm support, as well as vaapi drivers for the GPU
|
||||
* For vulkan (Any modern GPU), it requires vulkan headers of 1.3.283 or later, as well as vulkan drivers for the GPU
|
||||
* For x264 (software encoding), it requires libx264
|
||||
|
||||
Some distributions such as Fedora don't ship h264 and h265 encoders and need specific repositories.
|
||||
|
||||
@@ -64,7 +64,12 @@ Identifier of the encoder, one of
|
||||
Default value: first supported by both headset and encoder of `av1`, `h264`, `h265`.
|
||||
|
||||
One of `h264`, `h265`, `av1`, `raw`.
|
||||
Not all encoders support every codec, `x264` and `vulkan` only support `h264`. For `raw` codec, only `raw` encoder can be used.
|
||||
|
||||
Not all encoders support every codec:
|
||||
- `x264` encoder only supports `h264` codec
|
||||
- `vulkan` encoder supports `h264` and `h265` codecs
|
||||
- `raw` encoder only supports `raw` codec
|
||||
- `nvenc` and `vaapi` support all codecs, except `raw`
|
||||
|
||||
If `nvenc` encoder is in use, you can refer to [nvidia website](https://developer.nvidia.com/video-encode-decode-support-matrix) to make sure that your GPU supports encoding with the desired codec.
|
||||
|
||||
|
||||
+148
-114
@@ -8,8 +8,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn-dashboard\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-20 20:55+0200\n"
|
||||
"PO-Revision-Date: 2025-10-21 01:28+0200\n"
|
||||
"POT-Creation-Date: 2025-10-29 23:59+0100\n"
|
||||
"PO-Revision-Date: 2025-10-30 23:00+0100\n"
|
||||
"Last-Translator: Álvaro De Quinta <blackcherry@danwin1210.de>\n"
|
||||
"Language-Team: Spanish\n"
|
||||
"Language: es\n"
|
||||
@@ -19,47 +19,52 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Gtranslator 49.0\n"
|
||||
|
||||
#: dashboard/apk_installer.cpp:165
|
||||
#: dashboard/apk_installer.cpp:137
|
||||
#, kde-format
|
||||
msgid "Cannot save APK file: %1"
|
||||
msgstr "No se ha podido guardar el APK: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:171
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB / %2 MB"
|
||||
msgstr "Descargando APK: %1 MB / %2 MB"
|
||||
|
||||
#: dashboard/apk_installer.cpp:167
|
||||
#: dashboard/apk_installer.cpp:173
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB"
|
||||
msgstr "Descargando APK: %1 MB"
|
||||
|
||||
#: dashboard/apk_installer.cpp:176
|
||||
#: dashboard/apk_installer.cpp:182
|
||||
#, kde-format
|
||||
msgid "Download cancelled"
|
||||
msgstr "Descarga cancelada"
|
||||
|
||||
#: dashboard/apk_installer.cpp:192
|
||||
#: dashboard/apk_installer.cpp:198
|
||||
#, kde-format
|
||||
msgid "Cannot download APK: %1"
|
||||
msgstr "No se puede descargar el APK: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:215
|
||||
#: dashboard/apk_installer.cpp:221
|
||||
#, kde-format
|
||||
msgid "Installing APK"
|
||||
msgstr "Instalando APK"
|
||||
|
||||
#: dashboard/apk_installer.cpp:219
|
||||
#: dashboard/apk_installer.cpp:225
|
||||
#, kde-format
|
||||
msgid "adb failed to start: %1"
|
||||
msgstr "Error al iniciar adb: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:229
|
||||
#: dashboard/apk_installer.cpp:235
|
||||
#, kde-format
|
||||
msgid "adb exited abnormally: %1"
|
||||
msgstr "adb salió anormalmente: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:237
|
||||
#: dashboard/apk_installer.cpp:243
|
||||
#, kde-format
|
||||
msgid "The 'adb install' command failed: exit code %1"
|
||||
msgstr "El comando 'adb install' falló: código de salida %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:242
|
||||
#: dashboard/apk_installer.cpp:248
|
||||
#, kde-format
|
||||
msgid "Installation successful"
|
||||
msgstr "Instalación completada con éxito"
|
||||
@@ -85,6 +90,12 @@ msgstr "Comprobando la última versión..."
|
||||
msgid "No APK is available for this version"
|
||||
msgstr "No hay ningún APK disponible para esta versión"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:311
|
||||
#: dashboard/qml/Main.qml:396 dashboard/qml/WizardPage.qml:211
|
||||
#, kde-format
|
||||
msgid "ADB is not installed"
|
||||
msgstr "ADB no está instalado"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:47
|
||||
#, kde-format
|
||||
msgid "Connect a headset and make sure developer mode is enabled"
|
||||
@@ -129,7 +140,7 @@ msgstr "Reinstalar WiVRn"
|
||||
msgid "Install WiVRn"
|
||||
msgstr "Instalar WiVRn"
|
||||
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:375
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:401
|
||||
#, kde-format
|
||||
msgid "Headsets"
|
||||
msgstr "Visores"
|
||||
@@ -226,33 +237,44 @@ msgstr "Emparejar un nuevo visor"
|
||||
msgid "Headset statistics"
|
||||
msgstr "Estadísticas del visor"
|
||||
|
||||
#: dashboard/qml/Main.qml:129
|
||||
#: dashboard/qml/Main.qml:130
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities"
|
||||
msgstr "El servidor no tiene capacidades CAP_SYS_NICE"
|
||||
msgid "Avahi daemon is not installed"
|
||||
msgstr "El servicio Avahi no está instalado"
|
||||
|
||||
#: dashboard/qml/Main.qml:136 dashboard/qml/Main.qml:150
|
||||
#: dashboard/qml/Main.qml:138
|
||||
#, kde-format
|
||||
msgid "Avahi daemon is not started"
|
||||
msgstr "El servicio Avahi no está iniciado"
|
||||
|
||||
#: dashboard/qml/Main.qml:145 dashboard/qml/Main.qml:160
|
||||
#: dashboard/qml/Main.qml:174
|
||||
#, kde-format
|
||||
msgid "Fix it"
|
||||
msgstr "Arreglarlo"
|
||||
|
||||
#: dashboard/qml/Main.qml:144
|
||||
#: dashboard/qml/Main.qml:153
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities"
|
||||
msgstr "El servidor no tiene capacidades CAP_SYS_NICE"
|
||||
|
||||
#: dashboard/qml/Main.qml:168
|
||||
#, kde-format
|
||||
msgid "Firewall may not allow port 9757"
|
||||
msgstr "El firewall podría no permitir el puerto 9757"
|
||||
|
||||
#: dashboard/qml/Main.qml:159
|
||||
#: dashboard/qml/Main.qml:183
|
||||
#, kde-format
|
||||
msgid "The CAP_SYS_NICE capability will be used when the server is restarted"
|
||||
msgstr "La capacidad CAP_SYS_NICE se utilizará cuando el servidor se reinicie"
|
||||
|
||||
#: dashboard/qml/Main.qml:165
|
||||
#: dashboard/qml/Main.qml:189
|
||||
#, kde-format
|
||||
msgctxt "restart the server"
|
||||
msgid "Restart now"
|
||||
msgstr "Reiniciar ahora"
|
||||
|
||||
#: dashboard/qml/Main.qml:176
|
||||
#: dashboard/qml/Main.qml:200
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"NVIDIA GPUs require at least driver version 565.77, current version is %1"
|
||||
@@ -260,12 +282,12 @@ msgstr ""
|
||||
"Las GPU NVIDIA requieren al menos la versión 565.77 del controlador, la "
|
||||
"versión actual es %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:182
|
||||
#: dashboard/qml/Main.qml:206
|
||||
#, kde-format
|
||||
msgid "More info"
|
||||
msgstr "Más información"
|
||||
|
||||
#: dashboard/qml/Main.qml:190
|
||||
#: dashboard/qml/Main.qml:214
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Use the Mesa (radv) driver for AMD GPUs\n"
|
||||
@@ -274,7 +296,7 @@ msgstr ""
|
||||
"Usa el controlador Mesa (radv) para las GPU AMD\n"
|
||||
"La codificación por hardware con vaapi no funciona con AMDVLK y AMDGPU-PRO"
|
||||
|
||||
#: dashboard/qml/Main.qml:198
|
||||
#: dashboard/qml/Main.qml:222
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
|
||||
@@ -284,76 +306,75 @@ msgstr ""
|
||||
"en VR.\n"
|
||||
"Instala xrizer o OpenComposite."
|
||||
|
||||
#: dashboard/qml/Main.qml:207
|
||||
#: dashboard/qml/Main.qml:231
|
||||
#, kde-format
|
||||
msgid "Server failed to start"
|
||||
msgstr "El servidor no pudo iniciar"
|
||||
|
||||
#: dashboard/qml/Main.qml:213 dashboard/qml/TroubleshootPage.qml:85
|
||||
#: dashboard/qml/Main.qml:237 dashboard/qml/TroubleshootPage.qml:85
|
||||
#, kde-format
|
||||
msgid "Open server logs"
|
||||
msgstr "Abrir registros del servidor"
|
||||
|
||||
#: dashboard/qml/Main.qml:242
|
||||
#: dashboard/qml/Main.qml:266
|
||||
#, kde-format
|
||||
msgctxt "whether the server is running, displayed in front of a checkbox"
|
||||
msgid "Running"
|
||||
msgstr "En ejecución"
|
||||
|
||||
#: dashboard/qml/Main.qml:257
|
||||
#: dashboard/qml/Main.qml:281
|
||||
#, kde-format
|
||||
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
|
||||
msgid "Pairing"
|
||||
msgstr "Emparejando"
|
||||
|
||||
#: dashboard/qml/Main.qml:270
|
||||
#: dashboard/qml/Main.qml:294
|
||||
#, kde-format
|
||||
msgid "PIN: %1"
|
||||
msgstr "PIN: %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:278 dashboard/qml/WizardPage.qml:374
|
||||
#: dashboard/qml/Main.qml:302 dashboard/qml/WizardPage.qml:374
|
||||
#, kde-format
|
||||
msgid "Connect by USB"
|
||||
msgstr "Conectar por USB"
|
||||
|
||||
#: dashboard/qml/Main.qml:289
|
||||
#: dashboard/qml/Main.qml:313
|
||||
#, kde-format
|
||||
msgid "No headset is connected or your headset is not in developer mode"
|
||||
msgstr ""
|
||||
"No hay ningún visor conectado o tu visor no está en modo desarrollador"
|
||||
msgstr "No hay ningún visor conectado o tu visor no está en modo desarrollador"
|
||||
|
||||
#: dashboard/qml/Main.qml:297
|
||||
#: dashboard/qml/Main.qml:321
|
||||
#, kde-format
|
||||
msgid "Disconnect"
|
||||
msgstr "Desconectar"
|
||||
|
||||
#: dashboard/qml/Main.qml:314
|
||||
#: dashboard/qml/Main.qml:338
|
||||
#, kde-format
|
||||
msgctxt "automatically started application"
|
||||
msgid "Application"
|
||||
msgstr "Aplicación"
|
||||
|
||||
#: dashboard/qml/Main.qml:335
|
||||
#: dashboard/qml/Main.qml:359
|
||||
#, kde-format
|
||||
msgid "Steam information"
|
||||
msgstr "Información de Steam"
|
||||
|
||||
#: dashboard/qml/Main.qml:354
|
||||
#: dashboard/qml/Main.qml:380
|
||||
#, kde-format
|
||||
msgid "Wizard"
|
||||
msgstr "Asistente"
|
||||
|
||||
#: dashboard/qml/Main.qml:361
|
||||
#: dashboard/qml/Main.qml:387
|
||||
#, kde-format
|
||||
msgid "Install the app"
|
||||
msgstr "Instalar aplicación"
|
||||
|
||||
#: dashboard/qml/Main.qml:382 dashboard/qml/SettingsPage.qml:14
|
||||
#: dashboard/qml/Main.qml:408 dashboard/qml/SettingsPage.qml:14
|
||||
#, kde-format
|
||||
msgid "Settings"
|
||||
msgstr "Ajustes"
|
||||
|
||||
#: dashboard/qml/Main.qml:389 dashboard/qml/TroubleshootPage.qml:10
|
||||
#: dashboard/qml/Main.qml:415 dashboard/qml/TroubleshootPage.qml:10
|
||||
#, kde-format
|
||||
msgid "Troubleshoot"
|
||||
msgstr "Solucionar problemas"
|
||||
@@ -430,140 +451,119 @@ msgstr "Más fuerte"
|
||||
msgid "Bitrate:"
|
||||
msgstr "Tasa de bits:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
|
||||
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
|
||||
#, kde-format
|
||||
msgctxt "bitrate"
|
||||
msgid "%1 Mbit/s"
|
||||
msgstr "%1 Mbit/s"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:112
|
||||
#, kde-format
|
||||
msgid "Encoder layout:"
|
||||
msgstr "Configuración del codificador:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:115
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Automatic"
|
||||
msgstr "Automático"
|
||||
msgid "The current encoder configuration is not supported"
|
||||
msgstr "La configuración actual del codificador no está soportada"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:119
|
||||
#: dashboard/qml/SettingsPage.qml:120
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Manual"
|
||||
msgstr "Manual"
|
||||
msgid "Reset"
|
||||
msgstr "Restablecer"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:123
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Default preset"
|
||||
msgstr "Preajuste predeterminado"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:140
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Low latency preset"
|
||||
msgstr "Preajuste de baja latencia"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:159
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Safe preset"
|
||||
msgstr "Preajuste seguro"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:182
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
|
||||
"Drag an edge to resize or remove encoders."
|
||||
msgstr ""
|
||||
"Para agregar un nuevo codificador, divide un codificador existente haciendo "
|
||||
"clic cerca de un borde.\n"
|
||||
"Arrastra un borde para cambiar el tamaño o eliminar codificadores."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:209
|
||||
#: dashboard/qml/SettingsPage.qml:127
|
||||
#, kde-format
|
||||
msgid "Encoder:"
|
||||
msgstr "Codificador"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:218
|
||||
#: dashboard/qml/SettingsPage.qml:133
|
||||
#, kde-format
|
||||
msgctxt "automatic encoder setup"
|
||||
msgid "Auto"
|
||||
msgstr "Automático"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:223
|
||||
#: dashboard/qml/SettingsPage.qml:137
|
||||
#, kde-format
|
||||
msgid "nvenc (NVIDIA GPUs)"
|
||||
msgstr "nvenc (NVIDIA GPUs)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:228
|
||||
#: dashboard/qml/SettingsPage.qml:141
|
||||
#, kde-format
|
||||
msgid "vaapi (AMD and Intel GPUs)"
|
||||
msgstr "vaapi (AMD y Intel GPUs)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:233
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (codificación por software)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:238
|
||||
#: dashboard/qml/SettingsPage.qml:145
|
||||
#, kde-format
|
||||
msgid "Vulkan (Vulkan Video)"
|
||||
msgstr "Vulkan (Vulkan Video)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:261
|
||||
#: dashboard/qml/SettingsPage.qml:149
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (codificación por software)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:166
|
||||
#, kde-format
|
||||
msgid "\"Auto\" will use hardware acceleration if it is available"
|
||||
msgstr "\"Auto\" utilizará aceleración por hardware si está disponible"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:267
|
||||
#: dashboard/qml/SettingsPage.qml:171
|
||||
#, kde-format
|
||||
msgid "Codec:"
|
||||
msgstr "Códec"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:274
|
||||
#: dashboard/qml/SettingsPage.qml:177
|
||||
#, kde-format
|
||||
msgctxt "automatic codec setup"
|
||||
msgid "Auto"
|
||||
msgstr "Automático"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:278
|
||||
#: dashboard/qml/SettingsPage.qml:181
|
||||
#, kde-format
|
||||
msgid "H.264"
|
||||
msgstr "H.264"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:282
|
||||
#: dashboard/qml/SettingsPage.qml:185
|
||||
#, kde-format
|
||||
msgid "H.265"
|
||||
msgstr "H.265"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:286
|
||||
#: dashboard/qml/SettingsPage.qml:189
|
||||
#, kde-format
|
||||
msgid "AV1"
|
||||
msgstr "AV1"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#: dashboard/qml/SettingsPage.qml:217
|
||||
#, kde-format
|
||||
msgid "10-bits"
|
||||
msgstr "10-bits"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:221
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"10-bit encoding improves image quality but is not supported by all codecs "
|
||||
"and hardware"
|
||||
msgstr ""
|
||||
"La codificación de 10-bit mejora la calidad de imagen pero no está soportada "
|
||||
"por todos los codecs ni hardware"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:231
|
||||
#, kde-format
|
||||
msgid "Advanced options"
|
||||
msgstr "Opciones avanzadas"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:314
|
||||
#: dashboard/qml/SettingsPage.qml:237
|
||||
#, kde-format
|
||||
msgid "Check system configuration on start"
|
||||
msgstr "Comprobar configuración del sistema al iniciar"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:318
|
||||
#: dashboard/qml/SettingsPage.qml:241
|
||||
#, kde-format
|
||||
msgid "Enable debug window"
|
||||
msgstr "Habilitar ventana de depuración"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:325
|
||||
#: dashboard/qml/SettingsPage.qml:248
|
||||
#, kde-format
|
||||
msgid "Enable SteamVR tracked devices support"
|
||||
msgstr "Habilitar soporte para dispositivos de seguimiento a través de SteamVR"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:328
|
||||
#: dashboard/qml/SettingsPage.qml:251
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Allows the use of lighthouse-based controllers and trackers.\n"
|
||||
@@ -577,44 +577,44 @@ msgstr ""
|
||||
"Los dispositivos deben de estar encendidos antes de conectarte a WiVRn.\n"
|
||||
"Una herramienta externa como motoc será necesaria para la calibración."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:336
|
||||
#: dashboard/qml/SettingsPage.qml:259
|
||||
#, kde-format
|
||||
msgid "Custom adb location"
|
||||
msgstr "Ruta de adb personalizada"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:347
|
||||
#: dashboard/qml/SettingsPage.qml:270
|
||||
#, kde-format
|
||||
msgid "Adb location:"
|
||||
msgstr "Ruta de adb:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:356
|
||||
#: dashboard/qml/SettingsPage.qml:279
|
||||
#, kde-format
|
||||
msgctxt "browse a file to choose the adb binary"
|
||||
msgid "Browse"
|
||||
msgstr "Explorar"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:366
|
||||
#: dashboard/qml/SettingsPage.qml:289
|
||||
#, kde-format
|
||||
msgid "Default"
|
||||
msgstr "Por defecto"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:380
|
||||
#: dashboard/qml/SettingsPage.qml:303
|
||||
#, kde-format
|
||||
msgctxt "set a custom OpenVR compatibility library"
|
||||
msgid "Custom"
|
||||
msgstr "Personalizado"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:385
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#, kde-format
|
||||
msgid "Disabled"
|
||||
msgstr "Deshabilitado"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:393
|
||||
#: dashboard/qml/SettingsPage.qml:316
|
||||
#, kde-format
|
||||
msgid "OpenVR compatibility library:"
|
||||
msgstr "Librería de compatibilidad para OpenVR:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:419
|
||||
#: dashboard/qml/SettingsPage.qml:342
|
||||
#, kde-format
|
||||
msgid "Library path, excluding bin/linux64/vrclient.so"
|
||||
msgstr "Ruta de librería, excluyendo bin/linux64/vrclient.so"
|
||||
@@ -850,11 +850,6 @@ msgstr "O"
|
||||
msgid "Install over USB"
|
||||
msgstr "Instalar por USB"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:211
|
||||
#, kde-format
|
||||
msgid "ADB is not installed"
|
||||
msgstr "ADB no está instalado"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:219
|
||||
#, kde-format
|
||||
msgid ""
|
||||
@@ -971,6 +966,45 @@ msgstr "xrizer"
|
||||
msgid "Open Composite"
|
||||
msgstr "Open Composite"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid "Encoder layout:"
|
||||
#~ msgstr "Configuración del codificador:"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Automatic"
|
||||
#~ msgstr "Automático"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Manual"
|
||||
#~ msgstr "Manual"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Default preset"
|
||||
#~ msgstr "Preajuste predeterminado"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Low latency preset"
|
||||
#~ msgstr "Preajuste de baja latencia"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Safe preset"
|
||||
#~ msgstr "Preajuste seguro"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid ""
|
||||
#~ "To add a new encoder, split an existing encoder by clicking near an "
|
||||
#~ "edge.\n"
|
||||
#~ "Drag an edge to resize or remove encoders."
|
||||
#~ msgstr ""
|
||||
#~ "Para agregar un nuevo codificador, divide un codificador existente "
|
||||
#~ "haciendo clic cerca de un borde.\n"
|
||||
#~ "Arrastra un borde para cambiar el tamaño o eliminar codificadores."
|
||||
|
||||
#, kde-format
|
||||
#~ msgid ""
|
||||
#~ "If the server is not visible or the connection fails, check that port "
|
||||
|
||||
+33
-33
@@ -5,7 +5,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn 0.15\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-25 10:30+0200\n"
|
||||
"POT-Creation-Date: 2025-10-26 13:31+0100\n"
|
||||
"PO-Revision-Date: 2025-10-25 18:59+0200\n"
|
||||
"Last-Translator: Álvaro De Quinta <blackcherry@danwin1210.de>\n"
|
||||
"Language-Team: Spanish\n"
|
||||
@@ -68,11 +68,11 @@ msgstr "No se puede conectar a {} ({}): {}"
|
||||
msgid "Waiting for connection"
|
||||
msgstr "Esperando conexión"
|
||||
|
||||
#: client/scenes/lobby.cpp:998
|
||||
#: client/scenes/lobby.cpp:1000
|
||||
msgid "Passthrough"
|
||||
msgstr "Exterior"
|
||||
|
||||
#: client/scenes/lobby.cpp:1010
|
||||
#: client/scenes/lobby.cpp:1012
|
||||
msgid "Default environment"
|
||||
msgstr "Entorno por defecto"
|
||||
|
||||
@@ -96,9 +96,9 @@ msgstr "Deshabilitado"
|
||||
msgid "Disconnect"
|
||||
msgstr "Desconectar"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:132 client/scenes/lobby_gui_customize.cpp:618
|
||||
#: client/scenes/lobby_gui_customize.cpp:707
|
||||
#: client/scenes/lobby_gui_customize.cpp:763 client/scenes/stream_gui.cpp:889
|
||||
#: client/scenes/lobby_gui.cpp:132 client/scenes/lobby_gui_customize.cpp:653
|
||||
#: client/scenes/lobby_gui_customize.cpp:744
|
||||
#: client/scenes/lobby_gui_customize.cpp:800 client/scenes/stream_gui.cpp:889
|
||||
msgid "Close"
|
||||
msgstr "Cerrar"
|
||||
|
||||
@@ -135,7 +135,7 @@ msgstr "Puerto"
|
||||
msgid "TCP only"
|
||||
msgstr "Solo TCP"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:317 client/scenes/lobby_gui_customize.cpp:520
|
||||
#: client/scenes/lobby_gui.cpp:317 client/scenes/lobby_gui_customize.cpp:555
|
||||
#: client/scenes/stream_gui.cpp:857
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
@@ -241,7 +241,7 @@ msgstr "Activar seguimiento de manos"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:700 client/scenes/lobby_gui.cpp:712
|
||||
#: client/scenes/lobby_gui.cpp:724 client/scenes/lobby_gui.cpp:741
|
||||
#: client/scenes/lobby_gui_customize.cpp:505
|
||||
#: client/scenes/lobby_gui_customize.cpp:540
|
||||
msgid "This feature is not supported by your headset"
|
||||
msgstr "Esta función no es compatible con tu visor"
|
||||
|
||||
@@ -471,26 +471,28 @@ msgstr ""
|
||||
msgid "Press the grip button to move the main window"
|
||||
msgstr "Pulsa el botón de agarre para mover la ventana principal"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:328
|
||||
#: client/scenes/lobby_gui_customize.cpp:363
|
||||
#, c++-format
|
||||
msgid "Author: {}"
|
||||
msgstr "Autor: {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:332
|
||||
#: client/scenes/lobby_gui_customize.cpp:367
|
||||
#, c++-format
|
||||
msgid "Size: {:.1f} MB"
|
||||
msgstr "Tamaño: {:.1f} MB"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:412
|
||||
#: client/scenes/lobby_gui_customize.cpp:447
|
||||
msgid "Delete this model"
|
||||
msgstr "Borrar este modelo"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:448
|
||||
#: client/scenes/lobby_gui_customize.cpp:483
|
||||
#: client/scenes/lobby_gui_customize.cpp:689
|
||||
#, c++-format
|
||||
msgid "HTTP error {} when downloading {}"
|
||||
msgstr "Error HTTP {} mientras se descargaba {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:456
|
||||
#: client/scenes/lobby_gui_customize.cpp:491
|
||||
#: client/scenes/lobby_gui_customize.cpp:697
|
||||
#, c++-format
|
||||
msgid ""
|
||||
"Curl error when downloading {}\n"
|
||||
@@ -499,43 +501,29 @@ msgstr ""
|
||||
"Error de Curl mientras se descargaba {}\n"
|
||||
"{}: {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:517
|
||||
#: client/scenes/lobby_gui_customize.cpp:552
|
||||
#, c-format
|
||||
msgid "Really delete %s?"
|
||||
msgstr "Seguro que quiere borrar %s?"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:521
|
||||
#: client/scenes/lobby_gui_customize.cpp:556
|
||||
msgid "Delete"
|
||||
msgstr "Borrar"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:602
|
||||
#: client/scenes/lobby_gui_customize.cpp:637
|
||||
#, c++-format
|
||||
msgid "Cannot load environment: {}"
|
||||
msgstr "No se puede cargar el entorno: {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:610
|
||||
#: client/scenes/lobby_gui_customize.cpp:645
|
||||
msgid "Loading environment"
|
||||
msgstr "Cargando entorno"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:654
|
||||
#, c++-format
|
||||
msgid "HTTP error {} when downloading index.json"
|
||||
msgstr "Error HTTP {} mientras se descargaba index.json"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:661
|
||||
#, c++-format
|
||||
msgid ""
|
||||
"Curl error {} when downloading index.json\n"
|
||||
"{}"
|
||||
msgstr ""
|
||||
"Error de Curl {} mientras se descargaba index.json\n"
|
||||
"{}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:687
|
||||
#: client/scenes/lobby_gui_customize.cpp:724
|
||||
msgid "Download more environments"
|
||||
msgstr "Descargar más entornos"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:695
|
||||
#: client/scenes/lobby_gui_customize.cpp:732
|
||||
msgid "Open local glTF model"
|
||||
msgstr "Abrir modelo glTF local"
|
||||
|
||||
@@ -695,6 +683,18 @@ msgstr "No se puede verificar el PIN"
|
||||
msgid "Pairing is disabled on server"
|
||||
msgstr "El emparejamiento está deshabilitado en el servidor."
|
||||
|
||||
#, c++-format
|
||||
#~ msgid "HTTP error {} when downloading index.json"
|
||||
#~ msgstr "Error HTTP {} mientras se descargaba index.json"
|
||||
|
||||
#, c++-format
|
||||
#~ msgid ""
|
||||
#~ "Curl error {} when downloading index.json\n"
|
||||
#~ "{}"
|
||||
#~ msgstr ""
|
||||
#~ "Error de Curl {} mientras se descargaba index.json\n"
|
||||
#~ "{}"
|
||||
|
||||
#~ msgid "Enable video passthrough in lobby"
|
||||
#~ msgstr "Activar video passthrough en el lobby"
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn-dashboard\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-26 13:46+0100\n"
|
||||
"PO-Revision-Date: 2025-10-26 13:47+0100\n"
|
||||
"POT-Creation-Date: 2025-10-30 09:53+0100\n"
|
||||
"PO-Revision-Date: 2025-10-30 09:55+0100\n"
|
||||
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
|
||||
"Language-Team: French <>\n"
|
||||
"Language: French\n"
|
||||
@@ -445,141 +445,120 @@ msgstr "Fort"
|
||||
msgid "Bitrate:"
|
||||
msgstr "Débit :"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
|
||||
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
|
||||
#, kde-format
|
||||
msgctxt "bitrate"
|
||||
msgid "%1 Mbit/s"
|
||||
msgstr "%1 Mbit/s"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:112
|
||||
#, kde-format
|
||||
msgid "Encoder layout:"
|
||||
msgstr "Disposition :"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:115
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Automatic"
|
||||
msgstr "Automatique"
|
||||
msgid "The current encoder configuration is not supported"
|
||||
msgstr "La configuration actuelle des encodeurs n'est pas prise en charge"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:119
|
||||
#: dashboard/qml/SettingsPage.qml:120
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Manual"
|
||||
msgstr "Manuelle"
|
||||
msgid "Reset"
|
||||
msgstr "Réinitialiser"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:123
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Default preset"
|
||||
msgstr "Configuration prédéfinie : par défaut"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:140
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Low latency preset"
|
||||
msgstr "Configuration prédéfinie : basse latence"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:159
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Safe preset"
|
||||
msgstr "Configuration prédéfinie : sure"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:182
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
|
||||
"Drag an edge to resize or remove encoders."
|
||||
msgstr ""
|
||||
"Pour ajouter un encodeur, découpez un encodeur existant en cliquant près "
|
||||
"d'un bord.\n"
|
||||
"Déplacez un bord pour redimensionner ou supprimer un encodeur."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:209
|
||||
#: dashboard/qml/SettingsPage.qml:127
|
||||
#, kde-format
|
||||
msgid "Encoder:"
|
||||
msgstr "Encodeur :"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:218
|
||||
#: dashboard/qml/SettingsPage.qml:133
|
||||
#, kde-format
|
||||
msgctxt "automatic encoder setup"
|
||||
msgid "Auto"
|
||||
msgstr "Automatique"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:223
|
||||
#: dashboard/qml/SettingsPage.qml:137
|
||||
#, kde-format
|
||||
msgid "nvenc (NVIDIA GPUs)"
|
||||
msgstr "nvenc (GPUs NVIDIA)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:228
|
||||
#: dashboard/qml/SettingsPage.qml:141
|
||||
#, kde-format
|
||||
msgid "vaapi (AMD and Intel GPUs)"
|
||||
msgstr "vaapi (GPUs AMD et Intel)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:233
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (encodage logiciel)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:238
|
||||
#: dashboard/qml/SettingsPage.qml:145
|
||||
#, kde-format
|
||||
msgid "Vulkan (Vulkan Video)"
|
||||
msgstr "Vulkan (Vulkan Vidéo)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:261
|
||||
#: dashboard/qml/SettingsPage.qml:149
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (encodage logiciel)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:166
|
||||
#, kde-format
|
||||
msgid "\"Auto\" will use hardware acceleration if it is available"
|
||||
msgstr ""
|
||||
"« Automatique » utilisera l'accélération matérielle si elle est disponible"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:267
|
||||
#: dashboard/qml/SettingsPage.qml:171
|
||||
#, kde-format
|
||||
msgid "Codec:"
|
||||
msgstr "Codec :"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:274
|
||||
#: dashboard/qml/SettingsPage.qml:177
|
||||
#, kde-format
|
||||
msgctxt "automatic codec setup"
|
||||
msgid "Auto"
|
||||
msgstr "Automatique"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:278
|
||||
#: dashboard/qml/SettingsPage.qml:181
|
||||
#, kde-format
|
||||
msgid "H.264"
|
||||
msgstr "H.264"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:282
|
||||
#: dashboard/qml/SettingsPage.qml:185
|
||||
#, kde-format
|
||||
msgid "H.265"
|
||||
msgstr "H.265"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:286
|
||||
#: dashboard/qml/SettingsPage.qml:189
|
||||
#, kde-format
|
||||
msgid "AV1"
|
||||
msgstr "AV1"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#: dashboard/qml/SettingsPage.qml:217
|
||||
#, kde-format
|
||||
msgid "10-bits"
|
||||
msgstr "10 bits"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:221
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"10-bit encoding improves image quality but is not supported by all codecs "
|
||||
"and hardware"
|
||||
msgstr ""
|
||||
"L'encodage 10 bits améliore la qualité d'image mais n'est pas pris en charge "
|
||||
"part tous les codecs et matériel"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:231
|
||||
#, kde-format
|
||||
msgid "Advanced options"
|
||||
msgstr "Paramètres avancés"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:314
|
||||
#: dashboard/qml/SettingsPage.qml:237
|
||||
#, kde-format
|
||||
msgid "Check system configuration on start"
|
||||
msgstr "Vérifier les paramètres système au démarrage"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:318
|
||||
#: dashboard/qml/SettingsPage.qml:241
|
||||
#, kde-format
|
||||
msgid "Enable debug window"
|
||||
msgstr "Activer la fenêtre de débogage"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:325
|
||||
#: dashboard/qml/SettingsPage.qml:248
|
||||
#, kde-format
|
||||
msgid "Enable SteamVR tracked devices support"
|
||||
msgstr "Activer le support des manettes SteamVR"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:328
|
||||
#: dashboard/qml/SettingsPage.qml:251
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Allows the use of lighthouse-based controllers and trackers.\n"
|
||||
@@ -593,44 +572,44 @@ msgstr ""
|
||||
"WiVRn.\n"
|
||||
"Un utilitaire tiers tel que motoc est nécessaire pour la calibration."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:336
|
||||
#: dashboard/qml/SettingsPage.qml:259
|
||||
#, kde-format
|
||||
msgid "Custom adb location"
|
||||
msgstr "Spécifier l'emplacement d'adb"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:347
|
||||
#: dashboard/qml/SettingsPage.qml:270
|
||||
#, kde-format
|
||||
msgid "Adb location:"
|
||||
msgstr "Emplacement d'adb"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:356
|
||||
#: dashboard/qml/SettingsPage.qml:279
|
||||
#, kde-format
|
||||
msgctxt "browse a file to choose the adb binary"
|
||||
msgid "Browse"
|
||||
msgstr "Parcourir"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:366
|
||||
#: dashboard/qml/SettingsPage.qml:289
|
||||
#, kde-format
|
||||
msgid "Default"
|
||||
msgstr "Par défaut"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:380
|
||||
#: dashboard/qml/SettingsPage.qml:303
|
||||
#, kde-format
|
||||
msgctxt "set a custom OpenVR compatibility library"
|
||||
msgid "Custom"
|
||||
msgstr "Personnalisé"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:385
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#, kde-format
|
||||
msgid "Disabled"
|
||||
msgstr "Désactivé"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:393
|
||||
#: dashboard/qml/SettingsPage.qml:316
|
||||
#, kde-format
|
||||
msgid "OpenVR compatibility library:"
|
||||
msgstr "Compatibilité OpenVR :"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:419
|
||||
#: dashboard/qml/SettingsPage.qml:342
|
||||
#, kde-format
|
||||
msgid "Library path, excluding bin/linux64/vrclient.so"
|
||||
msgstr "Chemin de la bibliothèque, en enlevant bin/linux64/vrclient.so"
|
||||
@@ -984,3 +963,42 @@ msgstr "xrizer"
|
||||
#, kde-format
|
||||
msgid "Open Composite"
|
||||
msgstr "Open Composite"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid "Encoder layout:"
|
||||
#~ msgstr "Disposition :"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Automatic"
|
||||
#~ msgstr "Automatique"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Manual"
|
||||
#~ msgstr "Manuelle"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Default preset"
|
||||
#~ msgstr "Configuration prédéfinie : par défaut"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Low latency preset"
|
||||
#~ msgstr "Configuration prédéfinie : basse latence"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Safe preset"
|
||||
#~ msgstr "Configuration prédéfinie : sure"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid ""
|
||||
#~ "To add a new encoder, split an existing encoder by clicking near an "
|
||||
#~ "edge.\n"
|
||||
#~ "Drag an edge to resize or remove encoders."
|
||||
#~ msgstr ""
|
||||
#~ "Pour ajouter un encodeur, découpez un encodeur existant en cliquant près "
|
||||
#~ "d'un bord.\n"
|
||||
#~ "Déplacez un bord pour redimensionner ou supprimer un encodeur."
|
||||
|
||||
+150
-115
@@ -10,8 +10,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn-dashboard\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-20 20:55+0200\n"
|
||||
"PO-Revision-Date: 2025-10-20 21:18+0200\n"
|
||||
"POT-Creation-Date: 2025-10-29 23:59+0100\n"
|
||||
"PO-Revision-Date: 2025-10-30 11:31+0100\n"
|
||||
"Last-Translator: Claudio Sampaio (Patola) <patola@gmail.com>\n"
|
||||
"Language-Team: Portuguese <>\n"
|
||||
"Language: pt_BR\n"
|
||||
@@ -21,47 +21,52 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Lokalize 25.08.2\n"
|
||||
|
||||
#: dashboard/apk_installer.cpp:165
|
||||
#: dashboard/apk_installer.cpp:137
|
||||
#, kde-format
|
||||
msgid "Cannot save APK file: %1"
|
||||
msgstr "Não foi possível salvar arquivo APK: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:171
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB / %2 MB"
|
||||
msgstr "Baixando APK: %1 MB / %2 MB"
|
||||
|
||||
#: dashboard/apk_installer.cpp:167
|
||||
#: dashboard/apk_installer.cpp:173
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB"
|
||||
msgstr "Baixando APK: %1 MB"
|
||||
|
||||
#: dashboard/apk_installer.cpp:176
|
||||
#: dashboard/apk_installer.cpp:182
|
||||
#, kde-format
|
||||
msgid "Download cancelled"
|
||||
msgstr "Download cancelado"
|
||||
|
||||
#: dashboard/apk_installer.cpp:192
|
||||
#: dashboard/apk_installer.cpp:198
|
||||
#, kde-format
|
||||
msgid "Cannot download APK: %1"
|
||||
msgstr "Não é possível baixar o APK: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:215
|
||||
#: dashboard/apk_installer.cpp:221
|
||||
#, kde-format
|
||||
msgid "Installing APK"
|
||||
msgstr "Instalando APK"
|
||||
|
||||
#: dashboard/apk_installer.cpp:219
|
||||
#: dashboard/apk_installer.cpp:225
|
||||
#, kde-format
|
||||
msgid "adb failed to start: %1"
|
||||
msgstr "O adb não conseguiu iniciar: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:229
|
||||
#: dashboard/apk_installer.cpp:235
|
||||
#, kde-format
|
||||
msgid "adb exited abnormally: %1"
|
||||
msgstr "adb saiu anormalmente: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:237
|
||||
#: dashboard/apk_installer.cpp:243
|
||||
#, kde-format
|
||||
msgid "The 'adb install' command failed: exit code %1"
|
||||
msgstr "O comando 'adb install' falhou: código de saída %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:242
|
||||
#: dashboard/apk_installer.cpp:248
|
||||
#, kde-format
|
||||
msgid "Installation successful"
|
||||
msgstr "Instalação bem-sucedida"
|
||||
@@ -87,6 +92,12 @@ msgstr "Verificando a última versão..."
|
||||
msgid "No APK is available for this version"
|
||||
msgstr "Nenhum APK está disponível para esta versão"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:311
|
||||
#: dashboard/qml/Main.qml:396 dashboard/qml/WizardPage.qml:211
|
||||
#, kde-format
|
||||
msgid "ADB is not installed"
|
||||
msgstr "ABD não está instalado"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:47
|
||||
#, kde-format
|
||||
msgid "Connect a headset and make sure developer mode is enabled"
|
||||
@@ -131,7 +142,7 @@ msgstr "Reinstalar WiVRn"
|
||||
msgid "Install WiVRn"
|
||||
msgstr "Instalar WiVRn"
|
||||
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:375
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:401
|
||||
#, kde-format
|
||||
msgid "Headsets"
|
||||
msgstr "Headsets"
|
||||
@@ -227,45 +238,56 @@ msgstr "Parear um novo headset"
|
||||
msgid "Headset statistics"
|
||||
msgstr "Estatísticas do headset"
|
||||
|
||||
#: dashboard/qml/Main.qml:129
|
||||
#: dashboard/qml/Main.qml:130
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities"
|
||||
msgstr "O servidor não tem capabilities CAP_SYS_NICE"
|
||||
msgid "Avahi daemon is not installed"
|
||||
msgstr "Avahi daemon não está instalado"
|
||||
|
||||
#: dashboard/qml/Main.qml:136 dashboard/qml/Main.qml:150
|
||||
#: dashboard/qml/Main.qml:138
|
||||
#, kde-format
|
||||
msgid "Avahi daemon is not started"
|
||||
msgstr "Avahi daemon não foi iniciado"
|
||||
|
||||
#: dashboard/qml/Main.qml:145 dashboard/qml/Main.qml:160
|
||||
#: dashboard/qml/Main.qml:174
|
||||
#, kde-format
|
||||
msgid "Fix it"
|
||||
msgstr "Conserte"
|
||||
|
||||
#: dashboard/qml/Main.qml:144
|
||||
#: dashboard/qml/Main.qml:153
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities"
|
||||
msgstr "O servidor não tem capabilities CAP_SYS_NICE"
|
||||
|
||||
#: dashboard/qml/Main.qml:168
|
||||
#, kde-format
|
||||
msgid "Firewall may not allow port 9757"
|
||||
msgstr "O firewall pode não permitir a porta 9757"
|
||||
|
||||
#: dashboard/qml/Main.qml:159
|
||||
#: dashboard/qml/Main.qml:183
|
||||
#, kde-format
|
||||
msgid "The CAP_SYS_NICE capability will be used when the server is restarted"
|
||||
msgstr "A capability CAP_SYS_NICE será usada quando o servidor for reiniciado"
|
||||
|
||||
#: dashboard/qml/Main.qml:165
|
||||
#: dashboard/qml/Main.qml:189
|
||||
#, kde-format
|
||||
msgctxt "restart the server"
|
||||
msgid "Restart now"
|
||||
msgstr "Reiniciar agora"
|
||||
|
||||
#: dashboard/qml/Main.qml:176
|
||||
#: dashboard/qml/Main.qml:200
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"NVIDIA GPUs require at least driver version 565.77, current version is %1"
|
||||
msgstr ""
|
||||
"GPUs NVIDIA requerem pelo menos o driver versão 565.77, a versão atual é %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:182
|
||||
#: dashboard/qml/Main.qml:206
|
||||
#, kde-format
|
||||
msgid "More info"
|
||||
msgstr "Mais informações"
|
||||
|
||||
#: dashboard/qml/Main.qml:190
|
||||
#: dashboard/qml/Main.qml:214
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Use the Mesa (radv) driver for AMD GPUs\n"
|
||||
@@ -274,7 +296,7 @@ msgstr ""
|
||||
"Use o driver Mesa (radv) para GPUs AMD\n"
|
||||
"Codificação de hardware com a vaapi não funciona com AMDVLK e AMDGPU-PRO"
|
||||
|
||||
#: dashboard/qml/Main.qml:198
|
||||
#: dashboard/qml/Main.qml:222
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
|
||||
@@ -284,76 +306,76 @@ msgstr ""
|
||||
"conseguirão carregar em VR.\n"
|
||||
"Instale o xrizer ou o OpenComposite."
|
||||
|
||||
#: dashboard/qml/Main.qml:207
|
||||
#: dashboard/qml/Main.qml:231
|
||||
#, kde-format
|
||||
msgid "Server failed to start"
|
||||
msgstr "Servidor falhou em iniciar"
|
||||
|
||||
#: dashboard/qml/Main.qml:213 dashboard/qml/TroubleshootPage.qml:85
|
||||
#: dashboard/qml/Main.qml:237 dashboard/qml/TroubleshootPage.qml:85
|
||||
#, kde-format
|
||||
msgid "Open server logs"
|
||||
msgstr "Abrir logs do servidor"
|
||||
|
||||
#: dashboard/qml/Main.qml:242
|
||||
#: dashboard/qml/Main.qml:266
|
||||
#, kde-format
|
||||
msgctxt "whether the server is running, displayed in front of a checkbox"
|
||||
msgid "Running"
|
||||
msgstr "Rodando"
|
||||
|
||||
#: dashboard/qml/Main.qml:257
|
||||
#: dashboard/qml/Main.qml:281
|
||||
#, kde-format
|
||||
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
|
||||
msgid "Pairing"
|
||||
msgstr "Pareando"
|
||||
|
||||
#: dashboard/qml/Main.qml:270
|
||||
#: dashboard/qml/Main.qml:294
|
||||
#, kde-format
|
||||
msgid "PIN: %1"
|
||||
msgstr "PIN: %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:278 dashboard/qml/WizardPage.qml:374
|
||||
#: dashboard/qml/Main.qml:302 dashboard/qml/WizardPage.qml:374
|
||||
#, kde-format
|
||||
msgid "Connect by USB"
|
||||
msgstr "Conectar pela USB"
|
||||
|
||||
#: dashboard/qml/Main.qml:289
|
||||
#: dashboard/qml/Main.qml:313
|
||||
#, kde-format
|
||||
msgid "No headset is connected or your headset is not in developer mode"
|
||||
msgstr ""
|
||||
"Nenhum headset está conectado ou seu headset não está em modo desenvolvedor"
|
||||
|
||||
#: dashboard/qml/Main.qml:297
|
||||
#: dashboard/qml/Main.qml:321
|
||||
#, kde-format
|
||||
msgid "Disconnect"
|
||||
msgstr "Desconectar"
|
||||
|
||||
#: dashboard/qml/Main.qml:314
|
||||
#: dashboard/qml/Main.qml:338
|
||||
#, kde-format
|
||||
msgctxt "automatically started application"
|
||||
msgid "Application"
|
||||
msgstr "Aplicativo"
|
||||
|
||||
#: dashboard/qml/Main.qml:335
|
||||
#: dashboard/qml/Main.qml:359
|
||||
#, kde-format
|
||||
msgid "Steam information"
|
||||
msgstr "Informações da Steam"
|
||||
|
||||
#: dashboard/qml/Main.qml:354
|
||||
#: dashboard/qml/Main.qml:380
|
||||
#, kde-format
|
||||
msgid "Wizard"
|
||||
msgstr "Assistente"
|
||||
|
||||
#: dashboard/qml/Main.qml:361
|
||||
#: dashboard/qml/Main.qml:387
|
||||
#, kde-format
|
||||
msgid "Install the app"
|
||||
msgstr "Instalar o aplicativo"
|
||||
|
||||
#: dashboard/qml/Main.qml:382 dashboard/qml/SettingsPage.qml:14
|
||||
#: dashboard/qml/Main.qml:408 dashboard/qml/SettingsPage.qml:14
|
||||
#, kde-format
|
||||
msgid "Settings"
|
||||
msgstr "Ajustes"
|
||||
|
||||
#: dashboard/qml/Main.qml:389 dashboard/qml/TroubleshootPage.qml:10
|
||||
#: dashboard/qml/Main.qml:415 dashboard/qml/TroubleshootPage.qml:10
|
||||
#, kde-format
|
||||
msgid "Troubleshoot"
|
||||
msgstr "Resolver problemas"
|
||||
@@ -430,140 +452,120 @@ msgstr "Mais forte"
|
||||
msgid "Bitrate:"
|
||||
msgstr "Taxa de bits:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
|
||||
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
|
||||
#, kde-format
|
||||
msgctxt "bitrate"
|
||||
msgid "%1 Mbit/s"
|
||||
msgstr "%1 Mbit/s"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:112
|
||||
#, kde-format
|
||||
msgid "Encoder layout:"
|
||||
msgstr "Layout do codificador:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:115
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Automatic"
|
||||
msgstr "Automático"
|
||||
msgid "The current encoder configuration is not supported"
|
||||
msgstr "A configuração de codificador atual não é suportada"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:119
|
||||
#: dashboard/qml/SettingsPage.qml:120
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Manual"
|
||||
msgstr "Manual"
|
||||
msgid "Reset"
|
||||
msgstr "Resetar"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:123
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Default preset"
|
||||
msgstr "Predefinição padrão"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:140
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Low latency preset"
|
||||
msgstr "Predefinição de baixa latência"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:159
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Safe preset"
|
||||
msgstr "Predefinição segura"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:182
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
|
||||
"Drag an edge to resize or remove encoders."
|
||||
msgstr ""
|
||||
"Para adicionar um novo codificador, divida um codificador existente clicando "
|
||||
"perto de uma aresta.\n"
|
||||
"Arraste a aresta para redimensionar ou remover codificadores."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:209
|
||||
#: dashboard/qml/SettingsPage.qml:127
|
||||
#, kde-format
|
||||
msgid "Encoder:"
|
||||
msgstr "Codificador:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:218
|
||||
#: dashboard/qml/SettingsPage.qml:133
|
||||
#, kde-format
|
||||
msgctxt "automatic encoder setup"
|
||||
msgid "Auto"
|
||||
msgstr "Auto"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:223
|
||||
#: dashboard/qml/SettingsPage.qml:137
|
||||
#, kde-format
|
||||
msgid "nvenc (NVIDIA GPUs)"
|
||||
msgstr "nvenc (GPUs NVIDIA)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:228
|
||||
#: dashboard/qml/SettingsPage.qml:141
|
||||
#, kde-format
|
||||
msgid "vaapi (AMD and Intel GPUs)"
|
||||
msgstr "vaapi (GPUs AMD e Intel)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:233
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (codificação por software)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:238
|
||||
#: dashboard/qml/SettingsPage.qml:145
|
||||
#, kde-format
|
||||
msgid "Vulkan (Vulkan Video)"
|
||||
msgstr "Vulkan (Vídeo Vulkan)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:261
|
||||
#: dashboard/qml/SettingsPage.qml:149
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (codificação por software)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:166
|
||||
#, kde-format
|
||||
msgid "\"Auto\" will use hardware acceleration if it is available"
|
||||
msgstr "\"Auto\" usará aceleração de hardware se disponível"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:267
|
||||
#: dashboard/qml/SettingsPage.qml:171
|
||||
#, kde-format
|
||||
msgid "Codec:"
|
||||
msgstr "Codec:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:274
|
||||
#: dashboard/qml/SettingsPage.qml:177
|
||||
#, kde-format
|
||||
msgctxt "automatic codec setup"
|
||||
msgid "Auto"
|
||||
msgstr "Auto"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:278
|
||||
#: dashboard/qml/SettingsPage.qml:181
|
||||
#, kde-format
|
||||
msgid "H.264"
|
||||
msgstr "H.264"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:282
|
||||
#: dashboard/qml/SettingsPage.qml:185
|
||||
#, kde-format
|
||||
msgid "H.265"
|
||||
msgstr "H.265"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:286
|
||||
#: dashboard/qml/SettingsPage.qml:189
|
||||
#, kde-format
|
||||
msgid "AV1"
|
||||
msgstr "AV1"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#: dashboard/qml/SettingsPage.qml:217
|
||||
#, kde-format
|
||||
msgid "10-bits"
|
||||
msgstr "10-bits"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:221
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"10-bit encoding improves image quality but is not supported by all codecs "
|
||||
"and hardware"
|
||||
msgstr ""
|
||||
"Codificação de 10-bit melhora a qualidade de imagem mas não é suportada por to"
|
||||
"dos "
|
||||
"os codecs e hardware"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:231
|
||||
#, kde-format
|
||||
msgid "Advanced options"
|
||||
msgstr "Opções avançadas"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:314
|
||||
#: dashboard/qml/SettingsPage.qml:237
|
||||
#, kde-format
|
||||
msgid "Check system configuration on start"
|
||||
msgstr "Verificar configuração do sistema ao iniciar"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:318
|
||||
#: dashboard/qml/SettingsPage.qml:241
|
||||
#, kde-format
|
||||
msgid "Enable debug window"
|
||||
msgstr "Ativar janela de depuração"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:325
|
||||
#: dashboard/qml/SettingsPage.qml:248
|
||||
#, kde-format
|
||||
msgid "Enable SteamVR tracked devices support"
|
||||
msgstr "Ativar suporte a dispositivos rastreados pelo SteamVR"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:328
|
||||
#: dashboard/qml/SettingsPage.qml:251
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Allows the use of lighthouse-based controllers and trackers.\n"
|
||||
@@ -576,44 +578,44 @@ msgstr ""
|
||||
"Os dispositivos precisam estar ligados antes de se conectar ao WiVRn.\n"
|
||||
"Uma ferramenta externa como o motoc é necessária para calibração."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:336
|
||||
#: dashboard/qml/SettingsPage.qml:259
|
||||
#, kde-format
|
||||
msgid "Custom adb location"
|
||||
msgstr "Caminho personalizado do adb"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:347
|
||||
#: dashboard/qml/SettingsPage.qml:270
|
||||
#, kde-format
|
||||
msgid "Adb location:"
|
||||
msgstr "Caminho do adb:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:356
|
||||
#: dashboard/qml/SettingsPage.qml:279
|
||||
#, kde-format
|
||||
msgctxt "browse a file to choose the adb binary"
|
||||
msgid "Browse"
|
||||
msgstr "Navegar"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:366
|
||||
#: dashboard/qml/SettingsPage.qml:289
|
||||
#, kde-format
|
||||
msgid "Default"
|
||||
msgstr "Default"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:380
|
||||
#: dashboard/qml/SettingsPage.qml:303
|
||||
#, kde-format
|
||||
msgctxt "set a custom OpenVR compatibility library"
|
||||
msgid "Custom"
|
||||
msgstr "Personalizado"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:385
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#, kde-format
|
||||
msgid "Disabled"
|
||||
msgstr "Desativado"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:393
|
||||
#: dashboard/qml/SettingsPage.qml:316
|
||||
#, kde-format
|
||||
msgid "OpenVR compatibility library:"
|
||||
msgstr "Biblioteca de compatibilidade OpenVR:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:419
|
||||
#: dashboard/qml/SettingsPage.qml:342
|
||||
#, kde-format
|
||||
msgid "Library path, excluding bin/linux64/vrclient.so"
|
||||
msgstr "Caminho da biblioteca, excluindo bin/linux64/vrclient.so"
|
||||
@@ -851,11 +853,6 @@ msgstr "Ou"
|
||||
msgid "Install over USB"
|
||||
msgstr "Instalar pela USB"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:211
|
||||
#, kde-format
|
||||
msgid "ADB is not installed"
|
||||
msgstr "ABD não está instalado"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:219
|
||||
#, kde-format
|
||||
msgid ""
|
||||
@@ -925,9 +922,8 @@ msgid ""
|
||||
"If the server is not visible or the connection fails, check that ports 5353 "
|
||||
"(UDP) and 9757 (TCP and UDP) are open in your firewall."
|
||||
msgstr ""
|
||||
"Se o servidor não estiver visível ou a conexão falhar, verifique se as portas "
|
||||
"5353 "
|
||||
"(UDP) e 9757 (TCP e UDP) estão abertas no seu firewall."
|
||||
"Se o servidor não estiver visível ou a conexão falhar, verifique se as "
|
||||
"portas 5353 (UDP) e 9757 (TCP e UDP) estão abertas no seu firewall."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:406
|
||||
#, kde-format
|
||||
@@ -973,6 +969,45 @@ msgstr "xrizer"
|
||||
msgid "Open Composite"
|
||||
msgstr "Open Composite"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid "Encoder layout:"
|
||||
#~ msgstr "Layout do codificador:"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Automatic"
|
||||
#~ msgstr "Automático"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Manual"
|
||||
#~ msgstr "Manual"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Default preset"
|
||||
#~ msgstr "Predefinição padrão"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Low latency preset"
|
||||
#~ msgstr "Predefinição de baixa latência"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Safe preset"
|
||||
#~ msgstr "Predefinição segura"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid ""
|
||||
#~ "To add a new encoder, split an existing encoder by clicking near an "
|
||||
#~ "edge.\n"
|
||||
#~ "Drag an edge to resize or remove encoders."
|
||||
#~ msgstr ""
|
||||
#~ "Para adicionar um novo codificador, divida um codificador existente "
|
||||
#~ "clicando perto de uma aresta.\n"
|
||||
#~ "Arraste a aresta para redimensionar ou remover codificadores."
|
||||
|
||||
#, kde-format
|
||||
#~ msgid ""
|
||||
#~ "If the server is not visible or the connection fails, check that port "
|
||||
|
||||
+152
-115
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn-dashboard\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-20 22:55+0400\n"
|
||||
"POT-Creation-Date: 2025-10-30 02:59+0400\n"
|
||||
"PO-Revision-Date: 2025-10-06 14:57+0400\n"
|
||||
"Last-Translator: Alexander Afanasenko <aomiki.iki@gmail.com>\n"
|
||||
"Language-Team: Russian <>\n"
|
||||
@@ -19,47 +19,52 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
||||
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
|
||||
#: dashboard/apk_installer.cpp:165
|
||||
#: dashboard/apk_installer.cpp:137
|
||||
#, kde-format
|
||||
msgid "Cannot save APK file: %1"
|
||||
msgstr "Невозможно сохранить APK файл: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:171
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB / %2 MB"
|
||||
msgstr "Загрузка APK: %1 Мб / %2 Мб"
|
||||
|
||||
#: dashboard/apk_installer.cpp:167
|
||||
#: dashboard/apk_installer.cpp:173
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB"
|
||||
msgstr "Загрузка APK: %1 Мб"
|
||||
|
||||
#: dashboard/apk_installer.cpp:176
|
||||
#: dashboard/apk_installer.cpp:182
|
||||
#, kde-format
|
||||
msgid "Download cancelled"
|
||||
msgstr "Загрузка отменена"
|
||||
|
||||
#: dashboard/apk_installer.cpp:192
|
||||
#: dashboard/apk_installer.cpp:198
|
||||
#, kde-format
|
||||
msgid "Cannot download APK: %1"
|
||||
msgstr "Невозможно загрузить APK: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:215
|
||||
#: dashboard/apk_installer.cpp:221
|
||||
#, kde-format
|
||||
msgid "Installing APK"
|
||||
msgstr "Установка APK"
|
||||
|
||||
#: dashboard/apk_installer.cpp:219
|
||||
#: dashboard/apk_installer.cpp:225
|
||||
#, kde-format
|
||||
msgid "adb failed to start: %1"
|
||||
msgstr "Не удалось запустить adb: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:229
|
||||
#: dashboard/apk_installer.cpp:235
|
||||
#, kde-format
|
||||
msgid "adb exited abnormally: %1"
|
||||
msgstr "adb завершился некорректно: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:237
|
||||
#: dashboard/apk_installer.cpp:243
|
||||
#, kde-format
|
||||
msgid "The 'adb install' command failed: exit code %1"
|
||||
msgstr "Не удалось выполнить команду 'adb install': код возврата %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:242
|
||||
#: dashboard/apk_installer.cpp:248
|
||||
#, kde-format
|
||||
msgid "Installation successful"
|
||||
msgstr "Установка прошла успешно"
|
||||
@@ -82,8 +87,14 @@ msgstr "Проверяю новейшую версию..."
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:43 dashboard/qml/WizardPage.qml:198
|
||||
#, kde-format
|
||||
msgid "No precompiled APK is available for this version"
|
||||
msgstr "Нет прекомпилированного APK-файла для этой версии"
|
||||
msgid "No APK is available for this version"
|
||||
msgstr "APK файл для этой версии отсутствует"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:311
|
||||
#: dashboard/qml/Main.qml:396 dashboard/qml/WizardPage.qml:211
|
||||
#, kde-format
|
||||
msgid "ADB is not installed"
|
||||
msgstr "ADB не установлен"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:47
|
||||
#, kde-format
|
||||
@@ -128,7 +139,7 @@ msgstr "Переустановить WiVRn"
|
||||
msgid "Install WiVRn"
|
||||
msgstr "Установить WiVRn"
|
||||
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:375
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:401
|
||||
#, kde-format
|
||||
msgid "Headsets"
|
||||
msgstr "Шлемы"
|
||||
@@ -229,45 +240,56 @@ msgstr "Сопрячь новый шлем"
|
||||
msgid "Headset statistics"
|
||||
msgstr "Статистика шлема"
|
||||
|
||||
#: dashboard/qml/Main.qml:129
|
||||
#: dashboard/qml/Main.qml:130
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities"
|
||||
msgstr "Сервер не имеет CAP_SYS_NICE возможностей"
|
||||
msgid "Avahi daemon is not installed"
|
||||
msgstr "Сервис avahi не установлен"
|
||||
|
||||
#: dashboard/qml/Main.qml:136 dashboard/qml/Main.qml:150
|
||||
#: dashboard/qml/Main.qml:138
|
||||
#, kde-format
|
||||
msgid "Avahi daemon is not started"
|
||||
msgstr "Сервис avahi не запущен"
|
||||
|
||||
#: dashboard/qml/Main.qml:145 dashboard/qml/Main.qml:160
|
||||
#: dashboard/qml/Main.qml:174
|
||||
#, kde-format
|
||||
msgid "Fix it"
|
||||
msgstr "Исправить"
|
||||
|
||||
#: dashboard/qml/Main.qml:144
|
||||
#: dashboard/qml/Main.qml:153
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities"
|
||||
msgstr "Сервер не имеет CAP_SYS_NICE возможностей"
|
||||
|
||||
#: dashboard/qml/Main.qml:168
|
||||
#, kde-format
|
||||
msgid "Firewall may not allow port 9757"
|
||||
msgstr "Брандмауэр может не разрешать порт 9757"
|
||||
|
||||
#: dashboard/qml/Main.qml:159
|
||||
#: dashboard/qml/Main.qml:183
|
||||
#, kde-format
|
||||
msgid "The CAP_SYS_NICE capability will be used when the server is restarted"
|
||||
msgstr ""
|
||||
"CAP_SYS_NICE возможности будут использоваться после перезагрузки сервера"
|
||||
|
||||
#: dashboard/qml/Main.qml:165
|
||||
#: dashboard/qml/Main.qml:189
|
||||
#, kde-format
|
||||
msgctxt "restart the server"
|
||||
msgid "Restart now"
|
||||
msgstr "Перезагрузить сейчас"
|
||||
|
||||
#: dashboard/qml/Main.qml:176
|
||||
#: dashboard/qml/Main.qml:200
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"NVIDIA GPUs require at least driver version 565.77, current version is %1"
|
||||
msgstr "NVIDIA ГПУ требуют драйвер версии не ниже 565.77, текущая версия: %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:182
|
||||
#: dashboard/qml/Main.qml:206
|
||||
#, kde-format
|
||||
msgid "More info"
|
||||
msgstr "Больше информации"
|
||||
|
||||
#: dashboard/qml/Main.qml:190
|
||||
#: dashboard/qml/Main.qml:214
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Use the Mesa (radv) driver for AMD GPUs\n"
|
||||
@@ -276,7 +298,7 @@ msgstr ""
|
||||
"Используйте Mesa (radv) драйвер для AMD ГПУ\n"
|
||||
"Аппаратная кодировка с vaapi не работает с AMDVLK и AMDGPU-PRO"
|
||||
|
||||
#: dashboard/qml/Main.qml:198
|
||||
#: dashboard/qml/Main.qml:222
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
|
||||
@@ -285,75 +307,75 @@ msgstr ""
|
||||
"OpenVR совместимости не обнаружено, игры из Steam не смогут загрузить VR.\n"
|
||||
"Установите xrizer или OpenComposite."
|
||||
|
||||
#: dashboard/qml/Main.qml:207
|
||||
#: dashboard/qml/Main.qml:231
|
||||
#, kde-format
|
||||
msgid "Server failed to start"
|
||||
msgstr "Не удалось запустить сервер"
|
||||
|
||||
#: dashboard/qml/Main.qml:213 dashboard/qml/TroubleshootPage.qml:85
|
||||
#: dashboard/qml/Main.qml:237 dashboard/qml/TroubleshootPage.qml:85
|
||||
#, kde-format
|
||||
msgid "Open server logs"
|
||||
msgstr "Открыть логи сервера"
|
||||
|
||||
#: dashboard/qml/Main.qml:242
|
||||
#: dashboard/qml/Main.qml:266
|
||||
#, kde-format
|
||||
msgctxt "whether the server is running, displayed in front of a checkbox"
|
||||
msgid "Running"
|
||||
msgstr "Запущено"
|
||||
|
||||
#: dashboard/qml/Main.qml:257
|
||||
#: dashboard/qml/Main.qml:281
|
||||
#, kde-format
|
||||
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
|
||||
msgid "Pairing"
|
||||
msgstr "Сопряжение"
|
||||
|
||||
#: dashboard/qml/Main.qml:270
|
||||
#: dashboard/qml/Main.qml:294
|
||||
#, kde-format
|
||||
msgid "PIN: %1"
|
||||
msgstr "ПИН: %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:278 dashboard/qml/WizardPage.qml:374
|
||||
#: dashboard/qml/Main.qml:302 dashboard/qml/WizardPage.qml:374
|
||||
#, kde-format
|
||||
msgid "Connect by USB"
|
||||
msgstr "Подключиться по USB"
|
||||
|
||||
#: dashboard/qml/Main.qml:289
|
||||
#: dashboard/qml/Main.qml:313
|
||||
#, kde-format
|
||||
msgid "No headset is connected or your headset is not in developer mode"
|
||||
msgstr "Нет подключенного шлема, либо ваш шлем не в режиме разработчика"
|
||||
|
||||
#: dashboard/qml/Main.qml:297
|
||||
#: dashboard/qml/Main.qml:321
|
||||
#, kde-format
|
||||
msgid "Disconnect"
|
||||
msgstr "Отключиться"
|
||||
|
||||
#: dashboard/qml/Main.qml:314
|
||||
#: dashboard/qml/Main.qml:338
|
||||
#, kde-format
|
||||
msgctxt "automatically started application"
|
||||
msgid "Application"
|
||||
msgstr "Приложение"
|
||||
|
||||
#: dashboard/qml/Main.qml:335
|
||||
#: dashboard/qml/Main.qml:359
|
||||
#, kde-format
|
||||
msgid "Steam information"
|
||||
msgstr "Steam информация"
|
||||
|
||||
#: dashboard/qml/Main.qml:354
|
||||
#: dashboard/qml/Main.qml:380
|
||||
#, kde-format
|
||||
msgid "Wizard"
|
||||
msgstr "Мастер настройки"
|
||||
|
||||
#: dashboard/qml/Main.qml:361
|
||||
#: dashboard/qml/Main.qml:387
|
||||
#, kde-format
|
||||
msgid "Install the app"
|
||||
msgstr "Установить приложение"
|
||||
|
||||
#: dashboard/qml/Main.qml:382 dashboard/qml/SettingsPage.qml:14
|
||||
#: dashboard/qml/Main.qml:408 dashboard/qml/SettingsPage.qml:14
|
||||
#, kde-format
|
||||
msgid "Settings"
|
||||
msgstr "Настройки"
|
||||
|
||||
#: dashboard/qml/Main.qml:389 dashboard/qml/TroubleshootPage.qml:10
|
||||
#: dashboard/qml/Main.qml:415 dashboard/qml/TroubleshootPage.qml:10
|
||||
#, kde-format
|
||||
msgid "Troubleshoot"
|
||||
msgstr "Устранение неполадок"
|
||||
@@ -429,140 +451,117 @@ msgstr "Сильнее"
|
||||
msgid "Bitrate:"
|
||||
msgstr "Битрейт:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:100 dashboard/qml/SettingsPage.qml:102
|
||||
#: dashboard/qml/SettingsPage.qml:101 dashboard/qml/SettingsPage.qml:103
|
||||
#, kde-format
|
||||
msgctxt "bitrate"
|
||||
msgid "%1 Mbit/s"
|
||||
msgstr "%1 Мбит/с"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:112
|
||||
#, kde-format
|
||||
msgid "Encoder layout:"
|
||||
msgstr "Разметка кодировки:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:115
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Automatic"
|
||||
msgstr "Автоматическая"
|
||||
msgid "The current encoder configuration is not supported"
|
||||
msgstr "Текущая конфигурация кодировщика не поддерживается"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:119
|
||||
#: dashboard/qml/SettingsPage.qml:120
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Manual"
|
||||
msgstr "Ручная"
|
||||
msgid "Reset"
|
||||
msgstr "Сбросить"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:123
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Default preset"
|
||||
msgstr "Предустановка по умолчанию"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:140
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Low latency preset"
|
||||
msgstr "Предустановка с низкой задержкой"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:159
|
||||
#, kde-format
|
||||
msgctxt "encoder preset"
|
||||
msgid "Safe preset"
|
||||
msgstr "Безопасная предустановка"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:182
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
|
||||
"Drag an edge to resize or remove encoders."
|
||||
msgstr ""
|
||||
"Чтобы добавить новый кодировщик, разделите существующий кодировщик щелчком "
|
||||
"рядом с границей.\n"
|
||||
"Перетащите границу чтобы изменить размер или убрать кодировщики."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:209
|
||||
#: dashboard/qml/SettingsPage.qml:127
|
||||
#, kde-format
|
||||
msgid "Encoder:"
|
||||
msgstr "Кодировщик:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:218
|
||||
#: dashboard/qml/SettingsPage.qml:133
|
||||
#, kde-format
|
||||
msgctxt "automatic encoder setup"
|
||||
msgid "Auto"
|
||||
msgstr "Авто"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:223
|
||||
#: dashboard/qml/SettingsPage.qml:137
|
||||
#, kde-format
|
||||
msgid "nvenc (NVIDIA GPUs)"
|
||||
msgstr "nvenc (NVIDIA ГПУ)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:228
|
||||
#: dashboard/qml/SettingsPage.qml:141
|
||||
#, kde-format
|
||||
msgid "vaapi (AMD and Intel GPUs)"
|
||||
msgstr "vaapi (AMD и Intel ГПУ)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:233
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (программное кодирование)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:238
|
||||
#: dashboard/qml/SettingsPage.qml:145
|
||||
#, kde-format
|
||||
msgid "Vulkan (Vulkan Video)"
|
||||
msgstr "Vulkan (Vulkan Video)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:261
|
||||
#: dashboard/qml/SettingsPage.qml:149
|
||||
#, kde-format
|
||||
msgid "x264 (software encoding)"
|
||||
msgstr "x264 (программное кодирование)"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:166
|
||||
#, kde-format
|
||||
msgid "\"Auto\" will use hardware acceleration if it is available"
|
||||
msgstr "\"Авто\" будет использовать аппаратное ускорение если оно доступно"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:267
|
||||
#: dashboard/qml/SettingsPage.qml:171
|
||||
#, kde-format
|
||||
msgid "Codec:"
|
||||
msgstr "Кодек:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:274
|
||||
#: dashboard/qml/SettingsPage.qml:177
|
||||
#, kde-format
|
||||
msgctxt "automatic codec setup"
|
||||
msgid "Auto"
|
||||
msgstr "Авто"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:278
|
||||
#: dashboard/qml/SettingsPage.qml:181
|
||||
#, kde-format
|
||||
msgid "H.264"
|
||||
msgstr "H.264"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:282
|
||||
#: dashboard/qml/SettingsPage.qml:185
|
||||
#, kde-format
|
||||
msgid "H.265"
|
||||
msgstr "H.265"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:286
|
||||
#: dashboard/qml/SettingsPage.qml:189
|
||||
#, kde-format
|
||||
msgid "AV1"
|
||||
msgstr "AV1"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#: dashboard/qml/SettingsPage.qml:217
|
||||
#, kde-format
|
||||
msgid "10-bits"
|
||||
msgstr "10-бит"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:221
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"10-bit encoding improves image quality but is not supported by all codecs "
|
||||
"and hardware"
|
||||
msgstr "10-битное кодирование улучшает качество изображения, но поддерживается не всеми кодеками и оборудованием"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:231
|
||||
#, kde-format
|
||||
msgid "Advanced options"
|
||||
msgstr "Расширенные настройки"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:314
|
||||
#: dashboard/qml/SettingsPage.qml:237
|
||||
#, kde-format
|
||||
msgid "Check system configuration on start"
|
||||
msgstr "Проверить конфигурацию системы при запуске"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:318
|
||||
#: dashboard/qml/SettingsPage.qml:241
|
||||
#, kde-format
|
||||
msgid "Enable debug window"
|
||||
msgstr "Включить окно отладки"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:325
|
||||
#: dashboard/qml/SettingsPage.qml:248
|
||||
#, kde-format
|
||||
msgid "Enable SteamVR tracked devices support"
|
||||
msgstr "Включить поддержку устройств со SteamVR отслеживанием"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:328
|
||||
#: dashboard/qml/SettingsPage.qml:251
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Allows the use of lighthouse-based controllers and trackers.\n"
|
||||
@@ -575,44 +574,44 @@ msgstr ""
|
||||
"Устройства должны быть включены перед подключенем к WiVRn.\n"
|
||||
"Внешняя утилита, такая как motoc, необходима для калибрации."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:336
|
||||
#: dashboard/qml/SettingsPage.qml:259
|
||||
#, kde-format
|
||||
msgid "Custom adb location"
|
||||
msgstr "Пользовательское расположение adb"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:347
|
||||
#: dashboard/qml/SettingsPage.qml:270
|
||||
#, kde-format
|
||||
msgid "Adb location:"
|
||||
msgstr "Расположение adb:"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:356
|
||||
#: dashboard/qml/SettingsPage.qml:279
|
||||
#, kde-format
|
||||
msgctxt "browse a file to choose the adb binary"
|
||||
msgid "Browse"
|
||||
msgstr "Обзор"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:366
|
||||
#: dashboard/qml/SettingsPage.qml:289
|
||||
#, kde-format
|
||||
msgid "Default"
|
||||
msgstr "По умолчанию"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:380
|
||||
#: dashboard/qml/SettingsPage.qml:303
|
||||
#, kde-format
|
||||
msgctxt "set a custom OpenVR compatibility library"
|
||||
msgid "Custom"
|
||||
msgstr "Пользовательская"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:385
|
||||
#: dashboard/qml/SettingsPage.qml:308
|
||||
#, kde-format
|
||||
msgid "Disabled"
|
||||
msgstr "Выключена"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:393
|
||||
#: dashboard/qml/SettingsPage.qml:316
|
||||
#, kde-format
|
||||
msgid "OpenVR compatibility library:"
|
||||
msgstr "Библиотека для совместимости со SteamVR"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:419
|
||||
#: dashboard/qml/SettingsPage.qml:342
|
||||
#, kde-format
|
||||
msgid "Library path, excluding bin/linux64/vrclient.so"
|
||||
msgstr "Путь библиотеки, исключая bin/linux64/vrclient.so"
|
||||
@@ -655,8 +654,8 @@ msgid ""
|
||||
"If you installed WiVRn over USB on a Meta headset, the app is in the "
|
||||
"\"unknown sources\" section."
|
||||
msgstr ""
|
||||
"Если вы установили WiVRn по USB на шлем Meta, приложение находится в "
|
||||
"секции \"неизвестные источники\"."
|
||||
"Если вы установили WiVRn по USB на шлем Meta, приложение находится в секции "
|
||||
"\"неизвестные источники\"."
|
||||
|
||||
#: dashboard/qml/TroubleshootPage.qml:24
|
||||
#, kde-format
|
||||
@@ -848,11 +847,6 @@ msgstr "Или"
|
||||
msgid "Install over USB"
|
||||
msgstr "Установить по USB"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:211
|
||||
#, kde-format
|
||||
msgid "ADB is not installed"
|
||||
msgstr "ADB не установлен"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:219
|
||||
#, kde-format
|
||||
msgid ""
|
||||
@@ -968,3 +962,46 @@ msgstr "xrizer"
|
||||
#, kde-format
|
||||
msgid "Open Composite"
|
||||
msgstr "Open Composite"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid "No precompiled APK is available for this version"
|
||||
#~ msgstr "Нет прекомпилированного APK-файла для этой версии"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid "Encoder layout:"
|
||||
#~ msgstr "Разметка кодировки:"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Automatic"
|
||||
#~ msgstr "Автоматическая"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Manual"
|
||||
#~ msgstr "Ручная"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Default preset"
|
||||
#~ msgstr "Предустановка по умолчанию"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Low latency preset"
|
||||
#~ msgstr "Предустановка с низкой задержкой"
|
||||
|
||||
#, kde-format
|
||||
#~ msgctxt "encoder preset"
|
||||
#~ msgid "Safe preset"
|
||||
#~ msgstr "Безопасная предустановка"
|
||||
|
||||
#, kde-format
|
||||
#~ msgid ""
|
||||
#~ "To add a new encoder, split an existing encoder by clicking near an "
|
||||
#~ "edge.\n"
|
||||
#~ "Drag an edge to resize or remove encoders."
|
||||
#~ msgstr ""
|
||||
#~ "Чтобы добавить новый кодировщик, разделите существующий кодировщик "
|
||||
#~ "щелчком рядом с границей.\n"
|
||||
#~ "Перетащите границу чтобы изменить размер или убрать кодировщики."
|
||||
|
||||
+214
-137
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-10-06 14:57+0400\n"
|
||||
"POT-Creation-Date: 2025-10-29 18:30+0400\n"
|
||||
"PO-Revision-Date: 2025-10-06 14:57+0400\n"
|
||||
"Last-Translator: Alexander Afanasenko <aomiki.iki@gmail.com>\n"
|
||||
"Language-Team: Russian <>\n"
|
||||
@@ -21,117 +21,130 @@ msgstr ""
|
||||
msgid "No supported swapchain format"
|
||||
msgstr "Нет поддерживаемого формата цепочек обмена"
|
||||
|
||||
#: client/scenes/app_launcher.cpp:135
|
||||
#: client/scenes/app_launcher.cpp:128
|
||||
msgid "Connected to WiVRn server"
|
||||
msgstr "Подключение к серверу WiVRn установлено"
|
||||
|
||||
#: client/scenes/app_launcher.cpp:137
|
||||
#: client/scenes/app_launcher.cpp:130
|
||||
#, c++-format
|
||||
msgid "Connected to {}"
|
||||
msgstr "Подключен к {}"
|
||||
|
||||
#: client/scenes/app_launcher.cpp:143
|
||||
#: client/scenes/app_launcher.cpp:136
|
||||
msgid "Start an application on the server to start streaming."
|
||||
msgstr "Запустите приложение на сервере чтобы начать трансляцию."
|
||||
|
||||
#: client/scenes/app_launcher.cpp:153
|
||||
#: client/scenes/app_launcher.cpp:146
|
||||
msgid "Start an application on your computer or select one to start streaming."
|
||||
msgstr "Запустите приложение на вашем компьютере или выберите его чтобы начать трансляцию."
|
||||
msgstr ""
|
||||
"Запустите приложение на вашем компьютере или выберите его чтобы начать "
|
||||
"трансляцию."
|
||||
|
||||
#: client/scenes/app_launcher.cpp:155
|
||||
#: client/scenes/app_launcher.cpp:148
|
||||
#, c++-format
|
||||
msgid "Start an application on {} or select one to start streaming."
|
||||
msgstr "Запустите приложение на {} или выберите его чтобы начать трансляцию."
|
||||
|
||||
#: client/scenes/lobby.cpp:185
|
||||
#: client/scenes/lobby.cpp:205
|
||||
msgid "Incompatible WiVRn server: no protocol field in TXT"
|
||||
msgstr "Несовместимый сервер WiVRn: нет поля протокола в TXT"
|
||||
|
||||
#: client/scenes/lobby.cpp:188
|
||||
#: client/scenes/lobby.cpp:208
|
||||
#, c++-format
|
||||
msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
|
||||
msgstr "Несовместимый протокол сервера WiVRn (клиент: {}, сервер: {})"
|
||||
|
||||
#: client/scenes/lobby.cpp:203
|
||||
#: client/scenes/lobby.cpp:223
|
||||
#, c++-format
|
||||
msgid "Cannot resolve hostname: {}"
|
||||
msgstr "Невозможно разрешить имя хоста: {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:290 client/scenes/lobby.cpp:296
|
||||
#: client/scenes/lobby.cpp:310 client/scenes/lobby.cpp:316
|
||||
#, c++-format
|
||||
msgid "Cannot connect to {} ({}): {}"
|
||||
msgstr "Невозможно подключиться к {} ({}): {}"
|
||||
|
||||
#: client/scenes/lobby.cpp:379
|
||||
#: client/scenes/lobby.cpp:399
|
||||
msgid "Waiting for connection"
|
||||
msgstr "Ожидание подключения"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:107
|
||||
#: client/scenes/lobby.cpp:1000
|
||||
msgid "Passthrough"
|
||||
msgstr "Сквозная передача"
|
||||
|
||||
#: client/scenes/lobby.cpp:1012
|
||||
msgid "Default environment"
|
||||
msgstr "Окружение по умолчанию"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:99
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Normal"
|
||||
msgstr "Нормальное"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:110
|
||||
#: client/scenes/lobby_gui.cpp:102
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Quality"
|
||||
msgstr "Качество"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:112
|
||||
#: client/scenes/lobby_gui.cpp:104
|
||||
msgctxt "openxr_post_processing"
|
||||
msgid "Disabled"
|
||||
msgstr "Выключено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:120 client/scenes/lobby_gui.cpp:264
|
||||
#: client/scenes/stream_gui.cpp:944
|
||||
#: client/scenes/lobby_gui.cpp:112 client/scenes/lobby_gui.cpp:256
|
||||
#: client/scenes/stream_gui.cpp:893
|
||||
msgid "Disconnect"
|
||||
msgstr "Отключиться"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:140 client/scenes/stream_gui.cpp:940
|
||||
#: client/scenes/lobby_gui.cpp:132 client/scenes/lobby_gui_customize.cpp:653
|
||||
#: client/scenes/lobby_gui_customize.cpp:744
|
||||
#: client/scenes/lobby_gui_customize.cpp:800 client/scenes/stream_gui.cpp:889
|
||||
msgid "Close"
|
||||
msgstr "Закрыть"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:146
|
||||
#: client/scenes/lobby_gui.cpp:138
|
||||
msgid "Connection"
|
||||
msgstr "Подключение"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:148
|
||||
#: client/scenes/lobby_gui.cpp:140
|
||||
#, c++-format
|
||||
msgid "Connection to {}"
|
||||
msgstr "Подключение к {}"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:178
|
||||
#: client/scenes/lobby_gui.cpp:170
|
||||
msgid "PIN"
|
||||
msgstr "ПИН"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:200
|
||||
#: client/scenes/lobby_gui.cpp:192
|
||||
msgid "Input the PIN displayed on the dashboard"
|
||||
msgstr "Введите ПИН отображенный в панеле управления"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:290
|
||||
#: client/scenes/lobby_gui.cpp:282
|
||||
msgid "Name"
|
||||
msgstr "Название"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:301
|
||||
#: client/scenes/lobby_gui.cpp:293
|
||||
msgid "Address"
|
||||
msgstr "Адрес"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:310
|
||||
#: client/scenes/lobby_gui.cpp:302
|
||||
msgid "Port"
|
||||
msgstr "Порт"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:318
|
||||
#: client/scenes/lobby_gui.cpp:310
|
||||
msgid "TCP only"
|
||||
msgstr "Только TCP"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:325 client/scenes/stream_gui.cpp:908
|
||||
#: client/scenes/lobby_gui.cpp:317 client/scenes/lobby_gui_customize.cpp:555
|
||||
#: client/scenes/stream_gui.cpp:857
|
||||
msgid "Cancel"
|
||||
msgstr "Отменить"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:339
|
||||
#: client/scenes/lobby_gui.cpp:331
|
||||
msgid "Save"
|
||||
msgstr "Сохранить"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:392
|
||||
#: client/scenes/lobby_gui.cpp:384
|
||||
msgid ""
|
||||
"Start a WiVRn server on your\n"
|
||||
"local network"
|
||||
@@ -139,105 +152,110 @@ msgstr ""
|
||||
"Запустите сервер WiVRn в вашей\n"
|
||||
"локальной сети"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:424
|
||||
#: client/scenes/lobby_gui.cpp:416
|
||||
msgid "Autoconnect"
|
||||
msgstr "Автоматическое подключение"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:450
|
||||
#: client/scenes/lobby_gui.cpp:442
|
||||
msgid "Connect"
|
||||
msgstr "Подключиться"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:460 client/wivrn_client.cpp:186
|
||||
#: client/scenes/lobby_gui.cpp:452 client/wivrn_client.cpp:186
|
||||
msgid "Incompatible server version"
|
||||
msgstr "Несовместимая версия сервера"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:462
|
||||
#: client/scenes/lobby_gui.cpp:454
|
||||
msgid "Server not available"
|
||||
msgstr "Сервер недоступен"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:544
|
||||
#: client/scenes/lobby_gui.cpp:536
|
||||
msgctxt "language selection, replace with the name of the language"
|
||||
msgid "English"
|
||||
msgstr "Русский"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:558
|
||||
#: client/scenes/lobby_gui.cpp:550
|
||||
msgid "Language"
|
||||
msgstr "Язык"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:558 client/scenes/lobby_gui.cpp:560
|
||||
#: client/scenes/lobby_gui.cpp:550 client/scenes/lobby_gui.cpp:552
|
||||
msgid "System language"
|
||||
msgstr "Язык системы"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:585
|
||||
#: client/scenes/lobby_gui.cpp:577
|
||||
msgid "Refresh rate"
|
||||
msgstr "Частота обновления"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:585 client/scenes/lobby_gui.cpp:587
|
||||
#: client/scenes/lobby_gui.cpp:577 client/scenes/lobby_gui.cpp:579
|
||||
msgctxt "automatic refresh rate"
|
||||
msgid "Automatic"
|
||||
msgstr "Автоматическая"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:594
|
||||
#: client/scenes/lobby_gui.cpp:586
|
||||
msgid ""
|
||||
"Select refresh rate based on measured application performance.\n"
|
||||
"May cause flicker when a change happens."
|
||||
msgstr ""
|
||||
"Выберите частоту обновления основанную на измеренной производительности приложения.\n"
|
||||
"Выберите частоту обновления основанную на измеренной производительности "
|
||||
"приложения.\n"
|
||||
"Может вызвать мерцание когда изменениет произойдет."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:611
|
||||
#: client/scenes/lobby_gui.cpp:603
|
||||
msgid "Minimum refresh rate"
|
||||
msgstr "Минимальная частота обновления"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:634
|
||||
#: client/scenes/lobby_gui.cpp:629
|
||||
msgid "Foveation level"
|
||||
msgstr "Уровень фовеации"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:651
|
||||
msgid "Resolution scale"
|
||||
msgstr "Масштаб разрешения"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:638
|
||||
#: client/scenes/lobby_gui.cpp:655
|
||||
#, c-format, c++-format
|
||||
msgid "%d%% - {}x{} per eye"
|
||||
msgstr "%d%% - {}x{} на каждый глаз"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:649
|
||||
#: client/scenes/lobby_gui.cpp:666
|
||||
#, c++-format
|
||||
msgid "Resolution larger than {}x{} may not be supported by the headset"
|
||||
msgstr "Разрешение больше чем {}x{} может не поддерживаться шлемом"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:655
|
||||
#: client/scenes/lobby_gui.cpp:672
|
||||
msgid "Enable microphone"
|
||||
msgstr "Включить микрофон"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:664
|
||||
#: client/scenes/lobby_gui.cpp:681
|
||||
msgid "Unprocessed Microphone Audio"
|
||||
msgstr "Необработанный звук с микрофона"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:670
|
||||
#: client/scenes/lobby_gui.cpp:687
|
||||
msgid "Force disable audio filters, such as noise cancellation"
|
||||
msgstr "Принудительно отключить звуковые фильтры, такие как шумоподавление"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:677
|
||||
#: client/scenes/lobby_gui.cpp:694
|
||||
msgid "Enable hand tracking"
|
||||
msgstr "Включить отслеживание рук"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:683 client/scenes/lobby_gui.cpp:695
|
||||
#: client/scenes/lobby_gui.cpp:707 client/scenes/lobby_gui.cpp:724
|
||||
#: client/scenes/lobby_gui.cpp:769
|
||||
#: client/scenes/lobby_gui.cpp:700 client/scenes/lobby_gui.cpp:712
|
||||
#: client/scenes/lobby_gui.cpp:724 client/scenes/lobby_gui.cpp:741
|
||||
#: client/scenes/lobby_gui_customize.cpp:540
|
||||
msgid "This feature is not supported by your headset"
|
||||
msgstr "Эта функция не поддерживается вашим шлемом"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:689
|
||||
#: client/scenes/lobby_gui.cpp:706
|
||||
msgid "Enable eye tracking"
|
||||
msgstr "Включить отслеживание глаз"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:701
|
||||
#: client/scenes/lobby_gui.cpp:718
|
||||
msgid "Enable face tracking"
|
||||
msgstr "Включить отслеживание лица"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:715
|
||||
#: client/scenes/lobby_gui.cpp:732
|
||||
msgid "Enable body tracking"
|
||||
msgstr "Включить отслеживание тела"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:729
|
||||
#: client/scenes/lobby_gui.cpp:746
|
||||
msgid ""
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
"tracking settings,\n"
|
||||
@@ -247,11 +265,11 @@ msgstr ""
|
||||
"отслеживания движений,\n"
|
||||
"иначе данные тела будут угаданы из положения контроллера и шлема"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:739
|
||||
#: client/scenes/lobby_gui.cpp:756
|
||||
msgid "Enable lower body tracking"
|
||||
msgstr "Включить отслеживание нижней части тела"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:745
|
||||
#: client/scenes/lobby_gui.cpp:762
|
||||
msgid ""
|
||||
"Estimate lower body joint positions using Generative Legs\n"
|
||||
"Requires 'Hand and body tracking' to be enabled in the Quest movement "
|
||||
@@ -261,11 +279,11 @@ msgstr ""
|
||||
"Требуется чтобы в Quest было включено 'Отслеживание рук и тела' в настройках "
|
||||
"отслеживания движений"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:748
|
||||
#: client/scenes/lobby_gui.cpp:765
|
||||
msgid "Enable hip tracking"
|
||||
msgstr "Включить отслеживание бедер"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:754
|
||||
#: client/scenes/lobby_gui.cpp:771
|
||||
msgid ""
|
||||
"Only takes affect with lower body tracking enabled\n"
|
||||
"May be desired when using another source of hip tracking"
|
||||
@@ -273,15 +291,11 @@ msgstr ""
|
||||
"Вступает в силу только с включенным отслеживанием нижней части тела\n"
|
||||
"Может пригодится когда используется другой источник отслеживания бедер"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:762
|
||||
msgid "Enable video passthrough in lobby"
|
||||
msgstr "Включить сквозную передачу видео в лобби"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:773
|
||||
#: client/scenes/lobby_gui.cpp:779
|
||||
msgid "Enable in-stream window"
|
||||
msgstr "Включить окно во время трансляции"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:776
|
||||
#: client/scenes/lobby_gui.cpp:782
|
||||
msgid ""
|
||||
"Enables the configuration window to be shown while the game is streaming.\n"
|
||||
"If enabled, the window is activated by pressing both thumbsticks."
|
||||
@@ -289,15 +303,15 @@ msgstr ""
|
||||
"Позволяет отображать окно конфигурации во время трансляции игры.\n"
|
||||
"Если включено, окно активируется нажатием обоих джойстиков."
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:790 client/scenes/stream_gui.cpp:445
|
||||
#: client/scenes/lobby_gui.cpp:796 client/scenes/stream_gui.cpp:394
|
||||
msgid "OpenXR post-processing"
|
||||
msgstr "OpenXR постобработка"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:794 client/scenes/stream_gui.cpp:449
|
||||
#: client/scenes/lobby_gui.cpp:800 client/scenes/stream_gui.cpp:398
|
||||
msgid "Supersampling"
|
||||
msgstr "Supersampling"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:814 client/scenes/stream_gui.cpp:470
|
||||
#: client/scenes/lobby_gui.cpp:820 client/scenes/stream_gui.cpp:419
|
||||
msgid ""
|
||||
"Reduce flicker for high contrast edges.\n"
|
||||
"Useful when the input resolution is high compared to the headset display"
|
||||
@@ -305,11 +319,11 @@ msgstr ""
|
||||
"Уменьшает мерцание для высококонтрастных границ.\n"
|
||||
"Полезно когда входное разрешение высокое по сравнение с экраном шлема"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:819 client/scenes/stream_gui.cpp:475
|
||||
#: client/scenes/lobby_gui.cpp:825 client/scenes/stream_gui.cpp:424
|
||||
msgid "Sharpening"
|
||||
msgstr "Увеличение резкости"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:839 client/scenes/stream_gui.cpp:496
|
||||
#: client/scenes/lobby_gui.cpp:845 client/scenes/stream_gui.cpp:445
|
||||
msgid ""
|
||||
"Improve clarity of high contrast edges and counteract blur.\n"
|
||||
"Useful when the input resolution is low compared to the headset display"
|
||||
@@ -317,125 +331,129 @@ msgstr ""
|
||||
"Улучшить четкость высококонтрастных границ и противодействовать размытию.\n"
|
||||
"Полезно когда входное разрешение низкое по сравнение с экраном шлема"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:935 client/scenes/lobby_gui.cpp:943
|
||||
#: client/scenes/stream_gui.cpp:222 client/scenes/stream_gui.cpp:424
|
||||
#: client/scenes/lobby_gui.cpp:1029 client/scenes/lobby_gui.cpp:1037
|
||||
#: client/scenes/stream_gui.cpp:171 client/scenes/stream_gui.cpp:373
|
||||
msgid "CPU time"
|
||||
msgstr "Время ЦПУ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:939
|
||||
#: client/scenes/lobby_gui.cpp:1033
|
||||
msgid "CPU time [ms]"
|
||||
msgstr "Время ЦПУ [мс]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:949 client/scenes/lobby_gui.cpp:957
|
||||
#: client/scenes/stream_gui.cpp:224 client/scenes/stream_gui.cpp:425
|
||||
#: client/scenes/lobby_gui.cpp:1043 client/scenes/lobby_gui.cpp:1051
|
||||
#: client/scenes/stream_gui.cpp:173 client/scenes/stream_gui.cpp:374
|
||||
msgid "GPU time"
|
||||
msgstr "Время ГПУ"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:953
|
||||
#: client/scenes/lobby_gui.cpp:1047
|
||||
msgid "GPU time [ms]"
|
||||
msgstr "Время ГПУ [мс]"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:996
|
||||
#: client/scenes/lobby_gui.cpp:1111
|
||||
msgid "Enable the microphone?"
|
||||
msgstr "Включить микрофон?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1001
|
||||
#: client/scenes/lobby_gui.cpp:1116
|
||||
msgid "Enable eye tracking?"
|
||||
msgstr "Включить отслеживание глаз?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1006
|
||||
#: client/scenes/lobby_gui.cpp:1121
|
||||
msgid "Enable face tracking?"
|
||||
msgstr "Включить отслеживание лица?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1011
|
||||
#: client/scenes/lobby_gui.cpp:1126
|
||||
msgid "Enable body tracking?"
|
||||
msgstr "Включить отслеживание тела?"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1019
|
||||
#: client/scenes/lobby_gui.cpp:1134
|
||||
msgid "Welcome to WiVRn"
|
||||
msgstr "Добро пожаловать в WiVRn"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1043
|
||||
#: client/scenes/lobby_gui.cpp:1158
|
||||
msgid "Yes"
|
||||
msgstr "Да"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1050
|
||||
#: client/scenes/lobby_gui.cpp:1165
|
||||
msgid "No"
|
||||
msgstr "Нет"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1069 client/scenes/lobby_gui.cpp:1716
|
||||
#: client/scenes/lobby_gui.cpp:1184 client/scenes/lobby_gui.cpp:1825
|
||||
msgid "Licenses"
|
||||
msgstr "Лицензии"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1394
|
||||
#: client/scenes/lobby_gui.cpp:1459
|
||||
msgid "Microphone is enabled"
|
||||
msgstr "Микрофон включен"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1395
|
||||
#: client/scenes/lobby_gui.cpp:1460
|
||||
msgid "Microphone is disabled"
|
||||
msgstr "Микрофон выключен"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1404
|
||||
#: client/scenes/lobby_gui.cpp:1469
|
||||
msgid "Hand tracking is enabled"
|
||||
msgstr "Отслеживание рук включено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1405
|
||||
#: client/scenes/lobby_gui.cpp:1470
|
||||
msgid "Hand tracking is disabled"
|
||||
msgstr "Отслеживание рук выключено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1414
|
||||
#: client/scenes/lobby_gui.cpp:1479
|
||||
msgid "Eye tracking is enabled"
|
||||
msgstr "Отслеживание глаз включено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1415
|
||||
#: client/scenes/lobby_gui.cpp:1480
|
||||
msgid "Eye tracking is disabled"
|
||||
msgstr "Отслеживание глаз выключено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1425
|
||||
#: client/scenes/lobby_gui.cpp:1490
|
||||
msgid "Face tracking is enabled"
|
||||
msgstr "Отслеживание лица включено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1426
|
||||
#: client/scenes/lobby_gui.cpp:1491
|
||||
msgid "Face tracking is disabled"
|
||||
msgstr "Отслеживание лица выключено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1436
|
||||
#: client/scenes/lobby_gui.cpp:1501
|
||||
msgid "Body tracking is enabled"
|
||||
msgstr "Отслеживание тела включено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1437
|
||||
#: client/scenes/lobby_gui.cpp:1502
|
||||
msgid "Body tracking is disabled"
|
||||
msgstr "Отслеживание тела выключено"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1453
|
||||
#: client/scenes/lobby_gui.cpp:1518
|
||||
msgid "Add server"
|
||||
msgstr "Добавить сервер"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1698
|
||||
#: client/scenes/lobby_gui.cpp:1804
|
||||
msgid "Server list"
|
||||
msgstr "Список серверов"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1701 client/scenes/stream_gui.cpp:925
|
||||
#: client/scenes/lobby_gui.cpp:1807 client/scenes/stream_gui.cpp:874
|
||||
msgid "Settings"
|
||||
msgstr "Настройки"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1704
|
||||
#: client/scenes/lobby_gui.cpp:1810
|
||||
msgid "Post-processing"
|
||||
msgstr "Постобработка"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1708
|
||||
#: client/scenes/lobby_gui.cpp:1813
|
||||
msgid "Customize"
|
||||
msgstr "Настроить"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1817
|
||||
msgid "Debug"
|
||||
msgstr "Отладка"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1713
|
||||
#: client/scenes/lobby_gui.cpp:1822
|
||||
msgid "About"
|
||||
msgstr "О приложении"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1719
|
||||
#: client/scenes/lobby_gui.cpp:1828
|
||||
msgid "Exit"
|
||||
msgstr "Выйти"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1736
|
||||
#: client/scenes/lobby_gui.cpp:1845
|
||||
msgid ""
|
||||
"Press the grip button or put your palm up\n"
|
||||
"to move the main window"
|
||||
@@ -443,147 +461,203 @@ msgstr ""
|
||||
"Нажмите кнопку захвата или поднимите ладонь\n"
|
||||
"чтобы переместить главное окно"
|
||||
|
||||
#: client/scenes/lobby_gui.cpp:1738
|
||||
#: client/scenes/lobby_gui.cpp:1847
|
||||
msgid "Press the grip button to move the main window"
|
||||
msgstr "Нажмите кнопку захвата чтобы переместить главное окно"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:224
|
||||
#: client/scenes/lobby_gui_customize.cpp:363
|
||||
#, c++-format
|
||||
msgid "Author: {}"
|
||||
msgstr "Автор: {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:367
|
||||
#, c++-format
|
||||
msgid "Size: {:.1f} MB"
|
||||
msgstr "Размер: {:.1f} Мб"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:447
|
||||
msgid "Delete this model"
|
||||
msgstr "Удалить эту модель"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:483
|
||||
#: client/scenes/lobby_gui_customize.cpp:689
|
||||
#, c++-format
|
||||
msgid "HTTP error {} when downloading {}"
|
||||
msgstr "Ошибка HTTP {} во время загрузки {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:491
|
||||
#: client/scenes/lobby_gui_customize.cpp:697
|
||||
#, c++-format
|
||||
msgid ""
|
||||
"Curl error when downloading {}\n"
|
||||
"{}: {}"
|
||||
msgstr ""
|
||||
"Ошибка curl во время загрузки {}\n"
|
||||
"{}: {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:552
|
||||
#, c-format
|
||||
msgid "Really delete %s?"
|
||||
msgstr "Точно удалить %s?"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:556
|
||||
msgid "Delete"
|
||||
msgstr "Удалить"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:637
|
||||
#, c++-format
|
||||
msgid "Cannot load environment: {}"
|
||||
msgstr "Невозможно загрузить окружение: {}"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:645
|
||||
msgid "Loading environment"
|
||||
msgstr "Загрузка окружения"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:724
|
||||
msgid "Download more environments"
|
||||
msgstr "Скачать больше окружений"
|
||||
|
||||
#: client/scenes/lobby_gui_customize.cpp:732
|
||||
msgid "Open local glTF model"
|
||||
msgstr "Открыть локальную glTF модель"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:173
|
||||
msgid "Reproject"
|
||||
msgstr "Репроектирование"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:225
|
||||
#: client/scenes/stream_gui.cpp:174
|
||||
msgid "Blit"
|
||||
msgstr "Блит"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:227
|
||||
#: client/scenes/stream_gui.cpp:176
|
||||
msgid "Network"
|
||||
msgstr "Сеть"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:227 client/scenes/stream_gui.cpp:422
|
||||
#: client/scenes/stream_gui.cpp:176 client/scenes/stream_gui.cpp:371
|
||||
msgid "Download"
|
||||
msgstr "Загрузка"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:228 client/scenes/stream_gui.cpp:423
|
||||
#: client/scenes/stream_gui.cpp:177 client/scenes/stream_gui.cpp:372
|
||||
msgid "Upload"
|
||||
msgstr "Выгрузка"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:297
|
||||
#: client/scenes/stream_gui.cpp:246
|
||||
#, c++-format
|
||||
msgid "Decoder {}"
|
||||
msgstr "Декодер {}"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:309
|
||||
#: client/scenes/stream_gui.cpp:258
|
||||
msgid "Timings [ms]"
|
||||
msgstr "Тайминги [мс]"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:369
|
||||
#: client/scenes/stream_gui.cpp:318
|
||||
msgid "Encode"
|
||||
msgstr "Кодирование"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:370
|
||||
#: client/scenes/stream_gui.cpp:319
|
||||
msgid "Send"
|
||||
msgstr "Отправка"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:371
|
||||
#: client/scenes/stream_gui.cpp:320
|
||||
msgid "Receive"
|
||||
msgstr "Получение"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:372
|
||||
#: client/scenes/stream_gui.cpp:321
|
||||
msgid "Decode"
|
||||
msgstr "Декодирование"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:373
|
||||
#: client/scenes/stream_gui.cpp:322
|
||||
msgid "Blitted"
|
||||
msgstr "Блиттированное"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:374
|
||||
#: client/scenes/stream_gui.cpp:323
|
||||
msgid "Displayed"
|
||||
msgstr "Отображенное"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:375
|
||||
#: client/scenes/stream_gui.cpp:324
|
||||
msgid "Predicted"
|
||||
msgstr "Прогнозируемое"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:395
|
||||
#: client/scenes/stream_gui.cpp:344
|
||||
#, c++-format
|
||||
msgid "Estimated motion to photons latency: {}ms"
|
||||
msgstr "Расчетная задержка от движения к фотонам: {}мс"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:402
|
||||
#: client/scenes/stream_gui.cpp:351
|
||||
msgid "Press the grip button to move the window"
|
||||
msgstr "Нажмите кнопку захвата чтобы передвинуть окно"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:404 client/scenes/stream_gui.cpp:868
|
||||
#: client/scenes/stream_gui.cpp:353 client/scenes/stream_gui.cpp:817
|
||||
msgid "Press both thumbsticks to display the WiVRn window"
|
||||
msgstr "Нажмите оба джойстика чтобы показать окно WiVRn"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:426
|
||||
#: client/scenes/stream_gui.cpp:375
|
||||
msgid "Motion to photon latency"
|
||||
msgstr "Задержка от движения к фотонам"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:503
|
||||
#: client/scenes/stream_gui.cpp:452
|
||||
msgid "Foveation center override"
|
||||
msgstr "Переопределение центра фовеации"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:506
|
||||
#: client/scenes/stream_gui.cpp:455
|
||||
msgid "Enable"
|
||||
msgstr "Включить"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:514 client/scenes/stream_gui.cpp:561
|
||||
#: client/scenes/stream_gui.cpp:463 client/scenes/stream_gui.cpp:510
|
||||
#, c++-format
|
||||
msgid "Height {:.1f} deg"
|
||||
msgstr "Высота {:.1f} градусов"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:515 client/scenes/stream_gui.cpp:562
|
||||
#: client/scenes/stream_gui.cpp:464 client/scenes/stream_gui.cpp:511
|
||||
#, c++-format
|
||||
msgid "Distance {:.2f} m"
|
||||
msgstr "Расстояние {:.2f} м"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:516
|
||||
#: client/scenes/stream_gui.cpp:465
|
||||
msgid "Default"
|
||||
msgstr "По умолчанию"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:527
|
||||
#: client/scenes/stream_gui.cpp:476
|
||||
msgid "Change"
|
||||
msgstr "Изменить"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:559
|
||||
#: client/scenes/stream_gui.cpp:508
|
||||
msgid "Use the thumbsticks to move the foveation center"
|
||||
msgstr "Используйте джойстики чтобы передвинуть центр фовеации"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:560
|
||||
#: client/scenes/stream_gui.cpp:509
|
||||
msgid "Press A to save or B to cancel"
|
||||
msgstr "Нажмите A чтобы сохранить или B чтобы отменить"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:618
|
||||
#: client/scenes/stream_gui.cpp:567
|
||||
msgid "Running XR applications:"
|
||||
msgstr "Запущенные XR приложения:"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:635
|
||||
#: client/scenes/stream_gui.cpp:584
|
||||
msgid "Overlays"
|
||||
msgstr "Оверлеи"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:674
|
||||
#: client/scenes/stream_gui.cpp:623
|
||||
msgid "Request to quit, may be ignored by the application"
|
||||
msgstr "Запрос на выход, может быть проигнорирован приложением"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:677
|
||||
#: client/scenes/stream_gui.cpp:626
|
||||
msgid "Start"
|
||||
msgstr "Запустить"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:922
|
||||
#: client/scenes/stream_gui.cpp:871
|
||||
msgid "Stats"
|
||||
msgstr "Метрики"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:928
|
||||
#: client/scenes/stream_gui.cpp:877
|
||||
msgid "Applications"
|
||||
msgstr "Приложения"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:934
|
||||
#: client/scenes/stream_gui.cpp:883
|
||||
msgid "Statistics overlay"
|
||||
msgstr "Оверлей метрик"
|
||||
|
||||
#: client/scenes/stream_gui.cpp:937
|
||||
#: client/scenes/stream_gui.cpp:886
|
||||
msgid "Compact view"
|
||||
msgstr "Компактный вид"
|
||||
|
||||
@@ -602,3 +676,6 @@ msgstr "Невозможно проверить ПИН"
|
||||
#: client/wivrn_client.cpp:182
|
||||
msgid "Pairing is disabled on server"
|
||||
msgstr "Сопряжение выключено на сервере"
|
||||
|
||||
#~ msgid "Enable video passthrough in lobby"
|
||||
#~ msgstr "Включить сквозную передачу видео в лобби"
|
||||
|
||||
@@ -87,6 +87,7 @@ if (WIVRN_BUILD_SERVER)
|
||||
audio/audio_setup.cpp
|
||||
|
||||
encoder/encoder_settings.cpp
|
||||
encoder/idr_handler.cpp
|
||||
encoder/video_encoder.cpp
|
||||
encoder/video_encoder_raw.cpp
|
||||
|
||||
@@ -152,7 +153,7 @@ if (WIVRN_BUILD_SERVER)
|
||||
target_sources(wivrn-server PRIVATE
|
||||
encoder/video_encoder_vulkan.cpp
|
||||
encoder/video_encoder_vulkan_h264.cpp
|
||||
#encoder/video_encoder_vulkan_h265.cpp
|
||||
encoder/video_encoder_vulkan_h265.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -206,8 +206,6 @@ configuration::configuration()
|
||||
|
||||
if (auto it = json.find("tcp-only"); it != json.end())
|
||||
tcp_only = *it;
|
||||
else if (auto it = json.find("tcp_only"); it != json.end())
|
||||
tcp_only = *it;
|
||||
|
||||
if (auto it = json.find("publish-service"); it != json.end())
|
||||
{
|
||||
|
||||
@@ -819,14 +819,14 @@ static void comp_wivrn_info_gpu(struct comp_target * ct, int64_t frame_id, int64
|
||||
|
||||
void wivrn_comp_target::on_feedback(const from_headset::feedback & feedback, const clock_offset & o)
|
||||
{
|
||||
if (not o)
|
||||
return;
|
||||
uint8_t stream = feedback.stream_index;
|
||||
if (psc.status & 1)
|
||||
return;
|
||||
if (encoders.size() <= stream)
|
||||
return;
|
||||
encoders[stream]->on_feedback(feedback);
|
||||
if (not o)
|
||||
return;
|
||||
pacer.on_feedback(feedback, o);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "encoder_settings.h"
|
||||
|
||||
#include "driver/configuration.h"
|
||||
#include "util/u_logging.h"
|
||||
#include "utils/wivrn_vk_bundle.h"
|
||||
@@ -289,7 +289,12 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<wivrn::vid
|
||||
#endif
|
||||
|
||||
if (config.name == encoder_vulkan and not config.codec)
|
||||
config.codec = h264; // this will fail if 10-bit is enabled
|
||||
{
|
||||
if (bit_depth == 10)
|
||||
config.codec = h265;
|
||||
else
|
||||
config.codec = h264;
|
||||
}
|
||||
|
||||
#if WIVRN_USE_X264
|
||||
if (config.name == encoder_x264)
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
|
||||
#include "video_encoder_ffmpeg.h"
|
||||
|
||||
#include "util/u_logging.h"
|
||||
#include <stdexcept>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -66,21 +66,24 @@ namespace wivrn
|
||||
|
||||
bool video_encoder_ffmpeg::once = set_log_level();
|
||||
|
||||
std::optional<wivrn::video_encoder::data> video_encoder_ffmpeg::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot)
|
||||
std::optional<wivrn::video_encoder::data> video_encoder_ffmpeg::encode(uint8_t slot, uint64_t frame_index)
|
||||
{
|
||||
auto & idr_handler = (default_idr_handler &)*idr;
|
||||
if (auto bitrate = pending_bitrate.exchange(0))
|
||||
{
|
||||
idr = true;
|
||||
idr_handler.reset();
|
||||
encoder_ctx->bit_rate = bitrate;
|
||||
encoder_ctx->rc_max_rate = bitrate;
|
||||
}
|
||||
if (auto framerate = pending_framerate.exchange(0))
|
||||
{
|
||||
idr = true;
|
||||
idr_handler.reset();
|
||||
encoder_ctx->framerate = AVRational{.num = int(framerate * 1000), .den = 1000};
|
||||
}
|
||||
|
||||
push_frame(idr, target_timestamp, slot);
|
||||
bool is_idr = idr_handler.get_type(frame_index) == default_idr_handler::frame_type::i;
|
||||
|
||||
push_frame(is_idr, slot);
|
||||
std::shared_ptr<AVPacket> enc_pkt(av_packet_alloc(), [](AVPacket * d) { av_packet_free(&d); });
|
||||
int err = avcodec_receive_packet(encoder_ctx.get(), enc_pkt.get());
|
||||
if (err == 0)
|
||||
@@ -89,6 +92,7 @@ std::optional<wivrn::video_encoder::data> video_encoder_ffmpeg::encode(bool idr,
|
||||
.encoder = this,
|
||||
.span = std::span(enc_pkt->data, enc_pkt->size),
|
||||
.mem = std::move(enc_pkt), // elements are evaluated in order
|
||||
.prefer_control = is_idr,
|
||||
};
|
||||
}
|
||||
if (err == AVERROR(EAGAIN))
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "encoder/video_encoder.h"
|
||||
#include "ffmpeg_helper.h"
|
||||
#include <chrono>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
@@ -29,7 +28,7 @@ namespace wivrn
|
||||
class video_encoder_ffmpeg : public wivrn::video_encoder
|
||||
{
|
||||
public:
|
||||
std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) override;
|
||||
std::optional<data> encode(uint8_t slot, uint64_t frame_index) override;
|
||||
|
||||
struct mute_logs
|
||||
{
|
||||
@@ -39,9 +38,9 @@ public:
|
||||
|
||||
protected:
|
||||
video_encoder_ffmpeg(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier) :
|
||||
wivrn::video_encoder(stream_idx, channels, bitrate_multiplier, true) {}
|
||||
wivrn::video_encoder(stream_idx, channels, std::make_unique<default_idr_handler>(), bitrate_multiplier, true) {}
|
||||
|
||||
virtual void push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) = 0;
|
||||
virtual void push_frame(bool idr, uint8_t slot) = 0;
|
||||
|
||||
av_codec_context_ptr encoder_ctx;
|
||||
|
||||
|
||||
@@ -526,11 +526,10 @@ std::pair<bool, vk::Semaphore> video_encoder_va::present_image(vk::Image y_cbcr,
|
||||
return {false, nullptr};
|
||||
}
|
||||
|
||||
void video_encoder_va::push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot)
|
||||
void video_encoder_va::push_frame(bool idr, uint8_t slot)
|
||||
{
|
||||
auto & va_frame = in[slot].va_frame;
|
||||
va_frame->pict_type = idr ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||
va_frame->pts = pts.time_since_epoch().count();
|
||||
int err = avcodec_send_frame(encoder_ctx.get(), va_frame.get());
|
||||
if (err)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "video_encoder_ffmpeg.h"
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
@@ -53,6 +52,6 @@ public:
|
||||
std::pair<bool, vk::Semaphore> present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot, uint64_t frame_index) override;
|
||||
|
||||
protected:
|
||||
void push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) override;
|
||||
void push_frame(bool idr, uint8_t slot) override;
|
||||
};
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "idr_handler.h"
|
||||
|
||||
#include "utils/overloaded.h"
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
idr_handler::~idr_handler() = default;
|
||||
|
||||
void default_idr_handler::on_feedback(const from_headset::feedback & f)
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
std::visit(utils::overloaded{
|
||||
[](need_idr) {},
|
||||
[](idr_received) {},
|
||||
[this, &f](wait_idr_feedback s) {
|
||||
if (f.sent_to_decoder and f.frame_index == s.idr_id)
|
||||
state = idr_received{};
|
||||
},
|
||||
[this, &f](running r) {
|
||||
if (not f.sent_to_decoder and f.frame_index >= r.first_p)
|
||||
state = need_idr{};
|
||||
},
|
||||
},
|
||||
state);
|
||||
}
|
||||
|
||||
void default_idr_handler::reset()
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
state = need_idr{};
|
||||
}
|
||||
|
||||
bool default_idr_handler::should_skip(uint64_t frame_id)
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
return std::visit(utils::overloaded{
|
||||
[this, frame_id](wait_idr_feedback w) {
|
||||
if (frame_id > w.idr_id + 100)
|
||||
{
|
||||
state = need_idr{};
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
[](auto) {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
state);
|
||||
}
|
||||
|
||||
default_idr_handler::frame_type default_idr_handler::get_type(uint64_t frame_index)
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
return std::visit(utils::overloaded{
|
||||
[](need_idr) {
|
||||
return frame_type::i;
|
||||
},
|
||||
[this, frame_index](idr_received) {
|
||||
state = running{frame_index};
|
||||
return frame_type::p;
|
||||
},
|
||||
[](auto) {
|
||||
return frame_type::p;
|
||||
},
|
||||
},
|
||||
state);
|
||||
}
|
||||
} // namespace wivrn
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <variant>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
class idr_handler
|
||||
{
|
||||
public:
|
||||
virtual ~idr_handler();
|
||||
virtual void on_feedback(const from_headset::feedback &) = 0;
|
||||
virtual void reset() = 0;
|
||||
virtual bool should_skip(uint64_t frame_id) = 0;
|
||||
};
|
||||
|
||||
// handler for unknown P-frames
|
||||
// any lost frame triggers an I-frame
|
||||
// skip frames until th I frame is received
|
||||
class default_idr_handler : public idr_handler
|
||||
{
|
||||
std::mutex mutex;
|
||||
struct need_idr
|
||||
{};
|
||||
struct wait_idr_feedback
|
||||
{
|
||||
uint64_t idr_id;
|
||||
};
|
||||
struct idr_received
|
||||
{};
|
||||
struct running
|
||||
{
|
||||
uint64_t first_p;
|
||||
};
|
||||
std::variant<need_idr, wait_idr_feedback, idr_received, running> state;
|
||||
|
||||
public:
|
||||
enum class frame_type
|
||||
{
|
||||
i,
|
||||
p,
|
||||
};
|
||||
|
||||
void on_feedback(const from_headset::feedback &) override;
|
||||
void reset() override;
|
||||
bool should_skip(uint64_t frame_id) override;
|
||||
frame_type get_type(uint64_t frame_index);
|
||||
};
|
||||
} // namespace wivrn
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "encoder_settings.h"
|
||||
#include "os/os_time.h"
|
||||
#include "util/u_logging.h"
|
||||
#include "wivrn_config.h"
|
||||
|
||||
#include <string>
|
||||
@@ -40,7 +39,7 @@
|
||||
#endif
|
||||
#if WIVRN_USE_VULKAN_ENCODE
|
||||
#include "video_encoder_vulkan_h264.h"
|
||||
// #include "video_encoder_vulkan_h265.h"
|
||||
#include "video_encoder_vulkan_h265.h"
|
||||
#endif
|
||||
#include "video_encoder_raw.h"
|
||||
|
||||
@@ -122,9 +121,8 @@ std::unique_ptr<video_encoder> video_encoder::create(
|
||||
res = video_encoder_vulkan_h264::create(wivrn_vk, settings, fps, stream_idx);
|
||||
break;
|
||||
case video_codec::h265:
|
||||
throw std::runtime_error("h265 not supported for vulkan video encode");
|
||||
// res = video_encoder_vulkan_h265::create(wivrn_vk, settings, fps);
|
||||
// break;
|
||||
res = video_encoder_vulkan_h265::create(wivrn_vk, settings, fps, stream_idx);
|
||||
break;
|
||||
case video_codec::av1:
|
||||
throw std::runtime_error("av1 not supported for vulkan video encode");
|
||||
case video_codec::raw:
|
||||
@@ -192,15 +190,15 @@ std::unique_ptr<video_encoder> video_encoder::create(
|
||||
return res;
|
||||
}
|
||||
|
||||
static const uint64_t idr_throttle = 100;
|
||||
|
||||
video_encoder::video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier, bool async_send) :
|
||||
video_encoder::video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, std::unique_ptr<idr_handler> idr, double bitrate_multiplier, bool async_send) :
|
||||
stream_idx(stream_idx),
|
||||
channels(channels),
|
||||
bitrate_multiplier(bitrate_multiplier),
|
||||
last_idr_frame(-idr_throttle),
|
||||
shared_sender(async_send ? sender::get() : nullptr)
|
||||
{}
|
||||
shared_sender(async_send ? sender::get() : nullptr),
|
||||
idr(std::move(idr))
|
||||
{
|
||||
assert(idr);
|
||||
}
|
||||
|
||||
video_encoder::~video_encoder()
|
||||
{
|
||||
@@ -210,13 +208,13 @@ video_encoder::~video_encoder()
|
||||
|
||||
void video_encoder::on_feedback(const from_headset::feedback & feedback)
|
||||
{
|
||||
if (not feedback.sent_to_decoder)
|
||||
sync_needed = true;
|
||||
assert(feedback.stream_index == stream_idx);
|
||||
idr->on_feedback(feedback);
|
||||
}
|
||||
|
||||
void video_encoder::reset()
|
||||
{
|
||||
sync_needed = true;
|
||||
idr->reset();
|
||||
}
|
||||
|
||||
void video_encoder::set_bitrate(int bitrate_bps)
|
||||
@@ -233,13 +231,20 @@ std::pair<bool, vk::Semaphore> video_encoder::present_image(vk::Image y_cbcr, vk
|
||||
{
|
||||
// Wait for encoder to be done
|
||||
present_slot = (present_slot + 1) % num_slots;
|
||||
busy[present_slot].wait(true);
|
||||
busy[present_slot] = true;
|
||||
state[present_slot].wait(busy);
|
||||
if (idr->should_skip(frame_index))
|
||||
{
|
||||
state[present_slot] = skip;
|
||||
return {false, nullptr};
|
||||
}
|
||||
state[present_slot] = busy;
|
||||
return present_image(y_cbcr, cmd_buf, present_slot, frame_index);
|
||||
}
|
||||
|
||||
void video_encoder::post_submit()
|
||||
{
|
||||
if (state[present_slot] == skip)
|
||||
return;
|
||||
post_submit(present_slot);
|
||||
}
|
||||
|
||||
@@ -248,28 +253,30 @@ void video_encoder::encode(wivrn_session & cnx,
|
||||
uint64_t frame_index)
|
||||
{
|
||||
encode_slot = (encode_slot + 1) % num_slots;
|
||||
assert(busy[encode_slot].load());
|
||||
|
||||
struct idle_setter
|
||||
{
|
||||
std::atomic_unsigned_lock_free & state;
|
||||
~idle_setter()
|
||||
{
|
||||
state = idle;
|
||||
state.notify_all();
|
||||
}
|
||||
};
|
||||
idle_setter i{state[encode_slot]};
|
||||
|
||||
if (state[encode_slot] == skip)
|
||||
return;
|
||||
|
||||
if (shared_sender)
|
||||
shared_sender->wait_idle(this);
|
||||
this->cnx = &cnx;
|
||||
auto target_timestamp = std::chrono::steady_clock::time_point(std::chrono::nanoseconds(view_info.display_time));
|
||||
bool idr = sync_needed.exchange(false);
|
||||
// Throttle idr to prevent overloading the decoder
|
||||
if (idr and frame_index < last_idr_frame + idr_throttle)
|
||||
{
|
||||
U_LOG_D("Throttle IDR: stream %" PRIu8 " frame %" PRIu64, stream_idx, frame_index);
|
||||
sync_needed = true;
|
||||
idr = false;
|
||||
}
|
||||
if (idr)
|
||||
last_idr_frame = frame_index;
|
||||
const char * extra = idr ? ",idr" : ",p";
|
||||
clock = cnx.get_offset();
|
||||
|
||||
auto encode_begin = os_monotonic_get_ns();
|
||||
timing_info = {
|
||||
.encode_begin = clock.to_headset(os_monotonic_get_ns()),
|
||||
.encode_begin = clock.to_headset(encode_begin),
|
||||
};
|
||||
cnx.dump_time("encode_begin", frame_index, os_monotonic_get_ns(), stream_idx, extra);
|
||||
|
||||
// Prepare the video shard template
|
||||
shard.stream_item_idx = stream_idx;
|
||||
@@ -278,26 +285,15 @@ void video_encoder::encode(wivrn_session & cnx,
|
||||
shard.view_info = view_info;
|
||||
shard.timing_info.reset();
|
||||
|
||||
std::exception_ptr ex;
|
||||
try
|
||||
auto data = encode(encode_slot, frame_index);
|
||||
cnx.dump_time("encode_begin", frame_index, encode_begin, stream_idx);
|
||||
cnx.dump_time("encode_end", frame_index, os_monotonic_get_ns(), stream_idx);
|
||||
if (data)
|
||||
{
|
||||
auto data = encode(idr, target_timestamp, encode_slot);
|
||||
cnx.dump_time("encode_end", frame_index, os_monotonic_get_ns(), stream_idx, extra);
|
||||
if (data)
|
||||
{
|
||||
timing_info.encode_end = clock.to_headset(os_monotonic_get_ns());
|
||||
assert(shared_sender);
|
||||
shared_sender->push(std::move(*data));
|
||||
}
|
||||
timing_info.encode_end = clock.to_headset(os_monotonic_get_ns());
|
||||
assert(shared_sender);
|
||||
shared_sender->push(std::move(*data));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
ex = std::current_exception();
|
||||
}
|
||||
busy[encode_slot] = false;
|
||||
busy[encode_slot].notify_all();
|
||||
if (ex)
|
||||
std::rethrow_exception(ex);
|
||||
}
|
||||
|
||||
void video_encoder::SendData(std::span<uint8_t> data, bool end_of_frame, bool control)
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "driver/clock_offset.h"
|
||||
#include "idr_handler.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
@@ -80,11 +80,16 @@ public:
|
||||
const double bitrate_multiplier;
|
||||
|
||||
private:
|
||||
std::mutex mutex;
|
||||
std::array<std::atomic<bool>, num_slots> busy = {false, false};
|
||||
using state_t = std::atomic_unsigned_lock_free::value_type;
|
||||
static const state_t idle = 0;
|
||||
static const state_t busy = 1;
|
||||
static const state_t skip = 2;
|
||||
std::array<std::atomic_unsigned_lock_free, num_slots> state = {idle, idle};
|
||||
uint8_t present_slot = 0;
|
||||
uint8_t encode_slot = 0;
|
||||
|
||||
std::mutex mutex;
|
||||
|
||||
// temporary data
|
||||
wivrn_session * cnx;
|
||||
|
||||
@@ -94,9 +99,6 @@ private:
|
||||
to_headset::video_stream_data_shard::timing_info_t timing_info;
|
||||
clock_offset clock;
|
||||
|
||||
std::atomic_bool sync_needed = true;
|
||||
uint64_t last_idr_frame;
|
||||
|
||||
std::ofstream video_dump;
|
||||
|
||||
std::shared_ptr<sender> shared_sender;
|
||||
@@ -104,6 +106,7 @@ private:
|
||||
protected:
|
||||
std::atomic_int pending_bitrate;
|
||||
std::atomic<float> pending_framerate;
|
||||
std::unique_ptr<idr_handler> idr;
|
||||
|
||||
public:
|
||||
static std::unique_ptr<video_encoder> create(
|
||||
@@ -114,7 +117,7 @@ public:
|
||||
int input_height,
|
||||
float fps);
|
||||
|
||||
video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier, bool async_send);
|
||||
video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, std::unique_ptr<idr_handler>, double bitrate_multiplier, bool async_send);
|
||||
virtual ~video_encoder();
|
||||
|
||||
// return value: true if image should be transitioned to queue and layout for vulkan video encode
|
||||
@@ -122,8 +125,9 @@ public:
|
||||
std::pair<bool, vk::Semaphore> present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint64_t frame_index);
|
||||
void post_submit();
|
||||
|
||||
virtual void on_feedback(const from_headset::feedback &);
|
||||
virtual void reset();
|
||||
void on_feedback(const from_headset::feedback &);
|
||||
void reset();
|
||||
|
||||
void set_bitrate(int bitrate_bps);
|
||||
void set_framerate(float framerate);
|
||||
|
||||
@@ -136,7 +140,7 @@ public:
|
||||
// called after command buffer passed in present_image was submitted
|
||||
virtual void post_submit(uint8_t slot) {}
|
||||
// called when command buffer finished executing
|
||||
virtual std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) = 0;
|
||||
virtual std::optional<data> encode(uint8_t slot, uint64_t frame_index) = 0;
|
||||
|
||||
void SendData(std::span<uint8_t> data, bool end_of_frame, bool control = false);
|
||||
};
|
||||
|
||||
@@ -130,12 +130,28 @@ static void check_profile_guid_supported(std::shared_ptr<video_encoder_nvenc_sha
|
||||
}
|
||||
}
|
||||
|
||||
NV_ENC_RC_PARAMS video_encoder_nvenc::get_rc_params(uint64_t bitrate, float framerate)
|
||||
{
|
||||
return {
|
||||
.rateControlMode = NV_ENC_PARAMS_RC_CBR,
|
||||
.averageBitRate = static_cast<uint32_t>(bitrate),
|
||||
.vbvBufferSize = static_cast<uint32_t>(bitrate / framerate),
|
||||
.vbvInitialDelay = static_cast<uint32_t>(bitrate / framerate),
|
||||
.multiPass = NV_ENC_TWO_PASS_QUARTER_RESOLUTION};
|
||||
}
|
||||
|
||||
void video_encoder_nvenc::set_init_params_fps(float framerate)
|
||||
{
|
||||
init_params.frameRateNum = framerate;
|
||||
init_params.frameRateDen = 1;
|
||||
}
|
||||
|
||||
video_encoder_nvenc::video_encoder_nvenc(
|
||||
wivrn_vk_bundle & vk,
|
||||
encoder_settings & settings,
|
||||
float fps,
|
||||
uint8_t stream_idx) :
|
||||
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, true),
|
||||
video_encoder(stream_idx, settings.channels, std::make_unique<default_idr_handler>(), settings.bitrate_multiplier, true),
|
||||
vk(vk),
|
||||
shared_state(video_encoder_nvenc_shared_state::get()),
|
||||
fps(fps),
|
||||
@@ -157,13 +173,13 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
},
|
||||
};
|
||||
|
||||
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params_ex = {
|
||||
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS session_params = {
|
||||
.version = NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER,
|
||||
.deviceType = NV_ENC_DEVICE_TYPE_CUDA,
|
||||
.device = shared_state->cuda,
|
||||
.apiVersion = NVENCAPI_VERSION,
|
||||
};
|
||||
NVENC_CHECK_NOENCODER(shared_state->fn.nvEncOpenEncodeSessionEx(¶ms_ex, &session_handle));
|
||||
NVENC_CHECK_NOENCODER(shared_state->fn.nvEncOpenEncodeSessionEx(&session_params, &session_handle));
|
||||
|
||||
auto encodeGUID = encode_guid(settings.codec);
|
||||
check_encode_guid_supported(shared_state, session_handle, encodeGUID);
|
||||
@@ -182,18 +198,13 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
}};
|
||||
NVENC_CHECK(shared_state->fn.nvEncGetEncodePresetConfigEx(session_handle, encodeGUID, presetGUID, tuningInfo, &preset_config));
|
||||
|
||||
NV_ENC_CONFIG params = preset_config.presetCfg;
|
||||
config = preset_config.presetCfg;
|
||||
|
||||
// Bitrate control
|
||||
params.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CBR;
|
||||
params.rcParams.averageBitRate = bitrate;
|
||||
params.rcParams.maxBitRate = bitrate;
|
||||
params.rcParams.vbvBufferSize = bitrate / fps;
|
||||
params.rcParams.vbvInitialDelay = bitrate / fps;
|
||||
params.rcParams.multiPass = NV_ENC_TWO_PASS_QUARTER_RESOLUTION;
|
||||
config.rcParams = get_rc_params(bitrate, fps);
|
||||
|
||||
params.gopLength = NVENC_INFINITE_GOPLENGTH;
|
||||
params.frameIntervalP = 1;
|
||||
config.gopLength = NVENC_INFINITE_GOPLENGTH;
|
||||
config.frameIntervalP = 1;
|
||||
|
||||
NV_ENC_BIT_DEPTH bitDepth = NV_ENC_BIT_DEPTH_8;
|
||||
if (settings.bit_depth == 10)
|
||||
@@ -223,48 +234,48 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
if (bitDepth != NV_ENC_BIT_DEPTH_8)
|
||||
throw std::runtime_error("nvenc: selected codec only supports 8-bit encoding");
|
||||
|
||||
params.encodeCodecConfig.h264Config.repeatSPSPPS = 1;
|
||||
params.encodeCodecConfig.h264Config.maxNumRefFrames = 0;
|
||||
params.encodeCodecConfig.h264Config.idrPeriod = NVENC_INFINITE_GOPLENGTH;
|
||||
params.encodeCodecConfig.h264Config.h264VUIParameters.videoFullRangeFlag = 1;
|
||||
config.encodeCodecConfig.h264Config.repeatSPSPPS = 1;
|
||||
config.encodeCodecConfig.h264Config.maxNumRefFrames = 0;
|
||||
config.encodeCodecConfig.h264Config.idrPeriod = NVENC_INFINITE_GOPLENGTH;
|
||||
config.encodeCodecConfig.h264Config.h264VUIParameters.videoFullRangeFlag = 1;
|
||||
|
||||
break;
|
||||
case video_codec::h265:
|
||||
if (bitDepth == NV_ENC_BIT_DEPTH_10)
|
||||
{
|
||||
params.profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID;
|
||||
check_profile_guid_supported(shared_state, session_handle, encodeGUID, params.profileGUID, "GPU doesn't support 10-bit depth with H.265 codec.");
|
||||
config.profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID;
|
||||
check_profile_guid_supported(shared_state, session_handle, encodeGUID, config.profileGUID, "GPU doesn't support 10-bit depth with H.265 codec.");
|
||||
}
|
||||
|
||||
params.encodeCodecConfig.hevcConfig.inputBitDepth = bitDepth;
|
||||
params.encodeCodecConfig.hevcConfig.outputBitDepth = bitDepth;
|
||||
config.encodeCodecConfig.hevcConfig.inputBitDepth = bitDepth;
|
||||
config.encodeCodecConfig.hevcConfig.outputBitDepth = bitDepth;
|
||||
|
||||
params.encodeCodecConfig.hevcConfig.repeatSPSPPS = 1;
|
||||
params.encodeCodecConfig.hevcConfig.maxNumRefFramesInDPB = 0;
|
||||
params.encodeCodecConfig.hevcConfig.idrPeriod = NVENC_INFINITE_GOPLENGTH;
|
||||
params.encodeCodecConfig.hevcConfig.hevcVUIParameters.videoFullRangeFlag = 1;
|
||||
config.encodeCodecConfig.hevcConfig.repeatSPSPPS = 1;
|
||||
config.encodeCodecConfig.hevcConfig.maxNumRefFramesInDPB = 0;
|
||||
config.encodeCodecConfig.hevcConfig.idrPeriod = NVENC_INFINITE_GOPLENGTH;
|
||||
config.encodeCodecConfig.hevcConfig.hevcVUIParameters.videoFullRangeFlag = 1;
|
||||
|
||||
break;
|
||||
case video_codec::av1:
|
||||
if (bitDepth == NV_ENC_BIT_DEPTH_10)
|
||||
{
|
||||
params.profileGUID = NV_ENC_AV1_PROFILE_MAIN_GUID;
|
||||
check_profile_guid_supported(shared_state, session_handle, encodeGUID, params.profileGUID, "GPU doesn't support 10-bit depth with AV1 codec.");
|
||||
config.profileGUID = NV_ENC_AV1_PROFILE_MAIN_GUID;
|
||||
check_profile_guid_supported(shared_state, session_handle, encodeGUID, config.profileGUID, "GPU doesn't support 10-bit depth with AV1 codec.");
|
||||
}
|
||||
|
||||
params.encodeCodecConfig.av1Config.inputBitDepth = bitDepth;
|
||||
params.encodeCodecConfig.av1Config.outputBitDepth = bitDepth;
|
||||
config.encodeCodecConfig.av1Config.inputBitDepth = bitDepth;
|
||||
config.encodeCodecConfig.av1Config.outputBitDepth = bitDepth;
|
||||
|
||||
params.encodeCodecConfig.av1Config.repeatSeqHdr = 1;
|
||||
params.encodeCodecConfig.av1Config.maxNumRefFramesInDPB = 0;
|
||||
params.encodeCodecConfig.av1Config.idrPeriod = NVENC_INFINITE_GOPLENGTH;
|
||||
config.encodeCodecConfig.av1Config.repeatSeqHdr = 1;
|
||||
config.encodeCodecConfig.av1Config.maxNumRefFramesInDPB = 0;
|
||||
config.encodeCodecConfig.av1Config.idrPeriod = NVENC_INFINITE_GOPLENGTH;
|
||||
|
||||
break;
|
||||
case video_codec::raw:
|
||||
throw std::runtime_error("raw codec not supported for nvenc");
|
||||
}
|
||||
|
||||
NV_ENC_INITIALIZE_PARAMS params2{
|
||||
init_params = {
|
||||
.version = NV_ENC_INITIALIZE_PARAMS_VER,
|
||||
.encodeGUID = encodeGUID,
|
||||
.presetGUID = presetGUID,
|
||||
@@ -272,19 +283,20 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
.encodeHeight = settings.video_height,
|
||||
.darWidth = settings.video_width,
|
||||
.darHeight = settings.video_height,
|
||||
.frameRateNum = (uint32_t)fps,
|
||||
.frameRateDen = 1,
|
||||
.enableEncodeAsync = 0,
|
||||
.enablePTD = 1,
|
||||
.encodeConfig = ¶ms,
|
||||
.encodeConfig = &config,
|
||||
.tuningInfo = tuningInfo};
|
||||
NVENC_CHECK(shared_state->fn.nvEncInitializeEncoder(session_handle, ¶ms2));
|
||||
|
||||
NV_ENC_CREATE_BITSTREAM_BUFFER params3{
|
||||
set_init_params_fps(fps);
|
||||
|
||||
NVENC_CHECK(shared_state->fn.nvEncInitializeEncoder(session_handle, &init_params));
|
||||
|
||||
NV_ENC_CREATE_BITSTREAM_BUFFER out_buf_params{
|
||||
.version = NV_ENC_CREATE_BITSTREAM_BUFFER_VER,
|
||||
};
|
||||
NVENC_CHECK(shared_state->fn.nvEncCreateBitstreamBuffer(session_handle, ¶ms3));
|
||||
bitstreamBuffer = params3.bitstreamBuffer;
|
||||
NVENC_CHECK(shared_state->fn.nvEncCreateBitstreamBuffer(session_handle, &out_buf_params));
|
||||
outputBuffer = out_buf_params.bitstreamBuffer;
|
||||
|
||||
vk::DeviceSize buffer_size = rect.extent.width * settings.video_height * bytesPerPixel * 3 / 2;
|
||||
|
||||
@@ -329,23 +341,23 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPushCurrent(shared_state->cuda));
|
||||
{
|
||||
CUexternalMemory extmem;
|
||||
CUDA_EXTERNAL_MEMORY_HANDLE_DESC param{
|
||||
CUDA_EXTERNAL_MEMORY_HANDLE_DESC mem_handle_params{
|
||||
.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD,
|
||||
.handle = {.fd = fd},
|
||||
.size = memory_req.size,
|
||||
.flags = 0,
|
||||
};
|
||||
CU_CHECK(shared_state->cuda_fn->cuImportExternalMemory(&extmem, ¶m));
|
||||
CU_CHECK(shared_state->cuda_fn->cuImportExternalMemory(&extmem, &mem_handle_params));
|
||||
|
||||
CUDA_EXTERNAL_MEMORY_BUFFER_DESC map_param{
|
||||
CUDA_EXTERNAL_MEMORY_BUFFER_DESC ext_map_params{
|
||||
.offset = 0,
|
||||
.size = buffer_size,
|
||||
.flags = 0,
|
||||
};
|
||||
CU_CHECK(shared_state->cuda_fn->cuExternalMemoryGetMappedBuffer(&frame, extmem, &map_param));
|
||||
CU_CHECK(shared_state->cuda_fn->cuExternalMemoryGetMappedBuffer(&frame, extmem, &ext_map_params));
|
||||
}
|
||||
|
||||
NV_ENC_REGISTER_RESOURCE param3{
|
||||
NV_ENC_REGISTER_RESOURCE resource_params{
|
||||
.version = NV_ENC_REGISTER_RESOURCE_VER,
|
||||
.resourceType = NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR,
|
||||
.width = settings.video_width,
|
||||
@@ -355,8 +367,8 @@ video_encoder_nvenc::video_encoder_nvenc(
|
||||
.bufferFormat = (bitDepth == NV_ENC_BIT_DEPTH_10 ? NV_ENC_BUFFER_FORMAT_YUV420_10BIT : NV_ENC_BUFFER_FORMAT_NV12),
|
||||
.bufferUsage = NV_ENC_INPUT_IMAGE,
|
||||
};
|
||||
NVENC_CHECK(shared_state->fn.nvEncRegisterResource(session_handle, ¶m3));
|
||||
i.nvenc_resource = param3.registeredResource;
|
||||
NVENC_CHECK(shared_state->fn.nvEncRegisterResource(session_handle, &resource_params));
|
||||
i.nvenc_resource = resource_params.registeredResource;
|
||||
}
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPopCurrent(NULL));
|
||||
}
|
||||
@@ -408,46 +420,100 @@ std::pair<bool, vk::Semaphore> video_encoder_nvenc::present_image(vk::Image y_cb
|
||||
return {false, nullptr};
|
||||
}
|
||||
|
||||
std::optional<video_encoder::data> video_encoder_nvenc::encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot)
|
||||
std::optional<video_encoder::data> video_encoder_nvenc::encode(uint8_t slot, uint64_t frame_index)
|
||||
{
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPushCurrent(shared_state->cuda));
|
||||
auto & idr_handler = ((default_idr_handler &)*idr);
|
||||
|
||||
NV_ENC_MAP_INPUT_RESOURCE param4{};
|
||||
param4.version = NV_ENC_MAP_INPUT_RESOURCE_VER;
|
||||
param4.registeredResource = in[slot].nvenc_resource;
|
||||
NVENC_CHECK(shared_state->fn.nvEncMapInputResource(session_handle, ¶m4));
|
||||
auto new_bitrate = pending_bitrate.exchange(0);
|
||||
auto new_framerate = pending_framerate.exchange(0);
|
||||
|
||||
NV_ENC_PIC_PARAMS param{
|
||||
if (new_bitrate || new_framerate)
|
||||
{
|
||||
if (new_framerate)
|
||||
U_LOG_I("nvenc: reconfiguring framerate, new value: %f", new_framerate);
|
||||
else
|
||||
new_framerate = fps;
|
||||
|
||||
if (new_bitrate)
|
||||
U_LOG_I("nvenc: reconfiguring bitrate, new value: %d", new_bitrate);
|
||||
else
|
||||
new_bitrate = bitrate;
|
||||
|
||||
config.rcParams = get_rc_params(new_bitrate, new_framerate);
|
||||
set_init_params_fps(new_framerate);
|
||||
|
||||
NV_ENC_RECONFIGURE_PARAMS reconfig_params{
|
||||
.version = NV_ENC_RECONFIGURE_PARAMS_VER,
|
||||
.reInitEncodeParams = init_params,
|
||||
.resetEncoder = 1,
|
||||
.forceIDR = 1};
|
||||
|
||||
try
|
||||
{
|
||||
NVENC_CHECK(shared_state->fn.nvEncReconfigureEncoder(session_handle, &reconfig_params));
|
||||
fps = new_framerate;
|
||||
bitrate = new_bitrate;
|
||||
idr_handler.reset();
|
||||
|
||||
U_LOG_I("nvenc: reconfiguring succeeded.");
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
U_LOG_E("nvenc: reconfiguring failed.");
|
||||
config.rcParams = get_rc_params(bitrate, fps);
|
||||
set_init_params_fps(fps);
|
||||
}
|
||||
}
|
||||
|
||||
NV_ENC_MAP_INPUT_RESOURCE inp_resource_params{
|
||||
.version = NV_ENC_MAP_INPUT_RESOURCE_VER,
|
||||
.registeredResource = in[slot].nvenc_resource};
|
||||
|
||||
NVENC_CHECK(shared_state->fn.nvEncMapInputResource(session_handle, &inp_resource_params));
|
||||
|
||||
NV_ENC_PIC_PARAMS frame_params{
|
||||
.version = NV_ENC_PIC_PARAMS_VER,
|
||||
.inputWidth = rect.extent.width,
|
||||
.inputHeight = rect.extent.height,
|
||||
.inputPitch = rect.extent.width,
|
||||
.encodePicFlags = uint32_t(idr ? NV_ENC_PIC_FLAG_FORCEIDR | NV_ENC_PIC_FLAG_OUTPUT_SPSPPS : 0),
|
||||
.encodePicFlags = 0,
|
||||
.frameIdx = 0,
|
||||
.inputTimeStamp = 0,
|
||||
.inputBuffer = param4.mappedResource,
|
||||
.outputBitstream = bitstreamBuffer,
|
||||
.bufferFmt = param4.mappedBufferFmt,
|
||||
.inputBuffer = inp_resource_params.mappedResource,
|
||||
.outputBitstream = outputBuffer,
|
||||
.bufferFmt = inp_resource_params.mappedBufferFmt,
|
||||
.pictureStruct = NV_ENC_PIC_STRUCT_FRAME,
|
||||
};
|
||||
NVENC_CHECK(shared_state->fn.nvEncEncodePicture(session_handle, ¶m));
|
||||
|
||||
NV_ENC_LOCK_BITSTREAM param2{
|
||||
auto frame_type = idr_handler.get_type(frame_index);
|
||||
switch (frame_type)
|
||||
{
|
||||
case default_idr_handler::frame_type::i:
|
||||
frame_params.encodePicFlags |= NV_ENC_PIC_FLAG_FORCEIDR | NV_ENC_PIC_FLAG_OUTPUT_SPSPPS;
|
||||
break;
|
||||
case default_idr_handler::frame_type::p:
|
||||
break;
|
||||
}
|
||||
NVENC_CHECK(shared_state->fn.nvEncEncodePicture(session_handle, &frame_params));
|
||||
|
||||
NV_ENC_LOCK_BITSTREAM buf_lock_params{
|
||||
.version = NV_ENC_LOCK_BITSTREAM_VER,
|
||||
.doNotWait = 0,
|
||||
.outputBitstream = bitstreamBuffer,
|
||||
.outputBitstream = outputBuffer,
|
||||
};
|
||||
NVENC_CHECK(shared_state->fn.nvEncLockBitstream(session_handle, ¶m2));
|
||||
NVENC_CHECK(shared_state->fn.nvEncLockBitstream(session_handle, &buf_lock_params));
|
||||
|
||||
CU_CHECK(shared_state->cuda_fn->cuCtxPopCurrent(NULL));
|
||||
return data{
|
||||
.encoder = this,
|
||||
.span = std::span((uint8_t *)param2.bitstreamBufferPtr, param2.bitstreamSizeInBytes),
|
||||
.mem = std::shared_ptr<void>(param2.bitstreamBufferPtr, [this](void *) {
|
||||
NVENCSTATUS status = shared_state->fn.nvEncUnlockBitstream(session_handle, bitstreamBuffer);
|
||||
.span = std::span((uint8_t *)buf_lock_params.bitstreamBufferPtr, buf_lock_params.bitstreamSizeInBytes),
|
||||
.mem = std::shared_ptr<void>(buf_lock_params.bitstreamBufferPtr, [this](void *) {
|
||||
NVENCSTATUS status = shared_state->fn.nvEncUnlockBitstream(session_handle, outputBuffer);
|
||||
if (status != NV_ENC_SUCCESS)
|
||||
U_LOG_E("%s:%d: %d, %s", __FILE__, __LINE__, status, shared_state->fn.nvEncGetLastErrorString(session_handle));
|
||||
}),
|
||||
.prefer_control = frame_type == default_idr_handler::frame_type::i,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -475,14 +541,14 @@ std::array<int, 2> video_encoder_nvenc::get_max_size(video_codec codec)
|
||||
{NV_ENC_CAPS_WIDTH_MAX, &result[1]},
|
||||
})
|
||||
{
|
||||
NV_ENC_CAPS_PARAM cap_param{
|
||||
NV_ENC_CAPS_PARAM cap_params{
|
||||
.version = NV_ENC_CAPS_PARAM_VER,
|
||||
.capsToQuery = NV_ENC_CAPS_WIDTH_MAX,
|
||||
};
|
||||
|
||||
check_encode_guid_supported(state, session_handle, encodeGUID);
|
||||
|
||||
NVENCSTATUS status = state->fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_param, res);
|
||||
NVENCSTATUS status = state->fn.nvEncGetEncodeCaps(session_handle, encodeGUID, &cap_params, res);
|
||||
if (status != NV_ENC_SUCCESS)
|
||||
{
|
||||
throw std::runtime_error("nvenc get_max_size: failed to get caps");
|
||||
|
||||
@@ -40,7 +40,9 @@ private:
|
||||
std::shared_ptr<video_encoder_nvenc_shared_state> shared_state;
|
||||
|
||||
void * session_handle = nullptr;
|
||||
NV_ENC_OUTPUT_PTR bitstreamBuffer;
|
||||
NV_ENC_OUTPUT_PTR outputBuffer;
|
||||
NV_ENC_CONFIG config;
|
||||
NV_ENC_INITIALIZE_PARAMS init_params;
|
||||
|
||||
struct in_t
|
||||
{
|
||||
@@ -51,15 +53,18 @@ private:
|
||||
std::array<in_t, num_slots> in;
|
||||
|
||||
float fps;
|
||||
int bitrate;
|
||||
uint64_t bitrate;
|
||||
int bytesPerPixel = 1;
|
||||
|
||||
NV_ENC_RC_PARAMS get_rc_params(uint64_t bitrate, float framerate);
|
||||
void set_init_params_fps(float framerate);
|
||||
|
||||
public:
|
||||
video_encoder_nvenc(wivrn_vk_bundle & vk, encoder_settings & settings, float fps, uint8_t stream_idx);
|
||||
~video_encoder_nvenc();
|
||||
|
||||
std::pair<bool, vk::Semaphore> present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot, uint64_t frame_index) override;
|
||||
std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) override;
|
||||
std::optional<data> encode(uint8_t slot, uint64_t frame_index) override;
|
||||
|
||||
static std::array<int, 2> get_max_size(video_codec);
|
||||
};
|
||||
|
||||
@@ -21,12 +21,26 @@
|
||||
#include "encoder/encoder_settings.h"
|
||||
#include "utils/wivrn_vk_bundle.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
class dummy_idr_handler : public wivrn::idr_handler
|
||||
{
|
||||
public:
|
||||
void on_feedback(const wivrn::from_headset::feedback &) override {};
|
||||
void reset() override {};
|
||||
bool should_skip(uint64_t frame_id) override
|
||||
{
|
||||
return false;
|
||||
};
|
||||
};
|
||||
} // namespace
|
||||
|
||||
wivrn::video_encoder_raw::video_encoder_raw(
|
||||
wivrn_vk_bundle & vk,
|
||||
encoder_settings & settings,
|
||||
float fps,
|
||||
uint8_t stream_idx) :
|
||||
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, true)
|
||||
video_encoder(stream_idx, settings.channels, std::make_unique<dummy_idr_handler>(), settings.bitrate_multiplier, true)
|
||||
{
|
||||
if (settings.bit_depth != 8)
|
||||
throw std::runtime_error("Raw encoding is only supported for 8 bit");
|
||||
@@ -112,7 +126,7 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_raw::present_image(vk::Image
|
||||
return {false, nullptr};
|
||||
}
|
||||
|
||||
std::optional<wivrn::video_encoder::data> wivrn::video_encoder_raw::encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot)
|
||||
std::optional<wivrn::video_encoder::data> wivrn::video_encoder_raw::encode(uint8_t slot, uint64_t frame_id)
|
||||
{
|
||||
return wivrn::video_encoder::data{
|
||||
.encoder = this,
|
||||
|
||||
@@ -36,6 +36,6 @@ public:
|
||||
|
||||
std::pair<bool, vk::Semaphore> present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot, uint64_t frame_index) override;
|
||||
|
||||
std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) override;
|
||||
std::optional<data> encode(uint8_t slot, uint64_t frame_id) override;
|
||||
};
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -25,6 +25,107 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace
|
||||
{
|
||||
class dpb_state : public wivrn::idr_handler
|
||||
{
|
||||
public:
|
||||
struct dpb_item
|
||||
{
|
||||
vk::raii::ImageView image_view;
|
||||
vk::VideoPictureResourceInfoKHR resource;
|
||||
vk::VideoReferenceSlotInfoKHR & info;
|
||||
uint64_t frame_index = -1;
|
||||
bool acked = false;
|
||||
};
|
||||
|
||||
std::vector<dpb_item> items;
|
||||
std::vector<vk::VideoReferenceSlotInfoKHR> infos;
|
||||
uint32_t frame_num = 0;
|
||||
std::mutex mutex;
|
||||
|
||||
void on_feedback(const wivrn::from_headset::feedback & feedback) override
|
||||
{
|
||||
if (feedback.sent_to_decoder)
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
for (auto & item: items)
|
||||
{
|
||||
if (item.frame_index == feedback.frame_index)
|
||||
{
|
||||
item.acked = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reset() override
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
for (auto & item: items)
|
||||
{
|
||||
item.frame_index = -1;
|
||||
item.info.pPictureResource = nullptr;
|
||||
item.info.slotIndex = -1;
|
||||
item.acked = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool should_skip(uint64_t frame_id) override
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
bool pending = false; // has any data been sent?
|
||||
for (auto & i: items)
|
||||
{
|
||||
if (i.acked)
|
||||
return false;
|
||||
if (i.info.slotIndex != -1)
|
||||
pending = true;
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
|
||||
std::pair<dpb_item *, dpb_item *> get_ref(uint64_t frame_index)
|
||||
{
|
||||
// must hold the lock
|
||||
auto slot = std::ranges::min_element(
|
||||
items,
|
||||
[](const auto & a, const auto & b) {
|
||||
return a.frame_index + 1 < b.frame_index + 1;
|
||||
});
|
||||
slot->info.slotIndex = -1;
|
||||
|
||||
dpb_item * ref_slot = nullptr;
|
||||
for (auto & i: items)
|
||||
{
|
||||
if (i.info.slotIndex == -1 or not i.acked)
|
||||
continue;
|
||||
if (ref_slot and ref_slot->frame_index > i.frame_index)
|
||||
continue;
|
||||
ref_slot = &i;
|
||||
}
|
||||
|
||||
if (not ref_slot)
|
||||
{
|
||||
frame_num = 0;
|
||||
for (auto & slot: items)
|
||||
{
|
||||
slot.info.slotIndex = -1;
|
||||
slot.info.pPictureResource = nullptr;
|
||||
slot.frame_index = -1;
|
||||
slot.acked = false;
|
||||
}
|
||||
}
|
||||
slot->acked = false;
|
||||
slot->frame_index = frame_index;
|
||||
slot->info.pPictureResource = &slot->resource;
|
||||
|
||||
return {ref_slot, &*slot};
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static uint32_t align(uint32_t value, uint32_t alignment)
|
||||
{
|
||||
if (alignment == 0)
|
||||
@@ -62,7 +163,7 @@ wivrn::video_encoder_vulkan::video_encoder_vulkan(
|
||||
float fps,
|
||||
uint8_t stream_idx,
|
||||
const encoder_settings & settings) :
|
||||
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, true),
|
||||
video_encoder(stream_idx, settings.channels, std::make_unique<dpb_state>(), settings.bitrate_multiplier, true),
|
||||
vk(vk),
|
||||
encode_caps(patch_capabilities(in_encode_caps)),
|
||||
rect(rect),
|
||||
@@ -115,6 +216,18 @@ wivrn::video_encoder_vulkan::video_encoder_vulkan(
|
||||
U_LOG_W("No suitable rate control available, reverting to default");
|
||||
rate_control.reset();
|
||||
}
|
||||
|
||||
constexpr uint32_t cb_min_size = 8;
|
||||
uint32_t granWidth =
|
||||
std::max(video_caps.pictureAccessGranularity.width, encode_caps.encodeInputPictureGranularity.width);
|
||||
uint32_t granHeight =
|
||||
std::max(video_caps.pictureAccessGranularity.height, encode_caps.encodeInputPictureGranularity.height);
|
||||
|
||||
aligned_extent = vk::Extent3D{
|
||||
.width = align(rect.extent.width, std::max(cb_min_size, granWidth)),
|
||||
.height = align(rect.extent.height, std::max(cb_min_size, granHeight)),
|
||||
.depth = 1,
|
||||
};
|
||||
}
|
||||
|
||||
void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_caps,
|
||||
@@ -135,7 +248,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
.imageUsage = vk::ImageUsageFlagBits::eVideoEncodeSrcKHR,
|
||||
});
|
||||
|
||||
if (picture_format.format != vk::Format::eG8B8R82Plane420Unorm)
|
||||
if (picture_format.format != vk::Format::eG8B8R82Plane420Unorm && picture_format.format != vk::Format::eG10X6B10X6R10X62Plane420Unorm3Pack16)
|
||||
throw std::runtime_error("Unsupported format " +
|
||||
vk::to_string(picture_format.format) +
|
||||
" for encoder input image");
|
||||
@@ -151,12 +264,6 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
// TODO: check format capabilities
|
||||
// TODO: use multiple images if array levels are not supported
|
||||
|
||||
vk::Extent3D aligned_extent{
|
||||
.width = align(rect.extent.width, video_caps.pictureAccessGranularity.width),
|
||||
.height = align(rect.extent.height, video_caps.pictureAccessGranularity.height),
|
||||
.depth = 1,
|
||||
};
|
||||
|
||||
vk::ImageCreateInfo img_create_info{
|
||||
.pNext = &video_profile_list,
|
||||
.flags = reference_picture_format.imageCreateFlags,
|
||||
@@ -224,10 +331,10 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
//.flags = vk::VideoSessionCreateFlagBitsKHR::eAllowEncodeParameterOptimizations,
|
||||
.pVideoProfile = &video_profile,
|
||||
.pictureFormat = picture_format.format,
|
||||
.maxCodedExtent = rect.extent,
|
||||
.maxCodedExtent = {aligned_extent.width, aligned_extent.height},
|
||||
.referencePictureFormat = reference_picture_format.format,
|
||||
.maxDpbSlots = num_dpb_slots,
|
||||
.maxActiveReferencePictures = 2,
|
||||
.maxActiveReferencePictures = 1, // h265 code assumes only 1 reference
|
||||
.pStdHeaderVersion = &std_header_version,
|
||||
});
|
||||
|
||||
@@ -300,13 +407,15 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
}
|
||||
}
|
||||
|
||||
auto & dpb = (dpb_state &)*idr;
|
||||
|
||||
// DPB slot info
|
||||
{
|
||||
auto std_slots = setup_slot_info(num_dpb_slots);
|
||||
assert(std_slots.size() == num_dpb_slots);
|
||||
for (size_t i = 0; i < num_dpb_slots; ++i)
|
||||
{
|
||||
dpb_info.push_back({
|
||||
dpb.infos.push_back({
|
||||
.pNext = std_slots[i],
|
||||
.slotIndex = -1,
|
||||
.pPictureResource = nullptr,
|
||||
@@ -329,23 +438,17 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
for (size_t i = 0; i < num_dpb_slots; ++i)
|
||||
{
|
||||
img_view_create_info.subresourceRange.baseArrayLayer = i;
|
||||
dpb.push_back(
|
||||
{
|
||||
.image_view = vk.device.createImageView(img_view_create_info),
|
||||
.info = dpb_info[i],
|
||||
});
|
||||
vk.name(dpb.back().image_view, "vulkan encoder dpb view");
|
||||
}
|
||||
}
|
||||
|
||||
// DPB video picture resource info
|
||||
{
|
||||
for (auto & item: dpb)
|
||||
{
|
||||
item.resource = vk::VideoPictureResourceInfoKHR{
|
||||
.codedExtent = rect.extent,
|
||||
.imageViewBinding = *item.image_view,
|
||||
};
|
||||
vk::raii::ImageView v(vk.device, img_view_create_info);
|
||||
vk::ImageView v1(*v);
|
||||
vk.name(v, "vulkan encoder dpb view");
|
||||
dpb.items.push_back({
|
||||
.image_view = std::move(v),
|
||||
.resource = {
|
||||
.codedExtent = rect.extent,
|
||||
.imageViewBinding = v1,
|
||||
},
|
||||
.info = dpb.infos[i],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,10 +545,8 @@ std::vector<uint8_t> wivrn::video_encoder_vulkan::get_encoded_parameters(void *
|
||||
return encoded;
|
||||
}
|
||||
|
||||
std::optional<wivrn::video_encoder::data> wivrn::video_encoder_vulkan::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t encode_slot)
|
||||
std::optional<wivrn::video_encoder::data> wivrn::video_encoder_vulkan::encode(uint8_t encode_slot, uint64_t frame_index)
|
||||
{
|
||||
// we manage idrs ourselves
|
||||
(void)idr;
|
||||
auto & slot_item = slot_data[encode_slot];
|
||||
if (slot_item.idr)
|
||||
send_idr_data();
|
||||
@@ -632,52 +733,32 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
|
||||
|
||||
video_cmd_buf.resetQueryPool(*query_pool, encode_slot, 1);
|
||||
|
||||
auto slot = std::ranges::min_element(
|
||||
dpb,
|
||||
[](const auto & a, const auto & b) {
|
||||
return a.frame_index + 1 < b.frame_index + 1;
|
||||
});
|
||||
size_t slot_index = std::distance(dpb.begin(), slot);
|
||||
slot->info.slotIndex = -1;
|
||||
auto & dpb = (dpb_state &)*idr;
|
||||
std::unique_lock lock(dpb.mutex);
|
||||
auto [ref_slot, slot] = dpb.get_ref(frame_index);
|
||||
slot_item.idr = ref_slot == nullptr;
|
||||
|
||||
auto last_ack = this->last_ack.load();
|
||||
dpb_item * ref_slot = nullptr;
|
||||
for (auto & i: dpb)
|
||||
{
|
||||
if (i.frame_index == last_ack and i.info.slotIndex != -1)
|
||||
{
|
||||
ref_slot = &i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
vk::VideoReferenceSlotInfoKHR init_refs[2] = {};
|
||||
init_refs[0] = slot->info;
|
||||
init_refs[0].slotIndex = -1;
|
||||
init_refs[0].pPictureResource = &slot->resource;
|
||||
|
||||
if (not ref_slot)
|
||||
if (ref_slot)
|
||||
{
|
||||
frame_num = 0;
|
||||
for (auto & slot: dpb)
|
||||
{
|
||||
slot.info.slotIndex = -1;
|
||||
slot.info.pPictureResource = nullptr;
|
||||
slot.frame_index = -1;
|
||||
}
|
||||
slot_item.idr = true;
|
||||
last_ack = frame_index;
|
||||
init_refs[1] = ref_slot->info;
|
||||
init_refs[1].slotIndex = ref_slot->info.slotIndex;
|
||||
init_refs[1].pPictureResource = &ref_slot->resource;
|
||||
}
|
||||
else
|
||||
{
|
||||
slot_item.idr = false;
|
||||
}
|
||||
slot->frame_index = frame_index;
|
||||
slot->info.pPictureResource = &slot->resource;
|
||||
|
||||
video_cmd_buf.beginVideoCodingKHR({
|
||||
.pNext = (session_initialized and rate_control) ? &rate_control.value() : nullptr,
|
||||
.videoSession = *video_session,
|
||||
.videoSessionParameters = *video_session_parameters,
|
||||
.referenceSlotCount = uint32_t(dpb_info.size()),
|
||||
.pReferenceSlots = dpb_info.data(),
|
||||
.referenceSlotCount = ref_slot ? 2u : 1u,
|
||||
.pReferenceSlots = init_refs,
|
||||
});
|
||||
|
||||
size_t slot_index = std::distance(dpb.items.data(), slot);
|
||||
slot->info.slotIndex = slot_index;
|
||||
|
||||
if (not session_initialized)
|
||||
@@ -706,7 +787,7 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
|
||||
.baseMipLevel = 0,
|
||||
.levelCount = 1,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = uint32_t(dpb.size())},
|
||||
.layerCount = vk::RemainingArrayLayers},
|
||||
};
|
||||
video_cmd_buf.pipelineBarrier2({
|
||||
.imageMemoryBarrierCount = 1,
|
||||
@@ -746,17 +827,19 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
|
||||
});
|
||||
|
||||
vk::VideoEncodeInfoKHR encode_info{
|
||||
.pNext = encode_info_next(frame_num, slot_index, ref_slot ? std::make_optional(ref_slot->info.slotIndex) : std::nullopt),
|
||||
.pNext = encode_info_next(dpb.frame_num, slot_index, ref_slot ? std::make_optional(ref_slot->info.slotIndex) : std::nullopt),
|
||||
.dstBuffer = slot_item.output_buffer,
|
||||
.dstBufferOffset = 0,
|
||||
.dstBufferRange = slot_item.output_buffer.info().size,
|
||||
.srcPictureResource = {
|
||||
.codedExtent = rect.extent,
|
||||
.codedOffset = {0, 0},
|
||||
.codedExtent = {aligned_extent.width, aligned_extent.height},
|
||||
.baseArrayLayer = 0,
|
||||
.imageViewBinding = image_view,
|
||||
},
|
||||
.pSetupReferenceSlot = &slot->info,
|
||||
};
|
||||
|
||||
if (ref_slot)
|
||||
encode_info.setReferenceSlots(ref_slot->info);
|
||||
|
||||
@@ -832,7 +915,7 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
|
||||
|
||||
video_cmd_buf.end();
|
||||
|
||||
++frame_num;
|
||||
++dpb.frame_num;
|
||||
|
||||
// If we encode directly from the source, request a transition to video queue
|
||||
return {encode_direct, slot_item.wait_sem};
|
||||
@@ -879,14 +962,3 @@ void wivrn::video_encoder_vulkan::post_submit(uint8_t slot)
|
||||
*slot_item.fence);
|
||||
}
|
||||
}
|
||||
|
||||
void wivrn::video_encoder_vulkan::on_feedback(const from_headset::feedback & feedback)
|
||||
{
|
||||
if (feedback.sent_to_decoder)
|
||||
{
|
||||
auto prev = last_ack.load();
|
||||
while (prev < feedback.frame_index and last_ack.compare_exchange_weak(prev, feedback.frame_index))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include <vulkan/vulkan_structs.hpp>
|
||||
|
||||
#include "video_encoder.h"
|
||||
#include "vk/allocation.h"
|
||||
@@ -58,30 +59,18 @@ class video_encoder_vulkan : public video_encoder
|
||||
|
||||
image_allocation dpb_image;
|
||||
|
||||
struct dpb_item
|
||||
{
|
||||
vk::raii::ImageView image_view;
|
||||
vk::VideoPictureResourceInfoKHR resource;
|
||||
vk::VideoReferenceSlotInfoKHR & info;
|
||||
uint64_t frame_index = -1;
|
||||
};
|
||||
|
||||
std::vector<dpb_item> dpb;
|
||||
std::vector<vk::VideoReferenceSlotInfoKHR> dpb_info;
|
||||
|
||||
std::vector<vk::raii::DeviceMemory> mem;
|
||||
|
||||
vk::VideoFormatPropertiesKHR select_video_format(
|
||||
vk::raii::PhysicalDevice & physical_device,
|
||||
const vk::PhysicalDeviceVideoFormatInfoKHR &);
|
||||
|
||||
uint32_t frame_num = 0;
|
||||
std::atomic<uint64_t> last_ack = 0;
|
||||
bool session_initialized = false;
|
||||
const vk::Rect2D rect;
|
||||
|
||||
protected:
|
||||
const uint8_t num_dpb_slots;
|
||||
vk::Extent3D aligned_extent;
|
||||
vk::VideoEncodeRateControlLayerInfoKHR rate_control_layer;
|
||||
std::optional<vk::VideoEncodeRateControlInfoKHR> rate_control;
|
||||
|
||||
@@ -109,9 +98,8 @@ protected:
|
||||
virtual vk::ExtensionProperties std_header_version() = 0;
|
||||
|
||||
public:
|
||||
std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) override;
|
||||
std::optional<data> encode(uint8_t slot, uint64_t frame_index) override;
|
||||
std::pair<bool, vk::Semaphore> present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot, uint64_t frame_index) override;
|
||||
void post_submit(uint8_t slot) override;
|
||||
void on_feedback(const from_headset::feedback &) override;
|
||||
};
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "video_encoder_vulkan_h264.h"
|
||||
|
||||
#include "encoder/encoder_settings.h"
|
||||
#include "utils/wivrn_vk_bundle.h"
|
||||
|
||||
@@ -337,7 +338,7 @@ void * wivrn::video_encoder_vulkan_h264::encode_info_next(uint32_t frame_num, si
|
||||
std_picture_info = {
|
||||
.flags =
|
||||
{
|
||||
.IdrPicFlag = uint32_t(ref_slot ? 0 : 1),
|
||||
.IdrPicFlag = ref_slot ? 0u : 1u,
|
||||
.is_reference = 1,
|
||||
.no_output_of_prior_pics_flag = 0,
|
||||
.long_term_reference_flag = 0,
|
||||
|
||||
@@ -17,15 +17,90 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "video_encoder_vulkan_h265.h"
|
||||
#include "encoder/encoder_settings.h"
|
||||
#include "util/u_logging.h"
|
||||
#include "utils/wivrn_vk_bundle.h"
|
||||
|
||||
wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(wivrn_vk_bundle & vk, vk::Rect2D rect, vk::VideoEncodeCapabilitiesKHR encode_caps, float fps, uint64_t bitrate) :
|
||||
video_encoder_vulkan(vk, rect, encode_caps, fps, bitrate),
|
||||
#include "encoder/encoder_settings.h"
|
||||
#include "utils/wivrn_vk_bundle.h"
|
||||
#include <cstdint>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <vulkan/vulkan_enums.hpp>
|
||||
|
||||
static StdVideoH265LevelIdc choose_level(uint32_t w, uint32_t h, float fps)
|
||||
{
|
||||
const uint64_t pixrate = uint64_t(w) * uint64_t(h) * uint64_t(fps + 0.5f);
|
||||
|
||||
// only consider >=5_0 due to general_tier_flag on ptl
|
||||
|
||||
if (pixrate < 267'386'880)
|
||||
return STD_VIDEO_H265_LEVEL_IDC_5_0;
|
||||
if (pixrate < 534'773'760)
|
||||
return STD_VIDEO_H265_LEVEL_IDC_5_1;
|
||||
if (pixrate < 1'069'547'520)
|
||||
return STD_VIDEO_H265_LEVEL_IDC_6_0;
|
||||
if (pixrate < 2'139'095'040)
|
||||
return STD_VIDEO_H265_LEVEL_IDC_6_1;
|
||||
return STD_VIDEO_H265_LEVEL_IDC_6_2;
|
||||
}
|
||||
|
||||
static uint32_t find_lsb(uint32_t v)
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
if (v & (1u << i))
|
||||
return i;
|
||||
|
||||
throw std::runtime_error(std::string("invalid value in encode capabilities reported by gpu driver"));
|
||||
}
|
||||
|
||||
static uint32_t find_msb(uint32_t v)
|
||||
{
|
||||
for (int i = 31; i >= 0; i--)
|
||||
if (v & (1u << i))
|
||||
return i;
|
||||
|
||||
throw std::runtime_error(std::string("invalid value in encode capabilities reported by gpu driver"));
|
||||
}
|
||||
|
||||
wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(
|
||||
wivrn_vk_bundle & vk,
|
||||
vk::Rect2D rect,
|
||||
const vk::VideoCapabilitiesKHR & video_caps,
|
||||
const vk::VideoEncodeCapabilitiesKHR & encode_caps,
|
||||
float fps,
|
||||
uint8_t stream_idx,
|
||||
const encoder_settings & settings) :
|
||||
video_encoder_vulkan(vk, rect, video_caps, encode_caps, fps, stream_idx, settings),
|
||||
vui{
|
||||
.flags = {
|
||||
.aspect_ratio_info_present_flag = 1,
|
||||
.video_signal_type_present_flag = 1,
|
||||
.video_full_range_flag = 1,
|
||||
.colour_description_present_flag = 1,
|
||||
.chroma_loc_info_present_flag = 1,
|
||||
.vui_timing_info_present_flag = 0, // no fixed framerate
|
||||
.motion_vectors_over_pic_boundaries_flag = 1, // allow motion vectors that exceed picture boundaries
|
||||
.restricted_ref_pic_lists_flag = 1, // all slices in a single picture use the same referene
|
||||
},
|
||||
.aspect_ratio_idc = STD_VIDEO_H265_ASPECT_RATIO_IDC_SQUARE, // _pixels_ are square
|
||||
.video_format = 5, // unspecified video format
|
||||
.colour_primaries = 1, // BT.709
|
||||
.transfer_characteristics = 1, // BT.709
|
||||
.matrix_coeffs = 1, // BT.709
|
||||
.chroma_sample_loc_type_top_field = 0,
|
||||
.chroma_sample_loc_type_bottom_field = 0,
|
||||
|
||||
},
|
||||
dpb{.max_latency_increase_plus1 = {1}, .max_dec_pic_buffering_minus1 = {uint8_t(num_dpb_slots > 0 ? num_dpb_slots - 1 : 0)}, .max_num_reorder_pics = {0}},
|
||||
ptl{.flags = {
|
||||
.general_tier_flag = 1, // 1 if >=STD_VIDEO_H265_LEVEL_IDC_5_0 and we only do 5 and above
|
||||
.general_progressive_source_flag = 1,
|
||||
.general_interlaced_source_flag = 0,
|
||||
.general_non_packed_constraint_flag = 0,
|
||||
.general_frame_only_constraint_flag = 1,
|
||||
},
|
||||
.general_profile_idc = (settings.bit_depth == 10) ? STD_VIDEO_H265_PROFILE_IDC_MAIN_10 : STD_VIDEO_H265_PROFILE_IDC_MAIN,
|
||||
.general_level_idc = choose_level(rect.extent.width, rect.extent.height, fps)},
|
||||
vps{
|
||||
.flags{
|
||||
.vps_temporal_id_nesting_flag = 0,
|
||||
.flags = {
|
||||
.vps_temporal_id_nesting_flag = 1, // radv breaks without
|
||||
.vps_sub_layer_ordering_info_present_flag = 0,
|
||||
.vps_timing_info_present_flag = 0,
|
||||
.vps_poc_proportional_to_timing_flag = 0,
|
||||
@@ -37,55 +112,31 @@ wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(wivrn_vk_bundle & vk
|
||||
.vps_num_units_in_tick = 0,
|
||||
.vps_time_scale = 0,
|
||||
.vps_num_ticks_poc_diff_one_minus1 = 0,
|
||||
.reserved3 = 0,
|
||||
.pDecPicBufMgr = &dpb,
|
||||
.pHrdParameters = nullptr,
|
||||
.pProfileTierLevel = &ptl,
|
||||
},
|
||||
sps{
|
||||
.flags{
|
||||
.sps_temporal_id_nesting_flag = 0,
|
||||
.separate_colour_plane_flag = 0,
|
||||
.conformance_window_flag = 0,
|
||||
.sps_sub_layer_ordering_info_present_flag = 0,
|
||||
.scaling_list_enabled_flag = 0,
|
||||
.sps_scaling_list_data_present_flag = 0,
|
||||
.amp_enabled_flag = 0,
|
||||
.sample_adaptive_offset_enabled_flag = 0,
|
||||
.pcm_enabled_flag = 0,
|
||||
.pcm_loop_filter_disabled_flag = 0,
|
||||
.long_term_ref_pics_present_flag = 0,
|
||||
.sps_temporal_mvp_enabled_flag = 0,
|
||||
.strong_intra_smoothing_enabled_flag = 0,
|
||||
.vui_parameters_present_flag = 0,
|
||||
.sps_extension_present_flag = 0,
|
||||
.sps_range_extension_flag = 0,
|
||||
.transform_skip_rotation_enabled_flag = 0,
|
||||
.transform_skip_context_enabled_flag = 0,
|
||||
.implicit_rdpcm_enabled_flag = 0,
|
||||
.explicit_rdpcm_enabled_flag = 0,
|
||||
.extended_precision_processing_flag = 0,
|
||||
.intra_smoothing_disabled_flag = 0,
|
||||
.high_precision_offsets_enabled_flag = 0,
|
||||
.persistent_rice_adaptation_enabled_flag = 0,
|
||||
.cabac_bypass_alignment_enabled_flag = 0,
|
||||
.sps_scc_extension_flag = 0,
|
||||
.sps_curr_pic_ref_enabled_flag = 0,
|
||||
.palette_mode_enabled_flag = 0,
|
||||
.sps_palette_predictor_initializers_present_flag = 0,
|
||||
.intra_boundary_filtering_disabled_flag = 0,
|
||||
.flags = {
|
||||
.sps_temporal_id_nesting_flag = 1, // radv breaks without
|
||||
.conformance_window_flag = 1, // conf_win_* are set
|
||||
.amp_enabled_flag = 1, // confirmed ok
|
||||
.sample_adaptive_offset_enabled_flag = 0, // off for (ultra) low-latency
|
||||
.strong_intra_smoothing_enabled_flag = 1, // confirmed ok
|
||||
.vui_parameters_present_flag = 1,
|
||||
.sps_range_extension_flag = (settings.bit_depth == 10) ? 1u : 0u,
|
||||
},
|
||||
.chroma_format_idc = STD_VIDEO_H265_CHROMA_FORMAT_IDC_420,
|
||||
.pic_width_in_luma_samples = 0,
|
||||
.pic_height_in_luma_samples = 0,
|
||||
.pic_width_in_luma_samples = aligned_extent.width, // confirmed
|
||||
.pic_height_in_luma_samples = aligned_extent.height, // confirmed
|
||||
.sps_video_parameter_set_id = 0,
|
||||
.sps_max_sub_layers_minus1 = 0,
|
||||
.sps_seq_parameter_set_id = 0,
|
||||
.bit_depth_luma_minus8 = 0,
|
||||
.bit_depth_chroma_minus8 = 0,
|
||||
.log2_max_pic_order_cnt_lsb_minus4 = 0,
|
||||
.log2_min_luma_coding_block_size_minus3 = 0,
|
||||
.log2_diff_max_min_luma_coding_block_size = 0,
|
||||
.log2_min_luma_transform_block_size_minus2 = 0,
|
||||
.log2_diff_max_min_luma_transform_block_size = 0,
|
||||
.max_transform_hierarchy_depth_inter = 0,
|
||||
.max_transform_hierarchy_depth_intra = 0,
|
||||
.bit_depth_luma_minus8 = static_cast<uint8_t>(settings.bit_depth - 8),
|
||||
.bit_depth_chroma_minus8 = static_cast<uint8_t>(settings.bit_depth - 8),
|
||||
.log2_max_pic_order_cnt_lsb_minus4 = 4, // arbitrary
|
||||
.log2_min_luma_coding_block_size_minus3 = 0, // keep it 0, related values are filled in create()
|
||||
.num_short_term_ref_pic_sets = 0,
|
||||
.num_long_term_ref_pics_sps = 0,
|
||||
.pcm_sample_bit_depth_luma_minus1 = 0,
|
||||
@@ -98,46 +149,26 @@ wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(wivrn_vk_bundle & vk
|
||||
.delta_palette_max_predictor_size = 0,
|
||||
.motion_vector_resolution_control_idc = 0,
|
||||
.sps_num_palette_predictor_initializers_minus1 = 0,
|
||||
.conf_win_left_offset = 0,
|
||||
.conf_win_right_offset = 0,
|
||||
.conf_win_top_offset = 0,
|
||||
.conf_win_bottom_offset = 0,
|
||||
.conf_win_left_offset = 0u,
|
||||
.conf_win_right_offset = (aligned_extent.width - rect.extent.width) >> 1, // 4:2:0
|
||||
.conf_win_top_offset = 0u,
|
||||
.conf_win_bottom_offset = (aligned_extent.height - rect.extent.height) >> 1, // 4:2:0
|
||||
.pProfileTierLevel = &ptl,
|
||||
.pDecPicBufMgr = &dpb,
|
||||
.pScalingLists = nullptr,
|
||||
.pShortTermRefPicSet = nullptr,
|
||||
.pLongTermRefPicsSps = nullptr,
|
||||
.pSequenceParameterSetVui = &vui,
|
||||
.pPredictorPaletteEntries = nullptr,
|
||||
},
|
||||
pps{
|
||||
.flags =
|
||||
{
|
||||
.dependent_slice_segments_enabled_flag = 0,
|
||||
.output_flag_present_flag = 0,
|
||||
.sign_data_hiding_enabled_flag = 0,
|
||||
.cabac_init_present_flag = 0,
|
||||
.constrained_intra_pred_flag = 0,
|
||||
.transform_skip_enabled_flag = 0,
|
||||
.cu_qp_delta_enabled_flag = 0,
|
||||
.pps_slice_chroma_qp_offsets_present_flag = 0,
|
||||
.weighted_pred_flag = 0,
|
||||
.weighted_bipred_flag = 0,
|
||||
.transquant_bypass_enabled_flag = 0,
|
||||
.tiles_enabled_flag = 0,
|
||||
.entropy_coding_sync_enabled_flag = 0,
|
||||
.uniform_spacing_flag = 0,
|
||||
.loop_filter_across_tiles_enabled_flag = 0,
|
||||
.pps_loop_filter_across_slices_enabled_flag = 0,
|
||||
.deblocking_filter_control_present_flag = 0,
|
||||
.deblocking_filter_override_enabled_flag = 0,
|
||||
.pps_deblocking_filter_disabled_flag = 0,
|
||||
.pps_scaling_list_data_present_flag = 0,
|
||||
.lists_modification_present_flag = 0,
|
||||
.slice_segment_header_extension_present_flag = 0,
|
||||
.pps_extension_present_flag = 0,
|
||||
.cross_component_prediction_enabled_flag = 0,
|
||||
.chroma_qp_offset_list_enabled_flag = 0,
|
||||
.pps_curr_pic_ref_enabled_flag = 0,
|
||||
.residual_adaptive_colour_transform_enabled_flag = 0,
|
||||
.pps_slice_act_qp_offsets_present_flag = 0,
|
||||
.pps_palette_predictor_initializers_present_flag = 0,
|
||||
.monochrome_palette_flag = 0,
|
||||
.pps_range_extension_flag = 0,
|
||||
},
|
||||
.flags = {
|
||||
.cu_qp_delta_enabled_flag = 1, // must be 1 or nvidia breaks
|
||||
.transquant_bypass_enabled_flag = 0, // only 1 when tuned for lossless
|
||||
.deblocking_filter_control_present_flag = 1,
|
||||
.pps_range_extension_flag = (settings.bit_depth == 10) ? 1u : 0u,
|
||||
},
|
||||
|
||||
.pps_pic_parameter_set_id = 0,
|
||||
.pps_seq_parameter_set_id = 0,
|
||||
.sps_video_parameter_set_id = 0,
|
||||
@@ -151,7 +182,6 @@ wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(wivrn_vk_bundle & vk
|
||||
.pps_beta_offset_div2 = 0,
|
||||
.pps_tc_offset_div2 = 0,
|
||||
.log2_parallel_merge_level_minus2 = 0,
|
||||
.log2_max_transform_skip_block_size_minus2 = 0,
|
||||
.diff_cu_chroma_qp_offset_depth = 0,
|
||||
.chroma_qp_offset_list_len_minus1 = 0,
|
||||
.cb_qp_offset_list = {},
|
||||
@@ -162,8 +192,8 @@ wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(wivrn_vk_bundle & vk
|
||||
.pps_act_cb_qp_offset_plus5 = 0,
|
||||
.pps_act_cr_qp_offset_plus3 = 0,
|
||||
.pps_num_palette_predictor_initializers = 0,
|
||||
.luma_bit_depth_entry_minus8 = 0,
|
||||
.chroma_bit_depth_entry_minus8 = 0,
|
||||
.luma_bit_depth_entry_minus8 = static_cast<uint8_t>(settings.bit_depth - 8),
|
||||
.chroma_bit_depth_entry_minus8 = static_cast<uint8_t>(settings.bit_depth - 8),
|
||||
.num_tile_columns_minus1 = 0,
|
||||
.num_tile_rows_minus1 = 0,
|
||||
.reserved1 = 0,
|
||||
@@ -171,6 +201,8 @@ wivrn::video_encoder_vulkan_h265::video_encoder_vulkan_h265(wivrn_vk_bundle & vk
|
||||
.column_width_minus1 = {},
|
||||
.row_height_minus1 = {},
|
||||
.reserved3 = 0,
|
||||
.pScalingLists = nullptr,
|
||||
.pPredictorPaletteEntries = nullptr,
|
||||
}
|
||||
{
|
||||
if (not std::ranges::any_of(vk.device_extensions, [](std::string_view ext) { return ext == VK_KHR_VIDEO_ENCODE_H265_EXTENSION_NAME; }))
|
||||
@@ -195,44 +227,79 @@ std::vector<void *> wivrn::video_encoder_vulkan_h265::setup_slot_info(size_t dpb
|
||||
return res;
|
||||
}
|
||||
|
||||
std::unique_ptr<wivrn::video_encoder_vulkan_h265> wivrn::video_encoder_vulkan_h265::create(
|
||||
wivrn_vk_bundle & vk,
|
||||
encoder_settings & settings,
|
||||
float fps)
|
||||
static auto get_video_caps(vk::raii::PhysicalDevice & phys_dev, int bit_depth)
|
||||
{
|
||||
vk::Rect2D rect{
|
||||
.offset = {
|
||||
.x = settings.offset_x,
|
||||
.y = settings.offset_y,
|
||||
if (!(bit_depth == 8 || bit_depth == 10))
|
||||
throw std::runtime_error("h265 encoder supports 8-bit or 10-bit only");
|
||||
|
||||
vk::StructureChain video_profile_info{
|
||||
vk::VideoProfileInfoKHR{
|
||||
.videoCodecOperation = vk::VideoCodecOperationFlagBitsKHR::eEncodeH265,
|
||||
.chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420,
|
||||
.lumaBitDepth = bit_depth == 10 ? vk::VideoComponentBitDepthFlagBitsKHR::e10 : vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
.chromaBitDepth = bit_depth == 10 ? vk::VideoComponentBitDepthFlagBitsKHR::e10 : vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
},
|
||||
.extent = {
|
||||
.width = settings.width,
|
||||
.height = settings.height,
|
||||
vk::VideoEncodeH265ProfileInfoKHR{
|
||||
.stdProfileIdc = bit_depth == 10 ? STD_VIDEO_H265_PROFILE_IDC_MAIN_10 : STD_VIDEO_H265_PROFILE_IDC_MAIN,
|
||||
},
|
||||
};
|
||||
vk::VideoEncodeUsageInfoKHR{
|
||||
.videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming,
|
||||
.videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered,
|
||||
.tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency,
|
||||
}};
|
||||
|
||||
try
|
||||
{
|
||||
auto [video_caps, encode_caps, encode_h265_caps] =
|
||||
phys_dev.getVideoCapabilitiesKHR<
|
||||
vk::VideoCapabilitiesKHR,
|
||||
vk::VideoEncodeCapabilitiesKHR,
|
||||
vk::VideoEncodeH265CapabilitiesKHR>(video_profile_info.get());
|
||||
return std::make_tuple(video_caps, encode_caps, encode_h265_caps, video_profile_info);
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
// NVIDIA fails if the structure is there
|
||||
video_profile_info.unlink<vk::VideoEncodeUsageInfoKHR>();
|
||||
|
||||
auto [video_caps, encode_caps, encode_h265_caps] =
|
||||
vk.physical_device.getVideoCapabilitiesKHR<
|
||||
phys_dev.getVideoCapabilitiesKHR<
|
||||
vk::VideoCapabilitiesKHR,
|
||||
vk::VideoEncodeCapabilitiesKHR,
|
||||
vk::VideoEncodeH265CapabilitiesKHR>(video_profile_info.get());
|
||||
return std::make_tuple(video_caps, encode_caps, encode_h265_caps, video_profile_info);
|
||||
}
|
||||
|
||||
std::unique_ptr<video_encoder_vulkan_h265> self(new video_encoder_vulkan_h265(vk, rect, encode_caps, fps, settings.bitrate));
|
||||
std::unique_ptr<wivrn::video_encoder_vulkan_h265> wivrn::video_encoder_vulkan_h265::create(
|
||||
wivrn_vk_bundle & vk,
|
||||
encoder_settings & settings,
|
||||
float fps,
|
||||
uint8_t stream_idx)
|
||||
{
|
||||
vk::Rect2D rect{
|
||||
.offset = {.x = settings.offset_x, .y = settings.offset_y},
|
||||
.extent = {.width = settings.width, .height = settings.height},
|
||||
};
|
||||
|
||||
vk::VideoEncodeH265SessionParametersAddInfoKHR h265_add_info{};
|
||||
h265_add_info.setStdVPSs(self->vps);
|
||||
h265_add_info.setStdSPSs(self->sps);
|
||||
h265_add_info.setStdPPSs(self->pps);
|
||||
auto [video_caps, encode_caps, encode_h265_caps, video_profile_info] = get_video_caps(vk.physical_device, settings.bit_depth);
|
||||
|
||||
vk::VideoEncodeH265SessionParametersCreateInfoKHR h265_session_params{
|
||||
std::unique_ptr<video_encoder_vulkan_h265> self(
|
||||
new video_encoder_vulkan_h265(vk, rect, video_caps, encode_caps, fps, stream_idx, settings));
|
||||
|
||||
vk::VideoEncodeH265SessionParametersAddInfoKHR add_info{};
|
||||
add_info.setStdVPSs(self->vps);
|
||||
add_info.setStdSPSs(self->sps);
|
||||
add_info.setStdPPSs(self->pps);
|
||||
|
||||
vk::VideoEncodeH265SessionParametersCreateInfoKHR session_params_info{
|
||||
.maxStdVPSCount = 1,
|
||||
.maxStdSPSCount = 1,
|
||||
.maxStdPPSCount = 1,
|
||||
.pParametersAddInfo = &h265_add_info,
|
||||
.pParametersAddInfo = &add_info,
|
||||
};
|
||||
|
||||
vk::VideoEncodeH265SessionCreateInfoKHR session_create_info{
|
||||
.useMaxLevelIdc = false,
|
||||
.useMaxLevelIdc = false, // let driver clamp if needed
|
||||
};
|
||||
|
||||
if (encode_h265_caps.requiresGopRemainingFrames)
|
||||
@@ -243,16 +310,39 @@ std::unique_ptr<wivrn::video_encoder_vulkan_h265> wivrn::video_encoder_vulkan_h2
|
||||
.gopRemainingP = std::numeric_limits<uint32_t>::max(),
|
||||
.gopRemainingB = 0,
|
||||
};
|
||||
self->rate_control_h265 = vk::VideoEncodeH265RateControlInfoKHR{
|
||||
self->rc_h265 = vk::VideoEncodeH265RateControlInfoKHR{
|
||||
.pNext = &self->gop_info,
|
||||
.gopFrameCount = std::numeric_limits<uint32_t>::max(),
|
||||
.idrPeriod = std::numeric_limits<uint32_t>::max(),
|
||||
.flags = {},
|
||||
};
|
||||
self->rate_control->pNext = &self->rate_control_h265;
|
||||
self->rate_control->pNext = &self->rc_h265;
|
||||
}
|
||||
|
||||
self->init(video_caps, video_profile_info.get(), &session_create_info, &h265_session_params);
|
||||
self->sps.log2_diff_max_min_luma_coding_block_size = find_msb((uint32_t)encode_h265_caps.ctbSizes) + 1; // First bit is 16x16.
|
||||
self->sps.log2_min_luma_transform_block_size_minus2 = find_lsb((uint32_t)encode_h265_caps.transformBlockSizes);
|
||||
self->sps.log2_diff_max_min_luma_transform_block_size =
|
||||
find_msb((uint32_t)encode_h265_caps.transformBlockSizes) - find_lsb((uint32_t)encode_h265_caps.transformBlockSizes);
|
||||
|
||||
uint32_t max_transform_hierarchy = (find_msb((uint32_t)encode_h265_caps.ctbSizes) + 4) - (find_lsb((uint32_t)encode_h265_caps.transformBlockSizes) + 2);
|
||||
self->sps.max_transform_hierarchy_depth_inter = max_transform_hierarchy;
|
||||
self->sps.max_transform_hierarchy_depth_intra = max_transform_hierarchy;
|
||||
|
||||
uint32_t syntax_flags = (uint32_t)encode_h265_caps.stdSyntaxFlags;
|
||||
|
||||
if ((syntax_flags & VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_SET_BIT_KHR) != 0 ||
|
||||
(syntax_flags & VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_UNSET_BIT_KHR) == 0)
|
||||
{
|
||||
self->pps.flags.transform_skip_enabled_flag = 1;
|
||||
self->pps.log2_max_transform_skip_block_size_minus2 = find_msb((uint32_t)encode_h265_caps.transformBlockSizes);
|
||||
}
|
||||
|
||||
if ((syntax_flags & VK_VIDEO_ENCODE_H265_STD_CONSTRAINED_INTRA_PRED_FLAG_SET_BIT_KHR) != 0)
|
||||
self->pps.flags.constrained_intra_pred_flag = 1;
|
||||
|
||||
if ((syntax_flags & VK_VIDEO_ENCODE_H265_STD_SAMPLE_ADAPTIVE_OFFSET_ENABLED_FLAG_SET_BIT_KHR) != 0)
|
||||
self->sample_adaptive_offset_enabled = true;
|
||||
|
||||
self->rate_control_layer.pNext = &self->rc_layer_h265;
|
||||
self->init(video_caps, video_profile_info.get(), &session_create_info, &session_params_info);
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -262,6 +352,9 @@ std::vector<uint8_t> wivrn::video_encoder_vulkan_h265::get_vps_sps_pps()
|
||||
.writeStdVPS = true,
|
||||
.writeStdSPS = true,
|
||||
.writeStdPPS = true,
|
||||
.stdVPSId = 0,
|
||||
.stdSPSId = 0,
|
||||
.stdPPSId = 0,
|
||||
};
|
||||
return get_encoded_parameters(&next);
|
||||
}
|
||||
@@ -269,50 +362,28 @@ std::vector<uint8_t> wivrn::video_encoder_vulkan_h265::get_vps_sps_pps()
|
||||
void wivrn::video_encoder_vulkan_h265::send_idr_data()
|
||||
{
|
||||
auto data = get_vps_sps_pps();
|
||||
SendData(data, false);
|
||||
SendData(data, false, true);
|
||||
}
|
||||
|
||||
void * wivrn::video_encoder_vulkan_h265::encode_info_next(uint32_t frame_num, size_t slot, std::optional<size_t> ref)
|
||||
void * wivrn::video_encoder_vulkan_h265::encode_info_next(uint32_t frame_num, size_t slot, std::optional<int32_t> ref_slot)
|
||||
{
|
||||
slice_header = {
|
||||
.flags =
|
||||
{
|
||||
.first_slice_segment_in_pic_flag = 0,
|
||||
.dependent_slice_segment_flag = 0,
|
||||
.slice_sao_luma_flag = 0,
|
||||
.slice_sao_chroma_flag = 0,
|
||||
.num_ref_idx_active_override_flag = 0,
|
||||
.mvd_l1_zero_flag = 0,
|
||||
.cabac_init_flag = 0,
|
||||
.cu_chroma_qp_offset_enabled_flag = 0,
|
||||
.deblocking_filter_override_flag = 0,
|
||||
.slice_deblocking_filter_disabled_flag = 0,
|
||||
.collocated_from_l0_flag = 0,
|
||||
.slice_loop_filter_across_slices_enabled_flag = 0,
|
||||
},
|
||||
.slice_type = ref ? STD_VIDEO_H265_SLICE_TYPE_P
|
||||
: STD_VIDEO_H265_SLICE_TYPE_I,
|
||||
.slice_segment_address = 0,
|
||||
.collocated_ref_idx = 0,
|
||||
.MaxNumMergeCand = 0,
|
||||
.slice_cb_qp_offset = 0,
|
||||
.slice_cr_qp_offset = 0,
|
||||
.slice_beta_offset_div2 = 0,
|
||||
.slice_tc_offset_div2 = 0,
|
||||
.slice_act_y_qp_offset = 0,
|
||||
.slice_act_cb_qp_offset = 0,
|
||||
.slice_act_cr_qp_offset = 0,
|
||||
.slice_qp_delta = 0,
|
||||
.flags = {
|
||||
.first_slice_segment_in_pic_flag = 1,
|
||||
.slice_sao_luma_flag = sample_adaptive_offset_enabled,
|
||||
.slice_sao_chroma_flag = sample_adaptive_offset_enabled,
|
||||
.num_ref_idx_active_override_flag = ref_slot ? 1u : 0u,
|
||||
.collocated_from_l0_flag = 1,
|
||||
},
|
||||
.slice_type = ref_slot ? STD_VIDEO_H265_SLICE_TYPE_P : STD_VIDEO_H265_SLICE_TYPE_I,
|
||||
.MaxNumMergeCand = 5,
|
||||
};
|
||||
nalu_slice_info = vk::VideoEncodeH265NaluSliceSegmentInfoKHR{
|
||||
.constantQp = 0,
|
||||
.pStdSliceSegmentHeader = &slice_header,
|
||||
};
|
||||
reference_lists_info = {
|
||||
.flags =
|
||||
{
|
||||
.ref_pic_list_modification_flag_l0 = 0,
|
||||
.ref_pic_list_modification_flag_l1 = 0,
|
||||
},
|
||||
.flags = {.ref_pic_list_modification_flag_l0 = 0, .ref_pic_list_modification_flag_l1 = 0},
|
||||
.num_ref_idx_l0_active_minus1 = 0,
|
||||
.num_ref_idx_l1_active_minus1 = 0,
|
||||
.RefPicList0 = {},
|
||||
@@ -320,92 +391,99 @@ void * wivrn::video_encoder_vulkan_h265::encode_info_next(uint32_t frame_num, si
|
||||
.list_entry_l0 = {},
|
||||
.list_entry_l1 = {},
|
||||
};
|
||||
std::fill(reference_lists_info.RefPicList0,
|
||||
reference_lists_info.RefPicList0 + sizeof(reference_lists_info.RefPicList0),
|
||||
STD_VIDEO_H265_NO_REFERENCE_PICTURE);
|
||||
std::fill(reference_lists_info.RefPicList1,
|
||||
reference_lists_info.RefPicList1 + sizeof(reference_lists_info.RefPicList1),
|
||||
STD_VIDEO_H265_NO_REFERENCE_PICTURE);
|
||||
if (ref)
|
||||
std::ranges::fill(reference_lists_info.RefPicList0, STD_VIDEO_H265_NO_REFERENCE_PICTURE);
|
||||
std::ranges::fill(reference_lists_info.RefPicList1, STD_VIDEO_H265_NO_REFERENCE_PICTURE);
|
||||
|
||||
const int32_t poc = int32_t(frame_num);
|
||||
|
||||
if (ref_slot)
|
||||
{
|
||||
reference_lists_info.RefPicList0[0] = *ref;
|
||||
const int32_t refPoc = dpb_std_info[*ref_slot].PicOrderCntVal;
|
||||
|
||||
st_rps = {};
|
||||
|
||||
for (uint32_t i = 0; i < poc_history.size(); ++i)
|
||||
{
|
||||
const uint32_t delta = uint32_t(poc - poc_history[i]) - i; // deltas are accumulative!
|
||||
st_rps.delta_poc_s0_minus1[i] = uint16_t(delta - 1);
|
||||
if (poc_history[i] == refPoc)
|
||||
{
|
||||
st_rps.used_by_curr_pic_s0_flag |= (1u << i);
|
||||
st_rps.num_negative_pics = uint8_t(i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
st_rps.num_positive_pics = 0;
|
||||
st_rps.used_by_curr_pic_flag = 0;
|
||||
|
||||
reference_lists_info.num_ref_idx_l0_active_minus1 = 0;
|
||||
reference_lists_info.RefPicList0[0] = static_cast<uint8_t>(*ref_slot);
|
||||
|
||||
if (st_rps.used_by_curr_pic_s0_flag == 0)
|
||||
{
|
||||
// ref_slot is too old → encode an IDR instead
|
||||
ref_slot.reset();
|
||||
poc_history.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
poc_history.clear();
|
||||
}
|
||||
|
||||
std_picture_info = {
|
||||
.flags =
|
||||
{
|
||||
.is_reference = 1,
|
||||
.IrapPicFlag = uint32_t(ref ? 0 : 1),
|
||||
.used_for_long_term_reference = 0,
|
||||
.discardable_flag = 0,
|
||||
.cross_layer_bla_flag = 0,
|
||||
.pic_output_flag = 0,
|
||||
.no_output_of_prior_pics_flag = 0,
|
||||
.short_term_ref_pic_set_sps_flag = 0,
|
||||
.slice_temporal_mvp_enabled_flag = 0,
|
||||
},
|
||||
.pic_type = ref ? STD_VIDEO_H265_PICTURE_TYPE_P
|
||||
: STD_VIDEO_H265_PICTURE_TYPE_IDR,
|
||||
.flags = {
|
||||
.is_reference = 1,
|
||||
.IrapPicFlag = ref_slot ? 0u : 1u,
|
||||
.used_for_long_term_reference = 0,
|
||||
.discardable_flag = 0,
|
||||
.cross_layer_bla_flag = 0,
|
||||
.pic_output_flag = 1,
|
||||
.no_output_of_prior_pics_flag = ref_slot ? 0u : 1u,
|
||||
.short_term_ref_pic_set_sps_flag = 0u,
|
||||
.slice_temporal_mvp_enabled_flag = 1,
|
||||
},
|
||||
.pic_type = ref_slot ? STD_VIDEO_H265_PICTURE_TYPE_P : STD_VIDEO_H265_PICTURE_TYPE_IDR,
|
||||
.sps_video_parameter_set_id = 0,
|
||||
.pps_seq_parameter_set_id = 0,
|
||||
.pps_pic_parameter_set_id = 0,
|
||||
.pps_seq_parameter_set_id = sps.sps_seq_parameter_set_id,
|
||||
.pps_pic_parameter_set_id = pps.pps_pic_parameter_set_id,
|
||||
.short_term_ref_pic_set_idx = 0,
|
||||
.PicOrderCntVal = 0,
|
||||
.PicOrderCntVal = int32_t(poc),
|
||||
.TemporalId = 0,
|
||||
.reserved1 = {},
|
||||
.pRefLists = ref_slot ? &reference_lists_info : nullptr,
|
||||
.pShortTermRefPicSet = ref_slot ? &st_rps : nullptr,
|
||||
.pLongTermRefPics = nullptr,
|
||||
};
|
||||
|
||||
picture_info = vk::VideoEncodeH265PictureInfoKHR{
|
||||
.naluSliceSegmentEntryCount = 1,
|
||||
.pNaluSliceSegmentEntries = &nalu_slice_info,
|
||||
.pStdPictureInfo = &std_picture_info,
|
||||
};
|
||||
|
||||
dpb_std_info[slot].pic_type = std_picture_info.pic_type;
|
||||
auto & i = dpb_std_info[slot];
|
||||
i.flags = {.used_for_long_term_reference = 0, .unused_for_reference = 0};
|
||||
i.pic_type = std_picture_info.pic_type;
|
||||
i.PicOrderCntVal = std_picture_info.PicOrderCntVal;
|
||||
i.TemporalId = std_picture_info.TemporalId;
|
||||
|
||||
if (not ref)
|
||||
++idr_id;
|
||||
const uint32_t history_limit = std::min<uint32_t>(16u, dpb.max_dec_pic_buffering_minus1[0]);
|
||||
|
||||
if (poc_history.size() < 1 || poc_history.front() != poc)
|
||||
poc_history.push_front(poc);
|
||||
if (poc_history.size() > history_limit)
|
||||
poc_history.pop_back();
|
||||
|
||||
return &picture_info;
|
||||
}
|
||||
|
||||
vk::ExtensionProperties wivrn::video_encoder_vulkan_h265::std_header_version()
|
||||
{
|
||||
// FIXME: update to version 1.0
|
||||
vk::ExtensionProperties std_header_version{
|
||||
.specVersion = 0x0000900b, // VK_MAKE_VIDEO_STD_VERSION(1, 0, 0),
|
||||
.specVersion = VK_MAKE_VIDEO_STD_VERSION(1, 0, 0),
|
||||
};
|
||||
strcpy(std_header_version.extensionName,
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME);
|
||||
return std_header_version;
|
||||
}
|
||||
|
||||
decltype(wivrn::video_encoder_vulkan_h265::video_profile_info) wivrn::video_encoder_vulkan_h265::video_profile_info = vk::StructureChain{
|
||||
vk::VideoProfileInfoKHR{
|
||||
.videoCodecOperation =
|
||||
vk::VideoCodecOperationFlagBitsKHR::eEncodeH265,
|
||||
.chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420,
|
||||
.lumaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
.chromaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
},
|
||||
vk::VideoEncodeH265ProfileInfoKHR{
|
||||
.stdProfileIdc = STD_VIDEO_H265_PROFILE_IDC_MAIN,
|
||||
},
|
||||
vk::VideoEncodeUsageInfoKHR{
|
||||
.videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming,
|
||||
.videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered,
|
||||
.tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency,
|
||||
}};
|
||||
vk::StructureChain video_profile_info{
|
||||
vk::VideoProfileInfoKHR{
|
||||
.videoCodecOperation =
|
||||
vk::VideoCodecOperationFlagBitsKHR::eEncodeH265,
|
||||
.chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420,
|
||||
.lumaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
.chromaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
},
|
||||
vk::VideoEncodeH265ProfileInfoKHR{
|
||||
.stdProfileIdc = STD_VIDEO_H265_PROFILE_IDC_MAIN,
|
||||
},
|
||||
vk::VideoEncodeUsageInfoKHR{
|
||||
.videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming,
|
||||
.videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered,
|
||||
.tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency,
|
||||
}};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "video_encoder_vulkan.h"
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@@ -26,33 +27,50 @@
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
class video_encoder_vulkan_h265 : public video_encoder_vulkan
|
||||
{
|
||||
uint16_t idr_id = 0;
|
||||
StdVideoH265VideoParameterSet vps;
|
||||
StdVideoH265SequenceParameterSet sps;
|
||||
StdVideoH265PictureParameterSet pps;
|
||||
std::deque<int32_t> poc_history;
|
||||
bool sample_adaptive_offset_enabled = false;
|
||||
|
||||
StdVideoEncodeH265SliceSegmentHeader slice_header;
|
||||
vk::VideoEncodeH265NaluSliceSegmentInfoKHR nalu_slice_info;
|
||||
StdVideoH265SequenceParameterSetVui vui{};
|
||||
StdVideoH265DecPicBufMgr dpb{};
|
||||
|
||||
StdVideoEncodeH265PictureInfo std_picture_info;
|
||||
vk::VideoEncodeH265PictureInfoKHR picture_info;
|
||||
StdVideoH265ProfileTierLevel ptl{};
|
||||
StdVideoH265VideoParameterSet vps{};
|
||||
|
||||
StdVideoEncodeH265ReferenceListsInfo reference_lists_info;
|
||||
StdVideoH265SequenceParameterSet sps{};
|
||||
|
||||
StdVideoH265PictureParameterSet pps{};
|
||||
|
||||
StdVideoH265ShortTermRefPicSet st_rps{};
|
||||
|
||||
StdVideoEncodeH265SliceSegmentHeader slice_header{};
|
||||
vk::VideoEncodeH265NaluSliceSegmentInfoKHR nalu_slice_info{};
|
||||
|
||||
StdVideoEncodeH265ReferenceListsInfo reference_lists_info{};
|
||||
StdVideoEncodeH265PictureInfo std_picture_info{};
|
||||
vk::VideoEncodeH265PictureInfoKHR picture_info{};
|
||||
|
||||
std::vector<StdVideoEncodeH265ReferenceInfo> dpb_std_info;
|
||||
std::vector<vk::VideoEncodeH265DpbSlotInfoKHR> dpb_std_slots;
|
||||
|
||||
vk::VideoEncodeH265GopRemainingFrameInfoKHR gop_info;
|
||||
vk::VideoEncodeH265RateControlInfoKHR rate_control_h265;
|
||||
vk::VideoEncodeH265GopRemainingFrameInfoKHR gop_info{};
|
||||
vk::VideoEncodeH265RateControlInfoKHR rc_h265{};
|
||||
vk::VideoEncodeH265RateControlLayerInfoKHR rc_layer_h265{};
|
||||
|
||||
video_encoder_vulkan_h265(wivrn_vk_bundle & vk, vk::Rect2D rect, vk::VideoEncodeCapabilitiesKHR encode_caps, float fps, uint64_t bitrate);
|
||||
video_encoder_vulkan_h265(wivrn_vk_bundle & vk,
|
||||
vk::Rect2D rect,
|
||||
const vk::VideoCapabilitiesKHR & video_caps,
|
||||
const vk::VideoEncodeCapabilitiesKHR & encode_caps,
|
||||
float fps,
|
||||
uint8_t stream_idx,
|
||||
const encoder_settings & settings);
|
||||
|
||||
protected:
|
||||
std::vector<void *> setup_slot_info(size_t dpb_size) override;
|
||||
|
||||
void * encode_info_next(uint32_t frame_num, size_t slot, std::optional<size_t> ref) override;
|
||||
void * encode_info_next(uint32_t frame_num, size_t slot, std::optional<int32_t> ref_slot) override;
|
||||
virtual vk::ExtensionProperties std_header_version() override;
|
||||
|
||||
void send_idr_data() override;
|
||||
@@ -60,7 +78,8 @@ protected:
|
||||
public:
|
||||
static std::unique_ptr<video_encoder_vulkan_h265> create(wivrn_vk_bundle & vk,
|
||||
encoder_settings & settings,
|
||||
float fps);
|
||||
float fps,
|
||||
uint8_t stream_idx);
|
||||
|
||||
std::vector<uint8_t> get_vps_sps_pps();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void video_encoder_x264::ProcessCb(x264_t * h, x264_nal_t * nal, void * opaque)
|
||||
{
|
||||
case NAL_SPS:
|
||||
case NAL_PPS: {
|
||||
self->SendData(data, false);
|
||||
self->SendData(data, false, self->control);
|
||||
break;
|
||||
}
|
||||
case NAL_SLICE:
|
||||
@@ -57,7 +57,7 @@ void video_encoder_x264::ProcessNal(pending_nal && nal)
|
||||
if (nal.first_mb == next_mb)
|
||||
{
|
||||
next_mb = nal.last_mb + 1;
|
||||
SendData(nal.data, next_mb == num_mb);
|
||||
SendData(nal.data, next_mb == num_mb, control);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -91,7 +91,7 @@ video_encoder_x264::video_encoder_x264(
|
||||
encoder_settings & settings,
|
||||
float fps,
|
||||
uint8_t stream_idx) :
|
||||
video_encoder(stream_idx, settings.channels, settings.bitrate_multiplier, false)
|
||||
video_encoder(stream_idx, settings.channels, std::make_unique<default_idr_handler>(), settings.bitrate_multiplier, false)
|
||||
{
|
||||
if (settings.bit_depth != 8)
|
||||
throw std::runtime_error("x264 encoder only supports 8-bit encoding");
|
||||
@@ -239,7 +239,7 @@ std::pair<bool, vk::Semaphore> video_encoder_x264::present_image(vk::Image y_cbc
|
||||
return {false, nullptr};
|
||||
}
|
||||
|
||||
std::optional<video_encoder::data> video_encoder_x264::encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot)
|
||||
std::optional<video_encoder::data> video_encoder_x264::encode(uint8_t slot, uint64_t frame_index)
|
||||
{
|
||||
bool reconfigure = false;
|
||||
if (auto framerate = pending_framerate.exchange(0))
|
||||
@@ -256,16 +256,27 @@ std::optional<video_encoder::data> video_encoder_x264::encode(bool idr, std::chr
|
||||
param.rc.i_vbv_buffer_size = param.rc.i_bitrate / fps_mul * 1.1;
|
||||
param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
|
||||
}
|
||||
auto & idr_handler = ((default_idr_handler &)*idr);
|
||||
if (reconfigure)
|
||||
{
|
||||
x264_encoder_reconfig(enc, ¶m);
|
||||
idr = true;
|
||||
idr->reset();
|
||||
}
|
||||
auto frame_type = idr_handler.get_type(frame_index);
|
||||
int num_nal;
|
||||
x264_nal_t * nal;
|
||||
auto & pic = in[slot].pic;
|
||||
pic.i_type = idr ? X264_TYPE_IDR : X264_TYPE_P;
|
||||
pic.i_pts = pts.time_since_epoch().count();
|
||||
switch (frame_type)
|
||||
{
|
||||
case default_idr_handler::frame_type::i:
|
||||
control = true;
|
||||
pic.i_type = X264_TYPE_IDR;
|
||||
break;
|
||||
case default_idr_handler::frame_type::p:
|
||||
control = false;
|
||||
pic.i_type = X264_TYPE_P;
|
||||
break;
|
||||
}
|
||||
next_mb = 0;
|
||||
assert(pending_nals.empty());
|
||||
int size = x264_encoder_encode(enc, &nal, &num_nal, &pic, &pic_out);
|
||||
|
||||
@@ -34,6 +34,7 @@ class video_encoder_x264 : public video_encoder
|
||||
{
|
||||
x264_param_t param = {};
|
||||
x264_t * enc;
|
||||
bool control;
|
||||
|
||||
x264_picture_t pic_out = {};
|
||||
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
|
||||
std::pair<bool, vk::Semaphore> present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot, uint64_t frame_index) override;
|
||||
|
||||
std::optional<data> encode(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) override;
|
||||
std::optional<data> encode(uint8_t slot, uint64_t frame_index) override;
|
||||
|
||||
~video_encoder_x264();
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
[[maybe_unused]] vk::raii::Queue make_queue(vk::raii::Device & device, VkQueue queue, uint32_t family_index, uint32_t index)
|
||||
[[maybe_unused]] vk::raii::Queue make_queue(vk::raii::Device & device, vk_bundle_queue * queue)
|
||||
{
|
||||
if (queue == VK_NULL_HANDLE)
|
||||
if (queue == nullptr or queue->queue == VK_NULL_HANDLE)
|
||||
return nullptr;
|
||||
return vk::raii::Queue(device, family_index, index);
|
||||
return vk::raii::Queue(device, queue->family_index, queue->index);
|
||||
}
|
||||
|
||||
VkBool32 message_callback(
|
||||
@@ -92,8 +92,8 @@ wivrn::wivrn_vk_bundle::wivrn_vk_bundle(vk_bundle & vk, std::span<const char *>
|
||||
queue(device, vk.main_queue->family_index, vk.main_queue->index),
|
||||
queue_family_index(vk.main_queue->family_index),
|
||||
#ifdef VK_KHR_video_encode_queue
|
||||
encode_queue(make_queue(device, vk.encode_queue->queue, vk.encode_queue->family_index, vk.encode_queue->index)),
|
||||
encode_queue_family_index(vk.encode_queue->family_index),
|
||||
encode_queue(make_queue(device, vk.encode_queue)),
|
||||
encode_queue_family_index(vk.encode_queue ? vk.encode_queue->family_index : vk::QueueFamilyIgnored),
|
||||
#else
|
||||
encode_queue(nullptr),
|
||||
encode_queue_family_index(vk::QueueFamilyIgnored),
|
||||
|
||||
Reference in New Issue
Block a user