tools: Use `gst_macos_main()` on macOS
authorSebastian Dröge <sebastian@centricular.com>
Wed, 11 Jan 2023 10:17:13 +0000 (12:17 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 11 Jan 2023 13:36:55 +0000 (13:36 +0000)
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1673

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3709>

subprojects/gst-editing-services/tools/ges-launch.c
subprojects/gst-plugins-bad/tools/gst-transcoder.c
subprojects/gst-plugins-base/tools/gst-device-monitor.c
subprojects/gst-plugins-base/tools/gst-discoverer.c
subprojects/gst-plugins-base/tools/gst-play.c
subprojects/gstreamer/tools/gst-inspect.c
subprojects/gstreamer/tools/gst-launch.c
subprojects/gstreamer/tools/gst-typefind.c

index 66eeb23..610ff90 100644 (file)
 #include <locale.h>             /* for LC_ALL */
 #include "ges-launcher.h"
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}
index 9fcac13..a1ba29c 100644 (file)
 #include <glib-unix.h>
 #endif
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#endif
+
 static const gchar *HELP_SUMMARY =
     "gst-transcoder-1.0 transcodes a stream defined by its first <input-uri>\n"
     "argument to the place defined by its second <output-uri> 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
+}
index 880889e..d826ee2 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}
index 454ff89..fefee4f 100644 (file)
 #include <gst/pbutils/pbutils.h>
 #include <gst/audio/audio.h>
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}
index 115a7ce..6bf8ea2 100644 (file)
 #include <mmsystem.h>
 #endif
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}
index d8f42e9..40001a1 100644 (file)
 #include <io.h>
 #endif
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}
index 16759e6..7d93993 100644 (file)
 #include <mmsystem.h>
 #endif
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}
index 490aca8..b6b1b8a 100644 (file)
 #include <string.h>
 #include <locale.h>
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#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
+}