wivrn namespace: move all server classes

This commit is contained in:
Patrick Nicolas
2024-10-03 23:39:32 +02:00
parent efbcef2861
commit 28284a9694
55 changed files with 195 additions and 73 deletions
+4 -3
View File
@@ -37,8 +37,8 @@
#include "ffmpeg/video_encoder_va.h"
#endif
using namespace wivrn;
namespace wivrn
{
// TODO: size independent bitrate
static const uint64_t default_bitrate = 50'000'000;
@@ -258,7 +258,7 @@ static void make_even(uint16_t & value, uint16_t max)
value = std::min(value, max);
}
std::vector<encoder_settings> wivrn::get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info)
std::vector<encoder_settings> get_encoder_settings(wivrn_vk_bundle & bundle, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info)
{
configuration config;
try
@@ -316,3 +316,4 @@ std::vector<encoder_settings> wivrn::get_encoder_settings(wivrn_vk_bundle & bund
split_bitrate(res, bitrate);
return res;
}
} // namespace wivrn
+3 -4
View File
@@ -25,10 +25,9 @@
#include <string>
#include <vector>
struct wivrn_vk_bundle;
namespace wivrn
{
struct wivrn_vk_bundle;
struct encoder_settings : public to_headset::video_stream_description::item
{
@@ -43,6 +42,6 @@ struct encoder_settings : public to_headset::video_stream_description::item
std::vector<encoder_settings> get_encoder_settings(wivrn_vk_bundle &, uint32_t & width, uint32_t & height, const from_headset::headset_info_packet & info);
} // namespace wivrn
void print_encoders(const std::vector<wivrn::encoder_settings> & encoders);
} // namespace wivrn
@@ -61,6 +61,9 @@ bool set_log_level()
} // namespace
namespace wivrn
{
bool VideoEncoderFFMPEG::once = set_log_level();
std::optional<wivrn::VideoEncoder::data> VideoEncoderFFMPEG::encode(bool idr, std::chrono::steady_clock::time_point target_timestamp, uint8_t slot)
@@ -94,3 +97,4 @@ VideoEncoderFFMPEG::mute_logs::~mute_logs()
{
set_log_level();
}
} // namespace wivrn
@@ -23,6 +23,9 @@
#include "ffmpeg_helper.h"
#include <chrono>
namespace wivrn
{
class VideoEncoderFFMPEG : public wivrn::VideoEncoder
{
public:
@@ -47,3 +50,4 @@ protected:
private:
static bool once;
};
} // namespace wivrn
@@ -40,6 +40,9 @@ extern "C"
#include <libavutil/pixdesc.h>
}
namespace wivrn
{
namespace
{
const char *
@@ -475,3 +478,4 @@ void video_encoder_va::push_frame(bool idr, std::chrono::steady_clock::time_poin
throw std::system_error(err, av_error_category(), "avcodec_send_frame failed");
}
}
} // namespace wivrn
+1 -1
View File
@@ -27,7 +27,6 @@
namespace wivrn
{
struct encoder_settings;
}
class video_encoder_va : public VideoEncoderFFMPEG
{
@@ -52,3 +51,4 @@ public:
protected:
void push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) override;
};
} // namespace wivrn
+1 -2
View File
@@ -33,11 +33,10 @@
#include "encoder_settings.h"
#include "wivrn_packets.h"
struct wivrn_vk_bundle;
namespace wivrn
{
struct wivrn_vk_bundle;
class wivrn_session;
inline const char * encoder_nvenc = "nvenc";