mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-10-29 11:23:23 +00:00
docs: improvements to source code documentation (#1236)
This commit is contained in:
parent
97f18d6353
commit
979f7f4e60
@ -52,7 +52,7 @@ NamespaceIndentation: All
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
ReflowComments: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
|
||||
@ -8,16 +8,16 @@ version: 2
|
||||
|
||||
# Set the version of Python
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.10"
|
||||
python: "3.11"
|
||||
apt_packages:
|
||||
- graphviz
|
||||
|
||||
## Include the submodules, required for cmake
|
||||
# submodules:
|
||||
# include: all
|
||||
# recursive: true
|
||||
# submodules required for include statements
|
||||
submodules:
|
||||
include: all
|
||||
recursive: true
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
|
||||
@ -878,6 +878,7 @@ WARN_IF_UNDOC_ENUM_VAL = NO
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
# todo - ideally this will eventually become FAIL_ON_WARNINGS
|
||||
|
||||
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
|
||||
# can produce. The string should contain the $file, $line, and $text tags, which
|
||||
@ -2354,7 +2355,7 @@ SEARCH_INCLUDES = YES
|
||||
# RECURSIVE has no effect here.
|
||||
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
|
||||
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_PATH = ../third-party/ffmpeg-linux-x86_64/include/
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
|
||||
@ -95,8 +95,16 @@ breathe_projects = dict(
|
||||
)
|
||||
todo_include_todos = True
|
||||
|
||||
subprocess.run('doxygen', shell=True, cwd=source_dir)
|
||||
|
||||
# disable epub mimetype warnings
|
||||
# https://github.com/readthedocs/readthedocs.org/blob/eadf6ac6dc6abc760a91e1cb147cc3c5f37d1ea8/docs/conf.py#L235-L236
|
||||
suppress_warnings = ["epub.unknown_project_files"]
|
||||
|
||||
# get doxygen version
|
||||
doxy_proc = subprocess.run('doxygen --version', shell=True, cwd=source_dir, capture_output=True)
|
||||
doxy_version = doxy_proc.stdout.decode('utf-8').strip()
|
||||
print('doxygen version: ' + doxy_version)
|
||||
|
||||
# run doxygen
|
||||
doxy_proc = subprocess.run('doxygen Doxyfile', shell=True, cwd=source_dir)
|
||||
if doxy_proc.returncode != 0:
|
||||
raise RuntimeError('doxygen failed with return code ' + str(doxy_proc.returncode))
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_AUDIO_H
|
||||
#define SUNSHINE_AUDIO_H
|
||||
#pragma once
|
||||
|
||||
#include "thread_safe.h"
|
||||
#include "utility.h"
|
||||
@ -44,5 +43,3 @@ namespace audio {
|
||||
void
|
||||
capture(safe::mail_t mail, config_t config, void *channel_data);
|
||||
} // namespace audio
|
||||
|
||||
#endif
|
||||
|
||||
@ -87,9 +87,9 @@ namespace cbs {
|
||||
make_sps_h264(const AVCodecContext *ctx) {
|
||||
H264RawSPS sps {};
|
||||
|
||||
/* b_per_p == ctx->max_b_frames for h264 */
|
||||
/* desired_b_depth == avoption("b_depth") == 1 */
|
||||
/* max_b_depth == std::min(av_log2(ctx->b_per_p) + 1, desired_b_depth) ==> 1 */
|
||||
// b_per_p == ctx->max_b_frames for h264
|
||||
// desired_b_depth == avoption("b_depth") == 1
|
||||
// max_b_depth == std::min(av_log2(ctx->b_per_p) + 1, desired_b_depth) ==> 1
|
||||
auto max_b_depth = 1;
|
||||
auto dpb_frame = ctx->gop_size == 1 ? 0 : 1 + max_b_depth;
|
||||
auto mb_width = (FFALIGN(ctx->width, 16) / 16) * 16;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_CBS_H
|
||||
#define SUNSHINE_CBS_H
|
||||
#pragma once
|
||||
|
||||
#include "utility.h"
|
||||
|
||||
@ -28,10 +27,8 @@ namespace cbs {
|
||||
make_sps_h264(const AVCodecContext *ctx, const AVPacket *packet);
|
||||
|
||||
/**
|
||||
* Check if SPS->VUI is present
|
||||
*/
|
||||
* Check if SPS->VUI is present
|
||||
*/
|
||||
bool
|
||||
validate_sps(const AVPacket *packet, int codec_id);
|
||||
} // namespace cbs
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_CONFIG_H
|
||||
#define SUNSHINE_CONFIG_H
|
||||
#pragma once
|
||||
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
@ -162,4 +161,3 @@ namespace config {
|
||||
std::unordered_map<std::string, std::string>
|
||||
parse_config(const std::string_view &file_content);
|
||||
} // namespace config
|
||||
#endif
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// Created by TheElixZammuto on 2021-05-09.
|
||||
// TODO: Authentication, better handling of routes common to nvhttp, cleanup
|
||||
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 6/3/19.
|
||||
|
||||
#ifndef SUNSHINE_CONFIGHTTP_H
|
||||
#define SUNSHINE_CONFIGHTTP_H
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
@ -34,5 +31,3 @@ const std::map<std::string, std::string> mime_types = {
|
||||
{ "woff2", "font/woff2" },
|
||||
{ "xml", "text/xml" },
|
||||
};
|
||||
|
||||
#endif // SUNSHINE_CONFIGHTTP_H
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// Created by loki on 5/31/19.
|
||||
|
||||
#include "crypto.h"
|
||||
#include <openssl/pem.h>
|
||||
|
||||
@ -35,13 +33,13 @@ namespace crypto {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* When certificates from two or more instances of Moonlight have been added to x509_store_t,
|
||||
* only one of them will be verified by X509_verify_cert, resulting in only a single instance of
|
||||
* Moonlight to be able to use Sunshine
|
||||
*
|
||||
* To circumvent this, x509_store_t instance will be created for each instance of the certificates.
|
||||
*/
|
||||
/**
|
||||
* When certificates from two or more instances of Moonlight have been added to x509_store_t,
|
||||
* only one of them will be verified by X509_verify_cert, resulting in only a single instance of
|
||||
* Moonlight to be able to use Sunshine
|
||||
*
|
||||
* To circumvent this, x509_store_t instance will be created for each instance of the certificates.
|
||||
*/
|
||||
const char *
|
||||
cert_chain_t::verify(x509_t::element_type *cert) {
|
||||
int err_code = 0;
|
||||
|
||||
27
src/crypto.h
27
src/crypto.h
@ -1,7 +1,4 @@
|
||||
// Created by loki on 6/1/19.
|
||||
|
||||
#ifndef SUNSHINE_CRYPTO_H
|
||||
#define SUNSHINE_CRYPTO_H
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <openssl/evp.h>
|
||||
@ -123,11 +120,11 @@ namespace crypto {
|
||||
gcm_t(const crypto::aes_t &key, bool padding = true);
|
||||
|
||||
/**
|
||||
* length of cipher must be at least: round_to_pkcs7_padded(plaintext.size()) + crypto::cipher::tag_size
|
||||
*
|
||||
* return -1 on error
|
||||
* return bytes written on success
|
||||
*/
|
||||
* length of cipher must be at least: round_to_pkcs7_padded(plaintext.size()) + crypto::cipher::tag_size
|
||||
*
|
||||
* return -1 on error
|
||||
* return bytes written on success
|
||||
*/
|
||||
int
|
||||
encrypt(const std::string_view &plaintext, std::uint8_t *tagged_cipher, aes_t *iv);
|
||||
|
||||
@ -145,15 +142,13 @@ namespace crypto {
|
||||
cbc_t(const crypto::aes_t &key, bool padding = true);
|
||||
|
||||
/**
|
||||
* length of cipher must be at least: round_to_pkcs7_padded(plaintext.size())
|
||||
*
|
||||
* return -1 on error
|
||||
* return bytes written on success
|
||||
*/
|
||||
* length of cipher must be at least: round_to_pkcs7_padded(plaintext.size())
|
||||
*
|
||||
* return -1 on error
|
||||
* return bytes written on success
|
||||
*/
|
||||
int
|
||||
encrypt(const std::string_view &plaintext, std::uint8_t *cipher, aes_t *iv);
|
||||
};
|
||||
} // namespace cipher
|
||||
} // namespace crypto
|
||||
|
||||
#endif //SUNSHINE_CRYPTO_H
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "network.h"
|
||||
#include "thread_safe.h"
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// Created by loki on 6/20/19.
|
||||
|
||||
// define uint32_t for <moonlight-common-c/src/Input.h>
|
||||
#include <cstdint>
|
||||
extern "C" {
|
||||
@ -147,12 +145,12 @@ namespace input {
|
||||
};
|
||||
|
||||
/**
|
||||
* Apply shortcut based on VKEY
|
||||
* On success
|
||||
* return > 0
|
||||
* On nothing
|
||||
* return 0
|
||||
*/
|
||||
* Apply shortcut based on VKEY
|
||||
* On success
|
||||
* return > 0
|
||||
* On nothing
|
||||
* return 0
|
||||
*/
|
||||
inline int
|
||||
apply_shortcut(short keyCode) {
|
||||
constexpr auto VK_F1 = 0x70;
|
||||
@ -366,21 +364,20 @@ namespace input {
|
||||
|
||||
mouse_press[button] = !release;
|
||||
}
|
||||
///////////////////////////////////
|
||||
/*/
|
||||
* When Moonlight sends mouse input through absolute coordinates,
|
||||
* it's possible that BUTTON_RIGHT is pressed down immediately after releasing BUTTON_LEFT.
|
||||
* As a result, Sunshine will left-click on hyperlinks in the browser before right-clicking
|
||||
*
|
||||
* This can be solved by delaying BUTTON_LEFT, however, any delay on input is undesirable during gaming
|
||||
* As a compromise, Sunshine will only put delays on BUTTON_LEFT when
|
||||
* absolute mouse coordinates have been sent.
|
||||
*
|
||||
* Try to make sure BUTTON_RIGHT gets called before BUTTON_LEFT is released.
|
||||
*
|
||||
* input->mouse_left_button_timeout can only be nullptr
|
||||
* when the last mouse coordinates were absolute
|
||||
/*/
|
||||
/**
|
||||
* When Moonlight sends mouse input through absolute coordinates,
|
||||
* it's possible that BUTTON_RIGHT is pressed down immediately after releasing BUTTON_LEFT.
|
||||
* As a result, Sunshine will left-click on hyperlinks in the browser before right-clicking
|
||||
*
|
||||
* This can be solved by delaying BUTTON_LEFT, however, any delay on input is undesirable during gaming
|
||||
* As a compromise, Sunshine will only put delays on BUTTON_LEFT when
|
||||
* absolute mouse coordinates have been sent.
|
||||
*
|
||||
* Try to make sure BUTTON_RIGHT gets called before BUTTON_LEFT is released.
|
||||
*
|
||||
* input->mouse_left_button_timeout can only be nullptr
|
||||
* when the last mouse coordinates were absolute
|
||||
*/
|
||||
if (button == BUTTON_LEFT && release && !input->mouse_left_button_timeout) {
|
||||
auto f = [=]() {
|
||||
auto left_released = mouse_press[BUTTON_LEFT];
|
||||
@ -408,7 +405,6 @@ namespace input {
|
||||
|
||||
return;
|
||||
}
|
||||
///////////////////////////////////
|
||||
|
||||
platf::button_mouse(platf_input, button, release);
|
||||
}
|
||||
@ -424,8 +420,8 @@ namespace input {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update flags for keyboard shortcut combo's
|
||||
*/
|
||||
* Update flags for keyboard shortcut combo's
|
||||
*/
|
||||
inline void
|
||||
update_shortcutFlags(int *flags, short keyCode, bool release) {
|
||||
switch (keyCode) {
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 6/20/19.
|
||||
|
||||
#ifndef SUNSHINE_INPUT_H
|
||||
#define SUNSHINE_INPUT_H
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
@ -33,5 +30,3 @@ namespace input {
|
||||
float scalar_inv;
|
||||
};
|
||||
} // namespace input
|
||||
|
||||
#endif // SUNSHINE_INPUT_H
|
||||
|
||||
@ -3,8 +3,7 @@
|
||||
*/
|
||||
|
||||
// macros
|
||||
#ifndef SUNSHINE_MAIN_H
|
||||
#define SUNSHINE_MAIN_H
|
||||
#pragma once
|
||||
|
||||
// standard includes
|
||||
#include <filesystem>
|
||||
@ -87,5 +86,3 @@ namespace service_ctrl {
|
||||
wait_for_ui_ready();
|
||||
} // namespace service_ctrl
|
||||
#endif
|
||||
|
||||
#endif // SUNSHINE_MAIN_H
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
#ifndef DOSSIER_MOVE_BY_COPY_H
|
||||
#define DOSSIER_MOVE_BY_COPY_H
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
namespace move_by_copy_util {
|
||||
/*
|
||||
* When a copy is made, it moves the object
|
||||
* This allows you to move an object when a move can't be done.
|
||||
*/
|
||||
/**
|
||||
* When a copy is made, it moves the object
|
||||
* This allows you to move an object when a move can't be done.
|
||||
*/
|
||||
template <class T>
|
||||
class MoveByCopy {
|
||||
public:
|
||||
@ -53,4 +52,3 @@ namespace move_by_copy_util {
|
||||
return MoveByCopy<T>(std::move(const_cast<T &>(movable)));
|
||||
}
|
||||
} // namespace move_by_copy_util
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// Created by loki on 12/27/19.
|
||||
|
||||
#include "network.h"
|
||||
#include "utility.h"
|
||||
#include <algorithm>
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 12/27/19.
|
||||
|
||||
#ifndef SUNSHINE_NETWORK_H
|
||||
#define SUNSHINE_NETWORK_H
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
|
||||
@ -34,5 +31,3 @@ namespace net {
|
||||
host_t
|
||||
host_create(ENetAddress &addr, std::size_t peers, std::uint16_t port);
|
||||
} // namespace net
|
||||
|
||||
#endif // SUNSHINE_NETWORK_H
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file nvhttp.h
|
||||
*/
|
||||
* @file nvhttp.h
|
||||
*/
|
||||
|
||||
// macros
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
@ -522,15 +522,15 @@ namespace nvhttp {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare the user supplied pin to the Moonlight pin.
|
||||
* @param pin The user supplied pin.
|
||||
* @return `true` if the pin is correct, `false` otherwise.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* bool pin_status = nvhttp::pin("1234");
|
||||
* ```
|
||||
*/
|
||||
* @brief Compare the user supplied pin to the Moonlight pin.
|
||||
* @param pin The user supplied pin.
|
||||
* @return `true` if the pin is correct, `false` otherwise.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* bool pin_status = nvhttp::pin("1234");
|
||||
* ```
|
||||
*/
|
||||
bool
|
||||
pin(std::string pin) {
|
||||
pt::ptree tree;
|
||||
@ -889,13 +889,13 @@ namespace nvhttp {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Start the nvhttp server.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* nvhttp::start();
|
||||
* ```
|
||||
*/
|
||||
* @brief Start the nvhttp server.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* nvhttp::start();
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
start() {
|
||||
auto shutdown_event = mail::man->event<bool>(mail::shutdown);
|
||||
@ -1035,13 +1035,13 @@ namespace nvhttp {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove all paired clients.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* nvhttp::erase_all_clients();
|
||||
* ```
|
||||
*/
|
||||
* @brief Remove all paired clients.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* nvhttp::erase_all_clients();
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
erase_all_clients() {
|
||||
map_id_client.clear();
|
||||
|
||||
25
src/nvhttp.h
25
src/nvhttp.h
@ -1,10 +1,9 @@
|
||||
/**
|
||||
* @file nvhttp.h
|
||||
*/
|
||||
* @file nvhttp.h
|
||||
*/
|
||||
|
||||
// macros
|
||||
#ifndef SUNSHINE_NVHTTP_H
|
||||
#define SUNSHINE_NVHTTP_H
|
||||
#pragma once
|
||||
|
||||
// standard includes
|
||||
#include <string>
|
||||
@ -18,24 +17,24 @@
|
||||
namespace nvhttp {
|
||||
|
||||
/**
|
||||
* @brief The protocol version.
|
||||
*/
|
||||
* @brief The protocol version.
|
||||
*/
|
||||
constexpr auto VERSION = "7.1.431.-1";
|
||||
// The negative 4th version number tells Moonlight that this is Sunshine
|
||||
|
||||
/**
|
||||
* @brief The GFE version we are replicating.
|
||||
*/
|
||||
* @brief The GFE version we are replicating.
|
||||
*/
|
||||
constexpr auto GFE_VERSION = "3.23.0.74";
|
||||
|
||||
/**
|
||||
* @brief The HTTP port, as a difference from the config port.
|
||||
*/
|
||||
* @brief The HTTP port, as a difference from the config port.
|
||||
*/
|
||||
constexpr auto PORT_HTTP = 0;
|
||||
|
||||
/**
|
||||
* @brief The HTTPS port, as a difference from the config port.
|
||||
*/
|
||||
* @brief The HTTPS port, as a difference from the config port.
|
||||
*/
|
||||
constexpr auto PORT_HTTPS = -5;
|
||||
|
||||
// functions
|
||||
@ -46,5 +45,3 @@ namespace nvhttp {
|
||||
void
|
||||
erase_all_clients();
|
||||
} // namespace nvhttp
|
||||
|
||||
#endif // SUNSHINE_NVHTTP_H
|
||||
|
||||
@ -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
|
||||
@ -1,5 +1,3 @@
|
||||
// Created by loki on 12/14/19.
|
||||
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
|
||||
#include "process.h"
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 12/14/19.
|
||||
|
||||
#ifndef SUNSHINE_PROCESS_H
|
||||
#define SUNSHINE_PROCESS_H
|
||||
#pragma once
|
||||
|
||||
#ifndef __kernel_entry
|
||||
#define __kernel_entry
|
||||
@ -19,27 +16,27 @@ namespace proc {
|
||||
using file_t = util::safe_ptr_v2<FILE, int, fclose>;
|
||||
|
||||
typedef config::prep_cmd_t cmd_t;
|
||||
/*
|
||||
* pre_cmds -- guaranteed to be executed unless any of the commands fail.
|
||||
* detached -- commands detached from Sunshine
|
||||
* cmd -- Runs indefinitely until:
|
||||
* No session is running and a different set of commands it to be executed
|
||||
* Command exits
|
||||
* working_dir -- the process working directory. This is required for some games to run properly.
|
||||
* cmd_output --
|
||||
* empty -- The output of the commands are appended to the output of sunshine
|
||||
* "null" -- The output of the commands are discarded
|
||||
* filename -- The output of the commands are appended to filename
|
||||
*/
|
||||
/**
|
||||
* pre_cmds -- guaranteed to be executed unless any of the commands fail.
|
||||
* detached -- commands detached from Sunshine
|
||||
* cmd -- Runs indefinitely until:
|
||||
* No session is running and a different set of commands it to be executed
|
||||
* Command exits
|
||||
* working_dir -- the process working directory. This is required for some games to run properly.
|
||||
* cmd_output --
|
||||
* empty -- The output of the commands are appended to the output of sunshine
|
||||
* "null" -- The output of the commands are discarded
|
||||
* filename -- The output of the commands are appended to filename
|
||||
*/
|
||||
struct ctx_t {
|
||||
std::vector<cmd_t> prep_cmds;
|
||||
|
||||
/**
|
||||
* Some applications, such as Steam,
|
||||
* either exit quickly, or keep running indefinitely.
|
||||
* Steam.exe is one such application.
|
||||
* That is why some applications need be run and forgotten about
|
||||
*/
|
||||
* Some applications, such as Steam,
|
||||
* either exit quickly, or keep running indefinitely.
|
||||
* Steam.exe is one such application.
|
||||
* That is why some applications need be run and forgotten about
|
||||
*/
|
||||
std::vector<std::string> detached;
|
||||
|
||||
std::string name;
|
||||
@ -66,8 +63,8 @@ namespace proc {
|
||||
execute(int app_id);
|
||||
|
||||
/**
|
||||
* @return _app_id if a process is running, otherwise returns 0
|
||||
*/
|
||||
* @return _app_id if a process is running, otherwise returns 0
|
||||
*/
|
||||
int
|
||||
running();
|
||||
|
||||
@ -102,9 +99,9 @@ namespace proc {
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate a stable id based on name and image data
|
||||
* @return tuple of id calculated without index (for use if no collision) and one with
|
||||
*/
|
||||
* Calculate a stable id based on name and image data
|
||||
* @return tuple of id calculated without index (for use if no collision) and one with
|
||||
*/
|
||||
std::tuple<std::string, std::string>
|
||||
calculate_app_id(const std::string &app_name, std::string app_image_path, int index);
|
||||
|
||||
@ -117,4 +114,3 @@ namespace proc {
|
||||
|
||||
extern proc_t proc;
|
||||
} // namespace proc
|
||||
#endif // SUNSHINE_PROCESS_H
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef KITTY_UTIL_ITERATOR_H
|
||||
#define KITTY_UTIL_ITERATOR_H
|
||||
#pragma once
|
||||
|
||||
#include <iterator>
|
||||
|
||||
@ -180,5 +179,3 @@ namespace round_robin_util {
|
||||
return round_robin_t<V, It>(begin, end);
|
||||
}
|
||||
} // namespace round_robin_util
|
||||
|
||||
#endif
|
||||
|
||||
10
src/rtsp.cpp
10
src/rtsp.cpp
@ -1,5 +1,3 @@
|
||||
// Created by loki on 2/2/20.
|
||||
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
|
||||
extern "C" {
|
||||
@ -501,10 +499,10 @@ namespace rtsp_stream {
|
||||
auto mapping_p = stream_config.mapping;
|
||||
|
||||
/**
|
||||
* GFE advertises incorrect mapping for normal quality configurations,
|
||||
* as a result, Moonlight rotates all channels from index '3' to the right
|
||||
* To work around this, rotate channels to the left from index '3'
|
||||
*/
|
||||
* GFE advertises incorrect mapping for normal quality configurations,
|
||||
* as a result, Moonlight rotates all channels from index '3' to the right
|
||||
* To work around this, rotate channels to the left from index '3'
|
||||
*/
|
||||
if (x == audio::SURROUND51 || x == audio::SURROUND71) {
|
||||
std::copy_n(mapping_p, stream_config.channelCount, mapping);
|
||||
std::rotate(mapping + 3, mapping + 4, mapping + audio::MAX_STREAM_CONFIG);
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 2/2/20.
|
||||
|
||||
#ifndef SUNSHINE_RTSP_H
|
||||
#define SUNSHINE_RTSP_H
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
@ -27,5 +24,3 @@ namespace rtsp_stream {
|
||||
rtpThread();
|
||||
|
||||
} // namespace rtsp_stream
|
||||
|
||||
#endif // SUNSHINE_RTSP_H
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// Created by loki on 6/5/19.
|
||||
|
||||
#include "process.h"
|
||||
|
||||
#include <future>
|
||||
@ -359,11 +357,11 @@ namespace stream {
|
||||
};
|
||||
|
||||
/**
|
||||
* First part of cipher must be struct of type control_encrypted_t
|
||||
*
|
||||
* returns empty string_view on failure
|
||||
* returns string_view pointing to payload data
|
||||
*/
|
||||
* First part of cipher must be struct of type control_encrypted_t
|
||||
*
|
||||
* returns empty string_view on failure
|
||||
* returns string_view pointing to payload data
|
||||
*/
|
||||
template <std::size_t max_payload_size>
|
||||
static inline std::string_view
|
||||
encode_control(session_t *session, const std::string_view &plaintext, std::array<std::uint8_t, max_payload_size> &tagged_cipher) {
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 6/5/19.
|
||||
|
||||
#ifndef SUNSHINE_STREAM_H
|
||||
#define SUNSHINE_STREAM_H
|
||||
#pragma once
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
@ -49,5 +46,3 @@ namespace stream {
|
||||
state(session_t &session);
|
||||
} // namespace session
|
||||
} // namespace stream
|
||||
|
||||
#endif // SUNSHINE_STREAM_H
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 16-4-19.
|
||||
|
||||
#ifndef SUNSHINE_SYNC_H
|
||||
#define SUNSHINE_SYNC_H
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <mutex>
|
||||
@ -98,5 +95,3 @@ namespace sync_util {
|
||||
};
|
||||
|
||||
} // namespace sync_util
|
||||
|
||||
#endif // SUNSHINE_SYNC_H
|
||||
|
||||
@ -37,9 +37,9 @@ using namespace std::literals;
|
||||
namespace system_tray {
|
||||
|
||||
/**
|
||||
* @brief Callback for opening the UI from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for opening the UI from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_open_ui_cb(struct tray_menu *item) {
|
||||
BOOST_LOG(info) << "Opening UI from system tray"sv;
|
||||
@ -47,45 +47,45 @@ namespace system_tray {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback for opening GitHub Sponsors from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for opening GitHub Sponsors from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_donate_github_cb(struct tray_menu *item) {
|
||||
platf::open_url("https://github.com/sponsors/LizardByte");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback for opening MEE6 donation from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for opening MEE6 donation from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_donate_mee6_cb(struct tray_menu *item) {
|
||||
platf::open_url("https://mee6.xyz/m/804382334370578482");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback for opening Patreon from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for opening Patreon from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_donate_patreon_cb(struct tray_menu *item) {
|
||||
platf::open_url("https://www.patreon.com/LizardByte");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback for opening PayPal donation from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for opening PayPal donation from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_donate_paypal_cb(struct tray_menu *item) {
|
||||
platf::open_url("https://www.paypal.com/paypalme/ReenigneArcher");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback for restarting Sunshine from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for restarting Sunshine from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_restart_cb(struct tray_menu *item) {
|
||||
BOOST_LOG(info) << "Restarting from system tray"sv;
|
||||
@ -94,9 +94,9 @@ namespace system_tray {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Callback for exiting Sunshine from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
* @brief Callback for exiting Sunshine from the system tray.
|
||||
* @param item The tray menu item.
|
||||
*/
|
||||
void
|
||||
tray_quit_cb(struct tray_menu *item) {
|
||||
BOOST_LOG(info) << "Quiting from system tray"sv;
|
||||
@ -138,10 +138,10 @@ namespace system_tray {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Create the system tray.
|
||||
* @details This function has an endless loop, so it should be run in a separate thread.
|
||||
* @return 1 if the system tray failed to create, otherwise 0 once the tray has been terminated.
|
||||
*/
|
||||
* @brief Create the system tray.
|
||||
* @details This function has an endless loop, so it should be run in a separate thread.
|
||||
* @return 1 if the system tray failed to create, otherwise 0 once the tray has been terminated.
|
||||
*/
|
||||
int
|
||||
system_tray() {
|
||||
#ifdef _WIN32
|
||||
@ -229,9 +229,9 @@ namespace system_tray {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Run the system tray with platform specific options.
|
||||
* @note macOS requires that UI elements be created on the main thread, so the system tray is not implemented for macOS.
|
||||
*/
|
||||
* @brief Run the system tray with platform specific options.
|
||||
* @note macOS requires that UI elements be created on the main thread, so the system tray is not implemented for macOS.
|
||||
*/
|
||||
void
|
||||
run_tray() {
|
||||
// create the system tray
|
||||
@ -252,9 +252,9 @@ namespace system_tray {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Exit the system tray.
|
||||
* @return 0 after exiting the system tray.
|
||||
*/
|
||||
* @brief Exit the system tray.
|
||||
* @return 0 after exiting the system tray.
|
||||
*/
|
||||
int
|
||||
end_tray() {
|
||||
tray_exit();
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
* @file system_tray.h
|
||||
*/
|
||||
|
||||
#ifndef SUNSHINE_SYSTEM_TRAY_H
|
||||
#define SUNSHINE_SYSTEM_TRAY_H
|
||||
#pragma once
|
||||
|
||||
// system_tray namespace
|
||||
namespace system_tray {
|
||||
@ -31,4 +30,3 @@ namespace system_tray {
|
||||
end_tray();
|
||||
|
||||
} // namespace system_tray
|
||||
#endif // SUNSHINE_SYSTEM_TRAY_H
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef KITTY_TASK_POOL_H
|
||||
#define KITTY_TASK_POOL_H
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <deque>
|
||||
@ -111,8 +110,8 @@ namespace task_pool_util {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an id to potentially delay the task
|
||||
*/
|
||||
* @return an id to potentially delay the task.
|
||||
*/
|
||||
template <class Function, class X, class Y, class... Args>
|
||||
auto
|
||||
pushDelayed(Function &&newTask, std::chrono::duration<X, Y> duration, Args &&...args) {
|
||||
@ -146,8 +145,9 @@ namespace task_pool_util {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param duration The delay before executing the task
|
||||
*/
|
||||
* @param task_id The id of the task to delay.
|
||||
* @param duration The delay before executing the task.
|
||||
*/
|
||||
template <class X, class Y>
|
||||
void
|
||||
delay(task_id_t task_id, std::chrono::duration<X, Y> duration) {
|
||||
@ -257,4 +257,3 @@ namespace task_pool_util {
|
||||
}
|
||||
};
|
||||
} // namespace task_pool_util
|
||||
#endif
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
#ifndef KITTY_THREAD_POOL_H
|
||||
#define KITTY_THREAD_POOL_H
|
||||
#pragma once
|
||||
|
||||
#include "task_pool.h"
|
||||
#include <thread>
|
||||
|
||||
namespace thread_pool_util {
|
||||
/*
|
||||
* Allow threads to execute unhindered
|
||||
* while keeping full control over the threads.
|
||||
*/
|
||||
/**
|
||||
* Allow threads to execute unhindered while keeping full control over the threads.
|
||||
*/
|
||||
class ThreadPool: public task_pool_util::TaskPool {
|
||||
public:
|
||||
typedef TaskPool::__task __task;
|
||||
@ -127,4 +125,3 @@ namespace thread_pool_util {
|
||||
}
|
||||
};
|
||||
} // namespace thread_pool_util
|
||||
#endif
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 6/10/19.
|
||||
|
||||
#ifndef SUNSHINE_THREAD_SAFE_H
|
||||
#define SUNSHINE_THREAD_SAFE_H
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
@ -574,5 +571,3 @@ namespace safe {
|
||||
mail->cleanup();
|
||||
}
|
||||
} // namespace safe
|
||||
|
||||
#endif // SUNSHINE_THREAD_SAFE_H
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef SUNSHINE_UPNP_H
|
||||
#define SUNSHINE_UPNP_H
|
||||
#pragma once
|
||||
|
||||
#include "platform/common.h"
|
||||
|
||||
@ -7,5 +6,3 @@ namespace upnp {
|
||||
[[nodiscard]] std::unique_ptr<platf::deinit_t>
|
||||
start();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#ifndef UTILITY_H
|
||||
#define UTILITY_H
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <condition_variable>
|
||||
@ -1030,4 +1029,3 @@ namespace util {
|
||||
big(T x) { return endian_helper<T>::big(x); }
|
||||
} // namespace endian
|
||||
} // namespace util
|
||||
#endif
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 8-2-19.
|
||||
|
||||
#ifndef T_MAN_UUID_H
|
||||
#define T_MAN_UUID_H
|
||||
#pragma once
|
||||
|
||||
#include <random>
|
||||
|
||||
@ -80,4 +77,3 @@ namespace uuid_util {
|
||||
}
|
||||
};
|
||||
} // namespace uuid_util
|
||||
#endif // T_MAN_UUID_H
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
#ifndef INCLUDE_GUARD
|
||||
#define INCLUDE_GUARD
|
||||
#pragma once
|
||||
|
||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
||||
#define PROJECT_VER "@PROJECT_VERSION@"
|
||||
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
|
||||
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
|
||||
#define PROJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"
|
||||
|
||||
#endif // INCLUDE_GUARD
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// Created by loki on 6/6/19.
|
||||
|
||||
#include <atomic>
|
||||
#include <bitset>
|
||||
#include <list>
|
||||
@ -163,8 +161,8 @@ namespace video {
|
||||
}
|
||||
|
||||
/**
|
||||
* When preserving aspect ratio, ensure that padding is black
|
||||
*/
|
||||
* When preserving aspect ratio, ensure that padding is black
|
||||
*/
|
||||
int
|
||||
prefill() {
|
||||
auto frame = sw_frame ? sw_frame.get() : this->frame;
|
||||
@ -1001,7 +999,7 @@ namespace video {
|
||||
auto &sps = session.sps;
|
||||
auto &vps = session.vps;
|
||||
|
||||
/* send the frame to the encoder */
|
||||
// send the frame to the encoder
|
||||
auto ret = avcodec_send_frame(ctx.get(), frame);
|
||||
if (ret < 0) {
|
||||
char err_str[AV_ERROR_MAX_STRING_SIZE] { 0 };
|
||||
@ -1962,13 +1960,13 @@ namespace video {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
This is called once at startup and each time a stream is launched to
|
||||
ensure the best encoder is selected. Encoder availablility can change
|
||||
at runtime due to all sorts of things from driver updates to eGPUs.
|
||||
|
||||
This is only safe to call when there is no client actively streaming.
|
||||
*/
|
||||
/**
|
||||
* This is called once at startup and each time a stream is launched to
|
||||
* ensure the best encoder is selected. Encoder availablility can change
|
||||
* at runtime due to all sorts of things from driver updates to eGPUs.
|
||||
*
|
||||
* This is only safe to call when there is no client actively streaming.
|
||||
*/
|
||||
int
|
||||
probe_encoders() {
|
||||
auto encoder_list = encoders;
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
// Created by loki on 6/9/19.
|
||||
|
||||
#ifndef SUNSHINE_VIDEO_H
|
||||
#define SUNSHINE_VIDEO_H
|
||||
#pragma once
|
||||
|
||||
#include "input.h"
|
||||
#include "platform/common.h"
|
||||
@ -103,5 +100,3 @@ namespace video {
|
||||
int
|
||||
probe_encoders();
|
||||
} // namespace video
|
||||
|
||||
#endif // SUNSHINE_VIDEO_H
|
||||
|
||||
14
third-party/glad/include/KHR/khrplatform.h
vendored
14
third-party/glad/include/KHR/khrplatform.h
vendored
@ -101,7 +101,7 @@
|
||||
*/
|
||||
#if defined(KHRONOS_STATIC)
|
||||
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
|
||||
* header compatible with static linking. */
|
||||
* header compatible with static linking. */
|
||||
#define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
#define KHRONOS_APICALL __declspec(dllimport)
|
||||
@ -143,8 +143,8 @@
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
@ -156,8 +156,8 @@ typedef uint64_t khronos_uint64_t;
|
||||
#elif defined(__VMS) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
@ -208,8 +208,8 @@ typedef unsigned int khronos_uint32_t;
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
|
||||
1386
third-party/nvfbc/NvFBC.h
vendored
1386
third-party/nvfbc/NvFBC.h
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user