From 878ccf2400a56ee4499749b5c09c7d8423b0f3c2 Mon Sep 17 00:00:00 2001 From: "F. Duncanh" Date: Wed, 21 May 2025 10:59:28 -0400 Subject: [PATCH] add "-nc no" to unset nc option (for macOS, where -nc is default) --- README.html | 27 +++++++++++---------------- README.md | 26 +++++++++++--------------- README.txt | 27 +++++++++++---------------- uxplay.1 | 4 +++- uxplay.cpp | 21 +++++++++++++++++---- 5 files changed, 53 insertions(+), 52 deletions(-) diff --git a/README.html b/README.html index 1120dee..0e87632 100644 --- a/README.html +++ b/README.html @@ -841,23 +841,18 @@ another error (about videometa) that shows up in the GStreamer warnings. “-vsync no” (you can add a line “vsync no” in the uxplayrc configuration file).

  • On macOS with this installation of GStreamer, the only videosinks -available seem to be glimagesink (default choice made by autovideosink) -and osxvideosink. The window title does not show the Airplay server -name, but the window is visible to screen-sharing apps (e.g., Zoom). The -only available audiosink seems to be osxaudiosink.

  • -
  • The option -nc is always used, whether or not it is selected. -This is a workaround for a problem with GStreamer videosinks on macOS: -if the GStreamer pipeline is destroyed while the mirror window is still -open, a segfault occurs.

  • -
  • In the case of glimagesink, the resolution settings “-s wxh” do +available are glimagesink (default choice made by autovideosink) and +osxvideosink. The window title does not show the Airplay server name, +but the window can be shared on Zoom. Because of issues with +glimagesink, you may find osxvideosink works better. The only available +audiosink is osxaudiosink.

  • +
  • The option -nc is currently used by default om macOS, This is a +workaround for window-closing problems with GStreamer videosinks on +macOS. In anticipation of fixes, this option can be canceled with “-nc +no”, if not needed.

  • +
  • In the case of glimagesink, the resolution settings “-s wxh” may not affect the (small) initial OpenGL mirror window size, but the window -can be expanded using the mouse or trackpad. In contrast, a window -created with “-vs osxvideosink” is initially big, but has the wrong -aspect ratio (stretched image); in this case the aspect ratio changes -when the window width is changed by dragging its side; the option --vs "osxvideosink force-aspect-ratio=true" can be used to -make the window have the correct aspect ratio when it first -opens.

  • +can be expanded using the mouse or trackpad.

    Building diff --git a/README.md b/README.md index 115bebf..4772596 100644 --- a/README.md +++ b/README.md @@ -834,25 +834,21 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with the uxplayrc configuration file). - On macOS with this installation of GStreamer, the only videosinks - available seem to be glimagesink (default choice made by - autovideosink) and osxvideosink. The window title does not show the - Airplay server name, but the window is visible to screen-sharing - apps (e.g., Zoom). The only available audiosink seems to be + available are glimagesink (default choice made by + autovideosink) and osxvideosink. + The window title does not show the + Airplay server name, but the window can be shared on Zoom. + Because of issues with glimagesink, you may find + osxvideosink works better. The only available audiosink is osxaudiosink. -- The option -nc is always used, whether or not it is selected. This - is a workaround for a problem with GStreamer videosinks on macOS: if - the GStreamer pipeline is destroyed while the mirror window is still - open, a segfault occurs. +- The option -nc is currently used by default om macOS, This + is a workaround for window-closing problems with GStreamer videosinks on macOS. + In anticipation of fixes, this option can be canceled with "-nc no", if not needed. -- In the case of glimagesink, the resolution settings "-s wxh" do not +- In the case of glimagesink, the resolution settings "-s wxh" may not affect the (small) initial OpenGL mirror window size, but the window - can be expanded using the mouse or trackpad. In contrast, a window - created with "-vs osxvideosink" is initially big, but has the wrong - aspect ratio (stretched image); in this case the aspect ratio - changes when the window width is changed by dragging its side; the - option `-vs "osxvideosink force-aspect-ratio=true"` can be used to - make the window have the correct aspect ratio when it first opens. + can be expanded using the mouse or trackpad. ## Building UxPlay on Microsoft Windows, using MSYS2 with the MinGW-64 compiler. diff --git a/README.txt b/README.txt index b5a7538..4e4d602 100644 --- a/README.txt +++ b/README.txt @@ -850,25 +850,20 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with the uxplayrc configuration file). - On macOS with this installation of GStreamer, the only videosinks - available seem to be glimagesink (default choice made by - autovideosink) and osxvideosink. The window title does not show the - Airplay server name, but the window is visible to screen-sharing - apps (e.g., Zoom). The only available audiosink seems to be - osxaudiosink. + available are glimagesink (default choice made by autovideosink) and + osxvideosink. The window title does not show the Airplay server + name, but the window can be shared on Zoom. Because of issues with + glimagesink, you may find osxvideosink works better. The only + available audiosink is osxaudiosink. -- The option -nc is always used, whether or not it is selected. This - is a workaround for a problem with GStreamer videosinks on macOS: if - the GStreamer pipeline is destroyed while the mirror window is still - open, a segfault occurs. +- The option -nc is currently used by default om macOS, This is a + workaround for window-closing problems with GStreamer videosinks on + macOS. In anticipation of fixes, this option can be canceled with + "-nc no", if not needed. -- In the case of glimagesink, the resolution settings "-s wxh" do not +- In the case of glimagesink, the resolution settings "-s wxh" may not affect the (small) initial OpenGL mirror window size, but the window - can be expanded using the mouse or trackpad. In contrast, a window - created with "-vs osxvideosink" is initially big, but has the wrong - aspect ratio (stretched image); in this case the aspect ratio - changes when the window width is changed by dragging its side; the - option `-vs "osxvideosink force-aspect-ratio=true"` can be used to - make the window have the correct aspect ratio when it first opens. + can be expanded using the mouse or trackpad. ## Building UxPlay on Microsoft Windows, using MSYS2 with the MinGW-64 compiler. diff --git a/uxplay.1 b/uxplay.1 index 3675670..f4554e3 100644 --- a/uxplay.1 +++ b/uxplay.1 @@ -123,7 +123,9 @@ UxPlay 1.72: An open\-source AirPlay mirroring (+ audio streaming) server: .TP \fB\-nofreeze\fR Do NOT leave frozen screen in place after reset. .TP -\fB\-nc\fR Do NOT close video window when client stops mirroring +\fB\-nc\fR Do NOT close video window when client stops mirroring. +.TP +\fB\-nc\fR no Cancel the -nc option (DO close video window). .TP \fB\-nohold\fR Drop current connection when new client connects. .TP diff --git a/uxplay.cpp b/uxplay.cpp index 0eadbef..7fb0815 100644 --- a/uxplay.cpp +++ b/uxplay.cpp @@ -103,7 +103,11 @@ static unsigned char compression_type = 0; static std::string audiosink = "autoaudiosink"; static int audiodelay = -1; static bool use_audio = true; +#if __APPLE__ +static bool new_window_closing_behavior = false; +#else static bool new_window_closing_behavior = true; +#endif static bool close_window; static std::string video_parser = "h264parse"; static std::string video_decoder = "decodebin"; @@ -714,7 +718,8 @@ static void print_info (char *name) { printf("-md In Airplay Audio (ALAC) mode, write metadata text to file \n"); printf("-reset n Reset after n seconds of client silence (default n=%d, 0=never)\n", MISSED_FEEDBACK_LIMIT); printf("-nofreeze Do NOT leave frozen screen in place after reset\n"); - printf("-nc Do NOT Close video window when client stops mirroring\n"); + printf("-nc Do NOT Close video window when client stops mirroring\n"); + printf("-nc no Cancel the -nc option (DO close video window) \n"); printf("-nohold Drop current connection when new client connects.\n"); printf("-restrict Restrict clients to those specified by \"-allow \"\n"); printf(" UxPlay displays deviceID when a client attempts to connect\n"); @@ -1063,6 +1068,13 @@ static void parse_arguments (int argc, char *argv[]) { exit(1); } else if (arg == "-nc") { new_window_closing_behavior = false; + if (i < argc - 1) { + if (strlen(argv[i+1]) == 2 && strncmp(argv[i+1], "no", 2) == 0) { + new_window_closing_behavior = true; + i++; + continue; + } + } } else if (arg == "-avdec") { video_parser.erase(); video_parser = "h264parse"; @@ -2376,9 +2388,10 @@ int main (int argc, char *argv[]) { } #if __APPLE__ - /* force use of -nc option on macOS */ - LOGI("macOS detected: using -nc option as workaround for GStreamer problem"); - new_window_closing_behavior = false; + /* warn about default use of -nc option on macOS */ + if (!new_window_closing_behavior) { + LOGI("UxPlay on macOS is using -nc option as workaround for GStreamer problem: use \"-nc no\" to omit workaround"); + } #endif #ifdef _WIN32