diff --git a/client/audio/android/audio.cpp b/client/audio/android/audio.cpp index 1946f2fc..3b665646 100644 --- a/client/audio/android/audio.cpp +++ b/client/audio/android/audio.cpp @@ -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; diff --git a/client/audio/android/audio.h b/client/audio/android/audio.h index a6b3d522..559e08cb 100644 --- a/client/audio/android/audio.h +++ b/client/audio/android/audio.h @@ -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 output_buffer; + utils::ring_buffer output_buffer; std::atomic buffer_size_bytes; - xrt::drivers::wivrn::audio_data speaker_tmp; + wivrn::audio_data speaker_tmp; AAudioStreamStruct * speaker = nullptr; std::atomic 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 diff --git a/client/audio/audio.h b/client/audio/audio.h index a6476e16..6b67aef5 100644 --- a/client/audio/audio.h +++ b/client/audio/audio.h @@ -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 diff --git a/client/decoder/android/android_decoder.cpp b/client/decoder/android/android_decoder.cpp index 785b97f6..b9c096ae 100644 --- a/client/decoder/android/android_decoder.cpp +++ b/client/decoder/android/android_decoder.cpp @@ -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 weak_scene, @@ -219,7 +219,7 @@ void decoder::push_data(std::span> 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 decoder::supported_codecs() +std::vector decoder::supported_codecs() { - std::vector result; + std::vector result; - for (auto codec: std::ranges::reverse_view(magic_enum::enum_values())) + for (auto codec: std::ranges::reverse_view(magic_enum::enum_values())) { AMediaCodec_ptr media_codec(AMediaCodec_createDecoderByType(mime(codec))); diff --git a/client/decoder/android/android_decoder.h b/client/decoder/android/android_decoder.h index 10a384bc..ec152580 100644 --- a/client/decoder/android/android_decoder.h +++ b/client/decoder/android/android_decoder.h @@ -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_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 scene, @@ -151,9 +151,9 @@ public: void push_data(std::span> 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 supported_codecs(); + static std::vector supported_codecs(); }; } // namespace wivrn::android diff --git a/client/decoder/ffmpeg/ffmpeg_decoder.cpp b/client/decoder/ffmpeg/ffmpeg_decoder.cpp index 6453c33b..58b1f608 100644 --- a/client/decoder/ffmpeg/ffmpeg_decoder.cpp +++ b/client/decoder/ffmpeg/ffmpeg_decoder.cpp @@ -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 scene, @@ -166,7 +166,7 @@ void decoder::push_data(std::span> 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 decoder::supported_codecs() +std::vector 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, }; } diff --git a/client/decoder/ffmpeg/ffmpeg_decoder.h b/client/decoder/ffmpeg/ffmpeg_decoder.h index e0de8594..bff6440c 100644 --- a/client/decoder/ffmpeg/ffmpeg_decoder.h +++ b/client/decoder/ffmpeg/ffmpeg_decoder.h @@ -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 free_images; - xrt::drivers::wivrn::to_headset::video_stream_description::item description; + wivrn::to_headset::video_stream_description::item description; std::unique_ptr codec; std::unique_ptr 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 scene, @@ -105,9 +105,9 @@ public: void push_data(std::span> 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 supported_codecs(); + static std::vector supported_codecs(); }; } // namespace ffmpeg diff --git a/client/decoder/shard_accumulator.cpp b/client/decoder/shard_accumulator.cpp index 2bd5564e..22dac398 100644 --- a/client/decoder/shard_accumulator.cpp +++ b/client/decoder/shard_accumulator.cpp @@ -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(); diff --git a/client/decoder/shard_accumulator.h b/client/decoder/shard_accumulator.h index adf08dad..1b20a62e 100644 --- a/client/decoder/shard_accumulator.h +++ b/client/decoder/shard_accumulator.h @@ -39,7 +39,7 @@ class shard_accumulator std::shared_ptr 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 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 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 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(); }; diff --git a/client/main.cpp b/client/main.cpp index d542f720..90169726 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -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)); diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp index ee75957d..daef9cc8 100644 --- a/client/scenes/lobby.cpp +++ b/client/scenes/lobby.cpp @@ -163,7 +163,7 @@ std::unique_ptr 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) { diff --git a/client/scenes/lobby_gui.cpp b/client/scenes/lobby_gui.cpp index 7e76acc1..e2993fd8 100644 --- a/client/scenes/lobby_gui.cpp +++ b/client/scenes/lobby_gui.cpp @@ -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>; std::vector 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) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 75cce4ce..9dd781b1 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -37,7 +37,7 @@ #include #include -using namespace xrt::drivers::wivrn; +using namespace wivrn; // clang-format off static const std::unordered_map device_ids = { @@ -568,7 +568,7 @@ void scenes::stream::render(const XrFrameState & frame_state) std::array pose{}; std::array fov{}; - std::array foveation{}; + std::array foveation{}; { // Search for frame with desired display time on all decoders // If no such frame exists, use the latest frame for each decoder diff --git a/client/scenes/stream.h b/client/scenes/stream.h index e271587b..33b3f02b 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -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 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 { diff --git a/client/scenes/stream_network.cpp b/client/scenes/stream_network.cpp index cef386ae..be8b69b9 100644 --- a/client/scenes/stream_network.cpp +++ b/client/scenes/stream_network.cpp @@ -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 { diff --git a/client/scenes/stream_reprojection.cpp b/client/scenes/stream_reprojection.cpp index 16710423..229d04ab 100644 --- a/client/scenes/stream_reprojection.cpp +++ b/client/scenes/stream_reprojection.cpp @@ -49,7 +49,7 @@ stream_reprojection::stream_reprojection( std::vector 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 foveation) +void stream_reprojection::set_foveation(std::array foveation) { foveation_parameters = foveation; } diff --git a/client/scenes/stream_reprojection.h b/client/scenes/stream_reprojection.h index 8204bf5b..67c59c9a 100644 --- a/client/scenes/stream_reprojection.h +++ b/client/scenes/stream_reprojection.h @@ -52,7 +52,7 @@ class stream_reprojection vk::Extent2D extent; // Foveation - std::array foveation_parameters; + std::array foveation_parameters; public: stream_reprojection( @@ -62,7 +62,7 @@ public: std::vector 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 foveation); + void set_foveation(std::array foveation); }; diff --git a/client/scenes/stream_tracking.cpp b/client/scenes/stream_tracking.cpp index 369ec0e4..3c56242f 100644 --- a/client/scenes/stream_tracking.cpp +++ b/client/scenes/stream_tracking.cpp @@ -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) diff --git a/client/wivrn_client.h b/client/wivrn_client.h index eb85241e..6fd8394d 100644 --- a/client/wivrn_client.h +++ b/client/wivrn_client.h @@ -23,7 +23,7 @@ #include "wivrn_sockets.h" #include -using namespace xrt::drivers::wivrn; +using namespace wivrn; class wivrn_session { diff --git a/client/xr/fb_face_tracker2.cpp b/client/xr/fb_face_tracker2.cpp index 5b1d02a1..da2a1bb4 100644 --- a/client/xr/fb_face_tracker2.cpp +++ b/client/xr/fb_face_tracker2.cpp @@ -35,7 +35,7 @@ xr::fb_face_tracker2::fb_face_tracker2(instance & inst, XrFaceTracker2FB h) xrDestroyFaceTracker2FB = inst.get_proc("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; diff --git a/client/xr/fb_face_tracker2.h b/client/xr/fb_face_tracker2.h index b77f2a6a..499a1a49 100644 --- a/client/xr/fb_face_tracker2.h +++ b/client/xr/fb_face_tracker2.h @@ -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 diff --git a/common/version.cpp.in b/common/version.cpp.in index 160da4bc..a96904b5 100644 --- a/common/version.cpp.in +++ b/common/version.cpp.in @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -namespace xrt::drivers::wivrn +namespace wivrn { extern const char git_version[]; const char git_version[] = "@GIT_DESC@"; diff --git a/common/version.h b/common/version.h index e6a1935f..ef797018 100644 --- a/common/version.h +++ b/common/version.h @@ -3,10 +3,10 @@ #include "wivrn_packets.h" #include "wivrn_serialization.h" -namespace xrt::drivers::wivrn +namespace wivrn { using protocol = std::variant; extern const char git_version[]; static inline const constinit auto protocol_version = serialization_type_hash(); -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 3c2b7b77..f63928d7 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -32,7 +32,7 @@ #include "wivrn_serialization_types.h" -namespace xrt::drivers::wivrn +namespace wivrn { // Default port for server to listen, both TCP and UDP @@ -390,4 +390,4 @@ using packets = std::variant #include -namespace xrt::drivers::wivrn +namespace wivrn { // Intended to be the last element of a serializable type @@ -37,4 +37,4 @@ struct data_holder std::shared_ptr c; }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/common/wivrn_serialization_ut.cpp b/common/wivrn_serialization_ut.cpp index 1c96651d..a0011504 100644 --- a/common/wivrn_serialization_ut.cpp +++ b/common/wivrn_serialization_ut.cpp @@ -19,7 +19,7 @@ #include "wivrn_serialization.h" -using namespace xrt::drivers::wivrn; +using namespace wivrn; namespace { diff --git a/common/wivrn_sockets.cpp b/common/wivrn_sockets.cpp index 42392e74..23b5f647 100644 --- a/common/wivrn_sockets.cpp +++ b/common/wivrn_sockets.cpp @@ -32,35 +32,35 @@ #include #include -const char * xrt::drivers::wivrn::invalid_packet::what() const noexcept +const char * wivrn::invalid_packet::what() const noexcept { return "Invalid packet"; } -const char * xrt::drivers::wivrn::socket_shutdown::what() const noexcept +const char * wivrn::socket_shutdown::what() const noexcept { return "Socket shutdown"; } -xrt::drivers::wivrn::fd_base::fd_base(xrt::drivers::wivrn::fd_base && other) : +wivrn::fd_base::fd_base(wivrn::fd_base && other) : fd(other.fd) { other.fd = -1; } -xrt::drivers::wivrn::fd_base & xrt::drivers::wivrn::fd_base::operator=(xrt::drivers::wivrn::fd_base && other) +wivrn::fd_base & wivrn::fd_base::operator=(wivrn::fd_base && other) { std::swap(fd, other.fd); return *this; } -xrt::drivers::wivrn::fd_base::~fd_base() +wivrn::fd_base::~fd_base() { if (fd >= 0) ::close(fd); } -xrt::drivers::wivrn::UDP::UDP() +wivrn::UDP::UDP() { fd = socket(AF_INET6, SOCK_DGRAM, 0); @@ -68,12 +68,12 @@ xrt::drivers::wivrn::UDP::UDP() throw std::system_error{errno, std::generic_category()}; } -xrt::drivers::wivrn::UDP::UDP(int fd) +wivrn::UDP::UDP(int fd) { this->fd = fd; } -void xrt::drivers::wivrn::UDP::bind(int port) +void wivrn::UDP::bind(int port) { sockaddr_in6 bind_addr{}; bind_addr.sin6_family = AF_INET6; @@ -84,7 +84,7 @@ void xrt::drivers::wivrn::UDP::bind(int port) throw std::system_error{errno, std::generic_category()}; } -void xrt::drivers::wivrn::UDP::connect(in6_addr address, int port) +void wivrn::UDP::connect(in6_addr address, int port) { sockaddr_in6 sa; sa.sin6_family = AF_INET6; @@ -95,7 +95,7 @@ void xrt::drivers::wivrn::UDP::connect(in6_addr address, int port) throw std::system_error{errno, std::generic_category()}; } -void xrt::drivers::wivrn::UDP::connect(in_addr address, int port) +void wivrn::UDP::connect(in_addr address, int port) { sockaddr_in sa; sa.sin_family = AF_INET; @@ -106,7 +106,7 @@ void xrt::drivers::wivrn::UDP::connect(in_addr address, int port) throw std::system_error{errno, std::generic_category()}; } -void xrt::drivers::wivrn::UDP::subscribe_multicast(in6_addr address) +void wivrn::UDP::subscribe_multicast(in6_addr address) { assert(IN6_IS_ADDR_MULTICAST(&address)); @@ -120,7 +120,7 @@ void xrt::drivers::wivrn::UDP::subscribe_multicast(in6_addr address) } } -void xrt::drivers::wivrn::UDP::unsubscribe_multicast(in6_addr address) +void wivrn::UDP::unsubscribe_multicast(in6_addr address) { assert(IN6_IS_ADDR_MULTICAST(&address)); @@ -134,17 +134,17 @@ void xrt::drivers::wivrn::UDP::unsubscribe_multicast(in6_addr address) } } -void xrt::drivers::wivrn::UDP::set_receive_buffer_size(int size) +void wivrn::UDP::set_receive_buffer_size(int size) { setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); } -void xrt::drivers::wivrn::UDP::set_send_buffer_size(int size) +void wivrn::UDP::set_send_buffer_size(int size) { setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); } -void xrt::drivers::wivrn::UDP::set_tos(int tos) +void wivrn::UDP::set_tos(int tos) { int err = setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)); if (err == -1) @@ -153,7 +153,7 @@ void xrt::drivers::wivrn::UDP::set_tos(int tos) } } -void xrt::drivers::wivrn::TCP::init() +void wivrn::TCP::init() { int nodelay = 1; if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay)) < 0) @@ -165,14 +165,14 @@ void xrt::drivers::wivrn::TCP::init() mutex = std::make_unique(); } -xrt::drivers::wivrn::TCP::TCP(int fd) +wivrn::TCP::TCP(int fd) { this->fd = fd; init(); } -xrt::drivers::wivrn::TCP::TCP(in6_addr address, int port) +wivrn::TCP::TCP(in6_addr address, int port) { fd = socket(AF_INET6, SOCK_STREAM, 0); @@ -193,7 +193,7 @@ xrt::drivers::wivrn::TCP::TCP(in6_addr address, int port) init(); } -xrt::drivers::wivrn::TCP::TCP(in_addr address, int port) +wivrn::TCP::TCP(in_addr address, int port) { fd = socket(AF_INET, SOCK_STREAM, 0); @@ -214,11 +214,11 @@ xrt::drivers::wivrn::TCP::TCP(in_addr address, int port) init(); } -xrt::drivers::wivrn::TCPListener::TCPListener() +wivrn::TCPListener::TCPListener() { } -xrt::drivers::wivrn::TCPListener::TCPListener(int port) +wivrn::TCPListener::TCPListener(int port) { fd = socket(AF_INET6, SOCK_STREAM, 0); @@ -253,7 +253,7 @@ xrt::drivers::wivrn::TCPListener::TCPListener(int port) } } -std::pair xrt::drivers::wivrn::UDP::receive_from_raw() +std::pair wivrn::UDP::receive_from_raw() { sockaddr_in6 addr; socklen_t addrlen = sizeof(addr); @@ -275,7 +275,7 @@ std::pair xrt::driver return {deserialization_packet{std::move(buffer), std::span(tmp, received)}, addr}; } -xrt::drivers::wivrn::deserialization_packet xrt::drivers::wivrn::UDP::receive_pending() +wivrn::deserialization_packet wivrn::UDP::receive_pending() { if (messages.empty()) return {}; @@ -285,7 +285,7 @@ xrt::drivers::wivrn::deserialization_packet xrt::drivers::wivrn::UDP::receive_pe return deserialization_packet{buffer, span}; } -xrt::drivers::wivrn::deserialization_packet xrt::drivers::wivrn::UDP::receive_raw() +wivrn::deserialization_packet wivrn::UDP::receive_raw() { if (not messages.empty()) { @@ -339,7 +339,7 @@ xrt::drivers::wivrn::deserialization_packet xrt::drivers::wivrn::UDP::receive_ra return deserialization_packet{buffer, std::span(buffer.get(), mmsgs[0].msg_len)}; } -void xrt::drivers::wivrn::UDP::send_raw(const std::vector & data) +void wivrn::UDP::send_raw(const std::vector & data) { ssize_t sent = ::send(fd, data.data(), data.size(), 0); if (sent < 0) @@ -348,7 +348,7 @@ void xrt::drivers::wivrn::UDP::send_raw(const std::vector & data) bytes_sent_ += sent; } -void xrt::drivers::wivrn::UDP::send_raw(const std::vector> & data) +void wivrn::UDP::send_raw(const std::vector> & data) { thread_local std::vector spans; spans.clear(); @@ -359,7 +359,7 @@ void xrt::drivers::wivrn::UDP::send_raw(const std::vector> & throw std::system_error{errno, std::generic_category()}; } -void xrt::drivers::wivrn::UDP::send_many_raw(std::span> *> data) +void wivrn::UDP::send_many_raw(std::span> *> data) { thread_local std::vector iovecs; thread_local std::vector mmsgs; @@ -393,7 +393,7 @@ void xrt::drivers::wivrn::UDP::send_many_raw(std::span> & spans) +void wivrn::TCP::send_raw(const std::vector> & spans) { thread_local std::vector iovecs; iovecs.clear(); @@ -517,7 +517,7 @@ void xrt::drivers::wivrn::TCP::send_raw(const std::vector> & } } -void xrt::drivers::wivrn::TCP::send_many_raw(std::span> *> data) +void wivrn::TCP::send_many_raw(std::span> *> data) { thread_local std::vector iovecs; thread_local std::vector sizes; diff --git a/common/wivrn_sockets.h b/common/wivrn_sockets.h index cb00cf9e..10801430 100644 --- a/common/wivrn_sockets.h +++ b/common/wivrn_sockets.h @@ -31,7 +31,7 @@ #include #include -namespace xrt::drivers::wivrn +namespace wivrn { class socket_shutdown : public std::exception { @@ -109,7 +109,7 @@ public: deserialization_packet receive_raw(); deserialization_packet receive_pending(); - std::pair receive_from_raw(); + std::pair receive_from_raw(); void send_raw(const std::vector & data); void send_raw(const std::vector> & data); void send_many_raw(std::span> *> data); @@ -242,4 +242,4 @@ public: } }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/dashboard/main.cpp b/dashboard/main.cpp index ec027941..64ec705e 100644 --- a/dashboard/main.cpp +++ b/dashboard/main.cpp @@ -27,7 +27,7 @@ #include "main_window.h" #include "wizard.h" -namespace xrt::drivers::wivrn +namespace wivrn { extern const char git_version[]; } @@ -38,7 +38,7 @@ int main(int argc, char * argv[]) app.setApplicationName("wivrn-dashboard"); app.setOrganizationName("wivrn"); - app.setApplicationVersion(xrt::drivers::wivrn::git_version); + app.setApplicationVersion(wivrn::git_version); app.setDesktopFileName("io.github.wivrn.wivrn"); QTranslator translator; diff --git a/server/accept_connection.cpp b/server/accept_connection.cpp index 1aaa22e0..5c2e686e 100644 --- a/server/accept_connection.cpp +++ b/server/accept_connection.cpp @@ -30,11 +30,11 @@ static void handle_event_from_main_loop(to_monado::disconnect) // Ignore disconnect request when no headset is connected } -std::unique_ptr accept_connection(int watch_fd, std::function quit) +std::unique_ptr accept_connection(int watch_fd, std::function quit) { wivrn_ipc_socket_monado->send(from_monado::headsdet_disconnected{}); - xrt::drivers::wivrn::TCPListener listener(xrt::drivers::wivrn::default_port); + wivrn::TCPListener listener(wivrn::default_port); pollfd fds[3]{ {.fd = watch_fd, .events = POLLIN}, @@ -56,7 +56,7 @@ std::unique_ptr accept_connection(int watch_fd, std::f if (fds[1].revents & POLLIN) { wivrn_ipc_socket_monado->send(from_monado::headsdet_connected{}); - return std::make_unique(listener.accept().first); + return std::make_unique(listener.accept().first); } if (fds[2].revents & POLLIN) diff --git a/server/accept_connection.h b/server/accept_connection.h index dfe2ee68..7b0c8ee5 100644 --- a/server/accept_connection.h +++ b/server/accept_connection.h @@ -23,4 +23,4 @@ #include #include -std::unique_ptr accept_connection(int watch_fd, std::function quit = std::function()); +std::unique_ptr accept_connection(int watch_fd, std::function quit = std::function()); diff --git a/server/audio/audio_pipewire.cpp b/server/audio/audio_pipewire.cpp index 74b50478..152b0c18 100644 --- a/server/audio/audio_pipewire.cpp +++ b/server/audio/audio_pipewire.cpp @@ -26,7 +26,7 @@ #include #include -using namespace xrt::drivers::wivrn; +using namespace wivrn; struct deleter { @@ -73,7 +73,7 @@ struct pipewire_device : public audio_device static void speaker_process(void * self_v); static void mic_process(void * self_v); - void process_mic_data(xrt::drivers::wivrn::audio_data &&) override; + void process_mic_data(wivrn::audio_data &&) override; ~pipewire_device() = default; @@ -82,8 +82,8 @@ struct pipewire_device : public audio_device const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, - xrt::drivers::wivrn::wivrn_session & session) : + const wivrn::from_headset::headset_info_packet & info, + wivrn::wivrn_session & session) : session(session) { int argc = 0; @@ -289,7 +289,7 @@ void pipewire_device::speaker_process(void * self_v) pw_stream_queue_buffer(self->speaker.get(), buffer); } -void pipewire_device::process_mic_data(xrt::drivers::wivrn::audio_data && sample) +void pipewire_device::process_mic_data(wivrn::audio_data && sample) { auto size = sample.payload.size_bytes(); if (mic_samples.write(std::move(sample))) @@ -301,7 +301,7 @@ std::shared_ptr create_pipewire_handle( const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, + const wivrn::from_headset::headset_info_packet & info, wivrn_session & session) { try diff --git a/server/audio/audio_pipewire.h b/server/audio/audio_pipewire.h index 7e3662cf..2e0d566f 100644 --- a/server/audio/audio_pipewire.h +++ b/server/audio/audio_pipewire.h @@ -25,5 +25,5 @@ std::shared_ptr create_pipewire_handle( const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, - xrt::drivers::wivrn::wivrn_session & session); + const wivrn::from_headset::headset_info_packet & info, + wivrn::wivrn_session & session); diff --git a/server/audio/audio_pulse.cpp b/server/audio/audio_pulse.cpp index df117b86..ef484255 100644 --- a/server/audio/audio_pulse.cpp +++ b/server/audio/audio_pulse.cpp @@ -240,7 +240,7 @@ public: struct pulse_device : public audio_device { - xrt::drivers::wivrn::to_headset::audio_stream_description desc; + wivrn::to_headset::audio_stream_description desc; std::thread mic_thread; std::thread speaker_thread; @@ -251,10 +251,10 @@ struct pulse_device : public audio_device utils::sync_queue mic_buffer; - xrt::drivers::wivrn::fd_base speaker_pipe; - xrt::drivers::wivrn::fd_base mic_pipe; + wivrn::fd_base speaker_pipe; + wivrn::fd_base mic_pipe; - xrt::drivers::wivrn::wivrn_session & session; + wivrn::wivrn_session & session; ~pulse_device() { @@ -282,7 +282,7 @@ struct pulse_device : public audio_device } } - xrt::drivers::wivrn::to_headset::audio_stream_description description() const override + wivrn::to_headset::audio_stream_description description() const override { return desc; }; @@ -298,7 +298,7 @@ struct pulse_device : public audio_device // use buffers of up to 2ms // read buffers must be smaller than buffer size on client or we will discard chunks often const size_t buffer_size = (desc.speaker->sample_rate * sample_size * 2) / 1000; - xrt::drivers::wivrn::audio_data packet; + wivrn::audio_data packet; std::vector buffer(buffer_size, 0); size_t remainder = 0; @@ -396,7 +396,7 @@ struct pulse_device : public audio_device } } - void process_mic_data(xrt::drivers::wivrn::audio_data && mic_data) override + void process_mic_data(wivrn::audio_data && mic_data) override { mic_buffer.push(std::move(mic_data)); } @@ -406,8 +406,8 @@ struct pulse_device : public audio_device const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, - xrt::drivers::wivrn::wivrn_session & session) : + const wivrn::from_headset::headset_info_packet & info, + wivrn::wivrn_session & session) : session(session) { pa_connection cnx("WiVRn"); @@ -446,7 +446,7 @@ std::shared_ptr create_pulse_handle( const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, + const wivrn::from_headset::headset_info_packet & info, wivrn_session & session) { try diff --git a/server/audio/audio_pulse.h b/server/audio/audio_pulse.h index 0b968970..41e24059 100644 --- a/server/audio/audio_pulse.h +++ b/server/audio/audio_pulse.h @@ -25,5 +25,5 @@ std::shared_ptr create_pulse_handle( const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, - xrt::drivers::wivrn::wivrn_session & session); + const wivrn::from_headset::headset_info_packet & info, + wivrn::wivrn_session & session); diff --git a/server/audio/audio_setup.cpp b/server/audio/audio_setup.cpp index ad5f7d1c..1d25addd 100644 --- a/server/audio/audio_setup.cpp +++ b/server/audio/audio_setup.cpp @@ -35,8 +35,8 @@ std::shared_ptr audio_device::create( const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, - xrt::drivers::wivrn::wivrn_session & session) + const wivrn::from_headset::headset_info_packet & info, + wivrn::wivrn_session & session) { #if WIVRN_USE_PIPEWIRE if (auto res = create_pipewire_handle(source_name, source_description, sink_name, sink_description, info, session)) diff --git a/server/audio/audio_setup.h b/server/audio/audio_setup.h index 7528a4c7..4bc90cb6 100644 --- a/server/audio/audio_setup.h +++ b/server/audio/audio_setup.h @@ -24,7 +24,7 @@ #include "wivrn_packets.h" -namespace xrt::drivers::wivrn +namespace wivrn { class wivrn_session; } @@ -34,15 +34,15 @@ struct audio_device // unpublishes the device virtual ~audio_device() = default; - virtual xrt::drivers::wivrn::to_headset::audio_stream_description description() const = 0; + virtual wivrn::to_headset::audio_stream_description description() const = 0; - virtual void process_mic_data(xrt::drivers::wivrn::audio_data &&) = 0; + virtual void process_mic_data(wivrn::audio_data &&) = 0; static std::shared_ptr create( const std::string & source_name, const std::string & source_description, const std::string & sink_name, const std::string & sink_description, - const xrt::drivers::wivrn::from_headset::headset_info_packet & info, - xrt::drivers::wivrn::wivrn_session & session); + const wivrn::from_headset::headset_info_packet & info, + wivrn::wivrn_session & session); }; diff --git a/server/driver/clock_offset.cpp b/server/driver/clock_offset.cpp index 7245ff48..7e1e6cfc 100644 --- a/server/driver/clock_offset.cpp +++ b/server/driver/clock_offset.cpp @@ -42,12 +42,12 @@ void clock_offset_estimator::request_sample(wivrn_connection & connection) next_sample = std::chrono::steady_clock::now() + sample_interval.load(); connection.send_stream( - xrt::drivers::wivrn::to_headset::timesync_query{ + wivrn::to_headset::timesync_query{ .query = XrTime(os_monotonic_get_ns()), }); } -void clock_offset_estimator::add_sample(const xrt::drivers::wivrn::from_headset::timesync_response & base_sample) +void clock_offset_estimator::add_sample(const wivrn::from_headset::timesync_response & base_sample) { XrTime now = os_monotonic_get_ns(); clock_offset_estimator::sample sample{base_sample, now}; diff --git a/server/driver/clock_offset.h b/server/driver/clock_offset.h index edb9335c..fa7f78ce 100644 --- a/server/driver/clock_offset.h +++ b/server/driver/clock_offset.h @@ -48,7 +48,7 @@ struct clock_offset class clock_offset_estimator { - struct sample : public xrt::drivers::wivrn::from_headset::timesync_response + struct sample : public wivrn::from_headset::timesync_response { XrTime received; }; @@ -64,7 +64,7 @@ class clock_offset_estimator public: void reset(); void request_sample(wivrn_connection & connection); - void add_sample(const xrt::drivers::wivrn::from_headset::timesync_response & sample); + void add_sample(const wivrn::from_headset::timesync_response & sample); clock_offset get_offset(); }; diff --git a/server/driver/configuration.cpp b/server/driver/configuration.cpp index e1fe2199..b54d6d02 100644 --- a/server/driver/configuration.cpp +++ b/server/driver/configuration.cpp @@ -36,7 +36,7 @@ static std::filesystem::path config_file = xdg_config_home() / "wivrn" / "config.json"; static std::filesystem::path cookie_file = xdg_config_home() / "wivrn" / "cookie"; -namespace xrt::drivers::wivrn +namespace wivrn { NLOHMANN_JSON_SERIALIZE_ENUM( video_codec, @@ -102,7 +102,7 @@ configuration configuration::read_user_configuration() SET_IF(offset_y); SET_IF(group); SET_IF(codec); - if (e.codec == xrt::drivers::wivrn::video_codec(-1)) + if (e.codec == wivrn::video_codec(-1)) throw std::runtime_error("invalid codec value " + encoder["codec"].get()); SET_IF(options); SET_IF(device); diff --git a/server/driver/configuration.h b/server/driver/configuration.h index 3137a4d3..9faa9bf2 100644 --- a/server/driver/configuration.h +++ b/server/driver/configuration.h @@ -37,7 +37,7 @@ struct configuration std::optional offset_x; std::optional offset_y; std::optional group; - std::optional codec; + std::optional codec; std::map options; std::optional device; }; diff --git a/server/driver/hand_joints_list.cpp b/server/driver/hand_joints_list.cpp index 185e70b2..bf311427 100644 --- a/server/driver/hand_joints_list.cpp +++ b/server/driver/hand_joints_list.cpp @@ -22,7 +22,7 @@ #include "pose_list.h" #include "xrt_cast.h" -using namespace xrt::drivers::wivrn; +using namespace wivrn; static_assert(XRT_HAND_JOINT_COUNT == XR_HAND_JOINT_COUNT_EXT); diff --git a/server/driver/hand_joints_list.h b/server/driver/hand_joints_list.h index 0800a1b1..b5b8d1b7 100644 --- a/server/driver/hand_joints_list.h +++ b/server/driver/hand_joints_list.h @@ -33,5 +33,5 @@ public: hand_joints_list(int hand_id) : hand_id(hand_id) {} - bool update_tracking(const xrt::drivers::wivrn::from_headset::hand_tracking & tracking, const clock_offset & offset); + bool update_tracking(const wivrn::from_headset::hand_tracking & tracking, const clock_offset & offset); }; diff --git a/server/driver/pose_list.cpp b/server/driver/pose_list.cpp index 74f3c974..66c206fa 100644 --- a/server/driver/pose_list.cpp +++ b/server/driver/pose_list.cpp @@ -24,7 +24,7 @@ #include "xrt/xrt_defines.h" #include "xrt_cast.h" -using namespace xrt::drivers::wivrn; +using namespace wivrn; using namespace xrt::auxiliary::math; xrt_space_relation pose_list::interpolate(const xrt_space_relation & a, const xrt_space_relation & b, float t) diff --git a/server/driver/pose_list.h b/server/driver/pose_list.h index 6b81f979..10e962d9 100644 --- a/server/driver/pose_list.h +++ b/server/driver/pose_list.h @@ -27,15 +27,15 @@ class pose_list : public history { public: - const xrt::drivers::wivrn::device_id device; + const wivrn::device_id device; static xrt_space_relation interpolate(const xrt_space_relation & a, const xrt_space_relation & b, float t); static xrt_space_relation extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, int64_t ta, int64_t tb, int64_t t); - pose_list(xrt::drivers::wivrn::device_id id) : + pose_list(wivrn::device_id id) : device(id) {} - bool update_tracking(const xrt::drivers::wivrn::from_headset::tracking &, const clock_offset & offset); + bool update_tracking(const wivrn::from_headset::tracking &, const clock_offset & offset); - static xrt_space_relation convert_pose(const xrt::drivers::wivrn::from_headset::tracking::pose &); + static xrt_space_relation convert_pose(const wivrn::from_headset::tracking::pose &); }; diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index 90824b7c..4812e199 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -29,7 +29,7 @@ #include #include -using namespace xrt::drivers::wivrn; +using namespace wivrn; std::vector wivrn_comp_target::wanted_instance_extensions = {}; std::vector wivrn_comp_target::wanted_device_extensions = { @@ -650,7 +650,7 @@ void wivrn_comp_target::render_dynamic_foveation(std::array cnx, struct comp_compositor * c, float fps) : +wivrn_comp_target::wivrn_comp_target(std::shared_ptr cnx, struct comp_compositor * c, float fps) : comp_target{}, pacer(U_TIME_1S_IN_NS / fps), cnx(cnx) diff --git a/server/driver/wivrn_comp_target.h b/server/driver/wivrn_comp_target.h index 22b801c3..0c209103 100644 --- a/server/driver/wivrn_comp_target.h +++ b/server/driver/wivrn_comp_target.h @@ -35,7 +35,7 @@ #include #include -namespace xrt::drivers::wivrn +namespace wivrn { class VideoEncoder; @@ -97,10 +97,10 @@ struct wivrn_comp_target : public comp_target std::list encoder_threads; std::vector> encoders; - std::shared_ptr cnx; + std::shared_ptr cnx; std::unique_ptr foveation_renderer = nullptr; - wivrn_comp_target(std::shared_ptr cnx, struct comp_compositor * c, float fps); + wivrn_comp_target(std::shared_ptr cnx, struct comp_compositor * c, float fps); ~wivrn_comp_target(); void on_feedback(const from_headset::feedback &, const clock_offset &); @@ -109,4 +109,4 @@ struct wivrn_comp_target : public comp_target void render_dynamic_foveation(std::array foveation); }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/driver/wivrn_connection.h b/server/driver/wivrn_connection.h index 2a75a0e7..ab7bea8c 100644 --- a/server/driver/wivrn_connection.h +++ b/server/driver/wivrn_connection.h @@ -25,7 +25,7 @@ #include #include -using namespace xrt::drivers::wivrn; +using namespace wivrn; class wivrn_connection { diff --git a/server/driver/wivrn_controller.cpp b/server/driver/wivrn_controller.cpp index 24e0996b..8b910449 100644 --- a/server/driver/wivrn_controller.cpp +++ b/server/driver/wivrn_controller.cpp @@ -151,7 +151,7 @@ static void wivrn_controller_update_inputs(xrt_device * xdev); wivrn_controller::wivrn_controller(int hand_id, xrt_device * hmd, - xrt::drivers::wivrn::wivrn_session * cnx) : + wivrn::wivrn_session * cnx) : xrt_device{}, grip(hand_id == 0 ? device_id::LEFT_GRIP : device_id::RIGHT_GRIP), aim(hand_id == 0 ? device_id::LEFT_AIM : device_id::RIGHT_AIM), diff --git a/server/driver/wivrn_controller.h b/server/driver/wivrn_controller.h index 40c4c221..f99a1f70 100644 --- a/server/driver/wivrn_controller.h +++ b/server/driver/wivrn_controller.h @@ -29,7 +29,7 @@ #include #include -namespace xrt::drivers::wivrn +namespace wivrn { class wivrn_session; } @@ -46,10 +46,10 @@ class wivrn_controller : public xrt_device std::vector inputs_array; xrt_output haptic_output; - xrt::drivers::wivrn::wivrn_session * cnx; + wivrn::wivrn_session * cnx; public: - wivrn_controller(int hand_id, xrt_device * hmd, xrt::drivers::wivrn::wivrn_session * cnx); + wivrn_controller(int hand_id, xrt_device * hmd, wivrn::wivrn_session * cnx); void unregister() { diff --git a/server/driver/wivrn_eye_tracker.cpp b/server/driver/wivrn_eye_tracker.cpp index 7bbad490..09285be8 100644 --- a/server/driver/wivrn_eye_tracker.cpp +++ b/server/driver/wivrn_eye_tracker.cpp @@ -40,7 +40,7 @@ static void wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev, xrt_space_relation * out_relation); wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd, - std::shared_ptr cnx) : + std::shared_ptr cnx) : xrt_device{}, gaze(device_id::EYE_GAZE), cnx(cnx) { xrt_device * base = this; diff --git a/server/driver/wivrn_eye_tracker.h b/server/driver/wivrn_eye_tracker.h index 3c719bf2..482d6dc3 100644 --- a/server/driver/wivrn_eye_tracker.h +++ b/server/driver/wivrn_eye_tracker.h @@ -38,10 +38,10 @@ class wivrn_eye_tracker : public xrt_device xrt_input gaze_input; pose_list gaze; - std::shared_ptr cnx; + std::shared_ptr cnx; public: - wivrn_eye_tracker(xrt_device * hmd, std::shared_ptr cnx); + wivrn_eye_tracker(xrt_device * hmd, std::shared_ptr cnx); void unregister() { cnx = nullptr; diff --git a/server/driver/wivrn_fb_face2_tracker.cpp b/server/driver/wivrn_fb_face2_tracker.cpp index fc9e75e8..cf280a20 100644 --- a/server/driver/wivrn_fb_face2_tracker.cpp +++ b/server/driver/wivrn_fb_face2_tracker.cpp @@ -42,7 +42,7 @@ static xrt_result_t wivrn_fb_face2_tracker_get_face_tracking(struct xrt_device * struct xrt_facial_expression_set * out_value); wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd, - std::shared_ptr cnx) : + std::shared_ptr cnx) : xrt_device{}, cnx(cnx) { xrt_device * base = this; diff --git a/server/driver/wivrn_fb_face2_tracker.h b/server/driver/wivrn_fb_face2_tracker.h index fb3574b5..5f94ea0a 100644 --- a/server/driver/wivrn_fb_face2_tracker.h +++ b/server/driver/wivrn_fb_face2_tracker.h @@ -86,10 +86,10 @@ class wivrn_fb_face2_tracker : public xrt_device fb_face2_list face_list; xrt_input face_input; - std::shared_ptr cnx; + std::shared_ptr cnx; public: - wivrn_fb_face2_tracker(xrt_device * hmd, std::shared_ptr cnx); + wivrn_fb_face2_tracker(xrt_device * hmd, std::shared_ptr cnx); void unregister() { cnx = nullptr; diff --git a/server/driver/wivrn_hmd.cpp b/server/driver/wivrn_hmd.cpp index 0fdee45e..e49a1111 100644 --- a/server/driver/wivrn_hmd.cpp +++ b/server/driver/wivrn_hmd.cpp @@ -197,7 +197,7 @@ bool wivrn_hmd::wivrn_hmd_compute_distortion(xrt_device * xdev, uint32_t view_in return true; } -wivrn_hmd::wivrn_hmd(xrt::drivers::wivrn::wivrn_session * cnx, +wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx, const from_headset::headset_info_packet & info) : xrt_device{}, cnx(cnx) { diff --git a/server/driver/wivrn_hmd.h b/server/driver/wivrn_hmd.h index 58f62386..c0c88cc0 100644 --- a/server/driver/wivrn_hmd.h +++ b/server/driver/wivrn_hmd.h @@ -32,7 +32,7 @@ struct comp_target; -namespace xrt::drivers::wivrn +namespace wivrn { class wivrn_session; } @@ -55,12 +55,12 @@ class wivrn_hmd : public xrt_device std::array foveation_parameters{}; from_headset::battery battery{}; - xrt::drivers::wivrn::wivrn_session * cnx; + wivrn::wivrn_session * cnx; static bool wivrn_hmd_compute_distortion(xrt_device * xdev, uint32_t view_index, float u, float v, xrt_uv_triplet * result); public: - wivrn_hmd(xrt::drivers::wivrn::wivrn_session * cnx, + wivrn_hmd(wivrn::wivrn_session * cnx, const from_headset::headset_info_packet & info); void unregister() { diff --git a/server/driver/wivrn_pacer.cpp b/server/driver/wivrn_pacer.cpp index d545f812..71b9f456 100644 --- a/server/driver/wivrn_pacer.cpp +++ b/server/driver/wivrn_pacer.cpp @@ -68,7 +68,7 @@ void wivrn_pacer::predict( out_present_slop_ns = 0; } -void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback & feedback, const clock_offset & offset) +void wivrn_pacer::on_feedback(const wivrn::from_headset::feedback & feedback, const clock_offset & offset) { std::lock_guard lock(mutex); if (feedback.stream_index >= streams.size() or feedback.times_displayed > 1) diff --git a/server/driver/wivrn_pacer.h b/server/driver/wivrn_pacer.h index cd5a8b29..e478ec6e 100644 --- a/server/driver/wivrn_pacer.h +++ b/server/driver/wivrn_pacer.h @@ -56,7 +56,7 @@ private: struct stream_data { // Last feedback for each encoder - xrt::drivers::wivrn::from_headset::feedback last_feedback; + wivrn::from_headset::feedback last_feedback; std::vector times; size_t next_times_index = 0; }; @@ -78,7 +78,7 @@ public: int64_t & out_present_slop_ns, int64_t & out_predicted_display_time_ns); - void on_feedback(const xrt::drivers::wivrn::from_headset::feedback &, const clock_offset &); + void on_feedback(const wivrn::from_headset::feedback &, const clock_offset &); void mark_timing_point( comp_target_timing_point point, diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index 5924378a..c709069d 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -90,7 +90,7 @@ struct wivrn_comp_target_factory : public comp_target_factory } }; -void xrt::drivers::wivrn::tracking_control_t::send(wivrn_connection & connection) +void wivrn::tracking_control_t::send(wivrn_connection & connection) { if (std::chrono::steady_clock::now() < next_sample) return; @@ -102,7 +102,7 @@ void xrt::drivers::wivrn::tracking_control_t::send(wivrn_connection & connection next_sample += std::chrono::seconds(1); } -void xrt::drivers::wivrn::tracking_control_t::set_enabled(to_headset::tracking_control::id id, bool enabled) +void wivrn::tracking_control_t::set_enabled(to_headset::tracking_control::id id, bool enabled) { std::lock_guard lock(mutex); if (enabled != this->enabled[size_t(id)]) @@ -110,10 +110,10 @@ void xrt::drivers::wivrn::tracking_control_t::set_enabled(to_headset::tracking_c this->enabled[size_t(id)] = enabled; } -xrt::drivers::wivrn::wivrn_session::wivrn_session(xrt::drivers::wivrn::TCP && tcp, u_system & system) : +wivrn::wivrn_session::wivrn_session(wivrn::TCP && tcp, u_system & system) : connection(std::move(tcp)), info([](wivrn_connection & connection) { - std::optional control; + std::optional control; while (not(control = connection.poll_control(-1))) { // FIXME: timeout @@ -127,11 +127,11 @@ xrt::drivers::wivrn::wivrn_session::wivrn_session(xrt::drivers::wivrn::TCP && tc { } -xrt_result_t xrt::drivers::wivrn::wivrn_session::create_session(xrt::drivers::wivrn::TCP && tcp, - u_system & system, - xrt_system_devices ** out_xsysd, - xrt_space_overseer ** out_xspovrs, - xrt_system_compositor ** out_xsysc) +xrt_result_t wivrn::wivrn_session::create_session(wivrn::TCP && tcp, + u_system & system, + xrt_system_devices ** out_xsysd, + xrt_space_overseer ** out_xspovrs, + xrt_system_compositor ** out_xsysc) { std::shared_ptr self; try @@ -519,7 +519,7 @@ void wivrn_session::reconnect() { offset_est.reset(); connection.reset(std::move(*tcp)); - std::optional control; + std::optional control; while (not(control = connection.poll_control(100))) { // FIXME: timeout diff --git a/server/driver/wivrn_session.h b/server/driver/wivrn_session.h index c3fd1d20..624c0adb 100644 --- a/server/driver/wivrn_session.h +++ b/server/driver/wivrn_session.h @@ -45,7 +45,7 @@ struct xrt_space_overseer; struct xrt_system_compositor; struct wivrn_comp_target_factory; -namespace xrt::drivers::wivrn +namespace wivrn { struct wivrn_comp_target; @@ -175,4 +175,4 @@ private: void reconnect(); }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/encoder/encoder_settings.cpp b/server/encoder/encoder_settings.cpp index acdd6dbf..83e67ebc 100644 --- a/server/encoder/encoder_settings.cpp +++ b/server/encoder/encoder_settings.cpp @@ -37,7 +37,7 @@ #include "ffmpeg/video_encoder_va.h" #endif -using namespace xrt::drivers::wivrn; +using namespace wivrn; // TODO: size independent bitrate static const uint64_t default_bitrate = 50'000'000; @@ -50,7 +50,7 @@ static bool is_nvidia(vk::PhysicalDevice physical_device) return props.vendorID == 0x10DE; } -static void split_bitrate(std::vector & encoders, uint64_t bitrate) +static void split_bitrate(std::vector & encoders, uint64_t bitrate) { double total_weight = 0; for (auto & encoder: encoders) @@ -58,11 +58,11 @@ static void split_bitrate(std::vector & e double w = encoder.width * encoder.height; switch (encoder.codec) { - case xrt::drivers::wivrn::h264: + case wivrn::h264: w *= 2; break; - case xrt::drivers::wivrn::h265: - case xrt::drivers::wivrn::av1: + case wivrn::h265: + case wivrn::av1: break; } encoder.bitrate = w; @@ -75,7 +75,7 @@ static void split_bitrate(std::vector & e } } -void print_encoders(const std::vector & encoders) +void print_encoders(const std::vector & encoders) { int group = -1; for (auto & encoder: encoders) @@ -117,7 +117,7 @@ static void check_scale(std::string_view encoder_name, video_codec codec, uint16 } #if WIVRN_USE_VAAPI -static std::optional filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector & codecs) +static std::optional filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector & codecs) { VideoEncoderFFMPEG::mute_logs mute; encoder_settings s{ @@ -148,7 +148,7 @@ static std::optional filter_codecs_vaapi(wivrn } #endif -static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector & headset_codecs, configuration::encoder & config) +static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector & headset_codecs, configuration::encoder & config) { if (config.name.empty()) { @@ -200,7 +200,7 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector get_encoder_default_settings(wivrn_vk_bundle & bundle, const std::vector & headset_codecs) +static std::vector get_encoder_default_settings(wivrn_vk_bundle & bundle, const std::vector & headset_codecs) { configuration::encoder base; fill_defaults(bundle, headset_codecs, base); @@ -258,7 +258,7 @@ static void make_even(uint16_t & value, uint16_t max) value = std::min(value, max); } -std::vector xrt::drivers::wivrn::get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info) +std::vector wivrn::get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info) { configuration config; try @@ -291,11 +291,11 @@ std::vector xrt::drivers::wivrn::get_encoder_settings(wivrn_vk height *= scale[1]; height += height % 2; - std::vector res; + std::vector res; int next_group = 0; for (const auto & encoder: config.encoders) { - xrt::drivers::wivrn::encoder_settings settings{}; + wivrn::encoder_settings settings{}; settings.encoder_name = encoder.name; settings.width = std::ceil(encoder.width.value_or(1) * width); settings.height = std::ceil(encoder.height.value_or(1) * height); diff --git a/server/encoder/encoder_settings.h b/server/encoder/encoder_settings.h index 5071f19c..85e61df6 100644 --- a/server/encoder/encoder_settings.h +++ b/server/encoder/encoder_settings.h @@ -27,7 +27,7 @@ struct wivrn_vk_bundle; -namespace xrt::drivers::wivrn +namespace wivrn { struct encoder_settings : public to_headset::video_stream_description::item @@ -43,6 +43,6 @@ struct encoder_settings : public to_headset::video_stream_description::item std::vector get_encoder_settings(wivrn_vk_bundle &, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info); -} // namespace xrt::drivers::wivrn +} // namespace wivrn -void print_encoders(const std::vector & encoders); +void print_encoders(const std::vector & encoders); diff --git a/server/encoder/ffmpeg/video_encoder_ffmpeg.cpp b/server/encoder/ffmpeg/video_encoder_ffmpeg.cpp index ff19ace8..189a6172 100644 --- a/server/encoder/ffmpeg/video_encoder_ffmpeg.cpp +++ b/server/encoder/ffmpeg/video_encoder_ffmpeg.cpp @@ -63,7 +63,7 @@ bool set_log_level() bool VideoEncoderFFMPEG::once = set_log_level(); -std::optional VideoEncoderFFMPEG::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) +std::optional VideoEncoderFFMPEG::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) { push_frame(idr, target_timestamp, slot); std::shared_ptr enc_pkt(av_packet_alloc(), [](AVPacket * d) { av_packet_free(&d); }); diff --git a/server/encoder/ffmpeg/video_encoder_ffmpeg.h b/server/encoder/ffmpeg/video_encoder_ffmpeg.h index 00707dfe..9b80d59a 100644 --- a/server/encoder/ffmpeg/video_encoder_ffmpeg.h +++ b/server/encoder/ffmpeg/video_encoder_ffmpeg.h @@ -23,10 +23,10 @@ #include "ffmpeg_helper.h" #include -class VideoEncoderFFMPEG : public xrt::drivers::wivrn::VideoEncoder +class VideoEncoderFFMPEG : public wivrn::VideoEncoder { public: - using Codec = xrt::drivers::wivrn::video_codec; + using Codec = wivrn::video_codec; std::optional encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot) override; @@ -38,7 +38,7 @@ public: protected: VideoEncoderFFMPEG() : - xrt::drivers::wivrn::VideoEncoder(true) {} + wivrn::VideoEncoder(true) {} virtual void push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) = 0; diff --git a/server/encoder/ffmpeg/video_encoder_va.cpp b/server/encoder/ffmpeg/video_encoder_va.cpp index 19bf9b16..05efc9be 100644 --- a/server/encoder/ffmpeg/video_encoder_va.cpp +++ b/server/encoder/ffmpeg/video_encoder_va.cpp @@ -127,7 +127,7 @@ vk::Format drm_to_vulkan_fmt(uint32_t drm_fourcc) } // namespace -video_encoder_va::video_encoder_va(wivrn_vk_bundle & vk, xrt::drivers::wivrn::encoder_settings & settings, float fps) : +video_encoder_va::video_encoder_va(wivrn_vk_bundle & vk, wivrn::encoder_settings & settings, float fps) : synchronization2(vk.vk.features.synchronization_2) { auto drm_hw_ctx = make_drm_hw_ctx(vk.physical_device, settings.device); diff --git a/server/encoder/ffmpeg/video_encoder_va.h b/server/encoder/ffmpeg/video_encoder_va.h index 94b7a809..f1306fef 100644 --- a/server/encoder/ffmpeg/video_encoder_va.h +++ b/server/encoder/ffmpeg/video_encoder_va.h @@ -24,7 +24,7 @@ #include "video_encoder_ffmpeg.h" #include -namespace xrt::drivers::wivrn +namespace wivrn { struct encoder_settings; } @@ -45,7 +45,7 @@ class video_encoder_va : public VideoEncoderFFMPEG bool synchronization2 = false; public: - video_encoder_va(wivrn_vk_bundle &, xrt::drivers::wivrn::encoder_settings & settings, float fps); + video_encoder_va(wivrn_vk_bundle &, wivrn::encoder_settings & settings, float fps); void present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot) override; diff --git a/server/encoder/video_encoder.cpp b/server/encoder/video_encoder.cpp index 34fb8705..c36300bd 100644 --- a/server/encoder/video_encoder.cpp +++ b/server/encoder/video_encoder.cpp @@ -39,7 +39,7 @@ #include "video_encoder_x264.h" #endif -namespace xrt::drivers::wivrn +namespace wivrn { VideoEncoder::sender::sender() : @@ -293,4 +293,4 @@ void VideoEncoder::SendData(std::span data, bool end_of_frame) cnx->dump_time("send_end", shard.frame_idx, os_monotonic_get_ns(), stream_idx); } -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/encoder/video_encoder.h b/server/encoder/video_encoder.h index 0bbd792b..b9b63194 100644 --- a/server/encoder/video_encoder.h +++ b/server/encoder/video_encoder.h @@ -35,7 +35,7 @@ struct wivrn_vk_bundle; -namespace xrt::drivers::wivrn +namespace wivrn { class wivrn_session; @@ -126,4 +126,4 @@ protected: void SendData(std::span data, bool end_of_frame); }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/encoder/video_encoder_nvenc.cpp b/server/encoder/video_encoder_nvenc.cpp index 23d5faba..3c36e31f 100644 --- a/server/encoder/video_encoder_nvenc.cpp +++ b/server/encoder/video_encoder_nvenc.cpp @@ -60,7 +60,7 @@ } \ } while (0) -namespace xrt::drivers::wivrn +namespace wivrn { void VideoEncoderNvenc::deleter::operator()(CudaFunctions * fn) @@ -445,4 +445,4 @@ std::array VideoEncoderNvenc::get_max_size(video_codec codec) return result; } -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/encoder/video_encoder_nvenc.h b/server/encoder/video_encoder_nvenc.h index e81cd491..ce5dbd32 100644 --- a/server/encoder/video_encoder_nvenc.h +++ b/server/encoder/video_encoder_nvenc.h @@ -26,7 +26,7 @@ #include #include -namespace xrt::drivers::wivrn +namespace wivrn { class VideoEncoderNvenc : public VideoEncoder @@ -73,4 +73,4 @@ public: static std::array get_max_size(video_codec); }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/encoder/video_encoder_x264.cpp b/server/encoder/video_encoder_x264.cpp index 5dad09f3..5645b9d7 100644 --- a/server/encoder/video_encoder_x264.cpp +++ b/server/encoder/video_encoder_x264.cpp @@ -23,7 +23,7 @@ #include "utils/wivrn_vk_bundle.h" #include -namespace xrt::drivers::wivrn +namespace wivrn { void VideoEncoderX264::ProcessCb(x264_t * h, x264_nal_t * nal, void * opaque) @@ -249,4 +249,4 @@ VideoEncoderX264::~VideoEncoderX264() x264_encoder_close(enc); } -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/encoder/video_encoder_x264.h b/server/encoder/video_encoder_x264.h index 4b7ad65f..c5f9f5ec 100644 --- a/server/encoder/video_encoder_x264.h +++ b/server/encoder/video_encoder_x264.h @@ -27,7 +27,7 @@ #include #include -namespace xrt::drivers::wivrn +namespace wivrn { class VideoEncoderX264 : public VideoEncoder @@ -77,4 +77,4 @@ private: void InsertInPendingNal(pending_nal && nal); }; -} // namespace xrt::drivers::wivrn +} // namespace wivrn diff --git a/server/main.cpp b/server/main.cpp index 9479bc4d..27fd90d9 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -50,11 +50,11 @@ extern "C" ipc_server_main(int argc, char * argv[]); } -using namespace xrt::drivers::wivrn; +using namespace wivrn; static std::unique_ptr listener; -std::optional> wivrn_ipc_socket_main_loop; -std::optional> wivrn_ipc_socket_monado; +std::optional> wivrn_ipc_socket_main_loop; +std::optional> wivrn_ipc_socket_monado; std::filesystem::path socket_path() { @@ -205,7 +205,7 @@ std::optional publisher; gboolean headset_connected(gint fd, GIOCondition condition, gpointer user_data); void stop_listening(); -void on_headset_info_packet(const xrt::drivers::wivrn::from_headset::headset_info_packet & info); +void on_headset_info_packet(const wivrn::from_headset::headset_info_packet & info); void start_publishing(); void stop_publishing(); @@ -339,7 +339,7 @@ void start_listening() assert(listener_watch == 0); - listener = std::make_unique(xrt::drivers::wivrn::default_port); + listener = std::make_unique(wivrn::default_port); auto source_listener = g_unix_fd_source_new(listener->get_fd(), GIOCondition::G_IO_IN); g_source_set_callback(source_listener, G_SOURCE_FUNC(&headset_connected), nullptr, nullptr); listener_watch = g_source_attach(source_listener, nullptr); @@ -364,13 +364,13 @@ void start_publishing() return; char protocol_string[17]; - sprintf(protocol_string, "%016lx", xrt::drivers::wivrn::protocol_version); + sprintf(protocol_string, "%016lx", wivrn::protocol_version); std::map TXT = { {"protocol", protocol_string}, - {"version", xrt::drivers::wivrn::git_version}, + {"version", wivrn::git_version}, {"cookie", server_cookie()}, }; - publisher.emplace(poll_api, hostname(), "_wivrn._tcp", xrt::drivers::wivrn::default_port, TXT); + publisher.emplace(poll_api, hostname(), "_wivrn._tcp", wivrn::default_port, TXT); } void stop_publishing() @@ -428,7 +428,7 @@ gboolean headset_connected(gint fd, GIOCondition condition, gpointer user_data) assert(listener); - tcp = std::make_unique(listener->accept().first); + tcp = std::make_unique(listener->accept().first); init_cleanup_functions(); std::cout << "Client connected" << std::endl; @@ -444,9 +444,9 @@ gboolean control_received(gint fd, GIOCondition condition, gpointer user_data) auto packet = wivrn_ipc_socket_main_loop->receive(); if (packet) { - if (std::holds_alternative(*packet)) + if (std::holds_alternative(*packet)) { - on_headset_info_packet(std::get(*packet)); + on_headset_info_packet(std::get(*packet)); wivrn_server_set_headset_connected(dbus_server, true); } else if (std::holds_alternative(*packet)) @@ -503,7 +503,7 @@ void on_json_configuration(WivrnServer * server, const GParamSpec * pspec, gpoin std::cerr << "Failed to save configuration: " << ec.message() << std::endl; } -void on_headset_info_packet(const xrt::drivers::wivrn::from_headset::headset_info_packet & info) +void on_headset_info_packet(const wivrn::from_headset::headset_info_packet & info) { GVariantBuilder * builder; @@ -521,11 +521,11 @@ void on_headset_info_packet(const xrt::drivers::wivrn::from_headset::headset_inf wivrn_server_set_preferred_refresh_rate(dbus_server, info.preferred_refresh_rate); - auto speaker = info.speaker.value_or(xrt::drivers::wivrn::from_headset::headset_info_packet::audio_description{}); + auto speaker = info.speaker.value_or(wivrn::from_headset::headset_info_packet::audio_description{}); wivrn_server_set_speaker_channels(dbus_server, speaker.num_channels); wivrn_server_set_speaker_sample_rate(dbus_server, speaker.sample_rate); - auto mic = info.microphone.value_or(xrt::drivers::wivrn::from_headset::headset_info_packet::audio_description{}); + auto mic = info.microphone.value_or(wivrn::from_headset::headset_info_packet::audio_description{}); wivrn_server_set_mic_channels(dbus_server, mic.num_channels); wivrn_server_set_mic_sample_rate(dbus_server, mic.sample_rate); @@ -594,7 +594,7 @@ int inner_main(int argc, char * argv[], bool show_instructions) { if (show_instructions) { - std::cerr << "WiVRn " << xrt::drivers::wivrn::git_version << " starting" << std::endl; + std::cerr << "WiVRn " << wivrn::git_version << " starting" << std::endl; std::cerr << "For Steam games, set command to " << steam_command() << std::endl; } diff --git a/server/target_instance_wivrn.cpp b/server/target_instance_wivrn.cpp index 56c892c8..81698de7 100644 --- a/server/target_instance_wivrn.cpp +++ b/server/target_instance_wivrn.cpp @@ -40,7 +40,7 @@ wivrn_instance_create_system(struct xrt_instance * xinst, *out_xsys = &u_sys->base; struct xrt_system_compositor * xsysc = NULL; - auto res = xrt::drivers::wivrn::wivrn_session::create_session( + auto res = wivrn::wivrn_session::create_session( std::move(*tcp), *u_sys, out_xsysd, diff --git a/server/wivrn_ipc.cpp b/server/wivrn_ipc.cpp index 8e1076bf..d167d976 100644 --- a/server/wivrn_ipc.cpp +++ b/server/wivrn_ipc.cpp @@ -23,7 +23,7 @@ #include #include -std::unique_ptr tcp; +std::unique_ptr tcp; struct cleanup_function { diff --git a/server/wivrn_ipc.h b/server/wivrn_ipc.h index 0b686cf4..034407fc 100644 --- a/server/wivrn_ipc.h +++ b/server/wivrn_ipc.h @@ -23,7 +23,7 @@ #include #include -extern std::unique_ptr tcp; +extern std::unique_ptr tcp; namespace from_monado { @@ -32,7 +32,7 @@ struct headsdet_connected struct headsdet_disconnected {}; -using packets = std::variant; +using packets = std::variant; } // namespace from_monado namespace to_monado @@ -43,7 +43,7 @@ struct disconnect using packets = std::variant; } // namespace to_monado -extern std::optional> wivrn_ipc_socket_monado; +extern std::optional> wivrn_ipc_socket_monado; std::optional receive_from_main(); template diff --git a/tools/wireshark/dissector.cpp b/tools/wireshark/dissector.cpp index 78d62e7f..fe189582 100644 --- a/tools/wireshark/dissector.cpp +++ b/tools/wireshark/dissector.cpp @@ -54,7 +54,7 @@ static inline uint16_t get_uint8(tvbuff_t * tvb, const int offset) } #endif -using namespace xrt::drivers::wivrn; +using namespace wivrn; namespace { @@ -716,7 +716,7 @@ int dissect_wivrn(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree _U_, vo if (tcp) start += sizeof(uint16_t); - if (pinfo->destport == xrt::drivers::wivrn::default_port) + if (pinfo->destport == wivrn::default_port) tree_traits<"wivrn.from_headset", from_headset::packets>::dissect(subtree, tvb, start); else tree_traits<"wivrn.to_headset", to_headset::packets>::dissect(subtree, tvb, start); @@ -760,8 +760,8 @@ void proto_reg_handoff_wivrn() { static dissector_handle_t handle_tcp = create_dissector_handle(dissect_wivrn_tcp, proto); static dissector_handle_t handle_udp = create_dissector_handle(dissect_wivrn_udp, proto); - dissector_add_uint("udp.port", xrt::drivers::wivrn::default_port, handle_udp); - dissector_add_uint("tcp.port", xrt::drivers::wivrn::default_port, handle_tcp); + dissector_add_uint("udp.port", wivrn::default_port, handle_udp); + dissector_add_uint("tcp.port", wivrn::default_port, handle_tcp); } } // namespace