docs(src): add examples alias and general cleanup (#2763)

This commit is contained in:
ReenigneArcher
2024-06-28 08:34:14 -04:00
committed by GitHub
parent 49b6efcdfd
commit 1dd4b68e1c
142 changed files with 4218 additions and 1177 deletions

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/common.h
* @brief todo
* @brief Declarations for common platform specific utilities.
*/
#pragma once
@@ -87,10 +87,10 @@ namespace platf {
};
enum class gamepad_feedback_e {
rumble,
rumble_triggers,
set_motion_event_state,
set_rgb_led,
rumble, ///< Rumble
rumble_triggers, ///< Rumble triggers
set_motion_event_state, ///< Set motion event state
set_rgb_led, ///< Set RGB LED
};
struct gamepad_feedback_msg_t {
@@ -158,15 +158,15 @@ namespace platf {
namespace speaker {
enum speaker_e {
FRONT_LEFT,
FRONT_RIGHT,
FRONT_CENTER,
LOW_FREQUENCY,
BACK_LEFT,
BACK_RIGHT,
SIDE_LEFT,
SIDE_RIGHT,
MAX_SPEAKERS,
FRONT_LEFT, ///< Front left
FRONT_RIGHT, ///< Front right
FRONT_CENTER, ///< Front center
LOW_FREQUENCY, ///< Low frequency
BACK_LEFT, ///< Back left
BACK_RIGHT, ///< Back right
SIDE_LEFT, ///< Side left
SIDE_RIGHT, ///< Side right
MAX_SPEAKERS, ///< Maximum number of speakers
};
constexpr std::uint8_t map_stereo[] {
@@ -193,20 +193,20 @@ namespace platf {
} // namespace speaker
enum class mem_type_e {
system,
vaapi,
dxgi,
cuda,
videotoolbox,
unknown
system, ///< System memory
vaapi, ///< VAAPI
dxgi, ///< DXGI
cuda, ///< CUDA
videotoolbox, ///< VideoToolbox
unknown ///< Unknown
};
enum class pix_fmt_e {
yuv420p,
yuv420p10,
nv12,
p010,
unknown
yuv420p, ///< YUV 4:2:0
yuv420p10, ///< YUV 4:2:0 10-bit
nv12, ///< NV12
p010, ///< P010
unknown ///< Unknown
};
inline std::string_view
@@ -382,7 +382,8 @@ namespace platf {
}
/**
* implementations must take ownership of 'frame'
* @brief Set the frame to be encoded.
* @note Implementations must take ownership of 'frame'.
*/
virtual int
set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) {
@@ -391,13 +392,15 @@ namespace platf {
};
/**
* Implementations may set parameters during initialization of the hwframes context
* @brief Initialize the hwframes context.
* @note Implementations may set parameters during initialization of the hwframes context.
*/
virtual void
init_hwframes(AVHWFramesContext *frames) {};
/**
* Implementations may make modifications required before context derivation
* @brief Prepare to derive a context.
* @note Implementations may make modifications required before context derivation
*/
virtual int
prepare_to_derive_context(int hw_device_type) {
@@ -413,34 +416,30 @@ namespace platf {
};
enum class capture_e : int {
ok,
reinit,
timeout,
interrupted,
error
ok, ///< Success
reinit, ///< Need to reinitialize
timeout, ///< Timeout
interrupted, ///< Capture was interrupted
error ///< Error
};
class display_t {
public:
/**
* @brief Callback for when a new image is ready.
* 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
* @retval true On success
* @retval false On break request
*/
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.
* @brief Get free image from 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
* @retval true On success, img_out contains free image
* @retval 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)>;
@@ -448,18 +447,16 @@ namespace platf {
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 whether 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
* @brief Capture a frame.
* @param push_captured_image_cb The callback that is called with captured image,
* must be called from the same thread as capture()
* @param 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.
* @param cursor A pointer to the flag that indicates whether the cursor should be captured as well.
* @retval capture_e::ok When stopping
* @retval capture_e::error On error
* @retval 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;
@@ -492,10 +489,10 @@ namespace platf {
}
/**
* @brief Checks that a given codec is supported by the display device.
* @brief Check that a given codec is supported by the display device.
* @param name The FFmpeg codec name (or similar for non-FFmpeg codecs).
* @param config The codec configuration.
* @return true if supported, false otherwise.
* @return `true` if supported, `false` otherwise.
*/
virtual bool
is_codec_supported(std::string_view name, const ::video::config_t &config) {
@@ -570,11 +567,11 @@ namespace platf {
/**
* @brief Get the display_t instance for the given hwdevice_type.
* @param 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 separate thread, make a copy of it.
* @param display_name The name of the monitor that SHOULD be displayed
* @param config Stream configuration
* @returns display_t based on hwdevice_type
* @return The display_t instance 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);
@@ -584,7 +581,7 @@ namespace platf {
display_names(mem_type_e hwdevice_type);
/**
* @brief Returns if GPUs/drivers have changed since the last call to this function.
* @brief Check if GPUs/drivers have changed since the last call to this function.
* @return `true` if a change has occurred or if it is unknown whether a change occurred.
*/
bool
@@ -594,10 +591,10 @@ namespace platf {
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::environment &env, FILE *file, std::error_code &ec, boost::process::group *group);
enum class thread_priority_e : int {
low,
normal,
high,
critical
low, ///< Low priority
normal, ///< Normal priority
high, ///< High priority
critical ///< Critical priority
};
void
adjust_thread_priority(thread_priority_e priority);
@@ -637,12 +634,12 @@ namespace platf {
send(send_info_t &send_info);
enum class qos_data_type_e : int {
audio,
video
audio, ///< Audio
video ///< Video
};
/**
* @brief Enables QoS on the given socket for traffic to the specified destination.
* @brief Enable QoS on the given socket for traffic to the specified destination.
* @param native_socket The native socket handle.
* @param address The destination address for traffic sent on this socket.
* @param port The destination port for traffic sent on this socket.
@@ -662,15 +659,15 @@ namespace platf {
/**
* @brief Attempt to gracefully terminate a process group.
* @param native_handle The native handle of the process group.
* @return true if termination was successfully requested.
* @return `true` if termination was successfully requested.
*/
bool
request_process_group_exit(std::uintptr_t native_handle);
/**
* @brief Checks if a process group still has running children.
* @brief Check if a process group still has running children.
* @param native_handle The native handle of the process group.
* @return true if processes are still running.
* @return `true` if processes are still running.
*/
bool
process_group_running(std::uintptr_t native_handle);
@@ -678,14 +675,12 @@ namespace platf {
input_t
input();
/**
* @brief Gets the current mouse position on screen
* @brief Get the current mouse position on screen
* @param input The input_t instance to use.
* @return util::point_t (x, y)
*
* EXAMPLES:
* ```cpp
* @return Screen coordinates of the mouse.
* @examples
* auto [x, y] = get_mouse_loc(input);
* ```
* @examples_end
*/
util::point_t
get_mouse_loc(input_t &input);
@@ -709,7 +704,7 @@ namespace platf {
typedef deinit_t client_input_t;
/**
* @brief Allocates a context to store per-client input data.
* @brief Allocate a context to store per-client input data.
* @param input The global input context.
* @return A unique pointer to a per-client input data context.
*/
@@ -717,7 +712,7 @@ namespace platf {
allocate_client_input_context(input_t &input);
/**
* @brief Sends a touch event to the OS.
* @brief Send a touch event to the OS.
* @param input The client-specific input context.
* @param touch_port The current viewport for translating to screen coordinates.
* @param touch The touch event.
@@ -726,7 +721,7 @@ namespace platf {
touch_update(client_input_t *input, const touch_port_t &touch_port, const touch_input_t &touch);
/**
* @brief Sends a pen event to the OS.
* @brief Send a pen event to the OS.
* @param input The client-specific input context.
* @param touch_port The current viewport for translating to screen coordinates.
* @param pen The pen event.
@@ -735,7 +730,7 @@ namespace platf {
pen_update(client_input_t *input, const touch_port_t &touch_port, const pen_input_t &pen);
/**
* @brief Sends a gamepad touch event to the OS.
* @brief Send a gamepad touch event to the OS.
* @param input The global input context.
* @param touch The touch event.
*/
@@ -743,7 +738,7 @@ namespace platf {
gamepad_touch(input_t &input, const gamepad_touch_t &touch);
/**
* @brief Sends a gamepad motion event to the OS.
* @brief Send a gamepad motion event to the OS.
* @param input The global input context.
* @param motion The motion event.
*/
@@ -751,7 +746,7 @@ namespace platf {
gamepad_motion(input_t &input, const gamepad_motion_t &motion);
/**
* @brief Sends a gamepad battery event to the OS.
* @brief Send a gamepad battery event to the OS.
* @param input The global input context.
* @param battery The battery event.
*/
@@ -759,7 +754,7 @@ namespace platf {
gamepad_battery(input_t &input, const gamepad_battery_t &battery);
/**
* @brief Creates a new virtual gamepad.
* @brief Create a new virtual gamepad.
* @param input The global input context.
* @param id The gamepad ID.
* @param metadata Controller metadata from client (empty if none provided).
@@ -772,7 +767,7 @@ namespace platf {
free_gamepad(input_t &input, int nr);
/**
* @brief Returns the supported platform capabilities to advertise to the client.
* @brief Get the supported platform capabilities to advertise to the client.
* @return Capability flags.
*/
platform_caps::caps_t

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/audio.cpp
* @brief todo
* @brief Definitions for audio control on Linux.
*/
#include <bitset>
#include <sstream>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/cuda.cpp
* @brief todo
* @brief Definitions for CUDA encoding.
*/
#include <bitset>
#include <fcntl.h>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/cuda.cu
* @brief todo
* @brief CUDA implementation for Linux.
*/
// #include <algorithm>
#include <helper_math.h>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/cuda.h
* @brief todo
* @brief Definitions for CUDA implementation.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/graphics.cpp
* @brief todo
* @brief Definitions for graphics related functions.
*/
#include "graphics.h"
#include "src/file_handler.h"
@@ -507,7 +507,7 @@ namespace egl {
}
/**
* @brief Returns EGL attributes for eglCreateImage() to import the provided surface.
* @brief Get EGL attributes for eglCreateImage() to import the provided surface.
* @param surface The surface descriptor.
* @return Vector of EGL attributes.
*/
@@ -576,7 +576,7 @@ namespace egl {
}
/**
* @brief Creates a black RGB texture of the specified image size.
* @brief Create a black RGB texture of the specified image size.
* @param img The image to use for texture sizing.
* @return The new RGB texture.
*/
@@ -655,7 +655,7 @@ namespace egl {
}
/**
* @brief Creates biplanar YUV textures to render into.
* @brief Create biplanar YUV textures to render into.
* @param width Width of the target frame.
* @param height Height of the target frame.
* @param format Format of the target frame.

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/graphics.h
* @brief todo
* @brief Declarations for graphics related functions.
*/
#pragma once

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino.cpp
* @brief Definitions for the inputtino Linux input handling.
*/
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_common.h
* @brief Declarations for inputtino common input handling.
*/
#pragma once
#include <boost/locale.hpp>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_gamepad.cpp
* @brief Definitions for inputtino gamepad input handling.
*/
#include <boost/locale.hpp>
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>
@@ -15,10 +19,10 @@ using namespace std::literals;
namespace platf::gamepad {
enum GamepadStatus {
UHID_NOT_AVAILABLE = 0,
UINPUT_NOT_AVAILABLE,
XINPUT_NOT_AVAILABLE,
GAMEPAD_STATUS // Helper to indicate the number of status
UHID_NOT_AVAILABLE = 0, ///< UHID is not available
UINPUT_NOT_AVAILABLE, ///< UINPUT is not available
XINPUT_NOT_AVAILABLE, ///< XINPUT is not available
GAMEPAD_STATUS ///< Helper to indicate the number of status
};
auto

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_gamepad.h
* @brief Declarations for inputtino gamepad input handling.
*/
#pragma once
#include <boost/locale.hpp>
@@ -13,9 +17,9 @@ using namespace std::literals;
namespace platf::gamepad {
enum ControllerType {
XboxOneWired,
DualSenseWired,
SwitchProWired
XboxOneWired, ///< Xbox One Wired Controller
DualSenseWired, ///< DualSense Wired Controller
SwitchProWired ///< Switch Pro Wired Controller
};
int

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_keyboard.cpp
* @brief Definitions for inputtino keyboard input handling.
*/
#include <boost/locale.hpp>
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_keyboard.h
* @brief Declarations for inputtino keyboard input handling.
*/
#pragma once
#include <boost/locale.hpp>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_mouse.cpp
* @brief Definitions for inputtino mouse input handling.
*/
#include <boost/locale.hpp>
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_mouse.h
* @brief Declarations for inputtino mouse input handling.
*/
#pragma once
#include <boost/locale.hpp>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_pen.cpp
* @brief Definitions for inputtino pen input handling.
*/
#include <boost/locale.hpp>
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_pen.h
* @brief Declarations for inputtino pen input handling.
*/
#pragma once
#include <boost/locale.hpp>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_touch.cpp
* @brief Definitions for inputtino touch input handling.
*/
#include <boost/locale.hpp>
#include <inputtino/input.hpp>
#include <libevdev/libevdev.h>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/linux/input/inputtino_touch.h
* @brief Declarations for inputtino touch input handling.
*/
#pragma once
#include <boost/locale.hpp>

View File

@@ -1074,11 +1074,9 @@ namespace platf {
* @param input The input_t instance to use.
* @param x Absolute x position.
* @param y Absolute y position.
*
* EXAMPLES:
* ```cpp
* @examples
* x_abs_mouse(input, 0, 0);
* ```
* @examples_end
*/
static void
x_abs_mouse(input_t &input, float x, float y) {
@@ -1128,11 +1126,9 @@ namespace platf {
* @param touch_port The touch_port instance to use.
* @param x Absolute x position.
* @param y Absolute y position.
*
* EXAMPLES:
* ```cpp
* @examples
* abs_mouse(input, touch_port, 0, 0);
* ```
* @examples_end
*/
void
abs_mouse(input_t &input, const touch_port_t &touch_port, float x, float y) {
@@ -1160,11 +1156,9 @@ namespace platf {
* @param input The input_t instance to use.
* @param deltaX Relative x position.
* @param deltaY Relative y position.
*
* EXAMPLES:
* ```cpp
* @examples
* x_move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
* ```
* @examples_end
*/
static void
x_move_mouse(input_t &input, int deltaX, int deltaY) {
@@ -1183,11 +1177,9 @@ namespace platf {
* @param input The input_t instance to use.
* @param deltaX Relative x position.
* @param deltaY Relative y position.
*
* EXAMPLES:
* ```cpp
* @examples
* move_mouse(input, 10, 10); // Move mouse 10 pixels down and right
* ```
* @examples_end
*/
void
move_mouse(input_t &input, int deltaX, int deltaY) {
@@ -1218,11 +1210,9 @@ namespace platf {
* @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
* @examples
* x_button_mouse(input, 1, false); // Press left mouse button
* ```
* @examples_end
*/
static void
x_button_mouse(input_t &input, int button, bool release) {
@@ -1261,11 +1251,9 @@ namespace platf {
* @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
* @examples
* button_mouse(input, 1, false); // Press left mouse button
* ```
* @examples_end
*/
void
button_mouse(input_t &input, int button, bool release) {
@@ -1348,11 +1336,9 @@ namespace platf {
* @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
* @examples
* x_scroll(input, 10, 4, 5);
* ```
* @examples_end
*/
static void
x_scroll(input_t &input, int distance, int button_pos, int button_neg) {
@@ -1375,11 +1361,9 @@ namespace platf {
* @brief Vertical mouse scroll.
* @param input The input_t instance to use.
* @param high_res_distance How far to scroll.
*
* EXAMPLES:
* ```cpp
* @examples
* scroll(input, 1200);
* ```
* @examples_end
*/
void
scroll(input_t &input, int high_res_distance) {
@@ -1409,11 +1393,9 @@ namespace platf {
* @brief Horizontal mouse scroll.
* @param input The input_t instance to use.
* @param high_res_distance How far to scroll.
*
* EXAMPLES:
* ```cpp
* @examples
* hscroll(input, 1200);
* ```
* @examples_end
*/
void
hscroll(input_t &input, int high_res_distance) {
@@ -1454,11 +1436,9 @@ namespace platf {
* @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
* @examples
* x_keyboard(input, 0x5A, false, 0); // Press Z
* ```
* @examples_end
*/
static void
x_keyboard(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
@@ -1489,11 +1469,9 @@ namespace platf {
* @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
* @examples
* keyboard(input, 0x5A, false, 0); // Press Z
* ```
* @examples_end
*/
void
keyboard_update(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
@@ -2106,11 +2084,9 @@ namespace platf {
/**
* @brief Initialize a new keyboard and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_keyboard = keyboard();
* ```
* @examples_end
*/
evdev_t
keyboard() {
@@ -2135,11 +2111,9 @@ namespace platf {
/**
* @brief Initialize a new `uinput` virtual relative mouse and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_mouse = mouse_rel();
* ```
* @examples_end
*/
evdev_t
mouse_rel() {
@@ -2186,11 +2160,9 @@ namespace platf {
/**
* @brief Initialize a new `uinput` virtual absolute mouse and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_mouse = mouse_abs();
* ```
* @examples_end
*/
evdev_t
mouse_abs() {
@@ -2241,11 +2213,9 @@ namespace platf {
/**
* @brief Initialize a new `uinput` virtual touchscreen and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_touchscreen = touchscreen();
* ```
* @examples_end
*/
evdev_t
touchscreen() {
@@ -2348,11 +2318,9 @@ namespace platf {
/**
* @brief Initialize a new `uinput` virtual pen pad and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_penpad = penpad();
* ```
* @examples_end
*/
evdev_t
penpad() {
@@ -2447,11 +2415,9 @@ namespace platf {
/**
* @brief Initialize a new `uinput` virtual X360 gamepad and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_x360 = x360();
* ```
* @examples_end
*/
evdev_t
x360() {
@@ -2524,11 +2490,9 @@ namespace platf {
/**
* @brief Initialize the input system and return it.
*
* EXAMPLES:
* ```cpp
* @examples
* auto my_input = input();
* ```
* @examples_end
*/
input_t
input() {

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/kmsgrab.cpp
* @brief todo
* @brief Definitions for KMS screen capture.
*/
#include <drm_fourcc.h>
#include <errno.h>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/misc.cpp
* @brief todo
* @brief Miscellaneous definitions for Linux.
*/
// Required for in6_pktinfo with glibc headers
@@ -747,18 +747,18 @@ namespace platf {
namespace source {
enum source_e : std::size_t {
#ifdef SUNSHINE_BUILD_CUDA
NVFBC,
NVFBC, ///< NvFBC
#endif
#ifdef SUNSHINE_BUILD_WAYLAND
WAYLAND,
WAYLAND, ///< Wayland
#endif
#ifdef SUNSHINE_BUILD_DRM
KMS,
KMS, ///< KMS
#endif
#ifdef SUNSHINE_BUILD_X11
X11,
X11, ///< X11
#endif
MAX_FLAGS
MAX_FLAGS ///< The maximum number of flags
};
} // namespace source

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/misc.h
* @brief todo
* @brief Miscellaneous declarations for Linux.
*/
#pragma once
@@ -16,9 +16,9 @@ KITTY_USING_MOVE_T(file_t, int, -1, {
});
enum class window_system_e {
NONE,
X11,
WAYLAND,
NONE, ///< No window system
X11, ///< X11
WAYLAND, ///< Wayland
};
extern window_system_e window_system;

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/publish.cpp
* @brief todo
* @brief Definitions for publishing services on Linux.
* @note Adapted from https://www.avahi.org/doxygen/html/client-publish-service_8c-example.html
* @todo Use a common file for this and src/platform/macos/publish.cpp
*/
@@ -21,122 +21,118 @@ namespace avahi {
* @brief Error codes used by avahi.
*/
enum err_e {
OK = 0, /**< OK */
ERR_FAILURE = -1, /**< Generic error code */
ERR_BAD_STATE = -2, /**< Object was in a bad state */
ERR_INVALID_HOST_NAME = -3, /**< Invalid host name */
ERR_INVALID_DOMAIN_NAME = -4, /**< Invalid domain name */
ERR_NO_NETWORK = -5, /**< No suitable network protocol available */
ERR_INVALID_TTL = -6, /**< Invalid DNS TTL */
ERR_IS_PATTERN = -7, /**< RR key is pattern */
ERR_COLLISION = -8, /**< Name collision */
ERR_INVALID_RECORD = -9, /**< Invalid RR */
OK = 0, ///< OK
ERR_FAILURE = -1, ///< Generic error code
ERR_BAD_STATE = -2, ///< Object was in a bad state
ERR_INVALID_HOST_NAME = -3, ///< Invalid host name
ERR_INVALID_DOMAIN_NAME = -4, ///< Invalid domain name
ERR_NO_NETWORK = -5, ///< No suitable network protocol available
ERR_INVALID_TTL = -6, ///< Invalid DNS TTL
ERR_IS_PATTERN = -7, ///< RR key is pattern
ERR_COLLISION = -8, ///< Name collision
ERR_INVALID_RECORD = -9, ///< Invalid RR
ERR_INVALID_SERVICE_NAME = -10, /**< Invalid service name */
ERR_INVALID_SERVICE_TYPE = -11, /**< Invalid service type */
ERR_INVALID_PORT = -12, /**< Invalid port number */
ERR_INVALID_KEY = -13, /**< Invalid key */
ERR_INVALID_ADDRESS = -14, /**< Invalid address */
ERR_TIMEOUT = -15, /**< Timeout reached */
ERR_TOO_MANY_CLIENTS = -16, /**< Too many clients */
ERR_TOO_MANY_OBJECTS = -17, /**< Too many objects */
ERR_TOO_MANY_ENTRIES = -18, /**< Too many entries */
ERR_OS = -19, /**< OS error */
ERR_INVALID_SERVICE_NAME = -10, ///< Invalid service name
ERR_INVALID_SERVICE_TYPE = -11, ///< Invalid service type
ERR_INVALID_PORT = -12, ///< Invalid port number
ERR_INVALID_KEY = -13, ///< Invalid key
ERR_INVALID_ADDRESS = -14, ///< Invalid address
ERR_TIMEOUT = -15, ///< Timeout reached
ERR_TOO_MANY_CLIENTS = -16, ///< Too many clients
ERR_TOO_MANY_OBJECTS = -17, ///< Too many objects
ERR_TOO_MANY_ENTRIES = -18, ///< Too many entries
ERR_OS = -19, ///< OS error
ERR_ACCESS_DENIED = -20, /**< Access denied */
ERR_INVALID_OPERATION = -21, /**< Invalid operation */
ERR_DBUS_ERROR = -22, /**< An unexpected D-Bus error occurred */
ERR_DISCONNECTED = -23, /**< Daemon connection failed */
ERR_NO_MEMORY = -24, /**< Memory exhausted */
ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
ERR_NO_DAEMON = -26, /**< Daemon not running */
ERR_INVALID_INTERFACE = -27, /**< Invalid interface */
ERR_INVALID_PROTOCOL = -28, /**< Invalid protocol */
ERR_INVALID_FLAGS = -29, /**< Invalid flags */
ERR_ACCESS_DENIED = -20, ///< Access denied
ERR_INVALID_OPERATION = -21, ///< Invalid operation
ERR_DBUS_ERROR = -22, ///< An unexpected D-Bus error occurred
ERR_DISCONNECTED = -23, ///< Daemon connection failed
ERR_NO_MEMORY = -24, ///< Memory exhausted
ERR_INVALID_OBJECT = -25, ///< The object passed to this function was invalid
ERR_NO_DAEMON = -26, ///< Daemon not running
ERR_INVALID_INTERFACE = -27, ///< Invalid interface
ERR_INVALID_PROTOCOL = -28, ///< Invalid protocol
ERR_INVALID_FLAGS = -29, ///< Invalid flags
ERR_NOT_FOUND = -30, /**< Not found */
ERR_INVALID_CONFIG = -31, /**< Configuration error */
ERR_VERSION_MISMATCH = -32, /**< Version mismatch */
ERR_INVALID_SERVICE_SUBTYPE = -33, /**< Invalid service subtype */
ERR_INVALID_PACKET = -34, /**< Invalid packet */
ERR_INVALID_DNS_ERROR = -35, /**< Invalid DNS return code */
ERR_DNS_FORMERR = -36, /**< DNS Error: Form error */
ERR_DNS_SERVFAIL = -37, /**< DNS Error: Server Failure */
ERR_DNS_NXDOMAIN = -38, /**< DNS Error: No such domain */
ERR_DNS_NOTIMP = -39, /**< DNS Error: Not implemented */
ERR_NOT_FOUND = -30, ///< Not found
ERR_INVALID_CONFIG = -31, ///< Configuration error
ERR_VERSION_MISMATCH = -32, ///< Version mismatch
ERR_INVALID_SERVICE_SUBTYPE = -33, ///< Invalid service subtype
ERR_INVALID_PACKET = -34, ///< Invalid packet
ERR_INVALID_DNS_ERROR = -35, ///< Invalid DNS return code
ERR_DNS_FORMERR = -36, ///< DNS Error: Form error
ERR_DNS_SERVFAIL = -37, ///< DNS Error: Server Failure
ERR_DNS_NXDOMAIN = -38, ///< DNS Error: No such domain
ERR_DNS_NOTIMP = -39, ///< DNS Error: Not implemented
ERR_DNS_REFUSED = -40, /**< DNS Error: Operation refused */
ERR_DNS_YXDOMAIN = -41,
ERR_DNS_YXRRSET = -42,
ERR_DNS_NXRRSET = -43,
ERR_DNS_NOTAUTH = -44, /**< DNS Error: Not authorized */
ERR_DNS_NOTZONE = -45,
ERR_INVALID_RDATA = -46, /**< Invalid RDATA */
ERR_INVALID_DNS_CLASS = -47, /**< Invalid DNS class */
ERR_INVALID_DNS_TYPE = -48, /**< Invalid DNS type */
ERR_NOT_SUPPORTED = -49, /**< Not supported */
ERR_DNS_REFUSED = -40, ///< DNS Error: Operation refused
ERR_DNS_YXDOMAIN = -41, ///< TODO
ERR_DNS_YXRRSET = -42, ///< TODO
ERR_DNS_NXRRSET = -43, ///< TODO
ERR_DNS_NOTAUTH = -44, ///< DNS Error: Not authorized
ERR_DNS_NOTZONE = -45, ///< TODO
ERR_INVALID_RDATA = -46, ///< Invalid RDATA
ERR_INVALID_DNS_CLASS = -47, ///< Invalid DNS class
ERR_INVALID_DNS_TYPE = -48, ///< Invalid DNS type
ERR_NOT_SUPPORTED = -49, ///< Not supported
ERR_NOT_PERMITTED = -50, /**< Operation not permitted */
ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */
ERR_IS_EMPTY = -52, /**< Is empty */
ERR_NO_CHANGE = -53, /**< The requested operation is invalid because it is redundant */
ERR_NOT_PERMITTED = -50, ///< Operation not permitted
ERR_INVALID_ARGUMENT = -51, ///< Invalid argument
ERR_IS_EMPTY = -52, ///< Is empty
ERR_NO_CHANGE = -53, ///< The requested operation is invalid because it is redundant
ERR_MAX = -54
ERR_MAX = -54 ///< TODO
};
constexpr auto IF_UNSPEC = -1;
enum proto {
PROTO_INET = 0, /**< IPv4 */
PROTO_INET6 = 1, /**< IPv6 */
PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */
PROTO_INET = 0, ///< IPv4
PROTO_INET6 = 1, ///< IPv6
PROTO_UNSPEC = -1 ///< Unspecified/all protocol(s)
};
enum ServerState {
SERVER_INVALID, /**< Invalid state (initial) */
SERVER_REGISTERING, /**< Host RRs are being registered */
SERVER_RUNNING, /**< All host RRs have been established */
SERVER_COLLISION, /**< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name() */
SERVER_FAILURE /**< Some fatal failure happened, the server is unable to proceed */
SERVER_INVALID, ///< Invalid state (initial)
SERVER_REGISTERING, ///< Host RRs are being registered
SERVER_RUNNING, ///< All host RRs have been established
SERVER_COLLISION, ///< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name()
SERVER_FAILURE ///< Some fatal failure happened, the server is unable to proceed
};
enum ClientState {
CLIENT_S_REGISTERING = SERVER_REGISTERING, /**< Server state: REGISTERING */
CLIENT_S_RUNNING = SERVER_RUNNING, /**< Server state: RUNNING */
CLIENT_S_COLLISION = SERVER_COLLISION, /**< Server state: COLLISION */
CLIENT_FAILURE = 100, /**< Some kind of error happened on the client side */
CLIENT_CONNECTING = 101 /**< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. */
CLIENT_S_REGISTERING = SERVER_REGISTERING, ///< Server state: REGISTERING
CLIENT_S_RUNNING = SERVER_RUNNING, ///< Server state: RUNNING
CLIENT_S_COLLISION = SERVER_COLLISION, ///< Server state: COLLISION
CLIENT_FAILURE = 100, ///< Some kind of error happened on the client side
CLIENT_CONNECTING = 101 ///< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available.
};
enum EntryGroupState {
ENTRY_GROUP_UNCOMMITED, /**< The group has not yet been committed, the user must still call avahi_entry_group_commit() */
ENTRY_GROUP_REGISTERING, /**< The entries of the group are currently being registered */
ENTRY_GROUP_ESTABLISHED, /**< The entries have successfully been established */
ENTRY_GROUP_COLLISION, /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */
ENTRY_GROUP_FAILURE /**< Some kind of failure happened, the entries have been withdrawn */
ENTRY_GROUP_UNCOMMITED, ///< The group has not yet been committed, the user must still call avahi_entry_group_commit()
ENTRY_GROUP_REGISTERING, ///< The entries of the group are currently being registered
ENTRY_GROUP_ESTABLISHED, ///< The entries have successfully been established
ENTRY_GROUP_COLLISION, ///< A name collision for one of the entries in the group has been detected, the entries have been withdrawn
ENTRY_GROUP_FAILURE ///< Some kind of failure happened, the entries have been withdrawn
};
enum ClientFlags {
CLIENT_IGNORE_USER_CONFIG = 1, /**< Don't read user configuration */
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 */
CLIENT_IGNORE_USER_CONFIG = 1, ///< Don't read user configuration
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
};
/**
* @brief 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 */
PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
/** \cond fulldocs */
PUBLISH_NO_REVERSE = 16, /**< For address records: don't create a reverse (PTR) entry */
PUBLISH_NO_COOKIE = 32, /**< For service records: do not implicitly add the local service cookie to TXT data */
/** \endcond */
PUBLISH_UPDATE = 64, /**< Update existing records instead of adding new ones */
/** \cond fulldocs */
PUBLISH_USE_WIDE_AREA = 128, /**< Register the record using wide area DNS (i.e. unicast DNS update) */
PUBLISH_USE_MULTICAST = 256 /**< Register the record using multicast DNS */
/** \endcond */
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
PUBLISH_NO_ANNOUNCE = 4, ///< For raw records: Do not announce this RR to other hosts
PUBLISH_ALLOW_MULTIPLE = 8, ///< For raw records: Allow multiple local records of this type, even if they are intended to be unique
PUBLISH_NO_REVERSE = 16, ///< For address records: don't create a reverse (PTR) entry
PUBLISH_NO_COOKIE = 32, ///< For service records: do not implicitly add the local service cookie to TXT data
PUBLISH_UPDATE = 64, ///< Update existing records instead of adding new ones
PUBLISH_USE_WIDE_AREA = 128, ///< Register the record using wide area DNS (i.e. unicast DNS update)
PUBLISH_USE_MULTICAST = 256 ///< Register the record using multicast DNS
};
using IfIndex = int;

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/vaapi.cpp
* @brief todo
* @brief Definitions for VA-API hardware accelerated capture.
*/
#include <sstream>
#include <string>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/vaapi.h
* @brief todo
* @brief Declarations for VA-API hardware accelerated capture.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/wayland.cpp
* @brief todo
* @brief Definitions for Wayland capture.
*/
#include <poll.h>
#include <wayland-client.h>
@@ -65,7 +65,7 @@ namespace wl {
/**
* @brief Waits up to the specified timeout to dispatch new events on the wl_display.
* @param timeout The timeout in milliseconds.
* @return true if new events were dispatched or false if the timeout expired.
* @return `true` if new events were dispatched or `false` if the timeout expired.
*/
bool
display_t::dispatch(std::chrono::milliseconds timeout) {

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/wayland.h
* @brief todo
* @brief Declarations for Wayland capture.
*/
#pragma once
@@ -17,7 +17,7 @@
* The classes defined in this macro block should only be used by
* cpp files whose compilation depends on SUNSHINE_BUILD_WAYLAND
*/
#if defined(SUNSHINE_BUILD_WAYLAND) || defined(DOXYGEN)
#ifdef SUNSHINE_BUILD_WAYLAND
namespace wl {
using display_internal_t = util::safe_ptr<wl_display, wl_display_disconnect>;
@@ -34,9 +34,9 @@ namespace wl {
class dmabuf_t {
public:
enum status_e {
WAITING,
READY,
REINIT,
WAITING, ///< Waiting for a frame
READY, ///< Frame is ready
REINIT, ///< Reinitialize the frame
};
dmabuf_t(dmabuf_t &&) = delete;
@@ -154,9 +154,9 @@ namespace wl {
public:
enum interface_e {
XDG_OUTPUT,
WLR_EXPORT_DMABUF,
MAX_INTERFACES,
XDG_OUTPUT, ///< xdg-output
WLR_EXPORT_DMABUF, ///< Export dmabuf
MAX_INTERFACES, ///< Maximum number of interfaces
};
interface_t(interface_t &&) = delete;

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/wlgrab.cpp
* @brief todo
* @brief Definitions for wlgrab capture.
*/
#include <thread>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/x11grab.cpp
* @brief todo
* @brief Definitions for x11 capture.
*/
#include "src/platform/common.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/linux/x11grab.h
* @brief todo
* @brief Declarations for x11 capture.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/av_audio.h
* @brief todo
* @brief Declarations for audio capture on macOS.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/av_audio.m
* @brief todo
* @brief Definitions for audio capture on macOS.
*/
#import "av_audio.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/av_img_t.h
* @brief todo
* @brief Declarations for AV image types on macOS.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/av_video.h
* @brief todo
* @brief Declarations for video capture on macOS.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/av_video.m
* @brief todo
* @brief Definitions for video capture on macOS.
*/
#import "av_video.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/display.mm
* @brief todo
* @brief Definitions for display capture on macOS.
*/
#include "src/platform/common.h"
#include "src/platform/macos/av_img_t.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/input.cpp
* @brief todo
* @brief Definitions for macOS input handling.
*/
#include "src/input.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/microphone.mm
* @brief todo
* @brief Definitions for microphone capture on macOS.
*/
#include "src/platform/common.h"
#include "src/platform/macos/av_audio.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/misc.h
* @brief todo
* @brief Miscellaneous declarations for macOS platform.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/misc.mm
* @brief todo
* @brief Miscellaneous definitions for macOS platform.
*/
// Required for IPV6_PKTINFO with Darwin headers

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/nv12_zero_device.cpp
* @brief todo
* @brief Definitions for NV12 zero copy device on macOS.
*/
#include <utility>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/nv12_zero_device.h
* @brief todo
* @brief Declarations for NV12 zero copy device on macOS.
*/
#pragma once

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/macos/publish.cpp
* @brief todo
* @brief Definitions for publishing services on macOS.
* @note Adapted from https://www.avahi.org/doxygen/html/client-publish-service_8c-example.html
* @todo Use a common file for this and src/platform/linux/publish.cpp
*/
@@ -21,122 +21,118 @@ namespace avahi {
* @brief Error codes used by avahi.
*/
enum err_e {
OK = 0, /**< OK */
ERR_FAILURE = -1, /**< Generic error code */
ERR_BAD_STATE = -2, /**< Object was in a bad state */
ERR_INVALID_HOST_NAME = -3, /**< Invalid host name */
ERR_INVALID_DOMAIN_NAME = -4, /**< Invalid domain name */
ERR_NO_NETWORK = -5, /**< No suitable network protocol available */
ERR_INVALID_TTL = -6, /**< Invalid DNS TTL */
ERR_IS_PATTERN = -7, /**< RR key is pattern */
ERR_COLLISION = -8, /**< Name collision */
ERR_INVALID_RECORD = -9, /**< Invalid RR */
OK = 0, ///< OK
ERR_FAILURE = -1, ///< Generic error code
ERR_BAD_STATE = -2, ///< Object was in a bad state
ERR_INVALID_HOST_NAME = -3, ///< Invalid host name
ERR_INVALID_DOMAIN_NAME = -4, ///< Invalid domain name
ERR_NO_NETWORK = -5, ///< No suitable network protocol available
ERR_INVALID_TTL = -6, ///< Invalid DNS TTL
ERR_IS_PATTERN = -7, ///< RR key is pattern
ERR_COLLISION = -8, ///< Name collision
ERR_INVALID_RECORD = -9, ///< Invalid RR
ERR_INVALID_SERVICE_NAME = -10, /**< Invalid service name */
ERR_INVALID_SERVICE_TYPE = -11, /**< Invalid service type */
ERR_INVALID_PORT = -12, /**< Invalid port number */
ERR_INVALID_KEY = -13, /**< Invalid key */
ERR_INVALID_ADDRESS = -14, /**< Invalid address */
ERR_TIMEOUT = -15, /**< Timeout reached */
ERR_TOO_MANY_CLIENTS = -16, /**< Too many clients */
ERR_TOO_MANY_OBJECTS = -17, /**< Too many objects */
ERR_TOO_MANY_ENTRIES = -18, /**< Too many entries */
ERR_OS = -19, /**< OS error */
ERR_INVALID_SERVICE_NAME = -10, ///< Invalid service name
ERR_INVALID_SERVICE_TYPE = -11, ///< Invalid service type
ERR_INVALID_PORT = -12, ///< Invalid port number
ERR_INVALID_KEY = -13, ///< Invalid key
ERR_INVALID_ADDRESS = -14, ///< Invalid address
ERR_TIMEOUT = -15, ///< Timeout reached
ERR_TOO_MANY_CLIENTS = -16, ///< Too many clients
ERR_TOO_MANY_OBJECTS = -17, ///< Too many objects
ERR_TOO_MANY_ENTRIES = -18, ///< Too many entries
ERR_OS = -19, ///< OS error
ERR_ACCESS_DENIED = -20, /**< Access denied */
ERR_INVALID_OPERATION = -21, /**< Invalid operation */
ERR_DBUS_ERROR = -22, /**< An unexpected D-Bus error occurred */
ERR_DISCONNECTED = -23, /**< Daemon connection failed */
ERR_NO_MEMORY = -24, /**< Memory exhausted */
ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
ERR_NO_DAEMON = -26, /**< Daemon not running */
ERR_INVALID_INTERFACE = -27, /**< Invalid interface */
ERR_INVALID_PROTOCOL = -28, /**< Invalid protocol */
ERR_INVALID_FLAGS = -29, /**< Invalid flags */
ERR_ACCESS_DENIED = -20, ///< Access denied
ERR_INVALID_OPERATION = -21, ///< Invalid operation
ERR_DBUS_ERROR = -22, ///< An unexpected D-Bus error occurred
ERR_DISCONNECTED = -23, ///< Daemon connection failed
ERR_NO_MEMORY = -24, ///< Memory exhausted
ERR_INVALID_OBJECT = -25, ///< The object passed to this function was invalid
ERR_NO_DAEMON = -26, ///< Daemon not running
ERR_INVALID_INTERFACE = -27, ///< Invalid interface
ERR_INVALID_PROTOCOL = -28, ///< Invalid protocol
ERR_INVALID_FLAGS = -29, ///< Invalid flags
ERR_NOT_FOUND = -30, /**< Not found */
ERR_INVALID_CONFIG = -31, /**< Configuration error */
ERR_VERSION_MISMATCH = -32, /**< Version mismatch */
ERR_INVALID_SERVICE_SUBTYPE = -33, /**< Invalid service subtype */
ERR_INVALID_PACKET = -34, /**< Invalid packet */
ERR_INVALID_DNS_ERROR = -35, /**< Invalid DNS return code */
ERR_DNS_FORMERR = -36, /**< DNS Error: Form error */
ERR_DNS_SERVFAIL = -37, /**< DNS Error: Server Failure */
ERR_DNS_NXDOMAIN = -38, /**< DNS Error: No such domain */
ERR_DNS_NOTIMP = -39, /**< DNS Error: Not implemented */
ERR_NOT_FOUND = -30, ///< Not found
ERR_INVALID_CONFIG = -31, ///< Configuration error
ERR_VERSION_MISMATCH = -32, ///< Version mismatch
ERR_INVALID_SERVICE_SUBTYPE = -33, ///< Invalid service subtype
ERR_INVALID_PACKET = -34, ///< Invalid packet
ERR_INVALID_DNS_ERROR = -35, ///< Invalid DNS return code
ERR_DNS_FORMERR = -36, ///< DNS Error: Form error
ERR_DNS_SERVFAIL = -37, ///< DNS Error: Server Failure
ERR_DNS_NXDOMAIN = -38, ///< DNS Error: No such domain
ERR_DNS_NOTIMP = -39, ///< DNS Error: Not implemented
ERR_DNS_REFUSED = -40, /**< DNS Error: Operation refused */
ERR_DNS_YXDOMAIN = -41,
ERR_DNS_YXRRSET = -42,
ERR_DNS_NXRRSET = -43,
ERR_DNS_NOTAUTH = -44, /**< DNS Error: Not authorized */
ERR_DNS_NOTZONE = -45,
ERR_INVALID_RDATA = -46, /**< Invalid RDATA */
ERR_INVALID_DNS_CLASS = -47, /**< Invalid DNS class */
ERR_INVALID_DNS_TYPE = -48, /**< Invalid DNS type */
ERR_NOT_SUPPORTED = -49, /**< Not supported */
ERR_DNS_REFUSED = -40, ///< DNS Error: Operation refused
ERR_DNS_YXDOMAIN = -41, ///< TODO
ERR_DNS_YXRRSET = -42, ///< TODO
ERR_DNS_NXRRSET = -43, ///< TODO
ERR_DNS_NOTAUTH = -44, ///< DNS Error: Not authorized
ERR_DNS_NOTZONE = -45, ///< TODO
ERR_INVALID_RDATA = -46, ///< Invalid RDATA
ERR_INVALID_DNS_CLASS = -47, ///< Invalid DNS class
ERR_INVALID_DNS_TYPE = -48, ///< Invalid DNS type
ERR_NOT_SUPPORTED = -49, ///< Not supported
ERR_NOT_PERMITTED = -50, /**< Operation not permitted */
ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */
ERR_IS_EMPTY = -52, /**< Is empty */
ERR_NO_CHANGE = -53, /**< The requested operation is invalid because it is redundant */
ERR_NOT_PERMITTED = -50, ///< Operation not permitted
ERR_INVALID_ARGUMENT = -51, ///< Invalid argument
ERR_IS_EMPTY = -52, ///< Is empty
ERR_NO_CHANGE = -53, ///< The requested operation is invalid because it is redundant
ERR_MAX = -54
ERR_MAX = -54 ///< TODO
};
constexpr auto IF_UNSPEC = -1;
enum proto {
PROTO_INET = 0, /**< IPv4 */
PROTO_INET6 = 1, /**< IPv6 */
PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */
PROTO_INET = 0, ///< IPv4
PROTO_INET6 = 1, ///< IPv6
PROTO_UNSPEC = -1 ///< Unspecified/all protocol(s)
};
enum ServerState {
SERVER_INVALID, /**< Invalid state (initial) */
SERVER_REGISTERING, /**< Host RRs are being registered */
SERVER_RUNNING, /**< All host RRs have been established */
SERVER_COLLISION, /**< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name() */
SERVER_FAILURE /**< Some fatal failure happened, the server is unable to proceed */
SERVER_INVALID, ///< Invalid state (initial)
SERVER_REGISTERING, ///< Host RRs are being registered
SERVER_RUNNING, ///< All host RRs have been established
SERVER_COLLISION, ///< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name()
SERVER_FAILURE ///< Some fatal failure happened, the server is unable to proceed
};
enum ClientState {
CLIENT_S_REGISTERING = SERVER_REGISTERING, /**< Server state: REGISTERING */
CLIENT_S_RUNNING = SERVER_RUNNING, /**< Server state: RUNNING */
CLIENT_S_COLLISION = SERVER_COLLISION, /**< Server state: COLLISION */
CLIENT_FAILURE = 100, /**< Some kind of error happened on the client side */
CLIENT_CONNECTING = 101 /**< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. */
CLIENT_S_REGISTERING = SERVER_REGISTERING, ///< Server state: REGISTERING
CLIENT_S_RUNNING = SERVER_RUNNING, ///< Server state: RUNNING
CLIENT_S_COLLISION = SERVER_COLLISION, ///< Server state: COLLISION
CLIENT_FAILURE = 100, ///< Some kind of error happened on the client side
CLIENT_CONNECTING = 101 ///< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available.
};
enum EntryGroupState {
ENTRY_GROUP_UNCOMMITED, /**< The group has not yet been committed, the user must still call avahi_entry_group_commit() */
ENTRY_GROUP_REGISTERING, /**< The entries of the group are currently being registered */
ENTRY_GROUP_ESTABLISHED, /**< The entries have successfully been established */
ENTRY_GROUP_COLLISION, /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */
ENTRY_GROUP_FAILURE /**< Some kind of failure happened, the entries have been withdrawn */
ENTRY_GROUP_UNCOMMITED, ///< The group has not yet been committed, the user must still call avahi_entry_group_commit()
ENTRY_GROUP_REGISTERING, ///< The entries of the group are currently being registered
ENTRY_GROUP_ESTABLISHED, ///< The entries have successfully been established
ENTRY_GROUP_COLLISION, ///< A name collision for one of the entries in the group has been detected, the entries have been withdrawn
ENTRY_GROUP_FAILURE ///< Some kind of failure happened, the entries have been withdrawn
};
enum ClientFlags {
CLIENT_IGNORE_USER_CONFIG = 1, /**< Don't read user configuration */
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 */
CLIENT_IGNORE_USER_CONFIG = 1, ///< Don't read user configuration
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
};
/**
* @brief 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 */
PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
/** \cond fulldocs */
PUBLISH_NO_REVERSE = 16, /**< For address records: don't create a reverse (PTR) entry */
PUBLISH_NO_COOKIE = 32, /**< For service records: do not implicitly add the local service cookie to TXT data */
/** \endcond */
PUBLISH_UPDATE = 64, /**< Update existing records instead of adding new ones */
/** \cond fulldocs */
PUBLISH_USE_WIDE_AREA = 128, /**< Register the record using wide area DNS (i.e. unicast DNS update) */
PUBLISH_USE_MULTICAST = 256 /**< Register the record using multicast DNS */
/** \endcond */
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
PUBLISH_NO_ANNOUNCE = 4, ///< For raw records: Do not announce this RR to other hosts
PUBLISH_ALLOW_MULTIPLE = 8, ///< For raw records: Allow multiple local records of this type, even if they are intended to be unique
PUBLISH_NO_REVERSE = 16, ///< For address records: don't create a reverse (PTR) entry
PUBLISH_NO_COOKIE = 32, ///< For service records: do not implicitly add the local service cookie to TXT data
PUBLISH_UPDATE = 64, ///< Update existing records instead of adding new ones
PUBLISH_USE_WIDE_AREA = 128, ///< Register the record using wide area DNS (i.e. unicast DNS update)
PUBLISH_USE_MULTICAST = 256 ///< Register the record using multicast DNS
};
using IfIndex = int;

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/audio.cpp
* @brief todo
* @brief Definitions for Windows audio capture.
*/
#define INITGUID
#include <audioclient.h>
@@ -91,10 +91,10 @@ namespace platf::audio {
struct format_t {
enum type_e : int {
none,
stereo,
surr51,
surr71,
none, ///< No format
stereo, ///< Stereo
surr51, ///< Surround 5.1
surr71, ///< Surround 7.1
} type;
std::string_view name;
@@ -327,8 +327,7 @@ namespace platf::audio {
/**
* @brief Checks if the default rendering device changed and resets the change flag
*
* @return true if the device changed since last call
* @return `true` if the device changed since last call
*/
bool
check_default_render_device_changed() {
@@ -689,9 +688,7 @@ namespace platf::audio {
/**
* @brief Gets information encoded in the raw sink name
*
* @param sink The raw sink name
*
* @return A pair of type and the real sink name
*/
std::pair<format_t::type_e, std::string_view>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/display.h
* @brief todo
* @brief Declarations for the Windows display backend.
*/
#pragma once
@@ -187,12 +187,12 @@ namespace platf::dxgi {
util::safe_ptr_v2<std::remove_pointer_t<HANDLE>, BOOL, CloseHandle> timer;
typedef enum _D3DKMT_SCHEDULINGPRIORITYCLASS {
D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE,
D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL,
D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL,
D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL,
D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH,
D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME
D3DKMT_SCHEDULINGPRIORITYCLASS_IDLE, ///< Idle priority class
D3DKMT_SCHEDULINGPRIORITYCLASS_BELOW_NORMAL, ///< Below normal priority class
D3DKMT_SCHEDULINGPRIORITYCLASS_NORMAL, ///< Normal priority class
D3DKMT_SCHEDULINGPRIORITYCLASS_ABOVE_NORMAL, ///< Above normal priority class
D3DKMT_SCHEDULINGPRIORITYCLASS_HIGH, ///< High priority class
D3DKMT_SCHEDULINGPRIORITYCLASS_REALTIME ///< Realtime priority class
} D3DKMT_SCHEDULINGPRIORITYCLASS;
typedef UINT D3DKMT_HANDLE;

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/display_base.cpp
* @brief todo
* @brief Definitions for the Windows display base code.
*/
#include <cmath>
#include <initguid.h>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/display_ram.cpp
* @brief todo
* @brief Definitions for handling ram.
*/
#include "display.h"

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/display_vram.cpp
* @brief todo
* @brief Definitions for handling video ram.
*/
#include <cmath>
@@ -1617,10 +1617,10 @@ namespace platf::dxgi {
}
/**
* @brief Checks that a given codec is supported by the display device.
* @brief Check that a given codec is supported by the display device.
* @param name The FFmpeg codec name (or similar for non-FFmpeg codecs).
* @param config The codec configuration.
* @return true if supported, false otherwise.
* @return `true` if supported, `false` otherwise.
*/
bool
display_vram_t::is_codec_supported(std::string_view name, const ::video::config_t &config) {

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/display_wgc.cpp
* @brief WinRT Windows.Graphics.Capture API
* @brief Definitions for WinRT Windows.Graphics.Capture API
*/
#include <dxgi1_2.h>
@@ -26,7 +26,8 @@ namespace winrt {
HRESULT __stdcall CreateDirect3D11DeviceFromDXGIDevice(::IDXGIDevice *dxgiDevice, ::IInspectable **graphicsDevice);
}
/* Windows structures sometimes have compile-time GUIDs. GCC supports this, but in a roundabout way.
/**
* Windows structures sometimes have compile-time GUIDs. GCC supports this, but in a roundabout way.
* If WINRT_IMPL_HAS_DECLSPEC_UUID is true, then the compiler supports adding this attribute to a struct. For example, Visual Studio.
* If not, then MinGW GCC has a workaround to assign a GUID to a structure.
*/
@@ -66,8 +67,8 @@ namespace platf::dxgi {
}
/**
* Initialize the Windows.Graphics.Capture backend.
* @return 0 on success
* @brief Initialize the Windows.Graphics.Capture backend.
* @return 0 on success, -1 on failure.
*/
int
wgc_capture_t::init(display_base_t *display, const ::video::config_t &config) {
@@ -161,7 +162,7 @@ namespace platf::dxgi {
}
/**
* Get the next frame from the producer thread.
* @brief Get the next frame from the producer thread.
* If not available, the capture thread blocks until one is, or the wait times out.
* @param timeout how long to wait for the next frame
* @param out a texture containing the frame just captured
@@ -227,11 +228,11 @@ namespace platf::dxgi {
}
/**
* Get the next frame from the Windows.Graphics.Capture API and copy it into a new snapshot texture.
* @brief Get the next frame from the Windows.Graphics.Capture API and copy it into a new snapshot texture.
* @param pull_free_image_cb call this to get a new free image from the video subsystem.
* @param img_out the captured frame is returned here
* @param timeout how long to wait for the next frame
* @param cursor_visible
* @param cursor_visible whether to capture the cursor
*/
capture_e
display_wgc_ram_t::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_visible) {

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/input.cpp
* @brief todo
* @brief Definitions for input handling on Windows.
*/
#define WINVER 0x0A00
#include <windows.h>

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/misc.cpp
* @brief todo
* @brief Miscellaneous definitions for Windows.
*/
#include <csignal>
#include <filesystem>
@@ -462,7 +462,7 @@ namespace platf {
* @brief Impersonate the current user and invoke the callback function.
* @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
* @return Object that will store any error that occurred during the impersonation
*/
std::error_code
impersonate_current_user(HANDLE user_token, std::function<void()> callback) {
@@ -496,11 +496,11 @@ namespace platf {
}
/**
* @brief A function to create a `STARTUPINFOEXW` structure for launching a process.
* @brief 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 job A job object handle to insert the new process into. This pointer must remain valid for the life of this startup info!
* @param ec A reference to a `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.
* @return A structure that contains information about how to launch the new process.
*/
STARTUPINFOEXW
create_startup_info(FILE *file, HANDLE *job, std::error_code &ec) {
@@ -615,7 +615,7 @@ namespace platf {
}
/**
* @brief This function quotes/escapes an argument according to the Windows parsing convention.
* @brief Quote/escape an argument according to the Windows parsing convention.
* @param argument The raw argument to process.
* @return An argument string suitable for use by CreateProcess().
*/
@@ -655,7 +655,7 @@ namespace platf {
}
/**
* @brief This function escapes an argument according to cmd's parsing convention.
* @brief Escape an argument according to cmd's parsing convention.
* @param argument An argument already escaped by `escape_argument()`.
* @return An argument string suitable for use by cmd.exe.
*/
@@ -676,7 +676,7 @@ namespace platf {
}
/**
* @brief This function resolves the given raw command into a proper command string for CreateProcess().
* @brief Resolve the given raw command into a proper command string for CreateProcess().
* @details This converts URLs and non-executable file paths into a runnable command like ShellExecute().
* @param raw_cmd The raw command provided by the user.
* @param working_dir The working directory for the new process.
@@ -1701,11 +1701,6 @@ namespace platf {
return {};
}
/**
* @brief Converts a UTF-8 string into a UTF-16 wide string.
* @param string The UTF-8 string.
* @return The converted UTF-16 wide string.
*/
std::wstring
from_utf8(const std::string &string) {
// No conversion needed if the string is empty
@@ -1733,11 +1728,6 @@ namespace platf {
return output;
}
/**
* @brief Converts a UTF-16 wide string into a UTF-8 string.
* @param string The UTF-16 wide string.
* @return The converted UTF-8 string.
*/
std::string
to_utf8(const std::wstring &string) {
// No conversion needed if the string is empty

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/misc.h
* @brief todo
* @brief Miscellaneous declarations for Windows.
*/
#pragma once
@@ -22,7 +22,7 @@ namespace platf {
qpc_time_difference(int64_t performance_counter1, int64_t performance_counter2);
/**
* @brief Converts a UTF-8 string into a UTF-16 wide string.
* @brief Convert a UTF-8 string into a UTF-16 wide string.
* @param string The UTF-8 string.
* @return The converted UTF-16 wide string.
*/
@@ -30,7 +30,7 @@ namespace platf {
from_utf8(const std::string &string);
/**
* @brief Converts a UTF-16 wide string into a UTF-8 string.
* @brief Convert a UTF-16 wide string into a UTF-8 string.
* @param string The UTF-16 wide string.
* @return The converted UTF-8 string.
*/

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/driver_settings.cpp
* @brief Definitions for nvidia driver settings.
*/
// local includes
#include "driver_settings.h"
#include "nvprefs_common.h"

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/driver_settings.h
* @brief Declarations for nvidia driver settings.
*/
#pragma once
// nvapi headers

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/nvapi_opensource_wrapper.cpp
* @brief Definitions for the NVAPI wrapper.
*/
// standard library headers
#include <map>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/nvprefs_common.cpp
* @brief Definitions for common nvidia preferences.
*/
// local includes
#include "nvprefs_common.h"
#include "src/logging.h"

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/nvprefs_common.h
* @brief Declarations for common nvidia preferences.
*/
#pragma once
// sunshine utility header for generic smart pointers

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/nvprefs_interface.cpp
* @brief Definitions for nvidia preferences interface.
*/
// standard includes
#include <cassert>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/nvprefs_interface.h
* @brief Declarations for nvidia preferences interface.
*/
#pragma once
// standard library headers

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/undo_data.cpp
* @brief Definitions for undoing changes to nvidia preferences.
*/
// external includes
#include <nlohmann/json.hpp>

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/undo_data.h
* @brief Declarations for undoing changes to nvidia preferences.
*/
#pragma once
// standard library headers

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/undo_file.cpp
* @brief Definitions for the nvidia undo file.
*/
// local includes
#include "undo_file.h"

View File

@@ -1,3 +1,7 @@
/**
* @file src/platform/windows/nvprefs/undo_file.h
* @brief Declarations for the nvidia undo file.
*/
#pragma once
// standard library headers

View File

@@ -1,6 +1,6 @@
/**
* @file src/platform/windows/publish.cpp
* @brief todo
* @brief Definitions for Windows mDNS service registration.
*/
#include <winsock2.h>

View File

@@ -1,3 +1,9 @@
/**
* @file src/platform/windows/windows.rs.in
* @brief Windows resource file template.
* @note The final `windows.rs` is generated from this file during the CMake build.
* @todo Use CMake definitions directly, instead of configuring this file.
*/
#include "winver.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0