mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 00:51:32 -08:00
94 lines
2.5 KiB
C++
94 lines
2.5 KiB
C++
/*
|
|
* WiVRn VR streaming
|
|
* Copyright (C) 2022 Guillaume Meunier <[email protected]>
|
|
* Copyright (C) 2022 Patrick Nicolas <[email protected]>
|
|
*
|
|
* 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 "hostname.h"
|
|
#include "wivrn_config.h"
|
|
#include <array>
|
|
#include <chrono>
|
|
#include <filesystem>
|
|
#include <map>
|
|
#include <nlohmann/json.hpp>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <variant>
|
|
|
|
#include "wivrn_packets.h"
|
|
|
|
namespace wivrn
|
|
{
|
|
|
|
enum class service_publication
|
|
{
|
|
none,
|
|
avahi,
|
|
};
|
|
|
|
struct configuration
|
|
{
|
|
struct encoder
|
|
{
|
|
std::string name;
|
|
std::optional<wivrn::video_codec> codec;
|
|
std::map<std::string, std::string> options;
|
|
std::optional<std::string> device;
|
|
};
|
|
|
|
std::array<encoder, 3> encoders; // left, right, alpha
|
|
std::optional<uint8_t> bit_depth;
|
|
std::optional<std::array<float, 3>> grip_surface;
|
|
std::vector<std::string> application;
|
|
bool debug_gui = false;
|
|
bool use_steamvr_lh = false;
|
|
std::optional<int64_t> lh_max_extrapolation;
|
|
std::optional<float> lh_stick_deadzone;
|
|
bool hid_forwarding = false;
|
|
bool tcp_only = false;
|
|
int port = wivrn::default_port;
|
|
std::string hostname = wivrn::hostname();
|
|
service_publication publication = service_publication::avahi;
|
|
|
|
// monostate: default value, string: user defined, nullptr: disabled
|
|
std::variant<std::monostate, std::string, std::nullptr_t> openvr_compat_path;
|
|
|
|
static void set_config_file(const std::filesystem::path &);
|
|
static std::filesystem::path get_config_file();
|
|
|
|
static nlohmann::json read_configuration();
|
|
configuration();
|
|
};
|
|
|
|
std::string server_cookie();
|
|
|
|
struct headset_key
|
|
{
|
|
std::string public_key;
|
|
std::string name;
|
|
std::optional<std::chrono::system_clock::time_point> last_connection;
|
|
};
|
|
|
|
std::vector<headset_key> known_keys();
|
|
void add_known_key(headset_key key);
|
|
void remove_known_key(const std::string & key);
|
|
void rename_known_key(headset_key key);
|
|
void update_last_connection_timestamp(const std::string & key);
|
|
|
|
} // namespace wivrn
|