Add a default URI

This commit is contained in:
Xavi Artigas 2012-05-15 17:25:03 +02:00 committed by unknown
parent 6575e17365
commit 3bd4854409

View file

@ -164,10 +164,11 @@ static void on_finished_cb (GstDiscoverer *discoverer, CustomData *data) {
int main (int argc, char **argv) { int main (int argc, char **argv) {
CustomData data; CustomData data;
GError *err = NULL; GError *err = NULL;
gchar *uri = "http://docs.gstreamer.com/media/sintel_trailer-480p.webm";
if (argc != 2) { /* if a URI was provided, use it instead of the default one */
g_print ("No URI to discover given\n"); if (argc > 1) {
return -1; uri = argv[1];
} }
/* Initialize cumstom data structure */ /* Initialize cumstom data structure */
@ -176,7 +177,7 @@ int main (int argc, char **argv) {
/* Initialize GStreamer */ /* Initialize GStreamer */
gst_init (&argc, &argv); gst_init (&argc, &argv);
g_print ("Discovering '%s'\n", argv[1]); g_print ("Discovering '%s'\n", uri);
/* Instantiate the Discoverer */ /* Instantiate the Discoverer */
data.discoverer = gst_discoverer_new (5 * GST_SECOND, &err); data.discoverer = gst_discoverer_new (5 * GST_SECOND, &err);
@ -194,8 +195,8 @@ int main (int argc, char **argv) {
gst_discoverer_start (data.discoverer); gst_discoverer_start (data.discoverer);
/* Add a request to process asynchronously the URI passed through the command line */ /* Add a request to process asynchronously the URI passed through the command line */
if (!gst_discoverer_discover_uri_async (data.discoverer, argv[1])) { if (!gst_discoverer_discover_uri_async (data.discoverer, uri)) {
g_print ("Failed to start discovering URI '%s'\n", argv[1]); g_print ("Failed to start discovering URI '%s'\n", uri);
g_object_unref (data.discoverer); g_object_unref (data.discoverer);
g_main_loop_unref (data.loop); g_main_loop_unref (data.loop);
return -1; return -1;