clapper-app: Support Windows high resolution clock

Windows high resolution clock improves accuracy of various Windows
timer APIs and precision of GstSystemClock during playback
This commit is contained in:
Rafał Dzięgiel
2025-01-12 12:52:44 +01:00
parent 60e7d56611
commit d9b20dcc18
4 changed files with 162 additions and 3 deletions

View File

@@ -26,6 +26,7 @@
#include "clapper-app-application.h"
#include "clapper-app-types.h"
#include "clapper-app-utils.h"
gint
main (gint argc, gchar **argv)
@@ -34,6 +35,10 @@ main (gint argc, gchar **argv)
GApplication *application;
gint status;
#ifdef G_OS_WIN32
guint resolution = 0;
#endif
g_setenv ("GSK_RENDERER", "gl", FALSE);
setlocale (LC_ALL, "");
@@ -48,13 +53,24 @@ main (gint argc, gchar **argv)
adw_init ();
clapper_app_types_init ();
clapper_app_utils_debug_init ();
g_set_application_name ("Clapper");
#ifdef G_OS_WIN32
clapper_app_utils_win_enforce_hi_res_clock ();
resolution = clapper_app_utils_win_hi_res_clock_start ();
#endif
application = clapper_app_application_new ();
status = g_application_run (application, argc, argv);
g_object_unref (application);
#ifdef G_OS_WIN32
if (resolution > 0)
clapper_app_utils_win_hi_res_clock_stop (resolution);
#endif
return status;
}