mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 05:26:23 +00:00
Add directory for examples along with a minimalistic first example.
This commit is contained in:
parent
d8444f3844
commit
a25c707999
4 changed files with 86 additions and 2 deletions
|
@ -242,5 +242,6 @@ m4/Makefile
|
||||||
ges/Makefile
|
ges/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
tests/check/Makefile
|
tests/check/Makefile
|
||||||
|
tests/examples/Makefile
|
||||||
)
|
)
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
if HAVE_GST_CHECK
|
if HAVE_GST_CHECK
|
||||||
SUBDIRS = check
|
CHECK_SUBDIRS= check
|
||||||
else
|
else
|
||||||
SUBDIRS =
|
CHECK_SUBDIRS=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
SUBDIRS= $(CHECK_SUBDIRS) examples
|
4
tests/examples/Makefile.am
Normal file
4
tests/examples/Makefile.am
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
noinst_PROGRAMS = test1
|
||||||
|
|
||||||
|
AM_CFLAGS = $(GST_CFLAGS) -I$(top_srcdir)
|
||||||
|
LDADD = $(GST_LBS) $(top_builddir)/ges/libges-@GST_MAJORMINOR@.la -lges-@GST_MAJORMINOR@
|
77
tests/examples/test1.c
Normal file
77
tests/examples/test1.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/* 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
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ges/ges.h>
|
||||||
|
|
||||||
|
/* A simple timeline with 3 video-only sources */
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
fill_videotestsrc (GESTimelineObject * object, GESTrackObject * trobject,
|
||||||
|
GstElement * gnlobj, gpointer user_data)
|
||||||
|
{
|
||||||
|
GstElement *vsrc;
|
||||||
|
guint var = GPOINTER_TO_UINT (user_data);
|
||||||
|
|
||||||
|
vsrc = gst_element_factory_make ("videotestsrc", NULL);
|
||||||
|
g_object_set (vsrc, "pattern", var, NULL);
|
||||||
|
|
||||||
|
return gst_bin_add (GST_BIN (gnlobj), vsrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, gchar ** argv)
|
||||||
|
{
|
||||||
|
GESTimelinePipeline *pipeline;
|
||||||
|
GESTimeline *timeline;
|
||||||
|
GESTrack *track;
|
||||||
|
GESTimelineLayer *layer;
|
||||||
|
GESCustomTimelineSource *src1, *src2, *src3;
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
ges_init ();
|
||||||
|
|
||||||
|
pipeline = ges_timeline_pipeline_new ();
|
||||||
|
timeline = ges_timeline_new ();
|
||||||
|
track = ges_track_video_raw_new ();
|
||||||
|
layer = ges_timeline_layer_new ();
|
||||||
|
|
||||||
|
if (!ges_timeline_add_layer (timeline, layer))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!ges_timeline_add_track (timeline, track))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
src1 =
|
||||||
|
ges_custom_timeline_source_new (fill_videotestsrc, GUINT_TO_POINTER (1));
|
||||||
|
g_object_set (src1, "start", 0, "duration", GST_SECOND, NULL);
|
||||||
|
src2 =
|
||||||
|
ges_custom_timeline_source_new (fill_videotestsrc, GUINT_TO_POINTER (1));
|
||||||
|
g_object_set (src2, "start", GST_SECOND, "duration", GST_SECOND, NULL);
|
||||||
|
src3 =
|
||||||
|
ges_custom_timeline_source_new (fill_videotestsrc, GUINT_TO_POINTER (1));
|
||||||
|
g_object_set (src3, "start", 2 * GST_SECOND, "duration", GST_SECOND, NULL);
|
||||||
|
|
||||||
|
ges_timeline_layer_add_object (layer, (GESTimelineObject *) src1);
|
||||||
|
ges_timeline_layer_add_object (layer, (GESTimelineObject *) src2);
|
||||||
|
ges_timeline_layer_add_object (layer, (GESTimelineObject *) src3);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue