tools:discoverer: Add an option to print the cache directory
This commit is contained in:
parent
747f5a75c3
commit
0149f87626
@ -582,12 +582,14 @@ main (int argc, char **argv)
|
|||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
GstDiscoverer *dc;
|
GstDiscoverer *dc;
|
||||||
gint timeout = 10;
|
gint timeout = 10;
|
||||||
gboolean use_cache = FALSE;
|
gboolean use_cache = FALSE, print_cache_dir = FALSE;
|
||||||
GOptionEntry options[] = {
|
GOptionEntry options[] = {
|
||||||
{"async", 'a', 0, G_OPTION_ARG_NONE, &async,
|
{"async", 'a', 0, G_OPTION_ARG_NONE, &async,
|
||||||
"Run asynchronously", NULL},
|
"Run asynchronously", NULL},
|
||||||
{"use-cache", 'a', 0, G_OPTION_ARG_NONE, &use_cache,
|
{"use-cache", 'a', 0, G_OPTION_ARG_NONE, &use_cache,
|
||||||
"Use GstDiscovererInfo from our cache.", NULL},
|
"Use GstDiscovererInfo from our cache.", NULL},
|
||||||
|
{"print-cache-dir", 0, 0, G_OPTION_ARG_NONE, &print_cache_dir,
|
||||||
|
"Print the directory of the discoverer cache.", NULL},
|
||||||
{"timeout", 't', 0, G_OPTION_ARG_INT, &timeout,
|
{"timeout", 't', 0, G_OPTION_ARG_INT, &timeout,
|
||||||
"Specify timeout (in seconds, default 10)", "T"},
|
"Specify timeout (in seconds, default 10)", "T"},
|
||||||
/* {"elem", 'e', 0, G_OPTION_ARG_NONE, &elem_seek, */
|
/* {"elem", 'e', 0, G_OPTION_ARG_NONE, &elem_seek, */
|
||||||
@ -622,6 +624,15 @@ main (int argc, char **argv)
|
|||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (print_cache_dir) {
|
||||||
|
gchar *cache_dir =
|
||||||
|
g_build_filename (g_get_user_cache_dir (), "gstreamer-" GST_API_VERSION,
|
||||||
|
"discoverer", NULL);
|
||||||
|
g_print ("\nGstDiscoverer cache directory:\n\n %s\n\n", cache_dir);
|
||||||
|
g_free (cache_dir);
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
dc = gst_discoverer_new (timeout * GST_SECOND, &err);
|
dc = gst_discoverer_new (timeout * GST_SECOND, &err);
|
||||||
if (G_UNLIKELY (dc == NULL)) {
|
if (G_UNLIKELY (dc == NULL)) {
|
||||||
g_print ("Error initializing: %s\n", err->message);
|
g_print ("Error initializing: %s\n", err->message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user