Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling nightly into master #2459

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9288775
feat(macos/capture): support for capture display other than main disp…
TimmyOVO Apr 22, 2024
7fb8c76
Use C++20. (#2322)
tez011 Apr 26, 2024
9d5ee2f
fix(macos/input): incorrect mouse input for non-main display (#2461)
TimmyOVO May 2, 2024
c6fc12a
webui: Update resolution automation example text with auto refresh ra…
cgarst May 7, 2024
26e0ff8
build(archlinux): bump gcc from 12 to 13 (#2519)
ReenigneArcher May 10, 2024
b4c12cb
ci: fix code coverage (#2512)
ReenigneArcher May 11, 2024
4e49db9
build(linux)!: add fedora 40 and remove fedora 38 (#2525)
ReenigneArcher May 12, 2024
6674090
Unify asset building and use find_program to find NPM (#2522)
chewi May 12, 2024
659a426
fix(file_handler): avoid writing extra newline character (#2335)
ReenigneArcher May 12, 2024
0a595dc
fix(linux): add frame processing latency and logging improvements (#2…
gschintgen May 12, 2024
a5bbf36
AppImage: add needed VA-API libraries (Intel & AMD) (#2429)
gschintgen May 13, 2024
9c5239c
build(deps): bump LizardByte/homebrew-release-action from 2024.417.22…
dependabot[bot] May 13, 2024
81c2ecf
build(macos): skip link of nonexistent directories (#2526)
ReenigneArcher May 13, 2024
4b6ff37
refactor(ui): break down config.html into smaller pieces (#2491)
Hazer May 13, 2024
d8e73cc
build(deps): bump furo from 2024.1.29 to 2024.5.6 (#2511)
dependabot[bot] May 13, 2024
542cc71
build(deps): bump packaging/linux/flatpak/deps/org.flatpak.Builder.Ba…
dependabot[bot] May 13, 2024
2cadb81
Allow a custom FFmpeg build to be provided using CMake variables (#1970)
chewi May 13, 2024
9ee6811
build(deps): bump third-party/tray from `4d8b798` to `cb33552` (#2528)
dependabot[bot] May 14, 2024
786a9ac
build(deps): bump packaging/linux/flatpak/deps/shared-modules from `e…
dependabot[bot] May 14, 2024
b87fd42
build(deps): bump babel from 2.14.0 to 2.15.0 (#2504)
dependabot[bot] May 14, 2024
c5d8e1b
build(deps): bump vue from 3.4.23 to 3.4.27 (#2509)
dependabot[bot] May 14, 2024
ff54ab2
fix(macos): fix broken streaming on MacOS (#2485)
Hazer May 14, 2024
d70a17a
ci(codeql): fix codeql builds (#2475)
ReenigneArcher May 14, 2024
80d1d94
docs: packet loss and linux controller (#2514)
skryvel May 15, 2024
f4f343b
build(deps): bump vue-i18n from 9.13.0 to 9.13.1 (#2455)
dependabot[bot] May 15, 2024
1e59e28
build(deps): bump third-party/nvapi-open-source-sdk from `c0f5f7b` to…
dependabot[bot] May 16, 2024
aff3b56
build(deps): bump third-party/Simple-Web-Server from `27b41f5` to `4a…
dependabot[bot] May 16, 2024
2a1cb25
build(deps): bump third-party/wayland-protocols from `08d1c72` to `24…
dependabot[bot] May 16, 2024
3adb934
New Crowdin updates (#2454)
ReenigneArcher May 16, 2024
e6e4dcf
build(deps): bump third-party/moonlight-common-c from `cbd0ec1` to `e…
dependabot[bot] May 16, 2024
890b6fd
build(deps): bump LizardByte/homebrew-release-action from 2024.511.16…
dependabot[bot] May 17, 2024
373390e
build(deps): bump third-party/build-deps from `efd3a38` to `a326d43` …
dependabot[bot] May 19, 2024
fdb443a
Fix log message for Periodic Ping (#2538)
c3m3gyanesh May 19, 2024
26ceec5
chore: update global workflows (#2547)
LizardByte-bot May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmake/compile_definitions/macos.cmake
Expand Up @@ -8,12 +8,13 @@ link_directories(/opt/homebrew/lib)
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)

list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${APP_KIT_LIBRARY}
${APP_SERVICES_LIBRARY}
${AV_FOUNDATION_LIBRARY}
${CORE_MEDIA_LIBRARY}
${CORE_VIDEO_LIBRARY}
${VIDEO_TOOLBOX_LIBRARY}
${FOUNDATION_LIBRARY})
${FOUNDATION_LIBRARY}
${VIDEO_TOOLBOX_LIBRARY})

set(PLATFORM_INCLUDE_DIRS
${Boost_INCLUDE_DIR})
Expand Down
1 change: 1 addition & 0 deletions cmake/dependencies/macos.cmake
@@ -1,5 +1,6 @@
# macos specific dependencies

FIND_LIBRARY(APP_KIT_LIBRARY AppKit)
FIND_LIBRARY(APP_SERVICES_LIBRARY ApplicationServices)
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
FIND_LIBRARY(CORE_MEDIA_LIBRARY CoreMedia)
Expand Down
32 changes: 22 additions & 10 deletions docs/source/about/advanced_usage.rst
Expand Up @@ -576,20 +576,29 @@ keybindings
.. tip:: To find the name of the appropriate values follow these instructions.

**Linux**
During Sunshine startup, you should see the list of detected monitors:
During Sunshine startup, you should see the list of detected displays:

.. code-block:: text

Info: Detecting connected monitors
Info: Detected monitor 0: DVI-D-0, connected: false
Info: Detected monitor 1: HDMI-0, connected: true
Info: Detected monitor 2: DP-0, connected: true
Info: Detected monitor 3: DP-1, connected: false
Info: Detected monitor 4: DVI-D-1, connected: false
Info: Detecting displays
Info: Detected display: DVI-D-0 (id: 0) connected: false
Info: Detected display: HDMI-0 (id: 1) connected: true
Info: Detected display: DP-0 (id: 2) connected: true
Info: Detected display: DP-1 (id: 3) connected: false
Info: Detected display: DVI-D-1 (id: 4) connected: false

You need to use the value before the colon in the output, e.g. ``1``.
You need to use the id value inside the parenthesis, e.g. ``1``.

.. todo:: macOS
**macOS**
During Sunshine startup, you should see the list of detected displays:

.. code-block:: text

Info: Detecting displays
Info: Detected display: Monitor-0 (id: 3) connected: true
Info: Detected display: Monitor-1 (id: 2) connected: true

You need to use the id value inside the parenthesis, e.g. ``3``.

**Windows**
.. code-block:: batch
Expand All @@ -605,7 +614,10 @@ keybindings

output_name = 0

.. todo:: macOS
**macOS**
.. code-block:: text

output_name = 3

**Windows**
.. code-block:: text
Expand Down
6 changes: 3 additions & 3 deletions src/platform/linux/x11grab.cpp
Expand Up @@ -421,7 +421,7 @@ namespace platf {
}

if (streamedMonitor != -1) {
BOOST_LOG(info) << "Configuring selected monitor ("sv << streamedMonitor << ") to stream"sv;
BOOST_LOG(info) << "Configuring selected display ("sv << streamedMonitor << ") to stream"sv;
screen_res_t screenr { x11::rr::GetScreenResources(xdisplay.get(), xwindow) };
int output = screenr->noutput;

Expand Down Expand Up @@ -806,7 +806,7 @@ namespace platf {
return {};
}

BOOST_LOG(info) << "Detecting monitors"sv;
BOOST_LOG(info) << "Detecting displays"sv;

x11::xdisplay_t xdisplay { x11::OpenDisplay(nullptr) };
if (!xdisplay) {
Expand All @@ -821,7 +821,7 @@ namespace platf {
for (int x = 0; x < output; ++x) {
output_info_t out_info { x11::rr::GetOutputInfo(xdisplay.get(), screenr.get(), screenr->outputs[x]) };
if (out_info) {
BOOST_LOG(info) << "Detected monitor "sv << monitor << ": "sv << out_info->name << ", connected: "sv << (out_info->connection == RR_Connected);
BOOST_LOG(info) << "Detected display: "sv << out_info->name << " (id: "sv << monitor << ")"sv << out_info->name << " connected: "sv << (out_info->connection == RR_Connected);
++monitor;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/platform/macos/av_video.h
Expand Up @@ -5,6 +5,7 @@
#pragma once

#import <AVFoundation/AVFoundation.h>
#import <AppKit/AppKit.h>

struct CaptureSession {
AVCaptureVideoDataOutput *output;
Expand All @@ -29,6 +30,7 @@ typedef bool (^FrameCallbackBlock)(CMSampleBufferRef);
@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, dispatch_semaphore_t> *captureSignals;

+ (NSArray<NSDictionary *> *)displayNames;
+ (NSString *)getDisplayName:(CGDirectDisplayID)displayID;

- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate;

Expand Down
13 changes: 12 additions & 1 deletion src/platform/macos/av_video.m
Expand Up @@ -23,13 +23,24 @@ @implementation AVVideo
for (uint32_t i = 0; i < count; i++) {
[result addObject:@{
@"id": [NSNumber numberWithUnsignedInt:displays[i]],
@"name": [NSString stringWithFormat:@"%d", displays[i]]
@"name": [NSString stringWithFormat:@"%d", displays[i]],
@"displayName": [self getDisplayName:displays[i]],
}];
}

return [NSArray arrayWithArray:result];
}

+ (NSString *)getDisplayName:(CGDirectDisplayID)displayID {
NSScreen *screens = [NSScreen screens];
for (NSScreen *screen in screens) {
if (screen.deviceDescription[@"NSScreenNumber"] == [NSNumber numberWithUnsignedInt:displayID]) {
return screen.localizedName;
}
}
return nil;
}

- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate {
self = [super init];

Expand Down
23 changes: 14 additions & 9 deletions src/platform/macos/display.mm
Expand Up @@ -142,18 +142,23 @@

auto display = std::make_shared<av_display_t>();

// Default to main display
display->display_id = CGMainDisplayID();
if (!display_name.empty()) {
auto display_array = [AVVideo displayNames];

for (NSDictionary *item in display_array) {
NSString *name = item[@"name"];
if (name.UTF8String == display_name) {
NSNumber *display_id = item[@"id"];
display->display_id = [display_id unsignedIntValue];
}

// Print all displays available with it's name and id
auto display_array = [AVVideo displayNames];
BOOST_LOG(info) << "Detecting displays"sv;
for (NSDictionary *item in display_array) {
NSNumber *display_id = item[@"id"];
// We need show display's product name and corresponding display number given by user
NSString *name = item[@"displayName"];
// We are using CGGetActiveDisplayList that only returns active displays so hardcoded connected value in log to true
BOOST_LOG(info) << "Detected display: "sv << name.UTF8String << " (id: "sv << [NSString stringWithFormat:@"%@", display_id].UTF8String << ") connected: true"sv;
if (!display_name.empty() && std::atoi(display_name.c_str()) == [display_id unsignedIntValue]) {
display->display_id = [display_id unsignedIntValue];
}
}
BOOST_LOG(info) << "Configuring selected display ("sv << display->display_id << ") to stream"sv;

display->av_capture = [[AVVideo alloc] initWithDisplay:display->display_id frameRate:config.framerate];

Expand Down
21 changes: 20 additions & 1 deletion src/platform/macos/input.cpp
Expand Up @@ -509,9 +509,28 @@ const KeyCodeMap kKeyCodesMap[] = {

auto macos_input = (macos_input_t *) result.get();

// If we don't use the main display in the future, this has to be adapted
// Default to main display
macos_input->display = CGMainDisplayID();

auto output_name = config::video.output_name;
// If output_name is set, try to find the display with that display id
if (!output_name.empty()) {
uint32_t max_display = 32;
uint32_t display_count;
CGDirectDisplayID displays[max_display];
if (CGGetActiveDisplayList(max_display, displays, &display_count) != kCGErrorSuccess) {
BOOST_LOG(error) << "Unable to get active display list , error: "sv << std::endl;
}
else {
for (int i = 0; i < display_count; i++) {
CGDirectDisplayID display_id = displays[i];
if (display_id == std::atoi(output_name.c_str())) {
macos_input->display = display_id;
}
}
}
}

// Input coordinates are based on the virtual resolution not the physical, so we need the scaling factor
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(macos_input->display);
macos_input->displayScaling = ((CGFloat) CGDisplayPixelsWide(macos_input->display)) / ((CGFloat) CGDisplayModeGetPixelWidth(mode));
Expand Down
25 changes: 15 additions & 10 deletions src_assets/common/assets/web/config.html
Expand Up @@ -392,19 +392,24 @@ <h2 class="accordion-header">
<pre>tools\dxgi-info.exe</pre>
</div>
</div>
<div class="mb-3" v-if="platform === 'linux'">
<label for="output_name" class="form-label">{{ $t('config.output_name_linux') }}</label>
<div class="mb-3" v-if="platform === 'linux' || platform === 'macos'">
<label for="output_name" class="form-label">{{ $t('config.output_name_unix') }}</label>
<input type="text" class="form-control" id="output_name" placeholder="0" v-model="config.output_name" />
<div class="form-text">
{{ $t('config.output_name_desc_linux') }}<br>
{{ $t('config.output_name_desc_unix') }}<br>
<br>
<pre style="white-space: pre-line;">
Info: Detecting connected monitors
Info: Detected monitor 0: DVI-D-0, connected: false
Info: Detected monitor 1: HDMI-0, connected: true
Info: Detected monitor 2: DP-0, connected: true
Info: Detected monitor 3: DP-1, connected: false
Info: Detected monitor 4: DVI-D-1, connected: false
<pre style="white-space: pre-line;" v-if="platform === 'linux'">
Info: Detecting displays
Info: Detected display: DVI-D-0 (id: 0) connected: false
Info: Detected display: HDMI-0 (id: 1) connected: true
Info: Detected display: DP-0 (id: 2) connected: true
Info: Detected display: DP-1 (id: 3) connected: false
Info: Detected display: DVI-D-1 (id: 4) connected: false
</pre>
<pre style="white-space: pre-line;" v-if="platform === 'macos'">
Info: Detecting displays
Info: Detected display: Monitor-0 (id: 3) connected: true
Info: Detected display: Monitor-1 (id: 2) connected: true
</pre>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src_assets/common/assets/web/public/assets/locale/en.json
Expand Up @@ -243,9 +243,9 @@
"origin_web_ui_allowed_lan": "Only those in LAN may access Web UI",
"origin_web_ui_allowed_pc": "Only localhost may access Web UI",
"origin_web_ui_allowed_wan": "Anyone may access Web UI",
"output_name_desc_linux": "During Sunshine startup, you should see the list of detected monitors. You need to use the value before the colon in the output. e.g.:",
"output_name_desc_unix": "During Sunshine startup, you should see the list of detected displays. Note: You need to use the id value inside the parenthesis.",
"output_name_desc_win": "Manually specify a display to use for capture. If unset, the primary display is captured. Note: If you specified a GPU above, this display must be connected to that GPU. The appropriate values can be found using the following command:",
"output_name_linux": "Monitor number",
"output_name_unix": "Display number",
"output_name_win": "Output Name",
"ping_timeout": "Ping Timeout",
"ping_timeout_desc": "How long to wait in milliseconds for data from moonlight before shutting down the stream",
Expand Down