2009-08-07 18:29:35 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
* Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:25:20 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-08-07 18:29:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ges/ges.h>
|
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* A simple timeline with 3 audio/video sources */
|
2009-08-07 18:29:35 +00:00
|
|
|
int
|
|
|
|
main (int argc, gchar ** argv)
|
|
|
|
{
|
2012-09-20 10:16:38 +00:00
|
|
|
GESAsset *src_asset;
|
2009-08-07 18:29:35 +00:00
|
|
|
GESTimelinePipeline *pipeline;
|
|
|
|
GESTimeline *timeline;
|
2013-01-20 15:42:29 +00:00
|
|
|
GESClip *source;
|
2009-08-07 18:29:35 +00:00
|
|
|
GESTimelineLayer *layer;
|
2009-09-09 11:55:30 +00:00
|
|
|
GMainLoop *mainloop;
|
2009-08-07 18:29:35 +00:00
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* Initialize GStreamer (this will parse environment variables and commandline
|
|
|
|
* arguments. */
|
2009-08-07 18:29:35 +00:00
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* Initialize the GStreamer Editing Services */
|
2009-08-07 18:29:35 +00:00
|
|
|
ges_init ();
|
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* Setup of a A/V timeline */
|
|
|
|
|
|
|
|
/* This is our main GESTimeline */
|
2012-09-20 10:16:38 +00:00
|
|
|
timeline = ges_timeline_new_audio_video ();
|
2009-09-10 16:53:31 +00:00
|
|
|
|
2013-02-08 20:11:22 +00:00
|
|
|
/* We are only going to be doing one layer of clips */
|
2009-08-07 18:29:35 +00:00
|
|
|
layer = ges_timeline_layer_new ();
|
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* Add the tracks and the layer to the timeline */
|
2009-08-07 18:29:35 +00:00
|
|
|
if (!ges_timeline_add_layer (timeline, layer))
|
|
|
|
return -1;
|
2009-09-10 16:53:31 +00:00
|
|
|
|
2013-01-17 03:58:28 +00:00
|
|
|
/* We create a simple asset able to extract GESTestClip */
|
|
|
|
src_asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
|
2012-09-20 10:16:38 +00:00
|
|
|
|
|
|
|
/* Add sources to our layer */
|
layer: Remove the "rate" property of ges_timeline_layer_add_asset
API:
- ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, rate, track_types);
+ ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, track_types);
2013-04-23 22:57:44 +00:00
|
|
|
ges_timeline_layer_add_asset (layer, src_asset, 0, 0, GST_SECOND,
|
2012-09-20 10:16:38 +00:00
|
|
|
GES_TRACK_TYPE_UNKNOWN);
|
|
|
|
source = ges_timeline_layer_add_asset (layer, src_asset, GST_SECOND, 0,
|
layer: Remove the "rate" property of ges_timeline_layer_add_asset
API:
- ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, rate, track_types);
+ ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, track_types);
2013-04-23 22:57:44 +00:00
|
|
|
GST_SECOND, GES_TRACK_TYPE_UNKNOWN);
|
2012-09-20 10:16:38 +00:00
|
|
|
g_object_set (source, "freq", 480.0, "vpattern", 2, NULL);
|
|
|
|
ges_timeline_layer_add_asset (layer, src_asset, 2 * GST_SECOND, 0,
|
layer: Remove the "rate" property of ges_timeline_layer_add_asset
API:
- ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, rate, track_types);
+ ges_timeline_layer_add_asset (layer, asset, start, inpoint, duration, track_types);
2013-04-23 22:57:44 +00:00
|
|
|
GST_SECOND, GES_TRACK_TYPE_UNKNOWN);
|
2009-08-07 18:29:35 +00:00
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
|
|
|
|
/* In order to view our timeline, let's grab a convenience pipeline to put
|
|
|
|
* our timeline in. */
|
|
|
|
pipeline = ges_timeline_pipeline_new ();
|
|
|
|
|
|
|
|
/* Add the timeline to that pipeline */
|
2009-09-08 17:46:54 +00:00
|
|
|
if (!ges_timeline_pipeline_add_timeline (pipeline, timeline))
|
|
|
|
return -1;
|
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* The following is standard usage of a GStreamer pipeline (note how you haven't
|
|
|
|
* had to care about GStreamer so far ?).
|
|
|
|
*
|
|
|
|
* We set the pipeline to playing ... */
|
2009-09-08 17:46:54 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
|
|
|
|
2009-09-10 16:53:31 +00:00
|
|
|
/* .. and we start a GMainLoop. GES **REQUIRES** a GMainLoop to be running in
|
|
|
|
* order to function properly ! */
|
2009-09-09 11:55:30 +00:00
|
|
|
mainloop = g_main_loop_new (NULL, FALSE);
|
2009-09-10 16:53:31 +00:00
|
|
|
|
|
|
|
/* Simple code to have the mainloop shutdown after 4s */
|
2009-09-09 11:57:37 +00:00
|
|
|
g_timeout_add_seconds (4, (GSourceFunc) g_main_loop_quit, mainloop);
|
2009-09-09 11:55:30 +00:00
|
|
|
g_main_loop_run (mainloop);
|
2009-09-08 17:46:54 +00:00
|
|
|
|
2009-08-07 18:29:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|