int main( int argc, char **argv ) { // Initialise the factory if ( mlt_factory_init( NULL ) == 0 ) { // Create the default consumer mlt_consumer hello = mlt_factory_consumer( NULL, NULL ); // Create a producer using the default normalising selecter mlt_producer world = create_tracks( argc, argv ); // Connect the producer to the consumer mlt_consumer_connect( hello, mlt_producer_service( world ) ); // Start the consumer mlt_consumer_start( hello ); // Wait for the consumer to terminate while( !mlt_consumer_is_stopped( hello ) ) sleep( 1 ); // Close the consumer mlt_consumer_close( hello ); // Close the producer mlt_producer_close( world ); // Close the factory mlt_factory_close( ); } else { // Report an error during initialisation fprintf( stderr, "Unable to locate factory modules\n" ); } // End of program return 0; }
static gboolean load_pitivi_file_from_uri (GESFormatter * self, GESTimeline * timeline, const gchar * uri, GError ** error) { xmlDocPtr doc; GESLayer *layer; GESPitiviFormatterPrivate *priv = GES_PITIVI_FORMATTER (self)->priv; gboolean ret = TRUE; gint *prio = malloc (sizeof (gint)); *prio = 0; layer = ges_layer_new (); g_object_set (layer, "auto-transition", TRUE, NULL); g_hash_table_insert (priv->layers_table, prio, layer); g_object_set (layer, "priority", (gint32) 0, NULL); if (!ges_timeline_add_layer (timeline, layer)) { GST_ERROR ("Couldn't add layer"); return FALSE; } if (!(doc = xmlParseFile (uri))) { GST_ERROR ("The xptv file for uri %s was badly formed or did not exist", uri); return FALSE; } priv->xpathCtx = xmlXPathNewContext (doc); if (self->project) parse_metadatas (self); if (!create_tracks (self)) { GST_ERROR ("Couldn't create tracks"); return FALSE; } list_sources (self); if (!parse_clips (self)) { GST_ERROR ("Couldn't find clips markup in the xptv file"); return FALSE; } if (!parse_track_elements (self)) { GST_ERROR ("Couldn't find track objects markup in the xptv file"); return FALSE; } /* If there are no clips to load we should emit * 'project-loaded' signal. */ if (!g_hash_table_size (priv->clips_table) && GES_FORMATTER (self)->project) { ges_project_set_loaded (GES_FORMATTER (self)->project, GES_FORMATTER (self)); } else { if (!make_clips (self)) { GST_ERROR ("Couldn't deserialise the project properly"); return FALSE; } } xmlXPathFreeContext (priv->xpathCtx); xmlFreeDoc (doc); return ret; }