macos: Move macos function documentation to the .h so the introspection has the information

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8854>
This commit is contained in:
Thibault Saunier 2025-04-16 11:06:07 -04:00 committed by GStreamer Marge Bot
parent c8a802772c
commit 476bd6109e
2 changed files with 39 additions and 42 deletions

View File

@ -28,12 +28,47 @@ typedef int (*GstMainFunc) (int argc, char** argv, gpointer user_data);
*/
typedef int (*GstMainFuncSimple) (gpointer user_data);
/**
* gst_macos_main:
* @main_func: (scope call): pointer to the main function to be called
* @argc: the amount of arguments passed in @argv
* @argv: (array length=argc): an array of arguments to be passed to the main function
* @user_data: (nullable): user data to be passed to the main function
*
* Starts an NSApplication on the main thread before calling
* the provided main() function on a secondary thread.
*
* This ensures that GStreamer can correctly perform actions
* such as creating a GL window, which require a Cocoa main loop
* to be running on the main thread.
*
* Do not call this function more than once - especially while
* another one is still running - as that will cause unpredictable
* behaviour and most likely completely fail.
*
* Returns: the return value of the provided main_func
*
* Since: 1.22
*/
GST_API
int gst_macos_main (GstMainFunc main_func,
int argc,
char *argv[],
gpointer user_data);
/**
* gst_macos_main_simple:
* @main_func: (scope call): pointer to the main function to be called
* @user_data: (nullable): user data to be passed to the main function
*
* Simplified variant of gst_macos_main(), meant to be used with bindings
* for languages which do not have to pass argc and argv like C does.
* See gst_macos_main() for a more detailed description.
*
* Returns: the return value of the provided main_func
*
* Since: 1.22
*/
GST_API
int gst_macos_main_simple (GstMainFuncSimple main_func,
gpointer user_data);

View File

@ -100,31 +100,8 @@ run_main_with_nsapp (ThreadArgs args)
return result;
}
/**
* gst_macos_main:
* @main_func: (scope async): pointer to the main function to be called
* @argc: the amount of arguments passed in @argv
* @argv: (array length=argc): an array of arguments to be passed to the main function
* @user_data: (nullable): user data to be passed to the main function
*
* Starts an NSApplication on the main thread before calling
* the provided main() function on a secondary thread.
*
* This ensures that GStreamer can correctly perform actions
* such as creating a GL window, which require a Cocoa main loop
* to be running on the main thread.
*
* Do not call this function more than once - especially while
* another one is still running - as that will cause unpredictable
* behaviour and most likely completely fail.
*
* Returns: the return value of the provided main_func
*
* Since: 1.22
*/
int
gst_macos_main (GstMainFunc main_func, int argc, char **argv, gpointer user_data)
{
int gst_macos_main(GstMainFunc main_func, int argc, char **argv,
gpointer user_data) {
ThreadArgs args;
args.argc = argc;
@ -133,25 +110,10 @@ gst_macos_main (GstMainFunc main_func, int argc, char **argv, gpointer user_data
args.user_data = user_data;
args.is_simple = FALSE;
return run_main_with_nsapp (args);
return run_main_with_nsapp(args);
}
/**
* gst_macos_main_simple:
* @main_func: (scope async): pointer to the main function to be called
* @user_data: (nullable): user data to be passed to the main function
*
* Simplified variant of gst_macos_main(), meant to be used with bindings
* for languages which do not have to pass argc and argv like C does.
* See gst_macos_main() for a more detailed description.
*
* Returns: the return value of the provided main_func
*
* Since: 1.22
*/
int
gst_macos_main_simple (GstMainFuncSimple main_func, gpointer user_data)
{
int gst_macos_main_simple(GstMainFuncSimple main_func, gpointer user_data) {
ThreadArgs args;
args.argc = 0;