static void
asset_loaded_cb (GObject * source_object, GAsyncResult * res,
    GMainLoop * mainloop)
{
  GError *error = NULL;

  GESUriClipAsset *mfs =
      GES_URI_CLIP_ASSET (ges_asset_request_finish (res, &error));

  if (error) {
    GST_WARNING ("error creating asseti %s", error->message);

    return;
  }

  assetsLoaded++;
  /*
   * Check if we have loaded last asset and trigger concatenating
   */
  if (assetsLoaded == assetsCount) {
    GstDiscovererInfo *info = ges_uri_clip_asset_get_info (mfs);
    GstEncodingProfile *profile = make_profile_from_info (info);
    ges_pipeline_set_render_settings (pipeline, output_uri, profile);
    /* We want the pipeline to render (without any preview) */
    if (!ges_pipeline_set_mode (pipeline, TIMELINE_MODE_SMART_RENDER)) {
      g_main_loop_quit (mainloop);
      return;
    }
    gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
  }

  gst_object_unref (mfs);
}
Exemplo n.º 2
0
int
main (int argc, char **argv)
{
  GESTimeline *timeline;
  GESLayer *layer;
  GError **error = NULL;
  GESAsset *asset;
  const gchar *url =
      "file:///home/bmonkey/workspace/ges/ges-renderer/data/sd/sintel_trailer-480p.mp4";
  const gchar *exportURL =
      "file:///home/bmonkey/workspace/ges/ges-renderer/transition.mp4";

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

  timeline = ges_timeline_new_audio_video ();

  layer = ges_layer_new ();

  g_object_set (layer, "auto-transition", TRUE, NULL);

  ges_timeline_add_layer (timeline, layer);

  asset = GES_ASSET (ges_uri_clip_asset_request_sync (url, error));

  ges_layer_add_asset (layer, asset,
      0 * GST_SECOND, 0 * GST_SECOND, 10 * GST_SECOND, GES_TRACK_TYPE_VIDEO);

  ges_layer_add_asset (layer, asset,
      5 * GST_SECOND, 20 * GST_SECOND, 10 * GST_SECOND, GES_TRACK_TYPE_VIDEO);

  ges_timeline_commit (timeline);

  duration = ges_timeline_get_duration (timeline);

  pipeline = ges_pipeline_new ();
  ges_pipeline_set_timeline (pipeline, timeline);

  GESRendererProfile pal = { 720, 576, 25, PROFILE_AAC_H264_QUICKTIME };
  GstCaps *settings = gst_caps_from_renderer_profile (&pal);
  GstEncodingProfile *profile = profile_get_encoding_profile (settings);
  ges_pipeline_set_render_settings (pipeline, exportURL, profile);
  ges_pipeline_set_mode (pipeline, GES_PIPELINE_MODE_RENDER);

  GMainLoop *mainloop;
  mainloop = g_main_loop_new (NULL, FALSE);

  GstBus *bus;
  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
  g_signal_connect (bus, "message", (GCallback) bus_message_cb, mainloop);
  g_timeout_add (100, (GSourceFunc) ges_renderer_print_progress, NULL);
  gst_bus_add_signal_watch (bus);

  gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);

  g_main_loop_run (mainloop);
  g_main_loop_unref (mainloop);

  return 0;
}