diff --git a/CMakeLists.txt b/CMakeLists.txt
index ade537f..2a2ab75 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,11 @@ add_subdirectory( lib/playfair )
add_subdirectory( lib )
add_subdirectory( renderers )
+if ( GST_MACOS )
+ add_definitions( -DGST_MACOS )
+ message ( STATUS "define GST_MACOS" )
+endif()
+
add_executable( uxplay uxplay.cpp )
target_link_libraries( uxplay
renderers
diff --git a/README.html b/README.html
index aac56d1..a73f046 100644
--- a/README.html
+++ b/README.html
@@ -652,15 +652,12 @@ should not install (or should uninstall) the GStreamer
supplied by their package manager, if they use the “official”
release.
-- ADDED 2023-01-25: in the current 1.22.x releases something
-in the GStreamer macOS binaries appears to not be working (UxPlay starts
-receiving the AirPlay stream, but the video window does not
-open). If you have this problem, use the older GStreamer-1.20.7
-binary packages until a fix is found. You could instead compile the
-“official” GStreamer-1.22.x release from source: GStreamer-1.22.0 has
-been successfully built this way on a system using MacPorts: see the
-UxPlay Wiki.
+- Since GStreamer v1.22, the “Official” (gstreamer.freedesktop.org)
+macOS binaries require a wrapper “gst_macos_main” around the actual main
+program (uxplay). This should have been applied during the UxPlay
+compilation process, and the initial UxPlay terminal message should
+confirm it is being used. (UxPlay can also be built using “Official”
+GStreamer v.1.20.7 binaries, which work without the wrapper.)
Using Homebrew’s GStreamer: pkg-config is needed:
(“brew install pkg-config gstreamer”). This causes a large number of
@@ -676,10 +673,27 @@ any extra non-Homebrew plugins (that you build yourself) there, and
instead set GST_PLUGIN_PATH to point to their location (Homebrew does
not supply a complete GStreamer, but seems to have everything needed for
UxPlay).
-Finally, build and install uxplay: open a terminal and change into
-the UxPlay source directory (“UxPlay-master” for zipfile downloads,
-“UxPlay” for “git clone” downloads) and build/install with “cmake . ;
-make ; sudo make install” (same as for Linux).
+Using GStreamer installed from MacPorts: this is
+not recommended, as currently the MacPorts GStreamer is
+old (v1.16.2), unmaintained, and built to use X11:
+
+(If you really wish to use the MacPorts GStreamer-1.16.2, install
+pkgconf (“sudo port install pkgconf”), then “sudo port install
+gstreamer1-gst-plugins-base gstreamer1-gst-plugins-good
+gstreamer1-gst-plugins-bad gstreamer1-gst-libav”. For X11 support on
+macOS, compile UxPlay using a special cmake option
+-DUSE_X11=ON, and run it from an XQuartz terminal with -vs
+ximagesink; older non-retina macs require a lower resolution when using
+X11: uxplay -s 800x600.)
+After installing GStreamer, build and install uxplay: open a terminal
+and change into the UxPlay source directory (“UxPlay-master” for zipfile
+downloads, “UxPlay” for “git clone” downloads) and build/install with
+“cmake . ; make ; sudo make install” (same as for Linux).
Running UxPlay while checking for GStreamer warnings (do this
with “export GST_DEBUG=2” before runnng UxPlay) reveals that with the
@@ -707,23 +721,6 @@ 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.
-Using GStreamer installed from MacPorts (not
-recommended):
-To install: “sudo port install pkgconf”; “sudo port install
-gstreamer1-gst-plugins-base gstreamer1-gst-plugins-good
-gstreamer1-gst-plugins-bad gstreamer1-gst-libav”. The MacPorts
-GStreamer is old (v1.16.2) and built to use X11: use the
-special CMake option -DUSE_X11=ON when building UxPlay.
-Then uxplay must be run from an XQuartz terminal, and needs option “-vs
-ximagesink”. On a unibody (non-retina) MacBook Pro, the default
-resolution wxh = 1920x1080 was too large, but using option “-s 800x600”
-worked. The MacPorts GStreamer pipeline seems fragile against attempts
-to change the X11 window size, or to rotations that switch a connected
-client between portrait and landscape mode while uxplay is running.
-Using the MacPorts X11 GStreamer seems only possible if the image size
-is left unchanged from the initial “-s wxh” setting (also use the
-iPad/iPhone setting that locks the screen orientation against switching
-between portrait and landscape mode as the device is rotated).
Building
UxPlay on Microsoft Windows, using MSYS2 with the MinGW-64
diff --git a/README.md b/README.md
index d70a245..3050e54 100644
--- a/README.md
+++ b/README.md
@@ -518,11 +518,10 @@ so you don't have to install one.) Install both the gstreamer-1.0 and gstreamer-
to install (they install to /Library/FrameWorks/GStreamer.framework). Homebrew or MacPorts users should **not** install (or should uninstall)
the GStreamer supplied by their package manager, if they use the "official" release.
-* **ADDED 2023-01-25: in the current 1.22.x releases something in the GStreamer macOS binaries appears to not be
-working (UxPlay starts receiving the AirPlay stream, but the video window does not open)**. If
-you have this problem, use the older GStreamer-1.20.7 binary packages until a fix is found. _You could instead
-compile the "official" GStreamer-1.22.x release from source: GStreamer-1.22.0 has been successfully
-built this way on a system using MacPorts: see_ [the UxPlay Wiki](https://github.com/FDH2/UxPlay/wiki/Building-GStreamer-from-Source-on-macOS-with-MacPorts).
+* Since GStreamer v1.22, the "Official" (gstreamer.freedesktop.org) macOS binaries require a wrapper "gst_macos_main"
+around the actual main program (uxplay). This should have been applied during the UxPlay compilation process, and
+the initial UxPlay terminal message should confirm it is being used. (UxPlay can also be built using "Official" GStreamer v.1.20.7
+binaries, which work without the wrapper.)
**Using Homebrew's GStreamer**: pkg-config is needed: ("brew install pkg-config gstreamer").
This causes a large number of extra packages to be installed by Homebrew as dependencies.
@@ -534,7 +533,22 @@ extra non-Homebrew plugins (that you build yourself) there, and instead set GST_
their location (Homebrew does not supply a complete GStreamer, but seems to have everything needed for UxPlay).
-Finally, build and install uxplay: open a terminal and change into the UxPlay source directory
+**Using GStreamer installed from MacPorts**: this is **not** recommended, as currently the MacPorts GStreamer
+is old (v1.16.2), unmaintained, and built to use X11:
+
+ * Instead [build gstreamer yourself](https://github.com/FDH2/UxPlay/wiki/Building-GStreamer-from-Source-on-macOS-with-MacPorts)
+if you use MacPorts and do not want to use the "Official" Gstreamer binaries.
+
+_(If you really wish to use the MacPorts GStreamer-1.16.2,
+install pkgconf ("sudo port install pkgconf"), then
+"sudo port install gstreamer1-gst-plugins-base gstreamer1-gst-plugins-good gstreamer1-gst-plugins-bad gstreamer1-gst-libav".
+For X11 support on macOS, compile UxPlay using a special cmake option `-DUSE_X11=ON`, and run
+it from an XQuartz terminal with -vs ximagesink; older non-retina macs require a lower resolution
+when using X11: `uxplay -s 800x600`.)_
+
+
+
+After installing GStreamer, build and install uxplay: open a terminal and change into the UxPlay source directory
("UxPlay-master" for zipfile downloads, "UxPlay" for "git clone" downloads) and build/install with
"cmake . ; make ; sudo make install " (same as for Linux).
@@ -558,16 +572,6 @@ Finally, build and install uxplay: open a terminal and change into the UxPlay so
the option "-vs osxvideosink force-aspect-ratio=true" can be used to make the window have the
correct aspect ratio when it first opens.
-
-***Using GStreamer installed from MacPorts (not recommended):***
-
-To install: "sudo port install pkgconf"; "sudo port install gstreamer1-gst-plugins-base gstreamer1-gst-plugins-good gstreamer1-gst-plugins-bad gstreamer1-gst-libav".
-**The MacPorts GStreamer is old (v1.16.2) and built to use X11**: use the special CMake option `-DUSE_X11=ON`
-when building UxPlay. Then uxplay must be run from an XQuartz terminal, and needs
-option "-vs ximagesink". On a unibody (non-retina) MacBook Pro, the default resolution wxh = 1920x1080
-was too large, but using option "-s 800x600" worked. The MacPorts GStreamer pipeline
-seems fragile against attempts to change the X11 window size, or to rotations that switch a connected client between portrait and landscape mode while uxplay is running. Using the MacPorts X11 GStreamer seems only possible if the image size is left unchanged from the initial "-s wxh" setting (also use the iPad/iPhone setting that locks the screen orientation against switching between portrait and landscape mode as the device is rotated).
-
## Building UxPlay on Microsoft Windows, using MSYS2 with the MinGW-64 compiler.
* tested on Windows 10 and 11, 64-bit.
diff --git a/README.txt b/README.txt
index e10a6ca..9edf6dc 100644
--- a/README.txt
+++ b/README.txt
@@ -645,15 +645,13 @@ Shift-Click on them to install (they install to
should **not** install (or should uninstall) the GStreamer supplied by
their package manager, if they use the "official" release.
-- **ADDED 2023-01-25: in the current 1.22.x releases something in the
- GStreamer macOS binaries appears to not be working (UxPlay starts
- receiving the AirPlay stream, but the video window does not open)**.
- If you have this problem, use the older GStreamer-1.20.7 binary
- packages until a fix is found. *You could instead compile the
- "official" GStreamer-1.22.x release from source: GStreamer-1.22.0
- has been successfully built this way on a system using MacPorts:
- see* [the UxPlay
- Wiki](https://github.com/FDH2/UxPlay/wiki/Building-GStreamer-from-Source-on-macOS-with-MacPorts).
+- Since GStreamer v1.22, the "Official" (gstreamer.freedesktop.org)
+ macOS binaries require a wrapper "gst_macos_main" around the actual
+ main program (uxplay). This should have been applied during the
+ UxPlay compilation process, and the initial UxPlay terminal message
+ should confirm it is being used. (UxPlay can also be built using
+ "Official" GStreamer v.1.20.7 binaries, which work without the
+ wrapper.)
**Using Homebrew's GStreamer**: pkg-config is needed: ("brew install
pkg-config gstreamer"). This causes a large number of extra packages to
@@ -668,10 +666,27 @@ Homebrew installs gstreamer to `(HOMEBREW)/lib/gstreamer-1.0` where
point to their location (Homebrew does not supply a complete GStreamer,
but seems to have everything needed for UxPlay).
-Finally, build and install uxplay: open a terminal and change into the
-UxPlay source directory ("UxPlay-master" for zipfile downloads, "UxPlay"
-for "git clone" downloads) and build/install with "cmake . ; make ; sudo
-make install" (same as for Linux).
+**Using GStreamer installed from MacPorts**: this is **not**
+recommended, as currently the MacPorts GStreamer is old (v1.16.2),
+unmaintained, and built to use X11:
+
+- Instead [build gstreamer
+ yourself](https://github.com/FDH2/UxPlay/wiki/Building-GStreamer-from-Source-on-macOS-with-MacPorts)
+ if you use MacPorts and do not want to use the "Official" Gstreamer
+ binaries.
+
+*(If you really wish to use the MacPorts GStreamer-1.16.2, install
+pkgconf ("sudo port install pkgconf"), then "sudo port install
+gstreamer1-gst-plugins-base gstreamer1-gst-plugins-good
+gstreamer1-gst-plugins-bad gstreamer1-gst-libav". For X11 support on
+macOS, compile UxPlay using a special cmake option `-DUSE_X11=ON`, and
+run it from an XQuartz terminal with -vs ximagesink; older non-retina
+macs require a lower resolution when using X11: `uxplay -s 800x600`.)*
+
+After installing GStreamer, build and install uxplay: open a terminal
+and change into the UxPlay source directory ("UxPlay-master" for zipfile
+downloads, "UxPlay" for "git clone" downloads) and build/install with
+"cmake . ; make ; sudo make install" (same as for Linux).
- Running UxPlay while checking for GStreamer warnings (do this with
"export GST_DEBUG=2" before runnng UxPlay) reveals that with the
@@ -703,24 +718,6 @@ make install" (same as for Linux).
option "-vs osxvideosink force-aspect-ratio=true" can be used to
make the window have the correct aspect ratio when it first opens.
-***Using GStreamer installed from MacPorts (not recommended):***
-
-To install: "sudo port install pkgconf"; "sudo port install
-gstreamer1-gst-plugins-base gstreamer1-gst-plugins-good
-gstreamer1-gst-plugins-bad gstreamer1-gst-libav". **The MacPorts
-GStreamer is old (v1.16.2) and built to use X11**: use the special CMake
-option `-DUSE_X11=ON` when building UxPlay. Then uxplay must be run from
-an XQuartz terminal, and needs option "-vs ximagesink". On a unibody
-(non-retina) MacBook Pro, the default resolution wxh = 1920x1080 was too
-large, but using option "-s 800x600" worked. The MacPorts GStreamer
-pipeline seems fragile against attempts to change the X11 window size,
-or to rotations that switch a connected client between portrait and
-landscape mode while uxplay is running. Using the MacPorts X11 GStreamer
-seems only possible if the image size is left unchanged from the initial
-"-s wxh" setting (also use the iPad/iPhone setting that locks the screen
-orientation against switching between portrait and landscape mode as the
-device is rotated).
-
## Building UxPlay on Microsoft Windows, using MSYS2 with the MinGW-64 compiler.
- tested on Windows 10 and 11, 64-bit.
diff --git a/renderers/CMakeLists.txt b/renderers/CMakeLists.txt
index 3798fe9..72c73d3 100644
--- a/renderers/CMakeLists.txt
+++ b/renderers/CMakeLists.txt
@@ -44,6 +44,11 @@ target_link_libraries ( renderers PUBLIC airplay )
if( GST_INCLUDE_DIRS MATCHES "/Library/FrameWorks/GStreamer.framework/include" )
set( GST_INCLUDE_DIRS "/Library/FrameWorks/GStreamer.framework/Headers")
message( STATUS "GST_INCLUDE_DIRS" ${GST_INCLUDE_DIRS} )
+# fix to use -DGST_MACOS for "Official" GStreamer >= 1.22 packages
+ pkg_check_modules ( GST122 gstreamer-1.0>=1.22 )
+ if ( GST122_FOUND )
+ set( GST_MACOS "1" CACHE STRING "define GST_MACOS in uxplay.cpp" )
+ endif()
endif()
target_include_directories ( renderers PUBLIC ${GST_INCLUDE_DIRS} )
@@ -62,3 +67,4 @@ else()
endif()
+
diff --git a/uxplay.cpp b/uxplay.cpp
index dd47899..f13116e 100644
--- a/uxplay.cpp
+++ b/uxplay.cpp
@@ -1505,8 +1505,21 @@ static void read_config_file(const char * filename, const char * uxplay_name) {
free (argv);
}
}
+#ifdef GST_MACOS
+/* workaround for GStreamer >= 1.22 "Official Builds" on macOS */
+#include
+#include
+void real_main (int argc, char *argv[]);
int main (int argc, char *argv[]) {
+ printf("*=== Using gst_macos_main wrapper for GStreamer >= 1.22 on macOS ===*\n");
+ return gst_macos_main ((GstMainFunc) real_main, argc, argv , NULL);
+}
+
+void real_main (int argc, char *argv[]) {
+#else
+int main (int argc, char *argv[]) {
+#endif
std::vector server_hw_addr;
std::string mac_address;
std::string config_file = "";