From c28bc4492e48e8102ebf88bf4635f73e732b9ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 11 Jan 2023 12:17:13 +0200 Subject: [PATCH] tools: Use `gst_macos_main()` on macOS Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1673 Part-of: --- .../gst-editing-services/tools/ges-launch.c | 17 +++++++++++++++-- .../gst-plugins-bad/tools/gst-transcoder.c | 18 ++++++++++++++++-- .../tools/gst-device-monitor.c | 18 ++++++++++++++++-- .../gst-plugins-base/tools/gst-discoverer.c | 18 ++++++++++++++++-- subprojects/gst-plugins-base/tools/gst-play.c | 18 ++++++++++++++++-- subprojects/gstreamer/tools/gst-inspect.c | 18 ++++++++++++++++-- subprojects/gstreamer/tools/gst-launch.c | 18 ++++++++++++++++-- subprojects/gstreamer/tools/gst-typefind.c | 18 ++++++++++++++++-- 8 files changed, 127 insertions(+), 16 deletions(-) diff --git a/subprojects/gst-editing-services/tools/ges-launch.c b/subprojects/gst-editing-services/tools/ges-launch.c index 66eeb239a5..610ff90c4c 100644 --- a/subprojects/gst-editing-services/tools/ges-launch.c +++ b/subprojects/gst-editing-services/tools/ges-launch.c @@ -21,9 +21,12 @@ #include /* for LC_ALL */ #include "ges-launcher.h" +#ifdef __APPLE__ +#include +#endif -int -main (int argc, gchar ** argv) +static int +real_main (int argc, gchar ** argv) { GESLauncher *launcher; gint ret; @@ -43,3 +46,13 @@ main (int argc, gchar ** argv) return ret; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gst-plugins-bad/tools/gst-transcoder.c b/subprojects/gst-plugins-bad/tools/gst-transcoder.c index 9fcac13e69..a1ba29c212 100644 --- a/subprojects/gst-plugins-bad/tools/gst-transcoder.c +++ b/subprojects/gst-plugins-bad/tools/gst-transcoder.c @@ -26,6 +26,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + static const gchar *HELP_SUMMARY = "gst-transcoder-1.0 transcodes a stream defined by its first \n" "argument to the place defined by its second argument\n" @@ -317,8 +321,8 @@ _warning_cb (GstTranscoder * transcoder, GError * error, GstStructure * details) warn ("Got warning: %s", error->message); } -int -main (int argc, char *argv[]) +static int +real_main (int argc, char *argv[]) { gint res = 0; GError *err = NULL; @@ -460,3 +464,13 @@ no_extension: goto done; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gst-plugins-base/tools/gst-device-monitor.c b/subprojects/gst-plugins-base/tools/gst-device-monitor.c index 880889edfa..d826ee2fd3 100644 --- a/subprojects/gst-plugins-base/tools/gst-device-monitor.c +++ b/subprojects/gst-plugins-base/tools/gst-device-monitor.c @@ -30,6 +30,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + GST_DEBUG_CATEGORY (devmon_debug); #define GST_CAT_DEFAULT devmon_debug @@ -282,8 +286,8 @@ quit_loop (GMainLoop * loop) return G_SOURCE_REMOVE; } -int -main (int argc, char **argv) +static int +real_main (int argc, char **argv) { gboolean print_version = FALSE; GError *err = NULL; @@ -401,3 +405,13 @@ main (int argc, char **argv) return 0; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gst-plugins-base/tools/gst-discoverer.c b/subprojects/gst-plugins-base/tools/gst-discoverer.c index 454ff89f0e..fefee4f687 100644 --- a/subprojects/gst-plugins-base/tools/gst-discoverer.c +++ b/subprojects/gst-plugins-base/tools/gst-discoverer.c @@ -29,6 +29,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #define MAX_INDENT 40 /* *INDENT-OFF* */ @@ -633,8 +637,8 @@ _discoverer_finished (GstDiscoverer * dc, GMainLoop * ml) g_main_loop_quit (ml); } -int -main (int argc, char **argv) +static int +real_main (int argc, char **argv) { GError *err = NULL; GstDiscoverer *dc; @@ -730,3 +734,13 @@ main (int argc, char **argv) return 0; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gst-plugins-base/tools/gst-play.c b/subprojects/gst-plugins-base/tools/gst-play.c index 115a7ce542..6bf8ea2c49 100644 --- a/subprojects/gst-plugins-base/tools/gst-play.c +++ b/subprojects/gst-plugins-base/tools/gst-play.c @@ -45,6 +45,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + #include "gst-play-kb.h" #define VOLUME_STEPS 20 @@ -1592,8 +1596,8 @@ clear_winmm_timer_resolution (guint resolution) } #endif -int -main (int argc, char **argv) +static int +real_main (int argc, char **argv) { GstPlay *play; GPtrArray *playlist; @@ -1822,3 +1826,13 @@ main (int argc, char **argv) gst_deinit (); return 0; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gstreamer/tools/gst-inspect.c b/subprojects/gstreamer/tools/gst-inspect.c index d8f42e98ab..40001a1fd6 100644 --- a/subprojects/gstreamer/tools/gst-inspect.c +++ b/subprojects/gstreamer/tools/gst-inspect.c @@ -46,6 +46,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + /* "R" : support color * "X" : do not clear the screen when leaving the pager * "F" : skip the pager if content fit into the screen @@ -2087,8 +2091,8 @@ _parse_sort_type (const gchar * option_name, const gchar * optarg, return FALSE; } -int -main (int argc, char *argv[]) +static int +real_main (int argc, char *argv[]) { gboolean print_all = FALSE; gboolean do_print_blacklist = FALSE; @@ -2330,3 +2334,13 @@ done: return exit_code; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gstreamer/tools/gst-launch.c b/subprojects/gstreamer/tools/gst-launch.c index 16759e68de..7d93993528 100644 --- a/subprojects/gstreamer/tools/gst-launch.c +++ b/subprojects/gstreamer/tools/gst-launch.c @@ -50,6 +50,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + extern volatile gboolean glib_on_error_halt; #ifdef G_OS_UNIX @@ -1070,8 +1074,8 @@ clear_winmm_timer_resolution (guint resolution) } #endif -int -main (int argc, char *argv[]) +static int +real_main (int argc, char *argv[]) { /* options */ gboolean verbose = FALSE; @@ -1360,3 +1364,13 @@ main (int argc, char *argv[]) return last_launch_code; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +} diff --git a/subprojects/gstreamer/tools/gst-typefind.c b/subprojects/gstreamer/tools/gst-typefind.c index 490aca85e5..b6b1b8acb1 100644 --- a/subprojects/gstreamer/tools/gst-typefind.c +++ b/subprojects/gstreamer/tools/gst-typefind.c @@ -29,6 +29,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include "tools.h" static void @@ -134,8 +138,8 @@ typefind_file (const gchar * filename) gst_object_unref (pipeline); } -int -main (int argc, char *argv[]) +static int +real_main (int argc, char *argv[]) { gchar **filenames = NULL; guint num, i; @@ -185,3 +189,13 @@ main (int argc, char *argv[]) return 0; } + +int +main (int argc, char *argv[]) +{ +#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE + return gst_macos_main ((GstMainFunc) real_main, argc, argv, NULL); +#else + return real_main (argc, argv); +#endif +}