mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
style(cpp): separate multiple variable declarations (#4795)
This commit is contained in:
+10
-5
@@ -161,7 +161,8 @@ namespace crypto {
|
||||
|
||||
plaintext.resize(round_to_pkcs7_padded(cipher.size()));
|
||||
|
||||
int update_outlen, final_outlen;
|
||||
int final_outlen;
|
||||
int update_outlen;
|
||||
|
||||
if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) {
|
||||
return -1;
|
||||
@@ -195,7 +196,8 @@ namespace crypto {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int update_outlen, final_outlen;
|
||||
int final_outlen;
|
||||
int update_outlen;
|
||||
|
||||
// Encrypt into the caller's buffer
|
||||
if (EVP_EncryptUpdate(encrypt_ctx.get(), ciphertext, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
|
||||
@@ -232,7 +234,8 @@ namespace crypto {
|
||||
EVP_CIPHER_CTX_set_padding(decrypt_ctx.get(), padding);
|
||||
plaintext.resize(round_to_pkcs7_padded(cipher.size()));
|
||||
|
||||
int update_outlen, final_outlen;
|
||||
int final_outlen;
|
||||
int update_outlen;
|
||||
|
||||
if (EVP_DecryptUpdate(decrypt_ctx.get(), plaintext.data(), &update_outlen, (const std::uint8_t *) cipher.data(), (int) cipher.size()) != 1) {
|
||||
return -1;
|
||||
@@ -259,7 +262,8 @@ namespace crypto {
|
||||
EVP_CIPHER_CTX_set_padding(encrypt_ctx.get(), padding);
|
||||
cipher.resize(round_to_pkcs7_padded(plaintext.size()));
|
||||
|
||||
int update_outlen, final_outlen;
|
||||
int final_outlen;
|
||||
int update_outlen;
|
||||
|
||||
// Encrypt into the caller's buffer
|
||||
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher.data(), &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
|
||||
@@ -290,7 +294,8 @@ namespace crypto {
|
||||
return false;
|
||||
}
|
||||
|
||||
int update_outlen, final_outlen;
|
||||
int final_outlen;
|
||||
int update_outlen;
|
||||
|
||||
// Encrypt into the caller's buffer
|
||||
if (EVP_EncryptUpdate(encrypt_ctx.get(), cipher, &update_outlen, (const std::uint8_t *) plaintext.data(), (int) plaintext.size()) != 1) {
|
||||
|
||||
+2
-1
@@ -1254,7 +1254,8 @@ namespace input {
|
||||
* @return The status of the batching operation.
|
||||
*/
|
||||
batch_result_e batch(PNV_REL_MOUSE_MOVE_PACKET dest, PNV_REL_MOUSE_MOVE_PACKET src) {
|
||||
short deltaX, deltaY;
|
||||
short deltaX;
|
||||
short deltaY;
|
||||
|
||||
// Batching is safe as long as the result doesn't overflow a 16-bit integer
|
||||
if (!__builtin_add_overflow(util::endian::big(dest->deltaX), util::endian::big(src->deltaX), &deltaX)) {
|
||||
|
||||
+8
-4
@@ -25,14 +25,18 @@ namespace input {
|
||||
std::shared_ptr<input_t> alloc(safe::mail_t mail);
|
||||
|
||||
struct touch_port_t: public platf::touch_port_t {
|
||||
int env_width, env_height;
|
||||
int env_height;
|
||||
int env_width;
|
||||
|
||||
// Offset x and y coordinates of the client
|
||||
float client_offsetX, client_offsetY;
|
||||
float client_offsetX;
|
||||
float client_offsetY;
|
||||
|
||||
float scalar_inv, scalar_tpcoords;
|
||||
float scalar_inv;
|
||||
float scalar_tpcoords;
|
||||
|
||||
int env_logical_width, env_logical_height;
|
||||
int env_logical_height;
|
||||
int env_logical_width;
|
||||
|
||||
explicit operator bool() const {
|
||||
return width != 0 && height != 0 && env_width != 0 && env_height != 0;
|
||||
|
||||
+21
-8
@@ -268,9 +268,14 @@ namespace platf {
|
||||
|
||||
// Dimensions for touchscreen input
|
||||
struct touch_port_t {
|
||||
int offset_x, offset_y;
|
||||
int width, height;
|
||||
int logical_width, logical_height;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
|
||||
int height;
|
||||
int width;
|
||||
|
||||
int logical_height;
|
||||
int logical_width;
|
||||
};
|
||||
|
||||
// These values must match Limelight-internal.h's SS_FF_* constants!
|
||||
@@ -534,12 +539,20 @@ namespace platf {
|
||||
virtual ~display_t() = default;
|
||||
|
||||
// Offsets for when streaming a specific monitor. By default, they are 0.
|
||||
int offset_x, offset_y;
|
||||
int env_width, env_height;
|
||||
int env_logical_width, env_logical_height;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
|
||||
int width, height;
|
||||
int logical_width, logical_height;
|
||||
int env_height;
|
||||
int env_width;
|
||||
|
||||
int env_logical_height;
|
||||
int env_logical_width;
|
||||
|
||||
int height;
|
||||
int width;
|
||||
|
||||
int logical_height;
|
||||
int logical_width;
|
||||
|
||||
protected:
|
||||
// collect capture timing data (at loglevel debug)
|
||||
|
||||
@@ -188,7 +188,8 @@ namespace cuda {
|
||||
stream_t stream;
|
||||
frame_t hwframe;
|
||||
|
||||
int width, height;
|
||||
int height;
|
||||
int width;
|
||||
|
||||
// When height and width don't change, it's not necessary to use linear interpolation
|
||||
bool linear_interpolation;
|
||||
@@ -447,7 +448,8 @@ namespace cuda {
|
||||
egl::nv12_t nv12;
|
||||
AVPixelFormat sw_format;
|
||||
|
||||
int width, height;
|
||||
int height;
|
||||
int width;
|
||||
|
||||
std::uint64_t sequence;
|
||||
egl::rgb_t rgb;
|
||||
@@ -455,7 +457,8 @@ namespace cuda {
|
||||
registered_resource_t y_res;
|
||||
registered_resource_t uv_res;
|
||||
|
||||
int offset_x, offset_y;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
};
|
||||
|
||||
std::unique_ptr<platf::avcodec_encode_device_t> make_avcodec_encode_device(int width, int height, bool vram) {
|
||||
|
||||
@@ -69,8 +69,11 @@ namespace cuda {
|
||||
stream_t make_stream(int flags = 0);
|
||||
|
||||
struct viewport_t {
|
||||
int width, height;
|
||||
int offsetX, offsetY;
|
||||
int height;
|
||||
int width;
|
||||
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
};
|
||||
|
||||
class tex_t {
|
||||
|
||||
@@ -361,7 +361,8 @@ namespace egl {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int major, minor;
|
||||
int major;
|
||||
int minor;
|
||||
if (!eglInitialize(display.get(), &major, &minor)) {
|
||||
BOOST_LOG(error) << "Couldn't initialize EGL display: ["sv << util::hex(eglGetError()).to_string_view() << ']';
|
||||
return nullptr;
|
||||
|
||||
@@ -266,8 +266,10 @@ namespace egl {
|
||||
|
||||
class cursor_t: public platf::img_t {
|
||||
public:
|
||||
int x, y;
|
||||
int src_w, src_h;
|
||||
int src_h;
|
||||
int src_w;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
unsigned long serial;
|
||||
|
||||
@@ -329,9 +331,12 @@ namespace egl {
|
||||
gl::program_t program[3];
|
||||
gl::buffer_t color_matrix;
|
||||
|
||||
int out_width, out_height;
|
||||
int in_width, in_height;
|
||||
int offsetX, offsetY;
|
||||
int out_height;
|
||||
int out_width;
|
||||
int in_height;
|
||||
int in_width;
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
|
||||
// Pointer to the texture to be converted to nv12
|
||||
int loaded_texture;
|
||||
|
||||
@@ -296,14 +296,20 @@ namespace platf {
|
||||
struct cursor_t {
|
||||
// Public properties used during blending
|
||||
bool visible = false;
|
||||
std::int32_t x, y;
|
||||
std::uint32_t dst_w, dst_h;
|
||||
std::uint32_t src_w, src_h;
|
||||
std::uint32_t dst_h;
|
||||
std::uint32_t dst_w;
|
||||
std::uint32_t src_h;
|
||||
std::uint32_t src_w;
|
||||
std::int32_t x;
|
||||
std::int32_t y;
|
||||
std::vector<std::uint8_t> pixels;
|
||||
unsigned long serial;
|
||||
|
||||
// Private properties used for tracking cursor changes
|
||||
std::uint64_t prop_src_x, prop_src_y, prop_src_w, prop_src_h;
|
||||
std::uint64_t prop_src_x;
|
||||
std::uint64_t prop_src_y;
|
||||
std::uint64_t prop_src_h;
|
||||
std::uint64_t prop_src_w;
|
||||
std::uint32_t fb_id;
|
||||
};
|
||||
|
||||
@@ -1133,8 +1139,10 @@ namespace platf {
|
||||
|
||||
std::chrono::nanoseconds delay;
|
||||
|
||||
int img_width, img_height;
|
||||
int img_offset_x, img_offset_y;
|
||||
int img_height;
|
||||
int img_width;
|
||||
int img_offset_x;
|
||||
int img_offset_y;
|
||||
|
||||
int plane_id;
|
||||
int crtc_id;
|
||||
@@ -1317,7 +1325,8 @@ namespace platf {
|
||||
gl::ctx.BindTexture(GL_TEXTURE_2D, rgb->tex[0]);
|
||||
|
||||
// Don't remove these lines, see https://github.com/LizardByte/Sunshine/issues/453
|
||||
int w, h;
|
||||
int h;
|
||||
int w;
|
||||
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
||||
BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h;
|
||||
|
||||
@@ -398,7 +398,8 @@ namespace va {
|
||||
egl::sws_t sws;
|
||||
egl::nv12_t nv12;
|
||||
|
||||
int width, height;
|
||||
int height;
|
||||
int width;
|
||||
};
|
||||
|
||||
class va_ram_t: public va_t {
|
||||
@@ -455,7 +456,8 @@ namespace va {
|
||||
std::uint64_t sequence;
|
||||
egl::rgb_t rgb;
|
||||
|
||||
int offset_x, offset_y;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -531,7 +533,8 @@ namespace va {
|
||||
vaSetErrorCallback(display.get(), __log, &error);
|
||||
vaSetErrorCallback(display.get(), __log, &info);
|
||||
|
||||
int major, minor;
|
||||
int major;
|
||||
int minor;
|
||||
auto status = vaInitialize(display.get(), &major, &minor);
|
||||
if (status) {
|
||||
BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status);
|
||||
@@ -595,7 +598,8 @@ namespace va {
|
||||
return false;
|
||||
}
|
||||
|
||||
int major, minor;
|
||||
int major;
|
||||
int minor;
|
||||
auto status = vaInitialize(display.get(), &major, &minor);
|
||||
if (status) {
|
||||
BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status);
|
||||
|
||||
@@ -206,7 +206,8 @@ namespace wl {
|
||||
gl::ctx.BindTexture(GL_TEXTURE_2D, (*rgb_opt)->tex[0]);
|
||||
|
||||
// Don't remove these lines, see https://github.com/LizardByte/Sunshine/issues/453
|
||||
int w, h;
|
||||
int h;
|
||||
int w;
|
||||
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
|
||||
BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h;
|
||||
|
||||
@@ -77,7 +77,8 @@ namespace platf::dxgi {
|
||||
std::vector<std::uint8_t> img_data;
|
||||
|
||||
DXGI_OUTDUPL_POINTER_SHAPE_INFO shape_info;
|
||||
int x, y;
|
||||
int x;
|
||||
int y;
|
||||
bool visible;
|
||||
};
|
||||
|
||||
@@ -346,7 +347,8 @@ namespace platf::dxgi {
|
||||
winrt::Windows::Graphics::Capture::GraphicsCaptureItem item {nullptr};
|
||||
winrt::Windows::Graphics::Capture::Direct3D11CaptureFramePool frame_pool {nullptr};
|
||||
winrt::Windows::Graphics::Capture::GraphicsCaptureSession capture_session {nullptr};
|
||||
winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame produced_frame {nullptr}, consumed_frame {nullptr};
|
||||
winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame consumed_frame {nullptr};
|
||||
winrt::Windows::Graphics::Capture::Direct3D11CaptureFrame produced_frame {nullptr};
|
||||
SRWLOCK frame_lock = SRWLOCK_INIT;
|
||||
CONDITION_VARIABLE frame_present_cv;
|
||||
|
||||
|
||||
@@ -950,8 +950,10 @@ namespace platf::dxgi {
|
||||
ps_t convert_UV_ps;
|
||||
ps_t convert_UV_fp16_ps;
|
||||
|
||||
std::array<D3D11_VIEWPORT, 3> out_Y_or_YUV_viewports, out_Y_or_YUV_viewports_for_clear;
|
||||
D3D11_VIEWPORT out_UV_viewport, out_UV_viewport_for_clear;
|
||||
std::array<D3D11_VIEWPORT, 3> out_Y_or_YUV_viewports;
|
||||
std::array<D3D11_VIEWPORT, 3> out_Y_or_YUV_viewports_for_clear;
|
||||
D3D11_VIEWPORT out_UV_viewport;
|
||||
D3D11_VIEWPORT out_UV_viewport_for_clear;
|
||||
|
||||
DXGI_FORMAT format;
|
||||
|
||||
|
||||
@@ -138,7 +138,9 @@ namespace platf {
|
||||
auto &report = gamepad.report.ds4.Report;
|
||||
|
||||
// Use int32 to process this data, so we can clamp if needed.
|
||||
int32_t intX, intY, intZ;
|
||||
int32_t intX;
|
||||
int32_t intY;
|
||||
int32_t intZ;
|
||||
|
||||
switch (motion_type) {
|
||||
case LI_MOTION_TYPE_ACCEL:
|
||||
|
||||
@@ -74,18 +74,20 @@ namespace {
|
||||
std::atomic<bool> used_nt_set_timer_resolution = false;
|
||||
|
||||
bool nt_set_timer_resolution_max() {
|
||||
ULONG minimum, maximum, current;
|
||||
if (!NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) ||
|
||||
!NT_SUCCESS(NtSetTimerResolution(maximum, TRUE, ¤t))) {
|
||||
ULONG maximum;
|
||||
ULONG minimum;
|
||||
if (ULONG current; !NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) ||
|
||||
!NT_SUCCESS(NtSetTimerResolution(maximum, TRUE, ¤t))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nt_set_timer_resolution_min() {
|
||||
ULONG minimum, maximum, current;
|
||||
if (!NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) ||
|
||||
!NT_SUCCESS(NtSetTimerResolution(minimum, TRUE, ¤t))) {
|
||||
ULONG maximum;
|
||||
ULONG minimum;
|
||||
if (ULONG current; !NT_SUCCESS(NtQueryTimerResolution(&minimum, &maximum, ¤t)) ||
|
||||
!NT_SUCCESS(NtSetTimerResolution(minimum, TRUE, ¤t))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
+2
-3
@@ -1377,9 +1377,8 @@ namespace stream {
|
||||
}
|
||||
|
||||
std::array<std::string_view, MAX_FEC_BLOCKS> fec_blocks;
|
||||
decltype(fec_blocks)::iterator
|
||||
fec_blocks_begin = std::begin(fec_blocks),
|
||||
fec_blocks_end = std::begin(fec_blocks) + fec_blocks_needed;
|
||||
auto fec_blocks_begin = std::begin(fec_blocks);
|
||||
auto fec_blocks_end = std::begin(fec_blocks) + fec_blocks_needed;
|
||||
|
||||
BOOST_LOG(verbose) << "Generating "sv << fec_blocks_needed << " FEC blocks"sv;
|
||||
|
||||
|
||||
+2
-1
@@ -118,7 +118,8 @@ namespace upnp {
|
||||
}
|
||||
|
||||
if (data.IPv6FC.controlurl[0] != 0) {
|
||||
int firewallEnabled, pinholeAllowed;
|
||||
int firewallEnabled;
|
||||
int pinholeAllowed;
|
||||
|
||||
// Check if this firewall supports IPv6 pinholes
|
||||
err = UPNP_GetFirewallStatus(urls->controlURL_6FC, data.IPv6FC.servicetype, &firewallEnabled, &pinholeAllowed);
|
||||
|
||||
+15
-6
@@ -61,8 +61,10 @@ namespace video {
|
||||
struct encoder_platform_formats_t {
|
||||
virtual ~encoder_platform_formats_t() = default;
|
||||
platf::mem_type_e dev_type;
|
||||
platf::pix_fmt_e pix_fmt_8bit, pix_fmt_10bit;
|
||||
platf::pix_fmt_e pix_fmt_yuv444_8bit, pix_fmt_yuv444_10bit;
|
||||
platf::pix_fmt_e pix_fmt_8bit;
|
||||
platf::pix_fmt_e pix_fmt_10bit;
|
||||
platf::pix_fmt_e pix_fmt_yuv444_8bit;
|
||||
platf::pix_fmt_e pix_fmt_yuv444_10bit;
|
||||
};
|
||||
|
||||
struct encoder_platform_formats_avcodec: encoder_platform_formats_t {
|
||||
@@ -93,10 +95,13 @@ namespace video {
|
||||
pix_fmt_yuv444_10bit = map_pix_fmt(avcodec_pix_fmt_yuv444_10bit);
|
||||
}
|
||||
|
||||
AVHWDeviceType avcodec_base_dev_type, avcodec_derived_dev_type;
|
||||
AVHWDeviceType avcodec_base_dev_type;
|
||||
AVHWDeviceType avcodec_derived_dev_type;
|
||||
AVPixelFormat avcodec_dev_pix_fmt;
|
||||
AVPixelFormat avcodec_pix_fmt_8bit, avcodec_pix_fmt_10bit;
|
||||
AVPixelFormat avcodec_pix_fmt_yuv444_8bit, avcodec_pix_fmt_yuv444_10bit;
|
||||
AVPixelFormat avcodec_pix_fmt_8bit;
|
||||
AVPixelFormat avcodec_pix_fmt_10bit;
|
||||
AVPixelFormat avcodec_pix_fmt_yuv444_8bit;
|
||||
AVPixelFormat avcodec_pix_fmt_yuv444_10bit;
|
||||
|
||||
init_buffer_function_t init_avcodec_hardware_input_buffer;
|
||||
};
|
||||
@@ -179,7 +184,11 @@ namespace video {
|
||||
std::bitset<MAX_FLAGS>::reference operator[](flag_e flag) {
|
||||
return capabilities[(std::size_t) flag];
|
||||
}
|
||||
} av1, hevc, h264;
|
||||
};
|
||||
|
||||
codec_t av1;
|
||||
codec_t hevc;
|
||||
codec_t h264;
|
||||
|
||||
const codec_t &codec_from_config(const config_t &config) const {
|
||||
switch (config.videoFormat) {
|
||||
|
||||
@@ -123,7 +123,8 @@ namespace video {
|
||||
const color_t *color_vectors_from_colorspace(const sunshine_colorspace_t &colorspace, bool unorm_output) {
|
||||
constexpr auto generate_color_vectors = [](const sunshine_colorspace_t &colorspace, bool unorm_output) -> color_t {
|
||||
// "Table 4 – Interpretation of matrix coefficients (MatrixCoefficients) value" section of ITU-T H.273
|
||||
double Kr, Kb;
|
||||
double Kb;
|
||||
double Kr;
|
||||
switch (colorspace.colorspace) {
|
||||
case colorspace_e::rec601:
|
||||
Kr = 0.299;
|
||||
@@ -142,8 +143,10 @@ namespace video {
|
||||
}
|
||||
double Kg = 1.0 - Kr - Kb;
|
||||
|
||||
double y_mult, y_add;
|
||||
double uv_mult, uv_add;
|
||||
double uv_add;
|
||||
double uv_mult;
|
||||
double y_add;
|
||||
double y_mult;
|
||||
|
||||
// "8.3 Matrix coefficients" section of ITU-T H.273
|
||||
if (colorspace.full_range) {
|
||||
|
||||
Reference in New Issue
Block a user