examples: Make project loading more generic

Pitivi formatter is deprecated, do not use it by default
This commit is contained in:
Thibault Saunier 2013-09-16 11:19:13 -03:00
parent c0eae0c790
commit 7b96c50b4e
2 changed files with 11 additions and 6 deletions

View file

@ -20,6 +20,11 @@
/** /**
* SECTION: ges-pitivi-formatter * SECTION: ges-pitivi-formatter
* @short_description: A formatter for the PiTiVi project file format * @short_description: A formatter for the PiTiVi project file format
*
* This is a legacy format and you should avoid to use it. The formatter
* is really not in good shape and is deprecated.
*
* Deprecated: 1.0
*/ */
#include <libxml/xmlreader.h> #include <libxml/xmlreader.h>

View file

@ -111,7 +111,7 @@ gboolean window_delete_event_cb (GtkObject * window, GdkEvent * event,
void new_activate_cb (GtkMenuItem * item, App * app); void new_activate_cb (GtkMenuItem * item, App * app);
void open_activate_cb (GtkMenuItem * item, App * app); void open_activate_cb (GtkMenuItem * item, App * app);
void save_as_activate_cb (GtkMenuItem * item, App * app); void save_as_activate_cb (GtkMenuItem * item, App * app);
void launch_pitivi_project_activate_cb (GtkMenuItem * item, App * app); void launch_project_activate_cb (GtkMenuItem * item, App * app);
void quit_item_activate_cb (GtkMenuItem * item, App * app); void quit_item_activate_cb (GtkMenuItem * item, App * app);
void delete_activate_cb (GtkAction * item, App * app); void delete_activate_cb (GtkAction * item, App * app);
void play_activate_cb (GtkAction * item, App * app); void play_activate_cb (GtkAction * item, App * app);
@ -1156,24 +1156,24 @@ app_launch_project (App * app, gchar * uri)
GMainLoop *mainloop; GMainLoop *mainloop;
GESPipeline *pipeline; GESPipeline *pipeline;
GstBus *bus; GstBus *bus;
GESFormatter *formatter; GESProject *project;
uri = g_strsplit (uri, "//", 2)[1]; uri = g_strsplit (uri, "//", 2)[1];
printf ("we will launch this uri : %s\n", uri); printf ("we will launch this uri : %s\n", uri);
formatter = GES_FORMATTER (ges_pitivi_formatter_new ()); project = ges_project_new (uri);
timeline = ges_timeline_new (); timeline = GES_TIMELINE (ges_asset_extract (GES_ASSET (project), NULL));
pipeline = ges_pipeline_new (); pipeline = ges_pipeline_new ();
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
mainloop = g_main_loop_new (NULL, FALSE); mainloop = g_main_loop_new (NULL, FALSE);
ges_pipeline_add_timeline (pipeline, timeline); ges_pipeline_add_timeline (pipeline, timeline);
ges_formatter_load_from_uri (formatter, timeline, uri, NULL);
ges_pipeline_set_mode (pipeline, TIMELINE_MODE_PREVIEW_VIDEO); ges_pipeline_set_mode (pipeline, TIMELINE_MODE_PREVIEW_VIDEO);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
gst_bus_add_signal_watch (bus); gst_bus_add_signal_watch (bus);
g_signal_connect (bus, "message", G_CALLBACK (project_bus_message_cb), g_signal_connect (bus, "message", G_CALLBACK (project_bus_message_cb),
mainloop); mainloop);
g_main_loop_run (mainloop); g_main_loop_run (mainloop);
g_object_unref (project);
} }
static void static void
@ -1393,7 +1393,7 @@ new_activate_cb (GtkMenuItem * item, App * app)
} }
void void
launch_pitivi_project_activate_cb (GtkMenuItem * item, App * app) launch_project_activate_cb (GtkMenuItem * item, App * app)
{ {
GtkFileChooserDialog *dlg; GtkFileChooserDialog *dlg;
GtkFileFilter *filter; GtkFileFilter *filter;