macos: Add wrapper API to run a NSApplication in the main thread
[platform/upstream/gstreamer.git] / subprojects / gst-docs / examples / tutorials / basic-tutorial-5.c
index 34c75c9..7aab34c 100644 (file)
@@ -4,6 +4,10 @@
 #include <gst/gst.h>
 #include <gst/video/videooverlay.h>
 
+#ifdef __APPLE__
+#include <TargetConditionals.h>
+#endif
+
 #include <gdk/gdk.h>
 #if defined (GDK_WINDOWING_X11)
 #include <gdk/gdkx.h>
@@ -372,7 +376,7 @@ application_cb (GstBus * bus, GstMessage * msg, CustomData * data)
 }
 
 int
-main (int argc, char *argv[])
+tutorial_main (int argc, char *argv[])
 {
   CustomData data;
   GstStateChangeReturn ret;
@@ -443,3 +447,13 @@ main (int argc, char *argv[])
   gst_object_unref (data.playbin);
   return 0;
 }
+
+int
+main (int argc, char *argv[])
+{
+#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE
+  return gst_macos_main (tutorial_main, argc, argv, NULL);
+#else
+  return tutorial_main (argc, argv);
+#endif
+}