docs: improvements to source code documentation (#1236)
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
//
|
||||
// Created by loki on 6/21/19.
|
||||
//
|
||||
|
||||
#ifndef SUNSHINE_COMMON_H
|
||||
#define SUNSHINE_COMMON_H
|
||||
#pragma once
|
||||
|
||||
#include <bitset>
|
||||
#include <filesystem>
|
||||
@@ -215,8 +210,8 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* implementations must take ownership of 'frame'
|
||||
*/
|
||||
* implementations must take ownership of 'frame'
|
||||
*/
|
||||
virtual int
|
||||
set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) {
|
||||
BOOST_LOG(error) << "Illegal call to hwdevice_t::set_frame(). Did you forget to override it?";
|
||||
@@ -227,14 +222,14 @@ namespace platf {
|
||||
set_colorspace(std::uint32_t colorspace, std::uint32_t color_range) {};
|
||||
|
||||
/**
|
||||
* Implementations may set parameters during initialization of the hwframes context
|
||||
*/
|
||||
* Implementations may set parameters during initialization of the hwframes context
|
||||
*/
|
||||
virtual void
|
||||
init_hwframes(AVHWFramesContext *frames) {};
|
||||
|
||||
/**
|
||||
* Implementations may make modifications required before context derivation
|
||||
*/
|
||||
* Implementations may make modifications required before context derivation
|
||||
*/
|
||||
virtual int
|
||||
prepare_to_derive_context(int hw_device_type) {
|
||||
return 0;
|
||||
@@ -254,44 +249,44 @@ namespace platf {
|
||||
class display_t {
|
||||
public:
|
||||
/**
|
||||
* When display has a new image ready or a timeout occurs, this callback will be called with the image.
|
||||
* If a frame was captured, frame_captured will be true. If a timeout occurred, it will be false.
|
||||
*
|
||||
* On Break Request -->
|
||||
* Returns false
|
||||
*
|
||||
* On Success -->
|
||||
* Returns true
|
||||
*/
|
||||
* When display has a new image ready or a timeout occurs, this callback will be called with the image.
|
||||
* If a frame was captured, frame_captured will be true. If a timeout occurred, it will be false.
|
||||
*
|
||||
* On Break Request -->
|
||||
* Returns false
|
||||
*
|
||||
* On Success -->
|
||||
* Returns true
|
||||
*/
|
||||
using push_captured_image_cb_t = std::function<bool(std::shared_ptr<img_t> &&img, bool frame_captured)>;
|
||||
|
||||
/**
|
||||
* Use to get free image from the pool. Calls must be synchronized.
|
||||
* Blocks until there is free image in the pool or capture is interrupted.
|
||||
*
|
||||
* Returns:
|
||||
* 'true' on success, img_out contains free image
|
||||
* 'false' when capture has been interrupted, img_out contains nullptr
|
||||
*/
|
||||
* Use to get free image from the pool. Calls must be synchronized.
|
||||
* Blocks until there is free image in the pool or capture is interrupted.
|
||||
*
|
||||
* Returns:
|
||||
* 'true' on success, img_out contains free image
|
||||
* 'false' when capture has been interrupted, img_out contains nullptr
|
||||
*/
|
||||
using pull_free_image_cb_t = std::function<bool(std::shared_ptr<img_t> &img_out)>;
|
||||
|
||||
display_t() noexcept:
|
||||
offset_x { 0 }, offset_y { 0 } {}
|
||||
|
||||
/**
|
||||
* push_captured_image_cb --> The callback that is called with captured image,
|
||||
* must be called from the same thread as capture()
|
||||
* pull_free_image_cb --> Capture backends call this callback to get empty image
|
||||
* from the pool. If backend uses multiple threads, calls to this
|
||||
* callback must be synchronized. Calls to this callback and
|
||||
* push_captured_image_cb must be synchronized as well.
|
||||
* bool *cursor --> A pointer to the flag that indicates wether the cursor should be captured as well
|
||||
*
|
||||
* Returns either:
|
||||
* capture_e::ok when stopping
|
||||
* capture_e::error on error
|
||||
* capture_e::reinit when need of reinitialization
|
||||
*/
|
||||
* push_captured_image_cb --> The callback that is called with captured image,
|
||||
* must be called from the same thread as capture()
|
||||
* pull_free_image_cb --> Capture backends call this callback to get empty image
|
||||
* from the pool. If backend uses multiple threads, calls to this
|
||||
* callback must be synchronized. Calls to this callback and
|
||||
* push_captured_image_cb must be synchronized as well.
|
||||
* bool *cursor --> A pointer to the flag that indicates wether the cursor should be captured as well
|
||||
*
|
||||
* Returns either:
|
||||
* capture_e::ok when stopping
|
||||
* capture_e::error on error
|
||||
* capture_e::reinit when need of reinitialization
|
||||
*/
|
||||
virtual capture_e
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) = 0;
|
||||
|
||||
@@ -368,14 +363,14 @@ namespace platf {
|
||||
audio_control();
|
||||
|
||||
/**
|
||||
* display_name --> The name of the monitor that SHOULD be displayed
|
||||
* If display_name is empty --> Use the first monitor that's compatible you can find
|
||||
* If you require to use this parameter in a seperate thread --> make a copy of it.
|
||||
*
|
||||
* config --> Stream configuration
|
||||
*
|
||||
* Returns display_t based on hwdevice_type
|
||||
*/
|
||||
* display_name --> The name of the monitor that SHOULD be displayed
|
||||
* If display_name is empty --> Use the first monitor that's compatible you can find
|
||||
* If you require to use this parameter in a seperate thread --> make a copy of it.
|
||||
*
|
||||
* config --> Stream configuration
|
||||
*
|
||||
* Returns display_t based on hwdevice_type
|
||||
*/
|
||||
std::shared_ptr<display_t>
|
||||
display(mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config);
|
||||
|
||||
@@ -468,5 +463,3 @@ namespace platf {
|
||||
std::vector<std::string_view> &
|
||||
supported_gamepads();
|
||||
} // namespace platf
|
||||
|
||||
#endif //SUNSHINE_COMMON_H
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
//
|
||||
// Created by loki on 5/16/21.
|
||||
//
|
||||
#include <bitset>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ using namespace std::literals;
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
//////////////////// Special desclarations
|
||||
// Special declarations
|
||||
/**
|
||||
* NVCC tends to have problems with standard headers.
|
||||
* Don't include common.h, instead use bare minimum
|
||||
@@ -78,7 +78,7 @@ static_assert(sizeof(video::color_t) == sizeof(video::color_extern_t), "color ma
|
||||
extern color_t colors[6];
|
||||
} // namespace video
|
||||
|
||||
//////////////////// End special declarations
|
||||
// End special declarations
|
||||
|
||||
namespace cuda {
|
||||
auto constexpr INVALID_TEXTURE = std::numeric_limits<cudaTextureObject_t>::max();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#if !defined(SUNSHINE_PLATFORM_CUDA_H) && defined(SUNSHINE_BUILD_CUDA)
|
||||
#define SUNSHINE_PLATFORM_CUDA_H
|
||||
#pragma once
|
||||
|
||||
#if defined(SUNSHINE_BUILD_CUDA)
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@@ -89,11 +90,11 @@ namespace cuda {
|
||||
sws_t(int in_width, int in_height, int out_width, int out_height, int pitch, int threadsPerBlock, ptr_t &&color_matrix);
|
||||
|
||||
/**
|
||||
* in_width, in_height -- The width and height of the captured image in pixels
|
||||
* out_width, out_height -- the width and height of the NV12 image in pixels
|
||||
*
|
||||
* pitch -- The size of a single row of pixels in bytes
|
||||
*/
|
||||
* in_width, in_height -- The width and height of the captured image in pixels
|
||||
* out_width, out_height -- the width and height of the NV12 image in pixels
|
||||
*
|
||||
* pitch -- The size of a single row of pixels in bytes
|
||||
*/
|
||||
static std::optional<sws_t>
|
||||
make(int in_width, int in_height, int out_width, int out_height, int pitch);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_PLATFORM_LINUX_OPENGL_H
|
||||
#define SUNSHINE_PLATFORM_LINUX_OPENGL_H
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
@@ -94,8 +93,8 @@ namespace gl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a part of the framebuffer to texture
|
||||
*/
|
||||
* Copies a part of the framebuffer to texture
|
||||
*/
|
||||
void
|
||||
copy(int id, int texture, int offset_x, int offset_y, int width, int height);
|
||||
};
|
||||
@@ -352,5 +351,3 @@ namespace egl {
|
||||
bool
|
||||
fail();
|
||||
} // namespace egl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -143,9 +143,9 @@ namespace platf {
|
||||
constexpr auto UNKNOWN = 0;
|
||||
|
||||
/**
|
||||
* @brief Initializes the keycode constants for translating
|
||||
* moonlight keycodes to linux/X11 keycodes
|
||||
*/
|
||||
* @brief Initializes the keycode constants for translating
|
||||
* moonlight keycodes to linux/X11 keycodes.
|
||||
*/
|
||||
static constexpr std::array<keycode_t, 0xE3>
|
||||
init_keycodes() {
|
||||
std::array<keycode_t, 0xE3> keycodes {};
|
||||
@@ -1047,16 +1047,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XTest absolute mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param x Absolute x position.
|
||||
* @param y Absolute y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_abs_mouse(input, 0, 0);
|
||||
* ```
|
||||
*/
|
||||
* @brief XTest absolute mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param x Absolute x position.
|
||||
* @param y Absolute y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_abs_mouse(input, 0, 0);
|
||||
* ```
|
||||
*/
|
||||
static void
|
||||
x_abs_mouse(input_t &input, float x, float y) {
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
@@ -1070,17 +1070,17 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Absolute mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param touch_port The touch_port instance to use.
|
||||
* @param x Absolute x position.
|
||||
* @param y Absolute y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* abs_mouse(input, touch_port, 0, 0);
|
||||
* ```
|
||||
*/
|
||||
* @brief Absolute mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param touch_port The touch_port instance to use.
|
||||
* @param x Absolute x position.
|
||||
* @param y Absolute y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* abs_mouse(input, touch_port, 0, 0);
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y) {
|
||||
auto touchscreen = ((input_raw_t *) input.get())->touch_input.get();
|
||||
@@ -1101,16 +1101,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XTest relative mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param deltaX Relative x position.
|
||||
* @param deltaY Relative y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
|
||||
* ```
|
||||
*/
|
||||
* @brief XTest relative mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param deltaX Relative x position.
|
||||
* @param deltaY Relative y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
|
||||
* ```
|
||||
*/
|
||||
static void
|
||||
x_move_mouse(input_t &input, int deltaX, int deltaY) {
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
@@ -1124,16 +1124,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Relative mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param deltaX Relative x position.
|
||||
* @param deltaY Relative y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
|
||||
* ```
|
||||
*/
|
||||
* @brief Relative mouse move.
|
||||
* @param input The input_t instance to use.
|
||||
* @param deltaX Relative x position.
|
||||
* @param deltaY Relative y position.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
move_mouse(input_t &input, int deltaX, int deltaY) {
|
||||
auto mouse = ((input_raw_t *) input.get())->mouse_input.get();
|
||||
@@ -1154,16 +1154,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XTest mouse button press/release.
|
||||
* @param input The input_t instance to use.
|
||||
* @param button Which mouse button to emulate.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_button_mouse(input, 1, false); // Press left mouse button
|
||||
* ```
|
||||
*/
|
||||
* @brief XTest mouse button press/release.
|
||||
* @param input The input_t instance to use.
|
||||
* @param button Which mouse button to emulate.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_button_mouse(input, 1, false); // Press left mouse button
|
||||
* ```
|
||||
*/
|
||||
static void
|
||||
x_button_mouse(input_t &input, int button, bool release) {
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
@@ -1197,16 +1197,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Mouse button press/release.
|
||||
* @param input The input_t instance to use.
|
||||
* @param button Which mouse button to emulate.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* button_mouse(input, 1, false); // Press left mouse button
|
||||
* ```
|
||||
*/
|
||||
* @brief Mouse button press/release.
|
||||
* @param input The input_t instance to use.
|
||||
* @param button Which mouse button to emulate.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* button_mouse(input, 1, false); // Press left mouse button
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
button_mouse(input_t &input, int button, bool release) {
|
||||
auto mouse = ((input_raw_t *) input.get())->mouse_input.get();
|
||||
@@ -1245,17 +1245,17 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XTest mouse scroll.
|
||||
* @param input The input_t instance to use.
|
||||
* @param distance How far to scroll
|
||||
* @param button_pos Which mouse button to emulate for positive scroll.
|
||||
* @param button_neg Which mouse button to emulate for negative scroll.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_scroll(input, 10, 4, 5);
|
||||
* ```
|
||||
*/
|
||||
* @brief XTest mouse scroll.
|
||||
* @param input The input_t instance to use.
|
||||
* @param distance How far to scroll.
|
||||
* @param button_pos Which mouse button to emulate for positive scroll.
|
||||
* @param button_neg Which mouse button to emulate for negative scroll.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_scroll(input, 10, 4, 5);
|
||||
* ```
|
||||
*/
|
||||
static void
|
||||
x_scroll(input_t &input, int distance, int button_pos, int button_neg) {
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
@@ -1274,15 +1274,15 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Vertical mouse scroll.
|
||||
* @param input The input_t instance to use.
|
||||
* @param high_res_distance How far to scroll
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* scroll(input, 1200);
|
||||
* ```
|
||||
*/
|
||||
* @brief Vertical mouse scroll.
|
||||
* @param input The input_t instance to use.
|
||||
* @param high_res_distance How far to scroll.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* scroll(input, 1200);
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
scroll(input_t &input, int high_res_distance) {
|
||||
int distance = high_res_distance / 120;
|
||||
@@ -1299,15 +1299,15 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Horizontal mouse scroll.
|
||||
* @param input The input_t instance to use.
|
||||
* @param high_res_distance How far to scroll
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* hscroll(input, 1200);
|
||||
* ```
|
||||
*/
|
||||
* @brief Horizontal mouse scroll.
|
||||
* @param input The input_t instance to use.
|
||||
* @param high_res_distance How far to scroll.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* hscroll(input, 1200);
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
hscroll(input_t &input, int high_res_distance) {
|
||||
int distance = high_res_distance / 120;
|
||||
@@ -1333,17 +1333,17 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief XTest keyboard emulation.
|
||||
* @param input The input_t instance to use.
|
||||
* @param modcode The moonlight key code.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
* @param flags SS_KBE_FLAG_* values
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_keyboard(input, 0x5A, false, 0); // Press Z
|
||||
* ```
|
||||
*/
|
||||
* @brief XTest keyboard emulation.
|
||||
* @param input The input_t instance to use.
|
||||
* @param modcode The moonlight key code.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
* @param flags SS_KBE_FLAG_* values
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* x_keyboard(input, 0x5A, false, 0); // Press Z
|
||||
* ```
|
||||
*/
|
||||
static void
|
||||
x_keyboard(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
@@ -1368,17 +1368,17 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Keyboard emulation.
|
||||
* @param input The input_t instance to use.
|
||||
* @param modcode The moonlight key code.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
* @param flags SS_KBE_FLAG_* values
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* keyboard(input, 0x5A, false, 0); // Press Z
|
||||
* ```
|
||||
*/
|
||||
* @brief Keyboard emulation.
|
||||
* @param input The input_t instance to use.
|
||||
* @param modcode The moonlight key code.
|
||||
* @param release Whether the event was a press (false) or a release (true)
|
||||
* @param flags SS_KBE_FLAG_* values
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* keyboard(input, 0x5A, false, 0); // Press Z
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
keyboard(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
|
||||
auto keyboard = ((input_raw_t *) input.get())->keyboard_input.get();
|
||||
@@ -1407,12 +1407,12 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes an UTF-32 encoded string and returns a hex string representation of the bytes (uppercase)
|
||||
*
|
||||
* ex: ['👱'] = "1F471" // see UTF encoding at https://www.compart.com/en/unicode/U+1F471
|
||||
*
|
||||
* adapted from: https://stackoverflow.com/a/7639754
|
||||
*/
|
||||
* Takes an UTF-32 encoded string and returns a hex string representation of the bytes (uppercase)
|
||||
*
|
||||
* ex: ['👱'] = "1F471" // see UTF encoding at https://www.compart.com/en/unicode/U+1F471
|
||||
*
|
||||
* adapted from: https://stackoverflow.com/a/7639754
|
||||
*/
|
||||
std::string
|
||||
to_hex(const std::basic_string<char32_t> &str) {
|
||||
std::stringstream ss;
|
||||
@@ -1427,16 +1427,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* Here we receive a single UTF-8 encoded char at a time,
|
||||
* the trick is to convert it to UTF-32 then send CTRL+SHIFT+U+<HEXCODE> in order to produce any
|
||||
* unicode character, see: https://en.wikipedia.org/wiki/Unicode_input
|
||||
*
|
||||
* ex:
|
||||
* - when receiving UTF-8 [0xF0 0x9F 0x91 0xB1] (which is '👱')
|
||||
* - we'll convert it to UTF-32 [0x1F471]
|
||||
* - then type: CTRL+SHIFT+U+1F471
|
||||
* see the conversion at: https://www.compart.com/en/unicode/U+1F471
|
||||
*/
|
||||
* Here we receive a single UTF-8 encoded char at a time,
|
||||
* the trick is to convert it to UTF-32 then send CTRL+SHIFT+U+{HEXCODE} in order to produce any
|
||||
* unicode character, see: https://en.wikipedia.org/wiki/Unicode_input
|
||||
*
|
||||
* ex:
|
||||
* - when receiving UTF-8 [0xF0 0x9F 0x91 0xB1] (which is '👱')
|
||||
* - we'll convert it to UTF-32 [0x1F471]
|
||||
* - then type: CTRL+SHIFT+U+1F471
|
||||
* see the conversion at: https://www.compart.com/en/unicode/U+1F471
|
||||
*/
|
||||
void
|
||||
unicode(input_t &input, char *utf8, int size) {
|
||||
auto kb = ((input_raw_t *) input.get())->keyboard_input.get();
|
||||
@@ -1549,13 +1549,13 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initalize a new keyboard and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_keyboard = keyboard();
|
||||
* ```
|
||||
*/
|
||||
* @brief Initialize a new keyboard and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_keyboard = keyboard();
|
||||
* ```
|
||||
*/
|
||||
evdev_t
|
||||
keyboard() {
|
||||
evdev_t dev { libevdev_new() };
|
||||
@@ -1578,13 +1578,13 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initalize a new uinput virtual mouse and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_mouse = mouse();
|
||||
* ```
|
||||
*/
|
||||
* @brief Initialize a new `uinput` virtual mouse and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_mouse = mouse();
|
||||
* ```
|
||||
*/
|
||||
evdev_t
|
||||
mouse() {
|
||||
evdev_t dev { libevdev_new() };
|
||||
@@ -1629,13 +1629,13 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initalize a new uinput virtual touchscreen and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_touchscreen = touchscreen();
|
||||
* ```
|
||||
*/
|
||||
* @brief Initialize a new `uinput` virtual touchscreen and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_touchscreen = touchscreen();
|
||||
* ```
|
||||
*/
|
||||
evdev_t
|
||||
touchscreen() {
|
||||
evdev_t dev { libevdev_new() };
|
||||
@@ -1679,13 +1679,13 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initalize a new uinput virtual X360 gamepad and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_x360 = x360();
|
||||
* ```
|
||||
*/
|
||||
* @brief Initialize a new `uinput` virtual X360 gamepad and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_x360 = x360();
|
||||
* ```
|
||||
*/
|
||||
evdev_t
|
||||
x360() {
|
||||
evdev_t dev { libevdev_new() };
|
||||
@@ -1756,13 +1756,13 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initalize the input system and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_input = input();
|
||||
* ```
|
||||
*/
|
||||
* @brief Initialize the input system and return it.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* auto my_input = input();
|
||||
* ```
|
||||
*/
|
||||
input_t
|
||||
input() {
|
||||
input_t result { new input_raw_t() };
|
||||
|
||||
@@ -552,7 +552,7 @@ namespace platf {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//TODO: surf_sd = fb->to_sd();
|
||||
// TODO: surf_sd = fb->to_sd();
|
||||
|
||||
auto crct = card.crtc(plane->crtc_id);
|
||||
kms::print(plane.get(), fb.get(), crct.get());
|
||||
@@ -999,15 +999,15 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* On Wayland, it's not possible to determine the position of the monitor on the desktop with KMS.
|
||||
* Wayland does allow applications to query attached monitors on the desktop,
|
||||
* however, the naming scheme is not standardized across implementations.
|
||||
*
|
||||
* As a result, correlating the KMS output to the wayland outputs is guess work at best.
|
||||
* But, it's necessary for absolute mouse coordinates to work.
|
||||
*
|
||||
* This is an ugly hack :(
|
||||
*/
|
||||
* On Wayland, it's not possible to determine the position of the monitor on the desktop with KMS.
|
||||
* Wayland does allow applications to query attached monitors on the desktop,
|
||||
* however, the naming scheme is not standardized across implementations.
|
||||
*
|
||||
* As a result, correlating the KMS output to the wayland outputs is guess work at best.
|
||||
* But, it's necessary for absolute mouse coordinates to work.
|
||||
*
|
||||
* This is an ugly hack :(
|
||||
*/
|
||||
void
|
||||
correlate_to_wayland(std::vector<kms::card_descriptor_t> &cds) {
|
||||
auto monitors = wl::monitors();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_PLATFORM_MISC_H
|
||||
#define SUNSHINE_PLATFORM_MISC_H
|
||||
#pragma once
|
||||
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
@@ -29,5 +28,3 @@ namespace dyn {
|
||||
handle(const std::vector<const char *> &libs);
|
||||
|
||||
} // namespace dyn
|
||||
|
||||
#endif
|
||||
@@ -12,7 +12,9 @@ using namespace std::literals;
|
||||
|
||||
namespace avahi {
|
||||
|
||||
/** Error codes used by avahi */
|
||||
/**
|
||||
* @brief Error codes used by avahi
|
||||
*/
|
||||
enum err_e {
|
||||
OK = 0, /**< OK */
|
||||
ERR_FAILURE = -1, /**< Generic error code */
|
||||
@@ -113,7 +115,9 @@ namespace avahi {
|
||||
CLIENT_NO_FAIL = 2 /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter CLIENT_CONNECTING state and wait for the daemon to appear */
|
||||
};
|
||||
|
||||
/** Some flags for publishing functions */
|
||||
/**
|
||||
* @brief Some flags for publishing functions
|
||||
*/
|
||||
enum PublishFlags {
|
||||
PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
|
||||
PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
|
||||
@@ -434,4 +438,4 @@ namespace platf::publish {
|
||||
|
||||
return std::make_unique<deinit_t>(std::thread { avahi::simple_poll_loop, poll.get() });
|
||||
}
|
||||
} // namespace platf::publish
|
||||
} // namespace platf::publish
|
||||
|
||||
@@ -7,8 +7,7 @@ extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <va/va.h>
|
||||
#if !VA_CHECK_VERSION(1, 9, 0)
|
||||
/* vaSyncBuffer stub allows Sunshine built against libva <2.9.0
|
||||
to link against ffmpeg on libva 2.9.0 or later */
|
||||
// vaSyncBuffer stub allows Sunshine built against libva <2.9.0 to link against ffmpeg on libva 2.9.0 or later
|
||||
VAStatus
|
||||
vaSyncBuffer(
|
||||
VADisplay dpy,
|
||||
@@ -56,10 +55,7 @@ namespace va {
|
||||
// Needs to be closed manually
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* Total size of this object (may include regions which are
|
||||
* not part of the surface).
|
||||
*/
|
||||
// Total size of this object (may include regions which are not part of the surface)
|
||||
uint32_t size;
|
||||
// Format modifier applied to this object, not sure what that means
|
||||
uint64_t drm_format_modifier;
|
||||
@@ -85,7 +81,9 @@ namespace va {
|
||||
} layers[4];
|
||||
};
|
||||
|
||||
/** Currently defined profiles */
|
||||
/**
|
||||
* @brief Currently defined profiles
|
||||
*/
|
||||
enum class profile_e {
|
||||
// Profile ID used for video processing.
|
||||
ProfileNone = -1,
|
||||
@@ -135,9 +133,9 @@ namespace va {
|
||||
IDCT = 3,
|
||||
MoComp = 4,
|
||||
Deblocking = 5,
|
||||
EncSlice = 6, /* slice level encode */
|
||||
EncPicture = 7, /* pictuer encode, JPEG, etc */
|
||||
/*
|
||||
EncSlice = 6, /** slice level encode */
|
||||
EncPicture = 7, /** picture encode, JPEG, etc */
|
||||
/**
|
||||
* For an implementation that supports a low power/high performance variant
|
||||
* for slice level encode, it can choose to expose the
|
||||
* VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be
|
||||
@@ -148,7 +146,7 @@ namespace va {
|
||||
EncSliceLP = 8,
|
||||
VideoProc = 10, /**< Video pre/post-processing. */
|
||||
/**
|
||||
* \brief FEI
|
||||
* @brief FEI
|
||||
*
|
||||
* The purpose of FEI (Flexible Encoding Infrastructure) is to allow applications to
|
||||
* have more controls and trade off quality for speed with their own IPs.
|
||||
@@ -162,10 +160,10 @@ namespace va {
|
||||
* and VAEncFEIDistortionBufferType) for FEI entry function.
|
||||
* If separate PAK is set, two extra input buffers
|
||||
* (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input.
|
||||
**/
|
||||
*/
|
||||
FEI = 11,
|
||||
/**
|
||||
* \brief Stats
|
||||
* @brief Stats
|
||||
*
|
||||
* A pre-processing function for getting some statistics and motion vectors is added,
|
||||
* and some extra controls for Encode pipeline are provided. The application can
|
||||
@@ -179,19 +177,19 @@ namespace va {
|
||||
* (VAStatsStatisticsParameterBufferType) and one or two output buffers
|
||||
* (VAStatsStatisticsBufferType, VAStatsStatisticsBottomFieldBufferType (for interlace only)
|
||||
* and VAStatsMVBufferType) are needed for this entry point.
|
||||
**/
|
||||
*/
|
||||
Stats = 12,
|
||||
/**
|
||||
* \brief ProtectedTEEComm
|
||||
* @brief ProtectedTEEComm
|
||||
*
|
||||
* A function for communicating with TEE (Trusted Execution Environment).
|
||||
**/
|
||||
*/
|
||||
ProtectedTEEComm = 13,
|
||||
/**
|
||||
* \brief ProtectedContent
|
||||
* @brief ProtectedContent
|
||||
*
|
||||
* A function for protected content to decrypt encrypted content.
|
||||
**/
|
||||
*/
|
||||
ProtectedContent = 14,
|
||||
};
|
||||
|
||||
@@ -475,11 +473,11 @@ namespace va {
|
||||
};
|
||||
|
||||
/**
|
||||
* This is a private structure of FFmpeg, I need this to manually create
|
||||
* a VAAPI hardware context
|
||||
*
|
||||
* xdisplay will not be used internally by FFmpeg
|
||||
*/
|
||||
* This is a private structure of FFmpeg, I need this to manually create
|
||||
* a VAAPI hardware context
|
||||
*
|
||||
* xdisplay will not be used internally by FFmpeg
|
||||
*/
|
||||
typedef struct VAAPIDevicePriv {
|
||||
union {
|
||||
void *xdisplay;
|
||||
@@ -489,22 +487,22 @@ namespace va {
|
||||
} VAAPIDevicePriv;
|
||||
|
||||
/**
|
||||
* VAAPI connection details.
|
||||
*
|
||||
* Allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
* VAAPI connection details.
|
||||
*
|
||||
* Allocated as AVHWDeviceContext.hwctx
|
||||
*/
|
||||
typedef struct AVVAAPIDeviceContext {
|
||||
/**
|
||||
* The VADisplay handle, to be filled by the user.
|
||||
*/
|
||||
* The VADisplay handle, to be filled by the user.
|
||||
*/
|
||||
va::VADisplay display;
|
||||
/**
|
||||
* Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
|
||||
* with reference to a table of known drivers, unless the
|
||||
* AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
|
||||
* may need to refer to this field when performing any later
|
||||
* operations using VAAPI with the same VADisplay.
|
||||
*/
|
||||
* Driver quirks to apply - this is filled by av_hwdevice_ctx_init(),
|
||||
* with reference to a table of known drivers, unless the
|
||||
* AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user
|
||||
* may need to refer to this field when performing any later
|
||||
* operations using VAAPI with the same VADisplay.
|
||||
*/
|
||||
unsigned int driver_quirks;
|
||||
} AVVAAPIDeviceContext;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_VAAPI_H
|
||||
#define SUNSHINE_VAAPI_H
|
||||
#pragma once
|
||||
|
||||
#include "misc.h"
|
||||
#include "src/platform/common.h"
|
||||
@@ -9,12 +8,12 @@ namespace egl {
|
||||
}
|
||||
namespace va {
|
||||
/**
|
||||
* Width --> Width of the image
|
||||
* Height --> Height of the image
|
||||
* offset_x --> Horizontal offset of the image in the texture
|
||||
* offset_y --> Vertical offset of the image in the texture
|
||||
* file_t card --> The file descriptor of the render device used for encoding
|
||||
*/
|
||||
* Width --> Width of the image
|
||||
* Height --> Height of the image
|
||||
* offset_x --> Horizontal offset of the image in the texture
|
||||
* offset_y --> Vertical offset of the image in the texture
|
||||
* file_t card --> The file descriptor of the render device used for encoding
|
||||
*/
|
||||
std::shared_ptr<platf::hwdevice_t>
|
||||
make_hwdevice(int width, int height, bool vram);
|
||||
std::shared_ptr<platf::hwdevice_t>
|
||||
@@ -29,4 +28,3 @@ namespace va {
|
||||
int
|
||||
init();
|
||||
} // namespace va
|
||||
#endif
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_WAYLAND_H
|
||||
#define SUNSHINE_WAYLAND_H
|
||||
#pragma once
|
||||
|
||||
#include <bitset>
|
||||
|
||||
@@ -180,9 +179,9 @@ namespace wl {
|
||||
class display_t {
|
||||
public:
|
||||
/**
|
||||
* Initialize display with display_name
|
||||
* If display_name == nullptr -> display_name = std::getenv("WAYLAND_DISPLAY")
|
||||
*/
|
||||
* Initialize display with display_name
|
||||
* If display_name == nullptr -> display_name = std::getenv("WAYLAND_DISPLAY")
|
||||
*/
|
||||
int
|
||||
init(const char *display_name = nullptr);
|
||||
|
||||
@@ -246,5 +245,3 @@ namespace wl {
|
||||
init() { return -1; }
|
||||
} // namespace wl
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,3 @@
|
||||
//
|
||||
// Created by loki on 6/21/19.
|
||||
//
|
||||
|
||||
#include "src/platform/common.h"
|
||||
|
||||
#include <fstream>
|
||||
@@ -389,10 +385,10 @@ namespace platf {
|
||||
|
||||
mem_type_e mem_type;
|
||||
|
||||
/*
|
||||
* Last X (NOT the streamed monitor!) size.
|
||||
* This way we can trigger reinitialization if the dimensions changed while streaming
|
||||
*/
|
||||
/**
|
||||
* Last X (NOT the streamed monitor!) size.
|
||||
* This way we can trigger reinitialization if the dimensions changed while streaming
|
||||
*/
|
||||
// int env_width, env_height;
|
||||
|
||||
x11_attr_t(mem_type_e mem_type):
|
||||
@@ -468,11 +464,11 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the display attributes should change.
|
||||
*/
|
||||
* Called when the display attributes should change.
|
||||
*/
|
||||
void
|
||||
refresh() {
|
||||
x11::GetWindowAttributes(xdisplay.get(), xwindow, &xattr); //Update xattr's
|
||||
x11::GetWindowAttributes(xdisplay.get(), xwindow, &xattr); // Update xattr's
|
||||
}
|
||||
|
||||
capture_e
|
||||
@@ -521,7 +517,7 @@ namespace platf {
|
||||
snapshot(const pull_free_image_cb_t &pull_free_image_cb, std::shared_ptr<platf::img_t> &img_out, std::chrono::milliseconds timeout, bool cursor) {
|
||||
refresh();
|
||||
|
||||
//The whole X server changed, so we must reinit everything
|
||||
// The whole X server changed, so we must reinit everything
|
||||
if (xattr.width != env_width || xattr.height != env_height) {
|
||||
BOOST_LOG(warning) << "X dimensions changed in non-SHM mode, request reinit"sv;
|
||||
return capture_e::reinit;
|
||||
@@ -657,7 +653,7 @@ namespace platf {
|
||||
|
||||
capture_e
|
||||
snapshot(const pull_free_image_cb_t &pull_free_image_cb, std::shared_ptr<platf::img_t> &img_out, std::chrono::milliseconds timeout, bool cursor) {
|
||||
//The whole X server changed, so we must reinit everything
|
||||
// The whole X server changed, so we must reinit everything
|
||||
if (xattr.width != env_width || xattr.height != env_height) {
|
||||
BOOST_LOG(warning) << "X dimensions changed in SHM mode, request reinit"sv;
|
||||
return capture_e::reinit;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_X11_GRAB
|
||||
#define SUNSHINE_X11_GRAB
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
@@ -34,11 +33,11 @@ namespace platf::x11 {
|
||||
capture(egl::cursor_t &img);
|
||||
|
||||
/**
|
||||
* Capture and blend the cursor into the image
|
||||
*
|
||||
* img <-- destination image
|
||||
* offsetX, offsetY <--- Top left corner of the virtual screen
|
||||
*/
|
||||
* Capture and blend the cursor into the image
|
||||
*
|
||||
* img <-- destination image
|
||||
* offsetX, offsetY <--- Top left corner of the virtual screen
|
||||
*/
|
||||
void
|
||||
blend(img_t &img, int offsetX, int offsetY);
|
||||
|
||||
@@ -66,5 +65,3 @@ namespace platf::x11 {
|
||||
make_display() { return nullptr; }
|
||||
#endif
|
||||
} // namespace platf::x11
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_PLATFORM_AV_AUDIO_H
|
||||
#define SUNSHINE_PLATFORM_AV_AUDIO_H
|
||||
#pragma once
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
@@ -22,5 +21,3 @@
|
||||
- (int)setupMicrophone:(AVCaptureDevice *)device sampleRate:(UInt32)sampleRate frameSize:(UInt32)frameSize channels:(UInt8)channels;
|
||||
|
||||
@end
|
||||
|
||||
#endif //SUNSHINE_PLATFORM_AV_AUDIO_H
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
|
||||
CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, NULL, &audioBufferList, sizeof(audioBufferList), NULL, NULL, 0, &blockBuffer);
|
||||
|
||||
//NSAssert(audioBufferList.mNumberBuffers == 1, @"Expected interlveaved PCM format but buffer contained %u streams", audioBufferList.mNumberBuffers);
|
||||
// NSAssert(audioBufferList.mNumberBuffers == 1, @"Expected interlveaved PCM format but buffer contained %u streams", audioBufferList.mNumberBuffers);
|
||||
|
||||
// this is safe, because an interleaved PCM stream has exactly one buffer
|
||||
// and we don't want to do sanity checks in a performance critical exec path
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef av_img_t_h
|
||||
#define av_img_t_h
|
||||
#pragma once
|
||||
|
||||
#include "src/platform/common.h"
|
||||
|
||||
@@ -14,5 +13,3 @@ namespace platf {
|
||||
~av_img_t();
|
||||
};
|
||||
} // namespace platf
|
||||
|
||||
#endif /* av_img_t_h */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_PLATFORM_AV_VIDEO_H
|
||||
#define SUNSHINE_PLATFORM_AV_VIDEO_H
|
||||
#pragma once
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
@@ -38,5 +37,3 @@ typedef bool (^FrameCallbackBlock)(CMSampleBufferRef);
|
||||
- (dispatch_semaphore_t)capture:(FrameCallbackBlock)frameCallback;
|
||||
|
||||
@end
|
||||
|
||||
#endif //SUNSHINE_PLATFORM_AV_VIDEO_H
|
||||
|
||||
@@ -150,12 +150,12 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* A bridge from the pure C++ code of the hwdevice_t class to the pure Objective C code.
|
||||
*
|
||||
* display --> an opaque pointer to an object of this class
|
||||
* width --> the intended capture width
|
||||
* height --> the intended capture height
|
||||
*/
|
||||
* A bridge from the pure C++ code of the hwdevice_t class to the pure Objective C code.
|
||||
*
|
||||
* display --> an opaque pointer to an object of this class
|
||||
* width --> the intended capture width
|
||||
* height --> the intended capture height
|
||||
*/
|
||||
static void
|
||||
setResolution(void *display, int width, int height) {
|
||||
[static_cast<AVVideo *>(display) setFrameWidth:width frameHeight:height];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_PLATFORM_MISC_H
|
||||
#define SUNSHINE_PLATFORM_MISC_H
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -14,5 +13,3 @@ namespace dyn {
|
||||
handle(const std::vector<const char *> &libs);
|
||||
|
||||
} // namespace dyn
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef vtdevice_h
|
||||
#define vtdevice_h
|
||||
#pragma once
|
||||
|
||||
#include "src/platform/common.h"
|
||||
|
||||
@@ -29,5 +28,3 @@ namespace platf {
|
||||
};
|
||||
|
||||
} // namespace platf
|
||||
|
||||
#endif /* vtdevice_h */
|
||||
|
||||
@@ -12,7 +12,9 @@ using namespace std::literals;
|
||||
|
||||
namespace avahi {
|
||||
|
||||
/** Error codes used by avahi */
|
||||
/**
|
||||
* @brief Error codes used by avahi
|
||||
*/
|
||||
enum err_e {
|
||||
OK = 0, /**< OK */
|
||||
ERR_FAILURE = -1, /**< Generic error code */
|
||||
@@ -113,7 +115,9 @@ namespace avahi {
|
||||
CLIENT_NO_FAIL = 2 /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter CLIENT_CONNECTING state and wait for the daemon to appear */
|
||||
};
|
||||
|
||||
/** Some flags for publishing functions */
|
||||
/**
|
||||
* @brief Some flags for publishing functions
|
||||
*/
|
||||
enum PublishFlags {
|
||||
PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
|
||||
PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
|
||||
@@ -434,4 +438,4 @@ namespace platf::publish {
|
||||
|
||||
return std::make_unique<deinit_t>(std::thread { avahi::simple_poll_loop, poll.get() });
|
||||
}
|
||||
}; // namespace platf::publish
|
||||
} // namespace platf::publish
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
//
|
||||
// Created by loki on 1/12/20.
|
||||
//
|
||||
|
||||
#include <audioclient.h>
|
||||
#include <mmdeviceapi.h>
|
||||
#include <roapi.h>
|
||||
@@ -589,13 +585,13 @@ namespace platf::audio {
|
||||
}
|
||||
|
||||
/**
|
||||
* If the requested sink is a virtual sink, meaning no speakers attached to
|
||||
* the host, then we can seamlessly set the format to stereo and surround sound.
|
||||
*
|
||||
* Any virtual sink detected will be prefixed by:
|
||||
* virtual-(format name)
|
||||
* If it doesn't contain that prefix, then the format will not be changed
|
||||
*/
|
||||
* If the requested sink is a virtual sink, meaning no speakers attached to
|
||||
* the host, then we can seamlessly set the format to stereo and surround sound.
|
||||
*
|
||||
* Any virtual sink detected will be prefixed by:
|
||||
* virtual-(format name)
|
||||
* If it doesn't contain that prefix, then the format will not be changed
|
||||
*/
|
||||
std::optional<std::wstring>
|
||||
set_format(const std::string &sink) {
|
||||
std::string_view sv { sink.c_str(), sink.size() };
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
//
|
||||
// Created by loki on 4/23/20.
|
||||
//
|
||||
|
||||
#ifndef SUNSHINE_DISPLAY_H
|
||||
#define SUNSHINE_DISPLAY_H
|
||||
#pragma once
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <d3d11_4.h>
|
||||
@@ -237,5 +232,3 @@ namespace platf::dxgi {
|
||||
std::atomic<uint32_t> next_image_id;
|
||||
};
|
||||
} // namespace platf::dxgi
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
//
|
||||
// Created by loki on 1/12/20.
|
||||
//
|
||||
|
||||
#include <cmath>
|
||||
#include <codecvt>
|
||||
#include <initguid.h>
|
||||
@@ -537,7 +533,7 @@ namespace platf::dxgi {
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: Duplicate output on RX580 in combination with DOOM (2016) --> BSOD
|
||||
// FIXME: Duplicate output on RX580 in combination with DOOM (2016) --> BSOD
|
||||
{
|
||||
// IDXGIOutput5 is optional, but can provide improved performance and wide color support
|
||||
dxgi::output5_t output5 {};
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace platf::dxgi {
|
||||
auto colors_out = (std::uint8_t *) &cursor_pixel;
|
||||
auto colors_in = (std::uint8_t *) img_pixel_p;
|
||||
|
||||
//TODO: When use of IDXGIOutput5 is implemented, support different color formats
|
||||
// TODO: When use of IDXGIOutput5 is implemented, support different color formats
|
||||
auto alpha = colors_out[3];
|
||||
if (alpha == 255) {
|
||||
*img_pixel_p = cursor_pixel;
|
||||
@@ -97,7 +97,7 @@ namespace platf::dxgi {
|
||||
|
||||
void
|
||||
apply_color_masked(int *img_pixel_p, int cursor_pixel) {
|
||||
//TODO: When use of IDXGIOutput5 is implemented, support different color formats
|
||||
// TODO: When use of IDXGIOutput5 is implemented, support different color formats
|
||||
auto alpha = ((std::uint8_t *) &cursor_pixel)[3];
|
||||
if (alpha == 0xFF) {
|
||||
*img_pixel_p ^= cursor_pixel;
|
||||
@@ -270,7 +270,7 @@ namespace platf::dxgi {
|
||||
return capture_e::reinit;
|
||||
}
|
||||
|
||||
//Copy from GPU to CPU
|
||||
// Copy from GPU to CPU
|
||||
device_ctx->CopyResource(texture.get(), src.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ namespace platf::dxgi {
|
||||
frame_texture->AddRef();
|
||||
hwframe_texture.reset(frame_texture);
|
||||
|
||||
float info_in[16 / sizeof(float)] { 1.0f / (float) out_width_f }; //aligned to 16-byte
|
||||
float info_in[16 / sizeof(float)] { 1.0f / (float) out_width_f }; // aligned to 16-byte
|
||||
info_scene = make_buffer(device.get(), info_in);
|
||||
|
||||
if (!info_scene) {
|
||||
|
||||
@@ -229,10 +229,10 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A function to obtain the current sessions user's primary token with elevated privileges
|
||||
*
|
||||
* @return The users token, if user has admin capability it will be elevated. If not, it will return back a limited token. On error, nullptrs
|
||||
*/
|
||||
* @brief A function to obtain the current sessions user's primary token with elevated privileges
|
||||
*
|
||||
* @return The users token, if user has admin capability it will be elevated. If not, it will return back a limited token. On error, nullptrs
|
||||
*/
|
||||
HANDLE
|
||||
retrieve_users_token(bool elevated) {
|
||||
DWORD consoleSessionId;
|
||||
@@ -430,15 +430,15 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a bp::child object from the results of launching a process
|
||||
*
|
||||
* @param process_launched A boolean indicating whether the launch was successful or not
|
||||
* @param cmd The command that was used to launch the process
|
||||
* @param ec A reference to an std::error_code object that will store any error that occurred during the launch
|
||||
* @param process_info A reference to a PROCESS_INFORMATION structure that contains information about the new process
|
||||
* @param group A pointer to a bp::group object that will add the new process to its group, if not null
|
||||
* @return A bp::child object representing the new process, or an empty bp::child object if the launch failed or an error occurred
|
||||
*/
|
||||
* @brief Creates a bp::child object from the results of launching a process
|
||||
*
|
||||
* @param process_launched A boolean indicating whether the launch was successful or not
|
||||
* @param cmd The command that was used to launch the process
|
||||
* @param ec A reference to an std::error_code object that will store any error that occurred during the launch
|
||||
* @param process_info A reference to a PROCESS_INFORMATION structure that contains information about the new process
|
||||
* @param group A pointer to a bp::group object that will add the new process to its group, if not null
|
||||
* @return A bp::child object representing the new process, or an empty bp::child object if the launch failed or an error occurred
|
||||
*/
|
||||
bp::child
|
||||
create_boost_child_from_results(bool process_launched, const std::string &cmd, std::error_code &ec, PROCESS_INFORMATION &process_info, bp::group *group) {
|
||||
// Use RAII to ensure the process is closed when we're done with it, even if there was an error.
|
||||
@@ -477,12 +477,12 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Impersonate the current user, invoke the callback function, then returns back to system context.
|
||||
*
|
||||
* @param user_token A handle to the user's token that was obtained from the shell
|
||||
* @param callback A function that will be executed while impersonating the user
|
||||
* @return An std::error_code object that will store any error that occurred during the impersonation
|
||||
*/
|
||||
* @brief Impersonate the current user, invoke the callback function, then returns back to system context.
|
||||
*
|
||||
* @param user_token A handle to the user's token that was obtained from the shell
|
||||
* @param callback A function that will be executed while impersonating the user
|
||||
* @return An std::error_code object that will store any error that occurred during the impersonation
|
||||
*/
|
||||
std::error_code
|
||||
impersonate_current_user(HANDLE user_token, std::function<void()> callback) {
|
||||
std::error_code ec;
|
||||
@@ -515,12 +515,12 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A function to create a STARTUPINFOEXW structure for launching a process
|
||||
*
|
||||
* @param file A pointer to a FILE object that will be used as the standard output and error for the new process, or null if not needed
|
||||
* @param ec A reference to an std::error_code object that will store any error that occurred during the creation of the structure
|
||||
* @return A STARTUPINFOEXW structure that contains information about how to launch the new process
|
||||
*/
|
||||
* @brief A function to create a STARTUPINFOEXW structure for launching a process
|
||||
*
|
||||
* @param file A pointer to a FILE object that will be used as the standard output and error for the new process, or null if not needed
|
||||
* @param ec A reference to an std::error_code object that will store any error that occurred during the creation of the structure
|
||||
* @return A STARTUPINFOEXW structure that contains information about how to launch the new process
|
||||
*/
|
||||
STARTUPINFOEXW
|
||||
create_startup_info(FILE *file, std::error_code &ec) {
|
||||
// Initialize a zeroed-out STARTUPINFOEXW structure and set its size
|
||||
@@ -563,23 +563,23 @@ namespace platf {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Runs a command on the users profile
|
||||
*
|
||||
* This function launches a child process as the user, using the current user's environment
|
||||
* and a specific working directory. If the launch is successful, a `bp::child` object representing the new
|
||||
* process is returned. Otherwise, an error code is returned.
|
||||
*
|
||||
* @param elevated Specify to elevate the process or not
|
||||
* @param interactive Specifies whether this will run in a window or hidden
|
||||
* @param cmd The command to run
|
||||
* @param working_dir The working directory for the new process
|
||||
* @param env The environment variables to use for the new process
|
||||
* @param file A file object to redirect the child process's output to (may be nullptr)
|
||||
* @param ec An error code, set to indicate any errors that occur during the launch process
|
||||
* @param group A pointer to a `bp::group` object to which the new process should belong (may be nullptr)
|
||||
*
|
||||
* @return A `bp::child` object representing the new process, or an empty `bp::child` object if the launch fails
|
||||
*/
|
||||
* @brief Runs a command on the users profile
|
||||
*
|
||||
* This function launches a child process as the user, using the current user's environment
|
||||
* and a specific working directory. If the launch is successful, a `bp::child` object representing the new
|
||||
* process is returned. Otherwise, an error code is returned.
|
||||
*
|
||||
* @param elevated Specify to elevate the process or not
|
||||
* @param interactive Specifies whether this will run in a window or hidden
|
||||
* @param cmd The command to run
|
||||
* @param working_dir The working directory for the new process
|
||||
* @param env The environment variables to use for the new process
|
||||
* @param file A file object to redirect the child process's output to (may be nullptr)
|
||||
* @param ec An error code, set to indicate any errors that occur during the launch process
|
||||
* @param group A pointer to a `bp::group` object to which the new process should belong (may be nullptr)
|
||||
*
|
||||
* @return A `bp::child` object representing the new process, or an empty `bp::child` object if the launch fails
|
||||
*/
|
||||
bp::child
|
||||
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
|
||||
BOOL ret;
|
||||
@@ -1091,4 +1091,4 @@ namespace platf {
|
||||
}
|
||||
return {};
|
||||
}
|
||||
} // namespace platf
|
||||
} // namespace platf
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_WINDOWS_MISC_H
|
||||
#define SUNSHINE_WINDOWS_MISC_H
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <string_view>
|
||||
@@ -18,5 +17,3 @@ namespace platf {
|
||||
std::chrono::nanoseconds
|
||||
qpc_time_difference(int64_t performance_counter1, int64_t performance_counter2);
|
||||
} // namespace platf
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user