Skip to content

Commit

Permalink
tools:discoverer: Add an option to print the cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thiblahute authored and tsaunier committed Mar 7, 2019
1 parent 747f5a7 commit 0149f87
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/gst-discoverer.c
Expand Up @@ -582,12 +582,14 @@ main (int argc, char **argv)
GError *err = NULL;
GstDiscoverer *dc;
gint timeout = 10;
gboolean use_cache = FALSE;
gboolean use_cache = FALSE, print_cache_dir = FALSE;
GOptionEntry options[] = {
{"async", 'a', 0, G_OPTION_ARG_NONE, &async,
"Run asynchronously", NULL},
{"use-cache", 'a', 0, G_OPTION_ARG_NONE, &use_cache,
"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,
"Specify timeout (in seconds, default 10)", "T"},
/* {"elem", 'e', 0, G_OPTION_ARG_NONE, &elem_seek, */
Expand Down Expand Up @@ -622,6 +624,15 @@ main (int argc, char **argv)
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);
if (G_UNLIKELY (dc == NULL)) {
g_print ("Error initializing: %s\n", err->message);
Expand Down

0 comments on commit 0149f87

Please sign in to comment.