gst-launch: accept option to set program name

The option --prog-name="PROGRAM-NAME" can be passed to set the program name.
The program name is used by gtk and gstreamer to set the class or app-id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5263>
This commit is contained in:
Scott Moreau 2023-08-30 10:56:19 -06:00 committed by GStreamer Marge Bot
parent 8a99589d2c
commit f0d15f335d
5 changed files with 30 additions and 0 deletions

View file

@ -122,6 +122,11 @@ create_xdg_surface (GstVulkanWindowWayland * window_wl)
/* Then the XDG top-level */
xdg_toplevel = xdg_surface_get_toplevel (xdg_surface);
if (g_get_prgname ()) {
xdg_toplevel_set_app_id (xdg_toplevel, g_get_prgname ());
} else {
xdg_toplevel_set_app_id (xdg_toplevel, "org.gstreamer.wayland");
}
xdg_toplevel_set_title (xdg_toplevel, "Vulkan Renderer");
xdg_toplevel_add_listener (xdg_toplevel, &xdg_toplevel_listener, window_wl);

View file

@ -307,6 +307,11 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
}
xdg_toplevel_add_listener (priv->xdg_toplevel,
&xdg_toplevel_listener, self);
if (g_get_prgname ()) {
xdg_toplevel_set_app_id (priv->xdg_toplevel, g_get_prgname ());
} else {
xdg_toplevel_set_app_id (priv->xdg_toplevel, "org.gstreamer.wayland");
}
gst_wl_window_ensure_fullscreen (self, fullscreen);

View file

@ -305,6 +305,11 @@ create_xdg_surface_and_toplevel (GstGLWindowWaylandEGL * window_egl)
/* Then the XDG top-level */
xdg_toplevel = xdg_surface_get_toplevel (xdg_surface);
if (g_get_prgname ()) {
xdg_toplevel_set_app_id (xdg_toplevel, g_get_prgname ());
} else {
xdg_toplevel_set_app_id (xdg_toplevel, "org.gstreamer.wayland");
}
xdg_toplevel_set_title (xdg_toplevel, "OpenGL Renderer");
xdg_toplevel_add_listener (xdg_toplevel, &xdg_toplevel_listener, window_egl);

View file

@ -222,6 +222,11 @@ gst_vaapi_window_wayland_show (GstVaapiWindow * window)
/* Create a toplevel window out of it */
priv->xdg_toplevel = xdg_surface_get_toplevel (priv->xdg_surface);
g_return_val_if_fail (priv->xdg_toplevel, FALSE);
if (g_get_prgname ()) {
xdg_toplevel_set_app_id (priv->xdg_toplevel, g_get_prgname ());
} else {
xdg_toplevel_set_app_id (priv->xdg_toplevel, "org.gstreamer.wayland");
}
xdg_toplevel_set_title (priv->xdg_toplevel, "VA-API Wayland window");
wl_proxy_set_queue ((struct wl_proxy *) priv->xdg_toplevel,
priv->event_queue);

View file

@ -80,6 +80,7 @@ static gboolean toc = FALSE;
static gboolean messages = FALSE;
static gboolean eos_on_shutdown = FALSE;
static gchar **exclude_args = NULL;
static gchar *prog_name = NULL;
/* pipeline status */
static gboolean is_live = FALSE;
@ -1102,6 +1103,9 @@ real_main (int argc, char *argv[])
N_("Do not output status information for the specified property "
"if verbose output is enabled (can be used multiple times)"),
N_("PROPERTY-NAME")},
{"prog-name", 'p', 0, G_OPTION_ARG_STRING, &prog_name,
N_("Set the name of the program"),
N_("PROGRAM-NAME")},
{"no-fault", 'f', 0, G_OPTION_ARG_NONE, &no_fault,
N_("Do not install a fault handler"), NULL},
{"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown,
@ -1178,6 +1182,12 @@ real_main (int argc, char *argv[])
gst_init (&argc, &argv);
#endif
if (prog_name) {
g_set_prgname (prog_name);
} else if (!g_get_prgname ()) {
g_set_prgname ((const gchar *) argv[0]);
}
#ifdef G_OS_WIN32
argc = g_strv_length (argv);
#endif