device-monitor: Add argument to include devices from hidden providers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1077>
This commit is contained in:
Luke Yelavich 2021-03-20 11:16:51 +11:00
parent eb06907fb4
commit ddf3e6669f
2 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,9 @@ Print version and exit
.TP 8 .TP 8
.B \-f, \-\-follow .B \-f, \-\-follow
Don't exit after showing the initial device list, but wait for devices to be added or removed Don't exit after showing the initial device list, but wait for devices to be added or removed
.TP 8
.B \-i, \-\-include\-hidden
Include devices from hidden device providers.
.SH "EXAMPLES" .SH "EXAMPLES"
.l .l
@ -33,6 +36,8 @@ Don't exit after showing the initial device list, but wait for devices to be add
.B gst\-device\-monitor\-1.0 Audio/Source .B gst\-device\-monitor\-1.0 Audio/Source
.TP 8 .TP 8
.B gst\-device\-monitor\-1.0 Video/Source:video/x-raw .B gst\-device\-monitor\-1.0 Video/Source:video/x-raw
.TP 8
.B gst-device-monitor-1.0 -s Audio/Sink
.SH "SEE ALSO" .SH "SEE ALSO"
.BR gst\-inspect\-1.0 (1), .BR gst\-inspect\-1.0 (1),

View File

@ -287,6 +287,7 @@ main (int argc, char **argv)
GError *err = NULL; GError *err = NULL;
gchar **arg, **args = NULL; gchar **arg, **args = NULL;
gboolean follow = FALSE; gboolean follow = FALSE;
gboolean include_hidden = FALSE;
GOptionContext *ctx; GOptionContext *ctx;
GOptionEntry options[] = { GOptionEntry options[] = {
{"version", 0, 0, G_OPTION_ARG_NONE, &print_version, {"version", 0, 0, G_OPTION_ARG_NONE, &print_version,
@ -294,6 +295,8 @@ main (int argc, char **argv)
{"follow", 'f', 0, G_OPTION_ARG_NONE, &follow, {"follow", 'f', 0, G_OPTION_ARG_NONE, &follow,
N_("Don't exit after showing the initial device list, but wait " N_("Don't exit after showing the initial device list, but wait "
"for devices to added/removed."), NULL}, "for devices to added/removed."), NULL},
{"include-hidden", 'i', 0, G_OPTION_ARG_NONE, &include_hidden,
N_("Include devices from hidden device providers."), NULL},
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL}, {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &args, NULL},
{NULL} {NULL}
}; };
@ -340,6 +343,7 @@ main (int argc, char **argv)
app.loop = g_main_loop_new (NULL, FALSE); app.loop = g_main_loop_new (NULL, FALSE);
app.monitor = gst_device_monitor_new (); app.monitor = gst_device_monitor_new ();
gst_device_monitor_set_show_all_devices (app.monitor, include_hidden);
bus = gst_device_monitor_get_bus (app.monitor); bus = gst_device_monitor_get_bus (app.monitor);
app.bus_watch_id = gst_bus_add_watch (bus, bus_msg_handler, &app); app.bus_watch_id = gst_bus_add_watch (bus, bus_msg_handler, &app);