Commit e354ef4f authored by Luis de Bethencourt's avatar Luis de Bethencourt

snappy: load with no input file

parent fce08aa8
......@@ -728,10 +728,12 @@ engine_load_uri (GstEngine * engine, gchar * uri)
engine->has_started = FALSE;
engine->queries_blocked = TRUE;
discover (engine, uri);
if (uri) {
discover (engine, uri);
g_print ("Loading: %s\n", uri);
g_object_set (G_OBJECT (engine->player), "uri", uri, NULL);
g_print ("Loading: %s\n", uri);
g_object_set (G_OBJECT (engine->player), "uri", uri, NULL);
}
return;
}
......
......@@ -144,6 +144,7 @@ process_args (int argc, char *argv[],
}
} else {
/* If no files passed by user display help */
g_print ("Opening snappy without content.\n\n");
g_print ("%s", g_option_context_get_help (context, TRUE, NULL));
}
......@@ -164,7 +165,7 @@ main (int argc, char *argv[])
gboolean secret = FALSE, tags = FALSE;
gint ret = 0;
guint c, index, pos = 0;
gchar *uri;
gchar *uri = NULL;
gchar *suburi = NULL;
gchar *version_str;
GList *uri_list;
......@@ -207,8 +208,6 @@ main (int argc, char *argv[])
/* Process command arguments */
uri_list = process_args (argc, argv, &blind, &fullscreen, &hide,
&loop, &secret, &suburi, &tags, context);
if (uri_list == NULL)
goto quit;
/* User Interface */
ui = g_new (UserInterface, 1);
......@@ -250,7 +249,8 @@ main (int argc, char *argv[])
gst_object_unref (engine->bus);
/* Get uri to load */
uri = g_list_first (uri_list)->data;
if (uri_list)
uri = g_list_first (uri_list)->data;
/* Load engine and start interface */
engine_load_uri (engine, uri);
......
......@@ -1193,14 +1193,25 @@ interface_start (UserInterface * ui, gchar * uri)
g_print ("Loading ui!\n");
// Init UserInterface structure variables
ui->fileuri = uri;
ui->filename = g_path_get_basename (ui->fileuri);
if (uri) {
ui->fileuri = uri;
ui->media_width = ui->engine->media_width;
ui->media_height = ui->engine->media_height;
ui->filename = g_path_get_basename (ui->fileuri);
ui->media_width = ui->engine->media_width;
ui->media_height = ui->engine->media_height;
ui->stage_width = ui->media_width;
ui->stage_height = ui->media_height;
ui->stage_width = ui->media_width;
ui->stage_height = ui->media_height;
} else {
ui->filename = "";
ui->media_width = DEFAULT_WIDTH;
ui->media_height = DEFAULT_HEIGHT;
ui->stage_width = DEFAULT_WIDTH;
ui->stage_height = DEFAULT_HEIGHT;
}
/* Create the window and some child widgets: */
ui->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
......
......@@ -64,6 +64,9 @@
#define PENALTY_TIME G_TIME_SPAN_MILLISECOND / 2
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480
G_BEGIN_DECLS
enum
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment