#include <gio/gio.h>
#include <gst/pbutils/pbutils.h>

int main (int argc, char *argv[]) {
    GstDiscoverer *disco;
    GFile *file;
    int i = 0;
    char *uri;
    GTimer *timer;

    g_type_init ();
    gst_init (&argc, &argv);

    file = g_file_new_for_commandline_arg (argv[1]);
    uri = g_file_get_uri (file);
    timer = g_timer_new ();
    disco = gst_discoverer_new ((GstClockTime) 10 * GST_SECOND, NULL);
    for (i = 0; i < 4500; i++) {
        g_timer_reset (timer);
        gst_discoverer_discover_uri (disco, uri, NULL);
        g_print ("%d %f\n", i, g_timer_elapsed (timer, NULL));
    }

    g_timer_destroy (timer);
    g_free (uri);
    g_object_unref (file);
    g_object_unref (disco);

    return 0;
}
