From 3bb34553c0e367a409b41b526b0e73ce4f74f837 Mon Sep 17 00:00:00 2001
From: "F. Duncanh"
Date: Wed, 7 May 2025 13:09:46 -0400
Subject: [PATCH] Windows: README update; use d3d11 as default videosink
---
README.html | 93 ++++++++++++++++++++++++++++++++---------------------
README.md | 69 ++++++++++++++++++++++-----------------
README.txt | 89 ++++++++++++++++++++++++++++++--------------------
uxplay.cpp | 30 ++++++++++++++---
4 files changed, 176 insertions(+), 105 deletions(-)
diff --git a/README.html b/README.html
index ac51b77..4202942 100644
--- a/README.html
+++ b/README.html
@@ -852,22 +852,38 @@ href="https://www.msys2.org">https://www.msys2.org/. Accept the
default installation location C:\mysys64.
MSYS2 packages
are installed with a variant of the “pacman” package manager used by
-Arch Linux. Open a “MSYS2 MINGW64” terminal from the MSYS2 tab in the
-Windows Start menu, and update the new MSYS2 installation with “pacman
--Syu”. Then install the MinGW-64 compiler and
-cmake
-pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
-The compiler with all required dependencies will be installed in the
-msys64 directory, with default path C:/msys64/mingw64. Here
-we will simply build UxPlay from the command line in the MSYS2
-environment (this uses “ninja” in place of
-“make” for the build system).
+Arch Linux. Open a “MSYS2” terminal from the MSYS2 tab in the Windows
+Start menu, and update the new MSYS2 installation with “pacman
+-Syu”.
+
+- _NEW: MSYS2 now recommends using the newer UCRT64 terminal
+environment (which uses the newer Microsoft UCRT “Universal C RunTime
+Library”, included as part of the Windows OS since Windows 10) rather
+than the MINGW64 terminal environment (which uses the older Microsoft
+MSVCRT C library, which has “legacy” status, but is available on all
+Windows systems). If you wish to use the legacy MSVCRT library, to
+support older Windows versions, modify the instructions below as
+follows:
+
+
+- change the MSYS2 terminal type from UCRT64 to MINGW64; (2) modify
+mingw-w64-ucrt-x86_64-* package names to mingw-w64-x86_64-*, (just omit
+“-ucrt”);
+- replace
ucrt64 by mingw64 in directory
+names._
+
+Open a new MSYS2 UCRT64 terminal, and install the gcc compiler and
+cmake:
+pacman -S mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc
+We will simply build UxPlay from the command line in the MSYS2
+environment (using “ninja” in place of “make”
+for the build system).
Download the latest UxPlay from github (to use
git, install it with pacman -S git, then
“git clone https://github.com/FDH2/UxPlay”), then
install UxPlay dependencies (openssl is already installed with
MSYS2):
-pacman -S mingw-w64-x86_64-libplist mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base
+`pacman -S mingw-w64-ucrt-x86_64-libplist mingw-w64-ucrt-x86_64-gstreamer mingw-w64-ucrt-x86_64-gst-plugins-base`
If you are trying a different Windows build system, MSVC versions of
GStreamer for Windows are available from the official GStreamer
@@ -884,19 +900,23 @@ build UxPlay with
Assuming no error in either of these, you will have built the
uxplay executable uxplay.exe in the current (“build”)
directory. The “sudo make install” and “sudo make uninstall” features
-offered in the other builds are not available on Windows; instead, the
-MSYS2 environment has /mingw64/... available, and you can
-install the uxplay.exe executable in C:/msys64/mingw64/bin
-(plus manpage and documentation in
-C:/msys64/mingw64/share/...) with
-cmake --install . --prefix /mingw64
+offered in the other builds are not available on Windows; instead, you
+can install the uxplay.exe executable in
+C:/msys64/ucrt64/bin (plus manpage and documentation in
+C:/msys64/ucrt64/share/...) with
+cmake --install . --prefix $HOME/../../ucrt64
+You can later uninstall uxplay by returning to the build directory
+and running
+ninja uninstall
+(This assumes that certain files in the build directory were not
+deleted since building UxPlay).
To be able to view the manpage, you need to install the manpage
viewer with “pacman -S man”.
To run uxplay.exe you need to install some gstreamer
plugin packages with
-pacman -S mingw-w64-x86_64-gst-<plugin>, where the
-required ones have <plugin> given by
+pacman -S mingw-w64-ucrt-x86_64-gst-<plugin>, where
+the required ones have <plugin> given by
- libav
- plugins-good
@@ -913,9 +933,9 @@ Settings->Update and Security->Windows Security->Firewall &
network protection -> allow an app through firewall. If your
virus protection flags uxplay.exe as “suspicious” (but without a true
malware signature) you may need to give it an exception.
-Now test by running “uxplay” (in a MSYS2 terminal
-window). If you need to specify the audiosink, there are two main
-choices on Windows: the older DirectSound plugin
+
Now test by running “uxplay” (in a MSYS2 UCRT64 terminal
+window. If you need to specify the audiosink, there are two main choices
+on Windows: the older DirectSound plugin
“-as directsoundsink”, and the more modern Windows Audio
Session API (wasapi) plugin “-as wasapisink”, which
supports device” is not specified, the default audio device is
used.
If you wish to specify the videosink using the
-vs <videosink> option, some choices for
-<videosink> are d3d11videosink,
-d3dvideosink, glimagesink,
-gtksink.
+<videosink> are d3d12videosink,
+d3d11videosink, d3dvideosink,
+glimagesink, gtksink,
+autovideosink. If you do not specify the videosink, the
+d3d11videosink will be used (users have reported segfaults of the newer
+d3d12 videodecoder on certain older Nvidia cards when the image
+resolution changes: d3d11 will used by default until this is fixed).
-- With Direct3D 11.0 or greater, you can either always be in
-fullscreen mode using option
-
-vs "d3d11videosink fullscreen-toggle-mode=property fullscreen=true",
-or get the ability to toggle into and out of fullscreen mode using the
-Alt-Enter key combination with option
--vs "d3d11videosink fullscreen-toggle-mode=alt-enter". For
-convenience, these options will be added if just
--vs d3d11videosink with or without the fullscreen option
-“-fs” is used. (Windows users may wish to add
-“vs d3d11videosink” (no initial “-”) to the
-UxPlay startup options file; see “man uxplay” or “uxplay -h”.)
+- With Direct3D 11.0 or greater, various options can be set using
+e.g.
-vs "d3d11videosink <options>" (see the
+gstreamer videosink documentation for these videosinks). For
+convenience, if no <options> are set, the option to
+toggle in and out of fullscreen mode with the Alt-Enter key combination
+is added.
The executable uxplay.exe can also be run without the MSYS2
environment, in the Windows Terminal, with
-C:\msys64\mingw64\bin\uxplay.
+C:\msys64\ucrt64\bin\uxplay.
Usage
Options:
diff --git a/README.md b/README.md
index 8de9264..543c6f5 100644
--- a/README.md
+++ b/README.md
@@ -846,16 +846,25 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
3. [MSYS2 packages](https://packages.msys2.org/package/) are installed
with a variant of the "pacman" package manager used by Arch Linux.
- Open a "MSYS2 MINGW64" terminal from the MSYS2 tab in the Windows
+ Open a "MSYS2" terminal from the MSYS2 tab in the Windows
Start menu, and update the new MSYS2 installation with "pacman
- -Syu". Then install the **MinGW-64** compiler and **cmake**
+ -Syu".
- pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
+ * _NEW: MSYS2 now recommends using the newer UCRT64 terminal environment (which uses the newer Microsoft
+ UCRT "Universal C RunTime Library", included as part of the Windows OS since Windows 10)
+ rather than the MINGW64 terminal environment
+ (which uses the older Microsoft MSVCRT C library, which has "legacy" status, but is available on all Windows systems).
+ If you wish to use the legacy MSVCRT library, to support older Windows versions, modify the instructions below as follows:
+ (1) change the MSYS2 terminal type from UCRT64 to MINGW64; (2) modify mingw-w64-ucrt-x86_64-* package names to mingw-w64-x86_64-*, (just omit "-ucrt");
+ (3) replace `ucrt64` by ``mingw64`` in directory names._
- The compiler with all required dependencies will be installed in the
- msys64 directory, with default path `C:/msys64/mingw64`. Here we
- will simply build UxPlay from the command line in the MSYS2
- environment (this uses "`ninja`" in place of "`make`" for the build
+
+ Open a new MSYS2 UCRT64 terminal, and install the gcc compiler and cmake:
+
+ `pacman -S mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc`
+
+ We will simply build UxPlay from the command line in the MSYS2
+ environment (using "`ninja`" in place of "`make`" for the build
system).
4. Download the latest UxPlay from github **(to use `git`, install it
@@ -863,7 +872,7 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
"`git clone https://github.com/FDH2/UxPlay`")**, then install UxPlay
dependencies (openssl is already installed with MSYS2):
- `pacman -S mingw-w64-x86_64-libplist mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base`
+ `pacman -S mingw-w64-ucrt-x86_64-libplist mingw-w64-ucrt-x86_64-gstreamer mingw-w64-ucrt-x86_64-gst-plugins-base`
If you are trying a different Windows build system, MSVC versions of
GStreamer for Windows are available from the [official GStreamer
@@ -883,18 +892,23 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
6. Assuming no error in either of these, you will have built the uxplay
executable **uxplay.exe** in the current ("build") directory. The
"sudo make install" and "sudo make uninstall" features offered in
- the other builds are not available on Windows; instead, the MSYS2
- environment has `/mingw64/...` available, and you can install the
- uxplay.exe executable in `C:/msys64/mingw64/bin` (plus manpage and
- documentation in `C:/msys64/mingw64/share/...`) with
+ the other builds are not available on Windows; instead, you can install the
+ uxplay.exe executable in `C:/msys64/ucrt64/bin` (plus manpage and
+ documentation in `C:/msys64/ucrt64/share/...`) with
- `cmake --install . --prefix /mingw64`
+ `cmake --install . --prefix $HOME/../../ucrt64`
+
+ You can later uninstall uxplay by returning to the build directory and running
+
+ `ninja uninstall`
+
+ (This assumes that certain files in the build directory were not deleted since building UxPlay).
To be able to view the manpage, you need to install the manpage
viewer with "`pacman -S man`".
To run **uxplay.exe** you need to install some gstreamer plugin packages
-with `pacman -S mingw-w64-x86_64-gst-`, where the required ones
+with `pacman -S mingw-w64-ucrt-x86_64-gst-`, where the required ones
have `` given by
1. **libav**
@@ -913,7 +927,7 @@ app through firewall**. If your virus protection flags uxplay.exe as
"suspicious" (but without a true malware signature) you may need to give
it an exception.
-Now test by running "`uxplay`" (in a MSYS2 terminal window). If you need
+Now test by running "`uxplay`" (in a MSYS2 UCRT64 terminal window. If you need
to specify the audiosink, there are two main choices on Windows: the
older DirectSound plugin "`-as directsoundsink`", and the more modern
Windows Audio Session API (wasapi) plugin "`-as wasapisink`", which
@@ -929,23 +943,20 @@ like `\{0.0.0.00000000\}.\{98e35b2b-8eba-412e-b840-fd2c2492cf44\}`. If
"`device`" is not specified, the default audio device is used.
If you wish to specify the videosink using the `-vs ` option,
-some choices for `` are `d3d11videosink`, `d3dvideosink`,
-`glimagesink`, `gtksink`.
+some choices for `` are `d3d12videosink`, ``d3d11videosink``, ```d3dvideosink```,
+`glimagesink`, ``gtksink``, ```autovideosink```. If you do not specify the videosink,
+the d3d11videosink will be used (users have reported segfaults of the newer d3d12 videodecoder
+on certain older Nvidia cards when the image resolution changes:
+d3d11 will used by default until this is fixed).
-- With Direct3D 11.0 or greater, you can either always be in
- fullscreen mode using option
- `-vs "d3d11videosink fullscreen-toggle-mode=property fullscreen=true"`,
- or get the ability to toggle into and out of fullscreen mode using
- the Alt-Enter key combination with option
- `-vs "d3d11videosink fullscreen-toggle-mode=alt-enter"`. For
- convenience, these options will be added if just
- `-vs d3d11videosink` with or without the fullscreen option "-fs" is
- used. *(Windows users may wish to add "`vs d3d11videosink`" (no
- initial "`-`") to the UxPlay startup options file; see "man uxplay"
- or "uxplay -h".)*
+- With Direct3D 11.0 or greater, various options can be set
+ using e.g. `-vs "d3d11videosink "` (see the gstreamer videosink
+ documentation for these videosinks).
+ For convenience, if no `` are set, the option to
+ toggle in and out of fullscreen mode with the Alt-Enter key combination is added.
The executable uxplay.exe can also be run without the MSYS2 environment,
-in the Windows Terminal, with `C:\msys64\mingw64\bin\uxplay`.
+in the Windows Terminal, with `C:\msys64\ucrt64\bin\uxplay`.
# Usage
diff --git a/README.txt b/README.txt
index a6f5fd4..cd372fe 100644
--- a/README.txt
+++ b/README.txt
@@ -856,16 +856,30 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
3. [MSYS2 packages](https://packages.msys2.org/package/) are installed
with a variant of the "pacman" package manager used by Arch Linux.
- Open a "MSYS2 MINGW64" terminal from the MSYS2 tab in the Windows
- Start menu, and update the new MSYS2 installation with "pacman
- -Syu". Then install the **MinGW-64** compiler and **cmake**
+ Open a "MSYS2" terminal from the MSYS2 tab in the Windows Start
+ menu, and update the new MSYS2 installation with "pacman -Syu".
- pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
+ - \_NEW: MSYS2 now recommends using the newer UCRT64 terminal
+ environment (which uses the newer Microsoft UCRT "Universal C
+ RunTime Library", included as part of the Windows OS since
+ Windows 10) rather than the MINGW64 terminal environment (which
+ uses the older Microsoft MSVCRT C library, which has "legacy"
+ status, but is available on all Windows systems). If you wish to
+ use the legacy MSVCRT library, to support older Windows
+ versions, modify the instructions below as follows:
- The compiler with all required dependencies will be installed in the
- msys64 directory, with default path `C:/msys64/mingw64`. Here we
- will simply build UxPlay from the command line in the MSYS2
- environment (this uses "`ninja`" in place of "`make`" for the build
+ (1) change the MSYS2 terminal type from UCRT64 to MINGW64; (2)
+ modify mingw-w64-ucrt-x86_64-\* package names to
+ mingw-w64-x86_64-\*, (just omit "-ucrt");
+ (2) replace `ucrt64` by `mingw64` in directory names.\_
+
+ Open a new MSYS2 UCRT64 terminal, and install the gcc compiler and
+ cmake:
+
+ `pacman -S mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gcc`
+
+ We will simply build UxPlay from the command line in the MSYS2
+ environment (using "`ninja`" in place of "`make`" for the build
system).
4. Download the latest UxPlay from github **(to use `git`, install it
@@ -873,7 +887,7 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
"`git clone https://github.com/FDH2/UxPlay`")**, then install UxPlay
dependencies (openssl is already installed with MSYS2):
- `pacman -S mingw-w64-x86_64-libplist mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base`
+ `pacman -S mingw-w64-ucrt-x86_64-libplist mingw-w64-ucrt-x86_64-gstreamer mingw-w64-ucrt-x86_64-gst-plugins-base`
If you are trying a different Windows build system, MSVC versions of
GStreamer for Windows are available from the [official GStreamer
@@ -893,19 +907,26 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
6. Assuming no error in either of these, you will have built the uxplay
executable **uxplay.exe** in the current ("build") directory. The
"sudo make install" and "sudo make uninstall" features offered in
- the other builds are not available on Windows; instead, the MSYS2
- environment has `/mingw64/...` available, and you can install the
- uxplay.exe executable in `C:/msys64/mingw64/bin` (plus manpage and
- documentation in `C:/msys64/mingw64/share/...`) with
+ the other builds are not available on Windows; instead, you can
+ install the uxplay.exe executable in `C:/msys64/ucrt64/bin` (plus
+ manpage and documentation in `C:/msys64/ucrt64/share/...`) with
- `cmake --install . --prefix /mingw64`
+ `cmake --install . --prefix $HOME/../../ucrt64`
+
+ You can later uninstall uxplay by returning to the build directory
+ and running
+
+ `ninja uninstall`
+
+ (This assumes that certain files in the build directory were not
+ deleted since building UxPlay).
To be able to view the manpage, you need to install the manpage
viewer with "`pacman -S man`".
To run **uxplay.exe** you need to install some gstreamer plugin packages
-with `pacman -S mingw-w64-x86_64-gst-`, where the required ones
-have `` given by
+with `pacman -S mingw-w64-ucrt-x86_64-gst-`, where the required
+ones have `` given by
1. **libav**
2. **plugins-good**
@@ -923,11 +944,11 @@ app through firewall**. If your virus protection flags uxplay.exe as
"suspicious" (but without a true malware signature) you may need to give
it an exception.
-Now test by running "`uxplay`" (in a MSYS2 terminal window). If you need
-to specify the audiosink, there are two main choices on Windows: the
-older DirectSound plugin "`-as directsoundsink`", and the more modern
-Windows Audio Session API (wasapi) plugin "`-as wasapisink`", which
-supports [additional
+Now test by running "`uxplay`" (in a MSYS2 UCRT64 terminal window. If
+you need to specify the audiosink, there are two main choices on
+Windows: the older DirectSound plugin "`-as directsoundsink`", and the
+more modern Windows Audio Session API (wasapi) plugin
+"`-as wasapisink`", which supports [additional
options](https://gstreamer.freedesktop.org/documentation/wasapi/wasapisink.html)
such as
@@ -939,23 +960,21 @@ like `\{0.0.0.00000000\}.\{98e35b2b-8eba-412e-b840-fd2c2492cf44\}`. If
"`device`" is not specified, the default audio device is used.
If you wish to specify the videosink using the `-vs ` option,
-some choices for `` are `d3d11videosink`, `d3dvideosink`,
-`glimagesink`, `gtksink`.
+some choices for `` are `d3d12videosink`, `d3d11videosink`,
+`d3dvideosink`, `glimagesink`, `gtksink`, `autovideosink`. If you do not
+specify the videosink, the d3d11videosink will be used (users have
+reported segfaults of the newer d3d12 videodecoder on certain older
+Nvidia cards when the image resolution changes: d3d11 will used by
+default until this is fixed).
-- With Direct3D 11.0 or greater, you can either always be in
- fullscreen mode using option
- `-vs "d3d11videosink fullscreen-toggle-mode=property fullscreen=true"`,
- or get the ability to toggle into and out of fullscreen mode using
- the Alt-Enter key combination with option
- `-vs "d3d11videosink fullscreen-toggle-mode=alt-enter"`. For
- convenience, these options will be added if just
- `-vs d3d11videosink` with or without the fullscreen option "-fs" is
- used. *(Windows users may wish to add "`vs d3d11videosink`" (no
- initial "`-`") to the UxPlay startup options file; see "man uxplay"
- or "uxplay -h".)*
+- With Direct3D 11.0 or greater, various options can be set using
+ e.g. `-vs "d3d11videosink "` (see the gstreamer videosink
+ documentation for these videosinks). For convenience, if no
+ `` are set, the option to toggle in and out of fullscreen
+ mode with the Alt-Enter key combination is added.
The executable uxplay.exe can also be run without the MSYS2 environment,
-in the Windows Terminal, with `C:\msys64\mingw64\bin\uxplay`.
+in the Windows Terminal, with `C:\msys64\ucrt64\bin\uxplay`.
# Usage
diff --git a/uxplay.cpp b/uxplay.cpp
index 4f6ae33..fb0cc8c 100644
--- a/uxplay.cpp
+++ b/uxplay.cpp
@@ -2356,6 +2356,20 @@ int main (int argc, char *argv[]) {
new_window_closing_behavior = false;
#endif
+#ifdef _WIN32
+ /* because of issues in videosink dvd312videosink (segfault when resolution changes
+ with certain Nvdia graphics cards) make the default videosink d3d11videosink, and
+ use its decoder */
+ if (videosink == "autovideosink") {
+ videosink.erase();
+ videosink.append("d3d11videosink");
+ }
+ if (videosink == "d3d11videosink") {
+ video_decoder.erase();
+ video_decoder.append("d3d11h264dec");
+ }
+#endif
+
if (videosink == "0") {
use_video = false;
videosink.erase();
@@ -2373,16 +2387,24 @@ int main (int argc, char *argv[]) {
}
}
- if (videosink == "d3d11videosink" && videosink_options.empty() && use_video) {
+ if (videosink == "d3d11videosink" && videosink_options.empty() && use_video) {
if (fullscreen) {
- videosink_options.append(" fullscreen-toggle-mode=GST_D3D11_WINDOW_FULLSCREEN_TOGGLE_MODE_PROPERTY fullscreen=true ");
+ videosink_options.append(" fullscreen-toggle-mode=GST_D3D11_WINDOW_FULLSCREEN_TOGGLE_MODE_PROPERTY fullscreen=TRUE");
} else {
videosink_options.append(" fullscreen-toggle-mode=GST_D3D11_WINDOW_FULLSCREEN_TOGGLE_MODE_ALT_ENTER ");
+ LOGI("Use Alt-Enter key combination to toggle into/out of full-screen mode");
}
- LOGI("d3d11videosink is being used with option fullscreen-toggle-mode=alt-enter\n"
- "Use Alt-Enter key combination to toggle into/out of full-screen mode");
}
+ if (videosink == "d3d12videosink" && videosink_options.empty() && use_video) {
+ if (fullscreen) {
+ videosink_options.append("fullscreen=TRUE");
+ } else {
+ videosink_options.append(" fullscreen-on-alt-enter=TRUE ");
+ LOGI("Use Alt-Enter key combination to toggle into/out of full-screen mode");
+ }
+ }
+
if (bt709_fix && use_video) {
video_parser.append(" ! ");
video_parser.append(BT709_FIX);