Drop xrt::drivers namespace

This commit is contained in:
Patrick Nicolas
2024-10-03 23:39:32 +02:00
parent 6946d5144a
commit fdb79b1939
78 changed files with 260 additions and 260 deletions
+4 -4
View File
@@ -127,7 +127,7 @@ int32_t wivrn::android::audio::microphone_data_cb(AAudioStream * stream, void *
size_t frame_size = AAudioStream_getChannelCount(stream) * sizeof(uint16_t);
xrt::drivers::wivrn::audio_data packet{
wivrn::audio_data packet{
.timestamp = self->instance.now(),
.payload = std::span(audio_data, frame_size * num_frames),
};
@@ -237,7 +237,7 @@ void wivrn::android::audio::microphone_error_cb(AAudioStream * stream, void * us
recreate_thread.detach();
}
wivrn::android::audio::audio(const xrt::drivers::wivrn::to_headset::audio_stream_description & desc, wivrn_session & session, xr::instance & instance) :
wivrn::android::audio::audio(const wivrn::to_headset::audio_stream_description & desc, wivrn_session & session, xr::instance & instance) :
session(session), instance(instance)
{
AAudioStreamBuilder * builder;
@@ -265,14 +265,14 @@ wivrn::android::audio::~audio()
}
}
void wivrn::android::audio::operator()(xrt::drivers::wivrn::audio_data && data)
void wivrn::android::audio::operator()(wivrn::audio_data && data)
{
auto size = data.payload.size_bytes();
if (output_buffer.write(std::move(data)))
buffer_size_bytes.fetch_add(size);
}
void wivrn::android::audio::get_audio_description(xrt::drivers::wivrn::from_headset::headset_info_packet & info)
void wivrn::android::audio::get_audio_description(wivrn::from_headset::headset_info_packet & info)
{
AAudioStreamBuilder * builder;
+5 -5
View File
@@ -48,10 +48,10 @@ class audio
void build_microphone(AAudioStreamBuilderStruct *, int32_t, int32_t);
void build_speaker(AAudioStreamBuilderStruct *, int32_t, int32_t);
utils::ring_buffer<xrt::drivers::wivrn::audio_data, 100> output_buffer;
utils::ring_buffer<wivrn::audio_data, 100> output_buffer;
std::atomic<size_t> buffer_size_bytes;
xrt::drivers::wivrn::audio_data speaker_tmp;
wivrn::audio_data speaker_tmp;
AAudioStreamStruct * speaker = nullptr;
std::atomic<bool> speaker_stop_ack = false;
AAudioStreamStruct * microphone = nullptr;
@@ -67,11 +67,11 @@ class audio
public:
audio(const audio &) = delete;
audio & operator=(const audio &) = delete;
audio(const xrt::drivers::wivrn::to_headset::audio_stream_description &, wivrn_session &, xr::instance &);
audio(const wivrn::to_headset::audio_stream_description &, wivrn_session &, xr::instance &);
~audio();
void operator()(xrt::drivers::wivrn::audio_data &&);
void operator()(wivrn::audio_data &&);
static void get_audio_description(xrt::drivers::wivrn::from_headset::headset_info_packet & info);
static void get_audio_description(wivrn::from_headset::headset_info_packet & info);
};
} // namespace wivrn::android
+3 -3
View File
@@ -33,12 +33,12 @@ class audio
public:
audio(const audio &) = delete;
audio & operator=(const audio &) = delete;
audio(const xrt::drivers::wivrn::to_headset::audio_stream_description &, wivrn_session &, xr::instance &) {}
audio(const wivrn::to_headset::audio_stream_description &, wivrn_session &, xr::instance &) {}
~audio() = default;
void operator()(xrt::drivers::wivrn::audio_data &&) {}
void operator()(wivrn::audio_data &&) {}
static void get_audio_description(xrt::drivers::wivrn::from_headset::headset_info_packet & info) {}
static void get_audio_description(wivrn::from_headset::headset_info_packet & info) {}
};
#endif
+7 -7
View File
@@ -48,9 +48,9 @@ struct wivrn::android::decoder::mapped_hardware_buffer
namespace
{
const char * mime(xrt::drivers::wivrn::video_codec codec)
const char * mime(wivrn::video_codec codec)
{
using c = xrt::drivers::wivrn::video_codec;
using c = wivrn::video_codec;
switch (codec)
{
case c::h264:
@@ -80,7 +80,7 @@ namespace wivrn::android
decoder::decoder(
vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device,
const xrt::drivers::wivrn::to_headset::video_stream_description::item & description,
const wivrn::to_headset::video_stream_description::item & description,
float fps,
uint8_t stream_index,
std::weak_ptr<scenes::stream> weak_scene,
@@ -219,7 +219,7 @@ void decoder::push_data(std::span<std::span<const uint8_t>> data, uint64_t frame
current_input_buffer = input_buffer{};
}
void decoder::frame_completed(xrt::drivers::wivrn::from_headset::feedback & feedback, const xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info, const xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t & view_info)
void decoder::frame_completed(wivrn::from_headset::feedback & feedback, const wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info, const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info)
{
if (not media_codec)
{
@@ -532,11 +532,11 @@ static bool hardware_accelerated(AMediaCodec * media_codec)
return true;
}
std::vector<xrt::drivers::wivrn::video_codec> decoder::supported_codecs()
std::vector<wivrn::video_codec> decoder::supported_codecs()
{
std::vector<xrt::drivers::wivrn::video_codec> result;
std::vector<wivrn::video_codec> result;
for (auto codec: std::ranges::reverse_view(magic_enum::enum_values<xrt::drivers::wivrn::video_codec>()))
for (auto codec: std::ranges::reverse_view(magic_enum::enum_values<wivrn::video_codec>()))
{
AMediaCodec_ptr media_codec(AMediaCodec_createDecoderByType(mime(codec)));
+12 -12
View File
@@ -66,9 +66,9 @@ public:
{
void operator()(AImage *);
};
xrt::drivers::wivrn::from_headset::feedback feedback;
xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t timing_info;
xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
wivrn::from_headset::feedback feedback;
wivrn::to_headset::video_stream_data_shard::timing_info_t timing_info;
wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
vk::raii::ImageView & image_view;
vk::Image image = nullptr;
vk::ImageLayout * current_layout = nullptr;
@@ -80,7 +80,7 @@ public:
};
private:
xrt::drivers::wivrn::to_headset::video_stream_description::item description;
wivrn::to_headset::video_stream_description::item description;
float fps;
vk::raii::Device & device;
@@ -117,9 +117,9 @@ private:
struct frame_info
{
xrt::drivers::wivrn::from_headset::feedback feedback;
xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t timing_info;
xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
wivrn::from_headset::feedback feedback;
wivrn::to_headset::video_stream_data_shard::timing_info_t timing_info;
wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
};
utils::sync_queue<frame_info> frame_infos;
@@ -138,7 +138,7 @@ private:
public:
decoder(vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device,
const xrt::drivers::wivrn::to_headset::video_stream_description::item & description,
const wivrn::to_headset::video_stream_description::item & description,
float fps,
uint8_t stream_index,
std::weak_ptr<scenes::stream> scene,
@@ -151,9 +151,9 @@ public:
void push_data(std::span<std::span<const uint8_t>> data, uint64_t frame_index, bool partial);
void frame_completed(
xrt::drivers::wivrn::from_headset::feedback & feedback,
const xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info,
const xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t & view_info);
wivrn::from_headset::feedback & feedback,
const wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info,
const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info);
const auto & desc() const
{
@@ -170,7 +170,7 @@ public:
return extent;
}
static std::vector<xrt::drivers::wivrn::video_codec> supported_codecs();
static std::vector<wivrn::video_codec> supported_codecs();
};
} // namespace wivrn::android
+8 -8
View File
@@ -45,9 +45,9 @@ static void free_frame(AVFrame * frame)
av_frame_free(&frame);
}
static AVCodecID codec_id(xrt::drivers::wivrn::video_codec codec)
static AVCodecID codec_id(wivrn::video_codec codec)
{
using c = xrt::drivers::wivrn::video_codec;
using c = wivrn::video_codec;
switch (codec)
{
case c::h264:
@@ -73,7 +73,7 @@ decoder::blit_handle::~blit_handle()
decoder::decoder(
vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device,
const xrt::drivers::wivrn::to_headset::video_stream_description::item & description,
const wivrn::to_headset::video_stream_description::item & description,
float fps,
uint8_t stream_index,
std::weak_ptr<scenes::stream> scene,
@@ -166,7 +166,7 @@ void decoder::push_data(std::span<std::span<const uint8_t>> data, uint64_t frame
this->frame_index = frame_index;
}
void decoder::frame_completed(const xrt::drivers::wivrn::from_headset::feedback & feedback, const xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info, const xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t & view_info)
void decoder::frame_completed(const wivrn::from_headset::feedback & feedback, const wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info, const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info)
{
spdlog::trace("ffmpeg decoder:frame_completed {}", frame_index);
AVPacket packet{};
@@ -235,12 +235,12 @@ void decoder::frame_completed(const xrt::drivers::wivrn::from_headset::feedback
scene->push_blit_handle(accumulator, std::move(handle));
}
std::vector<xrt::drivers::wivrn::video_codec> decoder::supported_codecs()
std::vector<wivrn::video_codec> decoder::supported_codecs()
{
return {
xrt::drivers::wivrn::video_codec::h264,
xrt::drivers::wivrn::video_codec::h265,
xrt::drivers::wivrn::video_codec::av1,
wivrn::video_codec::h264,
wivrn::video_codec::h265,
wivrn::video_codec::av1,
};
}
+9 -9
View File
@@ -48,9 +48,9 @@ class decoder
public:
struct blit_handle
{
xrt::drivers::wivrn::from_headset::feedback feedback;
xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t timing_info;
xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
wivrn::from_headset::feedback feedback;
wivrn::to_headset::video_stream_data_shard::timing_info_t timing_info;
wivrn::to_headset::video_stream_data_shard::view_info_t view_info;
vk::raii::ImageView & image_view;
vk::Image image = nullptr;
vk::ImageLayout * current_layout = nullptr;
@@ -79,7 +79,7 @@ private:
vk::Extent2D extent{};
std::vector<int> free_images;
xrt::drivers::wivrn::to_headset::video_stream_description::item description;
wivrn::to_headset::video_stream_description::item description;
std::unique_ptr<AVCodecContext, void (*)(AVCodecContext *)> codec;
std::unique_ptr<SwsContext, void (*)(SwsContext *)> sws;
@@ -93,7 +93,7 @@ private:
public:
decoder(vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device,
const xrt::drivers::wivrn::to_headset::video_stream_description::item & description,
const wivrn::to_headset::video_stream_description::item & description,
float fps,
uint8_t stream_index,
std::weak_ptr<scenes::stream> scene,
@@ -105,9 +105,9 @@ public:
void push_data(std::span<std::span<const uint8_t>> data, uint64_t frame_index, bool partial);
void frame_completed(
const xrt::drivers::wivrn::from_headset::feedback & feedback,
const xrt::drivers::wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info,
const xrt::drivers::wivrn::to_headset::video_stream_data_shard::view_info_t & view_info);
const wivrn::from_headset::feedback & feedback,
const wivrn::to_headset::video_stream_data_shard::timing_info_t & timing_info,
const wivrn::to_headset::video_stream_data_shard::view_info_t & view_info);
const auto & desc() const
{
@@ -124,6 +124,6 @@ public:
return extent;
}
static std::vector<xrt::drivers::wivrn::video_codec> supported_codecs();
static std::vector<wivrn::video_codec> supported_codecs();
};
} // namespace ffmpeg
+2 -2
View File
@@ -22,7 +22,7 @@
#include "scenes/stream.h"
#include "spdlog/spdlog.h"
using namespace xrt::drivers::wivrn::to_headset;
using namespace wivrn::to_headset;
using shard_set = shard_accumulator::shard_set;
using data_shard = shard_accumulator::data_shard;
@@ -203,7 +203,7 @@ void shard_accumulator::try_submit_frame(uint16_t shard_idx)
advance();
}
void shard_accumulator::send_feedback(xrt::drivers::wivrn::from_headset::feedback & feedback)
void shard_accumulator::send_feedback(wivrn::from_headset::feedback & feedback)
{
if (not feedback.received_last_packet)
feedback.received_first_packet = application::now();
+5 -5
View File
@@ -39,7 +39,7 @@ class shard_accumulator
std::shared_ptr<decoder_impl> decoder;
public:
using data_shard = xrt::drivers::wivrn::to_headset::video_stream_data_shard;
using data_shard = wivrn::to_headset::video_stream_data_shard;
struct shard_set
{
size_t min_for_reconstruction = -1;
@@ -49,7 +49,7 @@ public:
std::optional<uint16_t> insert(data_shard &&);
xrt::drivers::wivrn::from_headset::feedback feedback{};
wivrn::from_headset::feedback feedback{};
explicit shard_set(uint8_t stream_index);
shard_set(const shard_set &) = default;
@@ -72,7 +72,7 @@ public:
explicit shard_accumulator(
vk::raii::Device & device,
vk::raii::PhysicalDevice & physical_device,
const xrt::drivers::wivrn::to_headset::video_stream_description::item & description,
const wivrn::to_headset::video_stream_description::item & description,
float fps,
std::weak_ptr<scenes::stream> scene,
uint8_t stream_index) :
@@ -84,7 +84,7 @@ public:
next.reset(1);
}
void push_shard(xrt::drivers::wivrn::to_headset::video_stream_data_shard &&);
void push_shard(wivrn::to_headset::video_stream_data_shard &&);
auto & desc() const
{
@@ -106,6 +106,6 @@ public:
private:
void try_submit_frame(std::optional<uint16_t> shard_idx);
void try_submit_frame(uint16_t shard_idx);
void send_feedback(xrt::drivers::wivrn::from_headset::feedback & feedback);
void send_feedback(wivrn::from_headset::feedback & feedback);
void advance();
};
+1 -1
View File
@@ -55,7 +55,7 @@ void real_main()
if (not server_address.empty())
{
auto colon = server_address.rfind(":");
int port = xrt::drivers::wivrn::default_port;
int port = wivrn::default_port;
if (colon != std::string::npos)
{
port = std::stoi(server_address.substr(colon + 1));
+2 -2
View File
@@ -163,7 +163,7 @@ std::unique_ptr<wivrn_session> connect_to_session(wivrn_discover::service servic
if (!manual_connection)
{
char protocol_string[17];
sprintf(protocol_string, "%016lx", xrt::drivers::wivrn::protocol_version);
sprintf(protocol_string, "%016lx", wivrn::protocol_version);
spdlog::debug("Client protocol version: {}", protocol_string);
spdlog::debug("Server TXT:");
@@ -290,7 +290,7 @@ void scenes::lobby::update_server_list()
}
char protocol_string[17];
sprintf(protocol_string, "%016lx", xrt::drivers::wivrn::protocol_version);
sprintf(protocol_string, "%016lx", wivrn::protocol_version);
for (auto & service: discovered_services)
{
+3 -3
View File
@@ -487,7 +487,7 @@ void scenes::lobby::gui_settings()
void scenes::lobby::gui_about()
{
ImGui::PushFont(imgui_ctx->large_font);
CenterTextH(std::string("WiVRn ") + xrt::drivers::wivrn::git_version);
CenterTextH(std::string("WiVRn ") + wivrn::git_version);
ImGui::PopFont();
ImGui::Dummy(ImVec2(0, 60));
@@ -611,7 +611,7 @@ static void ScrollWhenDraggingOnVoid(ImVec2 delta)
static auto face_weights()
{
using weights = decltype(xrt::drivers::wivrn::from_headset::tracking::fb_face2{}.weights);
using weights = decltype(wivrn::from_headset::tracking::fb_face2{}.weights);
using item = std::pair<const char *, std::array<float, XR_FACE_EXPRESSION2_COUNT_FB>>;
std::vector<item> res;
@@ -794,7 +794,7 @@ static auto face_weights()
static const char * get_face_icon(XrTime predicted_display_time)
{
static const auto w = face_weights();
xrt::drivers::wivrn::from_headset::tracking::fb_face2 expression;
wivrn::from_headset::tracking::fb_face2 expression;
application::get_fb_face_tracker2().get_weights(predicted_display_time, expression);
if (not expression.is_valid)
+2 -2
View File
@@ -37,7 +37,7 @@
#include <thread>
#include <vulkan/vulkan_raii.hpp>
using namespace xrt::drivers::wivrn;
using namespace wivrn;
// clang-format off
static const std::unordered_map<std::string, device_id> device_ids = {
@@ -568,7 +568,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
std::array<XrPosef, 2> pose{};
std::array<XrFovf, 2> fov{};
std::array<xrt::drivers::wivrn::to_headset::foveation_parameter, 2> foveation{};
std::array<wivrn::to_headset::foveation_parameter, 2> foveation{};
{
// Search for frame with desired display time on all decoders
// If no such frame exists, use the latest frame for each decoder
+2 -2
View File
@@ -48,7 +48,7 @@ public:
private:
static const size_t view_count = 2;
using stream_description = xrt::drivers::wivrn::to_headset::video_stream_description::item;
using stream_description = wivrn::to_headset::video_stream_description::item;
struct accumulator_images
{
@@ -149,7 +149,7 @@ public:
void push_blit_handle(shard_accumulator * decoder, std::shared_ptr<shard_accumulator::blit_handle> handle);
void send_feedback(const xrt::drivers::wivrn::from_headset::feedback & feedback);
void send_feedback(const wivrn::from_headset::feedback & feedback);
state current_state() const
{
+1 -1
View File
@@ -83,7 +83,7 @@ void scenes::stream::operator()(audio_data && data)
(*audio_handle)(std::move(data));
}
void scenes::stream::send_feedback(const xrt::drivers::wivrn::from_headset::feedback & feedback)
void scenes::stream::send_feedback(const wivrn::from_headset::feedback & feedback)
{
try
{
+2 -2
View File
@@ -49,7 +49,7 @@ stream_reprojection::stream_reprojection(
std::vector<vk::Image> output_images_,
vk::Extent2D extent,
vk::Format format,
const xrt::drivers::wivrn::to_headset::video_stream_description & description) :
const wivrn::to_headset::video_stream_description & description) :
input_images(std::move(input_images_)),
output_images(std::move(output_images_)),
extent(extent)
@@ -434,7 +434,7 @@ void stream_reprojection::reproject(vk::raii::CommandBuffer & command_buffer, in
command_buffer.endRenderPass();
}
void stream_reprojection::set_foveation(std::array<xrt::drivers::wivrn::to_headset::foveation_parameter, 2> foveation)
void stream_reprojection::set_foveation(std::array<wivrn::to_headset::foveation_parameter, 2> foveation)
{
foveation_parameters = foveation;
}
+3 -3
View File
@@ -52,7 +52,7 @@ class stream_reprojection
vk::Extent2D extent;
// Foveation
std::array<xrt::drivers::wivrn::to_headset::foveation_parameter, 2> foveation_parameters;
std::array<wivrn::to_headset::foveation_parameter, 2> foveation_parameters;
public:
stream_reprojection(
@@ -62,7 +62,7 @@ public:
std::vector<vk::Image> output_images,
vk::Extent2D extent,
vk::Format format,
const xrt::drivers::wivrn::to_headset::video_stream_description & description);
const wivrn::to_headset::video_stream_description & description);
stream_reprojection(const stream_reprojection &) = delete;
@@ -71,5 +71,5 @@ public:
int source,
int destination);
void set_foveation(std::array<xrt::drivers::wivrn::to_headset::foveation_parameter, 2> foveation);
void set_foveation(std::array<wivrn::to_headset::foveation_parameter, 2> foveation);
};
+1 -1
View File
@@ -240,7 +240,7 @@ void scenes::stream::tracking()
packet.state_flags = 0;
if (local_dirty.exchange(false))
packet.state_flags = xrt::drivers::wivrn::from_headset::tracking::recentered;
packet.state_flags = wivrn::from_headset::tracking::recentered;
packet.device_poses.clear();
for (auto [device, space]: spaces)
+1 -1
View File
@@ -23,7 +23,7 @@
#include "wivrn_sockets.h"
#include <poll.h>
using namespace xrt::drivers::wivrn;
using namespace wivrn;
class wivrn_session
{
+1 -1
View File
@@ -35,7 +35,7 @@ xr::fb_face_tracker2::fb_face_tracker2(instance & inst, XrFaceTracker2FB h)
xrDestroyFaceTracker2FB = inst.get_proc<PFN_xrDestroyFaceTracker2FB>("xrDestroyFaceTracker2FB");
}
void xr::fb_face_tracker2::get_weights(XrTime time, xrt::drivers::wivrn::from_headset::tracking::fb_face2 & out_expressions)
void xr::fb_face_tracker2::get_weights(XrTime time, wivrn::from_headset::tracking::fb_face2 & out_expressions)
{
if (!id || !xrGetFaceExpressionWeights2FB)
return;
+1 -1
View File
@@ -37,6 +37,6 @@ public:
fb_face_tracker2() = default;
fb_face_tracker2(instance & inst, XrFaceTracker2FB h);
void get_weights(XrTime time, struct xrt::drivers::wivrn::from_headset::tracking::fb_face2 & out_expressions);
void get_weights(XrTime time, struct wivrn::from_headset::tracking::fb_face2 & out_expressions);
};
} // namespace xr