diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2001-07-29 11:40:55 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2001-07-29 11:40:55 +0000 |
commit | e08ae456d3a83ce8dfef751e4b5206d0e0fd0a23 (patch) | |
tree | e483e9a8086d477ef24762013bab89588938524a |
Initial revision
Original commit message from CVS:
Initial revision
-rw-r--r-- | docs/random/design | 56 | ||||
-rw-r--r-- | docs/random/srctree | 7 | ||||
-rw-r--r-- | gnl/gnlcomposition.h | 71 | ||||
-rw-r--r-- | gnl/gnllayer.c | 84 | ||||
-rw-r--r-- | gnl/gnllayer.h | 70 | ||||
-rw-r--r-- | gnl/gnlobject.h | 94 | ||||
-rw-r--r-- | gnl/gnlsource.c | 98 | ||||
-rw-r--r-- | gnl/gnlsource.h | 76 | ||||
-rw-r--r-- | gnl/gnltimeline.c | 74 | ||||
-rw-r--r-- | gnl/gnltimeline.h | 67 | ||||
-rw-r--r-- | test/composition.c | 81 | ||||
-rw-r--r-- | test/simple.c | 52 |
12 files changed, 830 insertions, 0 deletions
diff --git a/docs/random/design b/docs/random/design new file mode 100644 index 0000000..8ae512e --- /dev/null +++ b/docs/random/design @@ -0,0 +1,56 @@ +GnlSource: + - extends from a GstBin + - consist of a single GStreamer pipeline with M output pads + - have a start and stop time + - have one or more output pads, ghosted from the Gst pipeline + +GnlLayer: + - extends GnlSource + - contains sources + - sources cannot overlap + - sources have start/length properties inside the layer + +GnlComposition: + - extends GnlLayer + - can contain GnlLayers, possibly overlapping + +GnlOperation: + - extends GnlSource + - also ghosts N input pads in addition to the GnlSources output pads + + + .-0----->-----------5000----->------10000----->-----15000---. + ! main_timeline ! + ! ! + ! .- composition -----------------------------------------. ! + ! ! ! ! + ! ! .- layer1 ------------------------------------------. ! ! + ! ! ! ! ! ! + ! ! ! .- operation ---. ! ! ! + ! ! ! ! ! ! ! ! + ! ! ! ! blend ! ! ! ! + ! ! ! '---------------' ! ! ! + ! ! '---------------------------------------------------' ! ! + ! ! .- layer2 ------------------------------------------. ! ! + ! ! ! ! ! ! + ! ! ! .-- source1 -------------------. ! ! ! + ! ! ! ! ! ! ! ! + ! ! ! ! /myfile.avi ! ! ! ! + ! ! ! '------------------------------' ! ! ! + ! ! '---------------------------------------------------' ! ! + ! ! .- layer3 ------------------------------------------. ! ! + ! ! ! .- source2 ---------------------. ! ! ! + ! ! ! ! ! ! ! ! + ! ! ! ! /myfile2.avi ! ! ! ! + ! ! ! '-------------------------------' ! ! ! + ! ! '---------------------------------------------------' ! ! + ! '-------------------------------------------------------' ! + '-----------------------------------------------------------' + + + + ***** (alpha blend 2 layers) +=========== + ********* (monochrome 1 layer) + ========= + diff --git a/docs/random/srctree b/docs/random/srctree new file mode 100644 index 0000000..5655322 --- /dev/null +++ b/docs/random/srctree @@ -0,0 +1,7 @@ + +src/ - core source files + +test/ - test apps + +gui/ - gui stuff + widgets/ - usefull widgets. diff --git a/gnl/gnlcomposition.h b/gnl/gnlcomposition.h new file mode 100644 index 0000000..fd570b2 --- /dev/null +++ b/gnl/gnlcomposition.h @@ -0,0 +1,71 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * gnlcomposition.h: Header for base GnlComposition + * + * 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. + */ + + +#ifndef __GNL_COMPOSITION_H__ +#define __GNL_COMPOSITION_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GNL_TYPE_COMPOSITION \ + (gnl_composition_get_type()) +#define GNL_COMPOSITION(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GNL_TYPE_COMPOSITION,GnlComposition)) +#define GNL_COMPOSITION_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GNL_TYPE_COMPOSITION,GnlCompositionClass)) +#define GNL_IS_COMPOSITION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GNL_TYPE_COMPOSITION)) +#define GNL_IS_COMPOSITION_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GNL_TYPE_COMPOSITION)) + +typedef struct _GnlComposition GnlComposition; +typedef struct _GnlCompositionClass GnlCompositionClass; + +struct _GnlComposition { + GnlLayer layer; + +}; + +struct _GnlCompositionClass { + GnlLayerClass parent_class; +}; + +/* normal GComposition stuff */ +GType gnl_composition_get_type (void); +GnlComposition* gnl_composition_new (const gchar *name); + +void gnl_composition_add_layer (GnlComposition *composition, + GnlLayer *layer, guin64 start); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNL_COMPOSITION_H__ */ + diff --git a/gnl/gnllayer.c b/gnl/gnllayer.c new file mode 100644 index 0000000..6de83cb --- /dev/null +++ b/gnl/gnllayer.c @@ -0,0 +1,84 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * 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 <gnl/gnllayer.h> + +static void gnl_layer_class_init (GnlLayerClass *klass); +static void gnl_layer_init (GnlLayer *layer); + +static GnlLayerClass *parent_class = NULL; + +GType +gnl_layer_get_type (void) +{ + static GType layer_type = 0; + + if (!layer_type) { + static const GTypeInfo layer_info = { + sizeof (GnlLayerClass), + NULL, + NULL, + (GClassInitFunc) gnl_layer_class_init, + NULL, + NULL, + sizeof (GnlLayer), + 32, + (GInstanceInitFunc) gnl_layer_init, + }; + layer_type = g_type_register_static (G_TYPE_OBJECT, "GnlLayer", &layer_info, 0); + } + return object_type; +} + +static void +gnl_layer_class_init (GnlLayerClass *klass) +{ + GObjectClass *gobject_class; + + gobject_class = (GObjectClass*)klass; + + parent_class = g_type_class_ref (GST_TYPE_BIN); +} + + +static void +gnl_layer_init (GnlLayer *layer) +{ +} + + +GnlLayer* +gnl_layer_new (const gchar *name) +{ + return NULL; +} + +void +gnl_layer_add_source (GnlLayer *layer, GnlSource *source, guint64 start) +{ + g_return_if_fail (layer != NULL); + g_return_if_fail (GNL_IS_LAYER (layer)); + g_return_if_fail (source != NULL); + g_return_if_fail (GNL_IS_SOURCE (source)); + +} + + diff --git a/gnl/gnllayer.h b/gnl/gnllayer.h new file mode 100644 index 0000000..31b6b78 --- /dev/null +++ b/gnl/gnllayer.h @@ -0,0 +1,70 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * gnllayer.h: Header for base GnlLayer + * + * 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. + */ + + +#ifndef __GNL_LAYER_H__ +#define __GNL_LAYER_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GNL_TYPE_LAYER \ + (gnl_layer_get_type()) +#define GNL_LAYER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GNL_TYPE_LAYER,GnlLayer)) +#define GNL_LAYER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GNL_TYPE_LAYER,GnlLayerClass)) +#define GNL_IS_LAYER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GNL_TYPE_LAYER)) +#define GNL_IS_LAYER_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GNL_TYPE_LAYER)) + +typedef struct _GnlLayer GnlLayer; +typedef struct _GnlLayerClass GnlLayerClass; + +struct _GnlLayer { + GnlSource source; + + GList *sources; +}; + +struct _GnlLayerClass { + GnlSourceClass parent_class; +}; + +GType gnl_layer_get_type (void); +GnlLayer* gnl_layer_new (void); + +void gnl_layer_add_source (GnlLayer *layer, GnlSource *source, guint64 start); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNL_LAYER_H__ */ + diff --git a/gnl/gnlobject.h b/gnl/gnlobject.h new file mode 100644 index 0000000..f32ce92 --- /dev/null +++ b/gnl/gnlobject.h @@ -0,0 +1,94 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * gnlobject.h: Header for base GnlObject + * + * 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. + */ + + +#ifndef __GNL_OBJECT_H__ +#define __GNL_OBJECT_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef USE_GLIB2 +#include <glib-object.h> // note that this gets wrapped in __GNL_OBJECT_H__ +#include <gnl/gnlmarshal.h> +#else +#include <gnl/gobject2gtk.h> +#endif + +#include <gnl/gnltrace.h> +#include <parser.h> + +#include <gnl/gnltypes.h> + +#ifdef HAVE_ATOMIC_H +#include <asm/atomic.h> +#endif + +// FIXME +#include "gnllog.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GNL_TYPE_OBJECT \ + (gnl_object_get_type()) +#define GNL_OBJECT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GNL_TYPE_OBJECT,GnlObject)) +#define GNL_OBJECT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GNL_TYPE_OBJECT,GnlObjectClass)) +#define GNL_IS_OBJECT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GNL_TYPE_OBJECT)) +#define GNL_IS_OBJECT_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GNL_TYPE_OBJECT)) + +//typedef struct _GnlObject GnlObject; +//typedef struct _GnlObjectClass GnlObjectClass; +// +typedef enum +{ + GNL_DESTROYED = 0, + GNL_FLOATING, + + GNL_OBJECT_FLAG_LAST = 4, +} GnlObjectFlags; + +struct _GnlObject { + GstObject object; +}; + +struct _GnlObjectClass { + GstObjectClass parent_class; +}; + +/* normal GObject stuff */ +GType gnl_object_get_type (void); +GnlObject* gnl_object_new (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNL_OBJECT_H__ */ + diff --git a/gnl/gnlsource.c b/gnl/gnlsource.c new file mode 100644 index 0000000..bfa2c08 --- /dev/null +++ b/gnl/gnlsource.c @@ -0,0 +1,98 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * 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 <gnl/gnlsource.h> + +static void gnl_source_class_init (GnlSourceClass *klass); +static void gnl_source_init (GnlSource *source); + +static GnlTrackClass *parent_class = NULL; + +GType +gnl_source_get_type (void) +{ + static GType source_type = 0; + + if (!source_type) { + static const GTypeInfo source_info = { + sizeof (GnlSourceClass), + NULL, + NULL, + (GClassInitFunc) gnl_source_class_init, + NULL, + NULL, + sizeof (GnlSource), + 32, + (GInstanceInitFunc) gnl_source_init, + }; + source_type = g_type_register_static (G_TYPE_OBJECT, "GnlSource", &source_info, 0); + } + return object_type; +} + +static void +gnl_source_class_init (GnlSourceClass *klass) +{ + GObjectClass *gobject_class; + + gobject_class = (GObjectClass*)klass; + + parent_class = g_type_class_ref (GST_TYPE_BIN); +} + + +static void +gnl_source_init (GnlSource *source) +{ +} + + +GnlSource* +gnl_source_new (const gchar *name) +{ + return NULL; +} + +void +gnl_source_set_element (GnlSource *source, GstElement *element) +{ + g_return_if_fail (element != NULL); + g_return_if_fail (GST_IS_ELEMENT (element)); + g_return_if_fail (source != NULL); + g_return_if_fail (GNL_IS_SOURCE (source)); + g_return_if_fail (source->bin == NULL); + + source->bin = element; +} + +void +gnl_source_set_start_stop (GnlSource *source, guint64 start, guint64 stop) +{ + g_return_if_fail (source != NULL); + g_return_if_fail (GNL_IS_SOURCE (source)); + g_return_if_fail (start < stop); + + source->start = start; + source->stop = stop; + +} + + diff --git a/gnl/gnlsource.h b/gnl/gnlsource.h new file mode 100644 index 0000000..d715446 --- /dev/null +++ b/gnl/gnlsource.h @@ -0,0 +1,76 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * gnlsource.h: Header for base GnlSource + * + * 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. + */ + + +#ifndef __GNL_SOURCE_H__ +#define __GNL_SOURCE_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GNL_TYPE_SOURCE \ + (gnl_source_get_type()) +#define GNL_SOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GNL_TYPE_SOURCE,GnlSource)) +#define GNL_SOURCE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GNL_TYPE_SOURCE,GnlSourceClass)) +#define GNL_IS_SOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GNL_TYPE_SOURCE)) +#define GNL_IS_SOURCE_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GNL_TYPE_SOURCE)) + +typedef struct _GnlSource GnlSource; +typedef struct _GnlSourceClass GnlSourceClass; + +struct _GnlSource { + GstBin bin; + + guint64 start; + guint64 stop; + + GstElement *source; + +}; + +struct _GnlSourceClass { + GstBinClass parent_class; +}; + +/* normal GSource stuff */ +GType gnl_source_get_type (void); +GnlSource* gnl_source_new (const gchar *name); + +void gnl_source_set_element (GnlSource *source, GstElement *element); +void gnl_source_set_start_stop (GnlSource *source, guint64 start, guint64 stop); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNL_SOURCE_H__ */ + diff --git a/gnl/gnltimeline.c b/gnl/gnltimeline.c new file mode 100644 index 0000000..98649db --- /dev/null +++ b/gnl/gnltimeline.c @@ -0,0 +1,74 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * 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 <gnl/gnltimeline.h> + +static void gnl_timeline_class_init (GnlTimelineClass *klass); +static void gnl_timeline_init (GnlTimeline *timeline); + +static GnlTrackClass *parent_class = NULL; + +GType +gnl_timeline_get_type (void) +{ + static GType timeline_type = 0; + + if (!timeline_type) { + static const GTypeInfo timeline_info = { + sizeof (GnlTimelineClass), + NULL, + NULL, + (GClassInitFunc) gnl_timeline_class_init, + NULL, + NULL, + sizeof (GnlTimeline), + 4, + (GInstanceInitFunc) gnl_timeline_init, + }; + timeline_type = g_type_register_static (G_TYPE_OBJECT, "GnlTimeline", &timeline_info, 0); + } + return object_type; +} + +static void +gnl_timeline_class_init (GnlTimelineClass *klass) +{ + GObjectClass *gobject_class; + + gobject_class = (GObjectClass*)klass; + + parent_class = g_type_class_ref (GNL_TYPE_TRACK); +} + + +static void +gnl_timeline_init (GnlTimeline *timeline) +{ +} + + +GnlTimeline* +gnl_timeline_new (const gchar *name) +{ + return NULL; +} + + diff --git a/gnl/gnltimeline.h b/gnl/gnltimeline.h new file mode 100644 index 0000000..b4fbd5c --- /dev/null +++ b/gnl/gnltimeline.h @@ -0,0 +1,67 @@ +/* GStreamer + * Copyright (C) 2001 Wim Taymans <wim.taymans@chello.be> + * + * gnltimeline.h: Header for base GnlTimeline + * + * 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. + */ + + +#ifndef __GNL_TIMELINE_H__ +#define __GNL_TIMELINE_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define GNL_TYPE_TIMELINE \ + (gnl_timeline_get_type()) +#define GNL_TIMELINE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GNL_TYPE_TIMELINE,GnlTimeline)) +#define GNL_TIMELINE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GNL_TYPE_TIMELINE,GnlTimelineClass)) +#define GNL_IS_TIMELINE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GNL_TYPE_TIMELINE)) +#define GNL_IS_TIMELINE_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GNL_TYPE_TIMELINE)) + +typedef struct _GnlTimeline GnlTimeline; +typedef struct _GnlTimelineClass GnlTimelineClass; + +struct _GnlTimeline { + GnlTrack track; + +}; + +struct _GnlTimelineClass { + GnlTrackClass parent_class; +}; + +GType gnl_timeline_get_type (void); +GnlTimeline* gnl_timeline_new (const gchar *name); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNL_TIMELINE_H__ */ + diff --git a/test/composition.c b/test/composition.c new file mode 100644 index 0000000..6f17ae3 --- /dev/null +++ b/test/composition.c @@ -0,0 +1,81 @@ + +#include <gnl/gnl.h> + +/* + + .-0----->-----------5000----->------10000----->-----15000---. + ! main_timeline ! + ! ! + ! .- composition -----------------------------------------. ! + ! ! ! ! + ! ! .- layer1 ------------------------------------------. ! ! + ! ! ! ! ! ! + ! ! ! .- operation ---. ! ! ! + ! ! ! ! ! ! ! ! + ! ! ! ! blend ! ! ! ! + ! ! ! '---------------' ! ! ! + ! ! '---------------------------------------------------' ! ! + ! ! .- layer2 ------------------------------------------. ! ! + ! ! ! ! ! ! + ! ! ! .-- source1 -------------------. ! ! ! + ! ! ! ! ! ! ! ! + ! ! ! ! /myfile.avi ! ! ! ! + ! ! ! '------------------------------' ! ! ! + ! ! '---------------------------------------------------' ! ! + ! ! .- layer3 ------------------------------------------. ! ! + ! ! ! .- source2 ---------------------. ! ! ! + ! ! ! ! ! ! ! ! + ! ! ! ! /myfile2.avi ! ! ! ! + ! ! ! '-------------------------------' ! ! ! + ! ! '---------------------------------------------------' ! ! + ! '-------------------------------------------------------' ! + '-----------------------------------------------------------' +*/ + +int +main (int argc, gchar *argv[]) +{ + GnlTimeline *timeline; + GnlComposition *composition; + GnlTrack *layer; + GnlSource *source1, *source2; + + gnl_init (&argc, &argv); + + timeline = gnl_timeline_new ("main_timeline"); + + source1 = gnl_source_new ("my_source1") + gnl_source_set_element (source1, element1); + gnl_source_set_start_stop (source1, 0, 10000); + + source2 = gnl_source_new ("my_source2"); + gnl_source_set_element (source2, element2); + gnl_source_set_start_stop (source2, 0, 10000); + + blend = gnl_operation_new ("blend"); + gnl_source_set_element (blend, blend_element); + gnl_source_set_start_stop (source2, 0, 5000); + + composition = gnl_composition_new ("my_composition"); + gnl_source_set_start_stop (GNL_SOURCE (composition), 0, 5000); + + layer1 = gnl_layer_new ("layer1"); + gnl_layer_add_source (layer1, blend, 5000); + layer2 = gnl_layer_new ("layer2"); + gnl_layer_add_source (layer2, source1, 0); + layer3 = gnl_layer_new ("layer3"); + gnl_layer_add_source (layer3, source2, 5000); + + gnl_composition_append_layer (composition, layer1); + gnl_composition_append_layer (composition, layer2); + gnl_composition_append_layer (composition, layer3); + + gnl_timeline_add_composition (timeline, composition); + + gst_element_set_state (GST_ELEMENT (timeline), GST_STATE_PLAYING); + + while (gst_bin_iterate (GST_BIN (timeline))); + + gst_element_set_state (GST_ELEMENT (timeline), GST_STATE_NULL); + +} diff --git a/test/simple.c b/test/simple.c new file mode 100644 index 0000000..293b9df --- /dev/null +++ b/test/simple.c @@ -0,0 +1,52 @@ + +#include <gnl/gnl.h> + +/* + (-0----->-----------5000----->------10000----->-----15000-) + ! main_timeline ! + ! ! + ! (-----------------------------------------------------) ! + ! ! my_track ! ! + ! ! (-------------------------------) ! ! + ! ! ! source1 ! ! ! + ! ! ! ! ! ! + ! ! (-------------------------------) ! ! + ! ! (-------------------------------) ! ! + ! ! ! source2 ! ! ! + ! ! ! ! ! ! + ! ! (-------------------------------) ! ! + ! (-----------------------------------------------------) ! + ! ! + (---------------------------------------------------------) +*/ + +int +main (int argc, gchar *argv[]) +{ + GnlTimeline *timeline; + GnlTrack *track; + GnlSource *source1, *source2; + + timeline = gnl_timeline_new ("main_timeline"); + + source1 = gnl_source_new_from_pipeline ("my_source1", bin1); + gnl_source_set_start_time (source1, 0); + gnl_source_set_end_time (source1, 10000); + + source2 = gnl_source_new_from_pipeline ("my_source2", bin2); + gnl_source_set_start_time (source2, 0); + gnl_source_set_end_time (source2, 10000); + + track = gnl_track_new ("my_track"); + gnl_track_add_source (track, source1, 0); + gnl_track_add_source (track, source2, 5000); + + gnl_timeline_add_track (timeline, track); + + gst_element_set_state (GST_ELEMENT (timeline), GST_STATE_PLAYING); + + while (gst_bin_iterate (GST_BIN (timeline))); + + gst_element_set_state (GST_ELEMENT (timeline), GST_STATE_NULL); + +} |