gstreamer/subprojects/gstreamer/gst/gstmacos.h
Piotr Brzeziński 3bb8700577 macos: Add wrapper API to run a NSApplication in the main thread
On macOS, a Cocoa event loop is needed in the main thread to ensure
things like opening a GL window work correctly. In the past, this was
patched into glib via Cerbero, but that prevented us from updating it.
This workaround simply runs an NSApplication and then calls the
main function on a secondary thread, allowing GStreamer to correctly
display windows and/or system permission prompts, for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3532>
2022-12-13 17:50:32 +00:00

43 lines
1.4 KiB
C

#ifndef __GST_MACOS_H__
#define __GST_MACOS_H__
#include <gst/gstconfig.h>
#include <gst/glib-compat.h>
G_BEGIN_DECLS
/**
* GstMainFunc:
* @argc: the amount of arguments passed in @argv
* @argv: (array length=argc): an array of arguments passed to the main function
* @user_data: (nullable): user data passed to the main function
*
* Represents a simple pointer to the main() function of a program.
* It is used to pass that function along with its arguments to
* gst_macos_main(), which ensures correct behaviour of various
* GStreamer elements (e.g glimagesink) on macOS.
*/
typedef int (*GstMainFunc) (int argc, char** argv, gpointer user_data);
/**
* GstMainFuncSimple:
* @user_data: (nullable): user data passed to the main function
*
* Simplified version of #GstMainFunc, meant to be used with
* gst_macos_main_simple(), which does not require argc/argv to be passed.
*/
typedef int (*GstMainFuncSimple) (gpointer user_data);
GST_API
int gst_macos_main (GstMainFunc main_func,
int argc,
char *argv[],
gpointer user_data);
GST_API
int gst_macos_main_simple (GstMainFuncSimple main_func,
gpointer user_data);
G_END_DECLS
#endif /* __GST_MACOS_H__ */