Remove GESSimplerLayer, that API should land into GESLayer in the end

The priority handling of clip is now handled by GESLayer itself, and
handling clip as a ordered list should be implemented in GESLayer itself
too, this way the user can decide to switch mode at any time instead of
This commit is contained in:
Thibault Saunier 2013-11-22 17:49:49 -03:00
parent 04071e7214
commit e7a45f0eef
24 changed files with 49 additions and 1209 deletions

View file

@ -81,11 +81,6 @@ platform as well as Windows. It is released under the GNU Library General Public
<xi:include href="xml/ges-effect.xml"/>
</chapter>
<chapter>
<title>Simple Timeline interface</title>
<xi:include href="xml/ges-simple-layer.xml"/>
</chapter>
<chapter>
<title>Convenience classes</title>
<xi:include href="xml/ges-pipeline.xml"/>

View file

@ -670,28 +670,6 @@ ges_transition_clip_get_type
</SECTION>
<SECTION>
<FILE>ges-simple-layer</FILE>
<TITLE>GESSimpleLayer</TITLE>
GESSimpleLayer
ges_simple_layer_new
ges_simple_layer_add_object
ges_simple_layer_move_object
ges_simple_layer_nth
ges_simple_layer_index
ges_simple_layer_is_valid
<SUBSECTION Standard>
GESSimpleLayerClass
ges_simple_layer_get_type
GESSimpleLayerPrivate
GES_IS_SIMPLE_LAYER
GES_IS_SIMPLE_LAYER_CLASS
GES_SIMPLE_LAYER
GES_SIMPLE_LAYER_CLASS
GES_SIMPLE_LAYER_GET_CLASS
GES_TYPE_SIMPLE_LAYER
</SECTION>
<SECTION>
<FILE>ges-test-clip</FILE>
<TITLE>GESTestClip</TITLE>

View file

@ -2,7 +2,6 @@
#include <ges/ges.h>
ges_formatter_get_type
ges_simple_layer_get_type
%ges_text_halign_get_type
%ges_text_valign_get_type
ges_timeline_get_type

View file

@ -12,7 +12,6 @@ libges_@GST_API_VERSION@_la_SOURCES = \
ges.c \
ges-enums.c \
ges-meta-container.c \
ges-simple-layer.c \
ges-timeline.c \
ges-layer.c \
ges-clip.c \
@ -77,7 +76,6 @@ libges_@GST_API_VERSION@include_HEADERS = \
ges-enums.h \
ges-gerror.h \
ges-meta-container.h \
ges-simple-layer.h \
ges-timeline.h \
ges-layer.h \
ges-clip.h \

View file

@ -23,10 +23,6 @@
*
* The effect will be applied on the sources that have lower priorities
* (higher number) between the inpoint and the end of it.
*
* In a #GESSimpleLayer, the priorities will be set for you but if
* you use another type of #GESLayer, you will have to handle it
* yourself.
*/
#include <ges/ges.h>

View file

@ -24,10 +24,6 @@
*
* The effect will be applied on the sources that have lower priorities
* (higher number) between the inpoint and the end of it.
*
* In a #GESSimpleLayer, the priorities will be set for you but if
* you use another type of #GESLayer, you will have to handle it
* yourself.
*/
#include <ges/ges.h>

View file

@ -1,526 +0,0 @@
/* GStreamer Editing Services
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
* 2009 Nokia Corporation
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/**
* SECTION:ges-simple-layer
* @short_description: High-level GESLayer
*
* #GESSimpleLayer allows using #GESClip(s) with a list-like
* API. Clients can add any type of GESClip to a
* GESSimpleLayer, and the layer will automatically compute the
* appropriate start times.
*
* Users should be aware that GESBaseTransitionClip objects are considered to
* have a negative duration for the purposes of positioning GESSourceClip
* objects (i.e., adding a GESBaseTransitionClip creates an overlap between
* the two adjacent sources.
*/
#include <ges/ges.h>
#include "ges-internal.h"
static void ges_simple_layer_object_removed (GESLayer * layer, GESClip * clip);
static void ges_simple_layer_object_added (GESLayer * layer, GESClip * clip);
static void
clip_height_changed_cb (GESClip * clip G_GNUC_UNUSED,
GParamSpec * arg G_GNUC_UNUSED, GESSimpleLayer * layer);
static GList *get_objects (GESLayer * layer);
G_DEFINE_TYPE (GESSimpleLayer, ges_simple_layer, GES_TYPE_LAYER);
struct _GESSimpleLayerPrivate
{
/* Sorted list of objects */
GList *objects;
gboolean adding_object;
gboolean valid;
};
enum
{
OBJECT_MOVED,
LAST_SIGNAL,
};
enum
{
PROP_0,
PROP_VALID,
LAST_PROP,
};
static guint gstl_signals[LAST_SIGNAL] = { 0 };
static void
ges_simple_layer_get_property (GObject * object,
guint property_id, GValue * value, GParamSpec * pspec)
{
GESSimpleLayer *self;
self = GES_SIMPLE_LAYER (object);
switch (property_id) {
case PROP_VALID:
g_value_set_boolean (value, self->priv->valid);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
ges_simple_layer_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
switch (property_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
ges_simple_layer_class_init (GESSimpleLayerClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GESLayerClass *layer_class = GES_LAYER_CLASS (klass);
g_type_class_add_private (klass, sizeof (GESSimpleLayerPrivate));
object_class->get_property = ges_simple_layer_get_property;
object_class->set_property = ges_simple_layer_set_property;
/* Be informed when objects are being added/removed from elsewhere */
layer_class->object_removed = ges_simple_layer_object_removed;
layer_class->object_added = ges_simple_layer_object_added;
layer_class->get_objects = get_objects;
/**
* GESSimpleLayer:valid:
*
* FALSE when the arrangement of objects in the layer would cause errors or
* unexpected output during playback. Do not set the containing pipeline
* state to PLAYING when this property is FALSE.
*/
g_object_class_install_property (object_class, PROP_VALID,
g_param_spec_boolean ("valid", "Valid",
"Layer is in a valid configuration", FALSE, G_PARAM_READABLE));
/**
* GESSimpleLayer::object-moved:
* @layer: the #GESSimpleLayer
* @object: the #GESClip that was added
* @old: the previous position of the object
* @new: the new position of the object
*
* Will be emitted when an object is moved with
* #ges_simple_layer_move_object.
*/
gstl_signals[OBJECT_MOVED] =
g_signal_new ("object-moved", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESSimpleLayerClass,
object_moved),
NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 3,
GES_TYPE_CLIP, G_TYPE_INT, G_TYPE_INT);
}
static void
ges_simple_layer_init (GESSimpleLayer * self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
GES_TYPE_SIMPLE_LAYER, GESSimpleLayerPrivate);
self->priv->objects = NULL;
}
static void
gstl_recalculate (GESSimpleLayer * self)
{
GList *tmp;
gint64 pos = 0;
gint priority = 0;
gint transition_priority = 0;
gint height;
GESClip *prev_object = NULL;
GESClip *prev_transition = NULL;
gboolean valid = TRUE;
GESSimpleLayerPrivate *priv = self->priv;
priority = GES_LAYER (self)->min_gnl_priority;
GST_DEBUG ("recalculating values");
if (priv->objects && GES_IS_BASE_TRANSITION_CLIP (priv->objects->data)) {
valid = FALSE;
}
for (tmp = priv->objects; tmp; tmp = tmp->next) {
GESClip *clip;
guint64 dur;
GList *l_next;
clip = (GESClip *) tmp->data;
dur = _DURATION (clip);
height = GES_CONTAINER_HEIGHT (clip);
if (GES_IS_SOURCE_CLIP (clip)) {
GST_LOG ("%p clip: height: %d: priority %d", clip, height, priority);
if (G_UNLIKELY (_START (clip) != pos)) {
_set_start0 (GES_TIMELINE_ELEMENT (clip), pos);
}
if (G_UNLIKELY (_PRIORITY (clip) != priority)) {
_set_priority0 (GES_TIMELINE_ELEMENT (clip), priority);
}
transition_priority = MAX (0, priority - 1);
priority += height;
pos += dur;
g_assert (priority != -1);
} else if (GES_IS_BASE_TRANSITION_CLIP (clip)) {
pos -= dur;
if (pos < 0)
pos = 0;
GST_LOG ("%p clip: height: %d: trans_priority %d Position: %"
G_GINT64_FORMAT ", duration %" G_GINT64_FORMAT, clip, height,
transition_priority, pos, dur);
g_assert (transition_priority != -1);
if (G_UNLIKELY (_START (clip) != pos))
_set_start0 (GES_TIMELINE_ELEMENT (clip), pos);
if (G_UNLIKELY (_PRIORITY (clip) != transition_priority)) {
_set_priority0 (GES_TIMELINE_ELEMENT (clip), transition_priority);
}
/* sanity checks */
l_next = g_list_next (tmp);
if (GES_IS_BASE_TRANSITION_CLIP (prev_object)) {
GST_ERROR ("two transitions in sequence!");
valid = FALSE;
}
if (prev_object && (_DURATION (prev_object) < dur)) {
GST_ERROR ("transition duration exceeds that of previous neighbor!");
valid = FALSE;
}
if (l_next && (_DURATION (l_next->data) < dur)) {
GST_ERROR ("transition duration exceeds that of next neighbor!");
valid = FALSE;
}
if (prev_transition) {
guint64 start, end;
end = (_DURATION (prev_transition) + _START (prev_transition));
start = pos;
if (end > start) {
GST_ERROR ("%" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT ": "
"overlapping transitions!", start, end);
valid = FALSE;
}
}
prev_transition = clip;
}
prev_object = clip;
}
if (prev_object && GES_IS_BASE_TRANSITION_CLIP (prev_object)) {
valid = FALSE;
}
GST_DEBUG ("Finished recalculating: final start pos is: %" GST_TIME_FORMAT,
GST_TIME_ARGS (pos));
GES_LAYER (self)->max_gnl_priority = priority;
if (valid != self->priv->valid) {
self->priv->valid = valid;
g_object_notify (G_OBJECT (self), "valid");
}
}
/**
* ges_simple_layer_add_object:
* @layer: a #GESSimpleLayer
* @object: the #GESClip to add
* @position: the position at which to add the object
*
* Adds the object at the given position in the layer. The position is where
* the object will be inserted. To put the object before all objects, use
* position 0. To put after all objects, use position -1.
*
* When adding transitions, it is important that the adjacent objects
* (objects at position, and position + 1) be (1) A derivative of
* GESSourceClip or other non-transition, and (2) have a duration at least
* as long as the duration of the transition.
*
* The layer will steal a reference to the provided object.
*
* Returns: TRUE if the object was successfuly added, else FALSE.
*/
gboolean
ges_simple_layer_add_object (GESSimpleLayer * layer,
GESClip * clip, gint position)
{
gboolean res;
GList *nth;
GESSimpleLayerPrivate *priv = layer->priv;
GST_DEBUG ("layer:%p, clip:%p, position:%d", layer, clip, position);
nth = g_list_nth (priv->objects, position);
if (GES_IS_BASE_TRANSITION_CLIP (clip)) {
GList *lprev = g_list_previous (nth);
GESClip *prev = GES_CLIP (lprev ? lprev->data : NULL);
GESClip *next = GES_CLIP (nth ? nth->data : NULL);
if ((prev && GES_IS_BASE_TRANSITION_CLIP (prev)) ||
(next && GES_IS_BASE_TRANSITION_CLIP (next))) {
GST_ERROR ("Not adding transition: Only insert transitions between two"
" sources, or at the begining or end the layer\n");
return FALSE;
}
}
priv->adding_object = TRUE;
/* provisionally insert the clip */
priv->objects = g_list_insert (priv->objects, clip, position);
res = ges_layer_add_clip ((GESLayer *) layer, clip);
/* Add to layer */
if (G_UNLIKELY (!res)) {
priv->adding_object = FALSE;
/* we failed to add the clip, so remove it from our list */
priv->objects = g_list_remove (priv->objects, clip);
return FALSE;
}
priv->adding_object = FALSE;
GST_DEBUG ("Adding clip %p to the list", clip);
g_signal_connect (G_OBJECT (clip), "notify::height", G_CALLBACK
(clip_height_changed_cb), layer);
/* recalculate positions */
gstl_recalculate (layer);
return TRUE;
}
/**
* ges_simple_layer_nth:
* @layer: a #GESSimpleLayer
* @position: The position in position to get, starting from 0.
*
* Gets the clip at the given position.
*
* Returns: (transfer none): The #GESClip at the given position or NULL if
* the position is off the end of the layer.
*/
GESClip *
ges_simple_layer_nth (GESSimpleLayer * layer, gint position)
{
GList *list;
GESSimpleLayerPrivate *priv = layer->priv;
list = g_list_nth (priv->objects, position);
if (list)
return GES_CLIP (list->data);
return NULL;
}
/**
* ges_simple_layer_index:
* @layer: a #GESSimpleLayer
* @clip: a #GESClip in the layer
*
* Gets the position of the given clip within the given layer.
*
* Returns: The position of the clip starting from 0, or -1 if the
* clip was not found.
*/
gint
ges_simple_layer_index (GESSimpleLayer * layer, GESClip * clip)
{
GESSimpleLayerPrivate *priv = layer->priv;
return g_list_index (priv->objects, clip);
}
/**
* ges_simple_layer_move_object:
* @layer: a #GESSimpleLayer
* @clip: the #GESClip to move
* @newposition: the new position at which to move the clip
*
* Moves the clip to the given position in the layer. To put the clip before
* all other objects, use position 0. To put the objects after all objects, use
* position -1.
*
* Returns: TRUE if the clip was successfuly moved, else FALSE.
*/
gboolean
ges_simple_layer_move_object (GESSimpleLayer * layer,
GESClip * clip, gint newposition)
{
gint idx;
GESSimpleLayerPrivate *priv = layer->priv;
GESLayer *clip_layer;
GST_DEBUG ("layer:%p, clip:%p, newposition:%d", layer, clip, newposition);
clip_layer = ges_clip_get_layer (clip);
if (G_UNLIKELY (clip_layer != (GESLayer *) layer)) {
GST_WARNING ("Clip doesn't belong to this layer");
if (clip_layer != NULL)
gst_object_unref (clip_layer);
return FALSE;
}
if (clip_layer != NULL)
gst_object_unref (clip_layer);
/* Find it's current position */
idx = g_list_index (priv->objects, clip);
if (G_UNLIKELY (idx == -1)) {
GST_WARNING ("Clip not controlled by this layer");
return FALSE;
}
GST_DEBUG ("Object was previously at position %d", idx);
/* If we don't have to change its position, don't */
if (idx == newposition)
return TRUE;
/* pop it off the list */
priv->objects = g_list_remove (priv->objects, clip);
/* re-add it at the proper position */
priv->objects = g_list_insert (priv->objects, clip, newposition);
/* recalculate positions */
gstl_recalculate (layer);
g_signal_emit (layer, gstl_signals[OBJECT_MOVED], 0, clip, idx, newposition);
return TRUE;
}
/**
* ges_simple_layer_new:
*
* Creates a new #GESSimpleLayer.
*
* Returns: The new #GESSimpleLayer
*/
GESSimpleLayer *
ges_simple_layer_new (void)
{
return g_object_new (GES_TYPE_SIMPLE_LAYER, NULL);
}
/**
* ges_simple_layer_is_valid:
* @layer: a #GESSimpleLayer
*
* Checks whether the arrangement of objects in the layer would cause errors
* or unexpected output during playback. Do not set the containing pipeline
* state to PLAYING when this property is FALSE.
*
* Returns: #TRUE if current arrangement of the layer is valid else #FALSE.
*/
gboolean
ges_simple_layer_is_valid (GESSimpleLayer * layer)
{
return layer->priv->valid;
}
static void
ges_simple_layer_object_removed (GESLayer * layer, GESClip * clip)
{
GESSimpleLayer *sl = (GESSimpleLayer *) layer;
/* remove clip from our list */
sl->priv->objects = g_list_remove (sl->priv->objects, clip);
gstl_recalculate (sl);
}
static void
ges_simple_layer_object_added (GESLayer * layer, GESClip * clip)
{
GESSimpleLayer *sl = (GESSimpleLayer *) layer;
if (sl->priv->adding_object == FALSE) {
/* remove clip from our list */
sl->priv->objects = g_list_append (sl->priv->objects, clip);
gstl_recalculate (sl);
}
g_signal_connect_swapped (clip, "notify::duration",
G_CALLBACK (gstl_recalculate), layer);
}
static void
clip_height_changed_cb (GESClip * clip,
GParamSpec * arg G_GNUC_UNUSED, GESSimpleLayer * layer)
{
GST_LOG ("layer %p: notify height changed %p", layer, clip);
gstl_recalculate (layer);
}
static GList *
get_objects (GESLayer * l)
{
GList *ret;
GList *tmp;
GESSimpleLayer *layer = (GESSimpleLayer *) l;
ret = g_list_copy (layer->priv->objects);
for (tmp = ret; tmp; tmp = tmp->next) {
gst_object_ref (tmp->data);
}
return ret;
}

View file

@ -1,101 +0,0 @@
/* GStreamer Editing Services
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
* 2009 Nokia Corporation
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GES_SIMPLE_LAYER
#define _GES_SIMPLE_LAYER
#include <glib-object.h>
#include <ges/ges-types.h>
#include <ges/ges-layer.h>
G_BEGIN_DECLS
#define GES_TYPE_SIMPLE_LAYER ges_simple_layer_get_type()
#define GES_SIMPLE_LAYER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_SIMPLE_LAYER, GESSimpleLayer))
#define GES_SIMPLE_LAYER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_SIMPLE_LAYER, GESSimpleLayerClass))
#define GES_IS_SIMPLE_LAYER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_SIMPLE_LAYER))
#define GES_IS_SIMPLE_LAYER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_SIMPLE_LAYER))
#define GES_SIMPLE_LAYER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_SIMPLE_LAYER, GESSimpleLayerClass))
typedef struct _GESSimpleLayerPrivate GESSimpleLayerPrivate;
/**
* GESSimpleLayer:
*/
struct _GESSimpleLayer {
/*< private >*/
GESLayer parent;
GESSimpleLayerPrivate *priv;
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
};
struct _GESSimpleLayerClass {
/*< private >*/
GESLayerClass parent_class;
/*< signals >*/
void (*object_moved) (GESLayer * layer, GESClip * object,
gint old_position, gint new_position);
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
};
GType ges_simple_layer_get_type (void);
GESSimpleLayer* ges_simple_layer_new (void);
gboolean
ges_simple_layer_add_object (GESSimpleLayer *layer,
GESClip *object, gint position);
gboolean
ges_simple_layer_move_object (GESSimpleLayer *layer,
GESClip *clip, gint newposition);
gboolean
ges_simple_layer_is_valid (GESSimpleLayer *layer);
GESClip *
ges_simple_layer_nth (GESSimpleLayer *layer,
gint position);
gint
ges_simple_layer_index (GESSimpleLayer *layer,
GESClip *clip);
G_END_DECLS
#endif /* _GES_SIMPLE_LAYER */

View file

@ -32,10 +32,6 @@
* property. The default value is "crossfade". For audio, only "crossfade" is
* supported.
*
* #GESSimpleLayer will automatically manage the priorities of sources
* and transitions. If you use #GESTransitionClips in another type of
* #GESLayer, you will need to manage priorities yourself.
*
* The ID of the ExtractableType is the nickname of the vtype property value. Note
* that this value can be changed after creation and the GESExtractable.asset value
* will be updated when needed.

View file

@ -28,7 +28,6 @@
#include <ges/ges-timeline.h>
#include <ges/ges-layer.h>
#include <ges/ges-simple-layer.h>
#include <ges/ges-timeline-element.h>
#include <ges/ges-clip.h>
#include <ges/ges-pipeline.h>

View file

@ -33,7 +33,6 @@ check_PROGRAMS = \
ges/layer \
ges/effects \
ges/uriclip \
ges/simplelayer \
ges/clip \
ges/timelineedition \
ges/titles\

View file

@ -132,7 +132,7 @@ GST_START_TEST (test_test_source_in_layer)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
@ -146,7 +146,7 @@ GST_START_TEST (test_test_source_in_layer)
g_object_set (source, "duration", (guint64) GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) layer, (GESClip *) source, 0);
ges_layer_add_clip (layer, (GESClip *) source);
/* specifically test the vpattern property */
g_object_set (source, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_WHITE, NULL);

View file

@ -49,7 +49,7 @@ GST_START_TEST (test_add_effect_to_clip)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
track_video = GES_TRACK (ges_video_track_new ());
@ -61,8 +61,7 @@ GST_START_TEST (test_add_effect_to_clip)
g_object_set (source, "duration", 10 * GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) (layer),
(GESClip *) source, 0);
ges_layer_add_clip (layer, (GESClip *) source);
GST_DEBUG ("Create effect");
@ -97,7 +96,7 @@ GST_START_TEST (test_get_effects_from_tl)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_layer_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
ges_timeline_add_track (timeline, track_video);
@ -186,7 +185,7 @@ GST_START_TEST (test_effect_clip)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
track_video = GES_TRACK (ges_video_track_new ());
@ -199,8 +198,7 @@ GST_START_TEST (test_effect_clip)
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) (layer),
(GESClip *) effect_clip, 0);
ges_layer_add_clip (layer, (GESClip *) effect_clip);
effect = ges_effect_new ("agingtv");
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
@ -366,7 +364,7 @@ GST_START_TEST (test_effect_set_properties)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
ges_timeline_add_track (timeline, track_video);
@ -377,8 +375,7 @@ GST_START_TEST (test_effect_set_properties)
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) (layer),
(GESClip *) effect_clip, 0);
ges_layer_add_clip (layer, (GESClip *) effect_clip);
effect = GES_TRACK_ELEMENT (ges_effect_new ("agingtv"));
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),
@ -454,7 +451,7 @@ GST_START_TEST (test_clip_signals)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
ges_timeline_add_track (timeline, track_video);
@ -467,8 +464,7 @@ GST_START_TEST (test_clip_signals)
g_object_set (effect_clip, "duration", 25 * GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) (layer),
(GESClip *) effect_clip, 0);
ges_layer_add_clip (layer, (GESClip *) effect_clip);
effect = ges_effect_new ("agingtv");
fail_unless (ges_container_add (GES_CONTAINER (effect_clip),

View file

@ -121,7 +121,7 @@ GST_START_TEST (test_overlay_in_layer)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = (GESLayer *) ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
@ -133,7 +133,7 @@ GST_START_TEST (test_overlay_in_layer)
g_object_set (source, "duration", (guint64) GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) layer, (GESClip *) source, 0);
ges_layer_add_clip (layer, (GESClip *) source);
/* specifically test the text property */
g_object_set (source, "text", (gchar *) "some text", NULL);

View file

@ -1,454 +0,0 @@
/* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "test-utils.h"
#include <ges/ges.h>
#include <gst/check/gstcheck.h>
GST_START_TEST (test_gsl_add)
{
GESTimeline *timeline;
GESLayer *layer;
GESTrack *track;
GESTestClip *source;
GESClip *source2;
gint result;
ges_init ();
/* This is the simplest scenario ever */
/* Timeline and 1 Layer */
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer));
track = GES_TRACK (ges_video_track_new ());
fail_unless (ges_timeline_add_track (timeline, track));
source = ges_test_clip_new ();
fail_unless (source != NULL);
g_object_set (source, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source), GST_SECOND);
fail_unless_equals_uint64 (_START (source), 42);
fail_unless (ges_simple_layer_add_object (GES_SIMPLE_LAYER
(layer), GES_CLIP (source), -1));
fail_unless (ges_clip_get_layer (GES_CLIP (source)) == layer);
fail_unless_equals_uint64 (_DURATION (source), GST_SECOND);
fail_unless_equals_uint64 (_START (source), 0);
/* test nth */
source2 = ges_simple_layer_nth ((GESSimpleLayer *) layer, -1);
fail_if (source2);
source2 = ges_simple_layer_nth ((GESSimpleLayer *) layer, 2);
fail_if (source2);
source2 = ges_simple_layer_nth ((GESSimpleLayer *) layer, 0);
fail_unless ((GESClip *) source == source2);
/* test position */
result = ges_simple_layer_index ((GESSimpleLayer *) layer, source2);
fail_unless_equals_int (result, 0);
result = ges_simple_layer_index ((GESSimpleLayer *) layer, (GESClip *) NULL);
fail_unless_equals_int (result, -1);
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source)));
fail_unless (ges_timeline_remove_track (timeline, track));
fail_unless (ges_timeline_remove_layer (timeline, layer));
gst_object_unref (timeline);
}
GST_END_TEST;
typedef struct
{
gint new;
gint old;
} siginfo;
static void
object_moved_cb (GESSimpleLayer * layer,
GESClip * clip, gint old, gint new, gpointer user)
{
siginfo *info;
info = (siginfo *) user;
info->new = new;
info->old = old;
}
GST_START_TEST (test_gsl_move_simple)
{
GESTimeline *timeline;
GESLayer *layer;
GESTrack *track;
GESTestClip *source1, *source2;
siginfo info = { 0, 0 };
ges_init ();
/* Timeline and 1 Layer */
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer));
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_new_any ());
fail_unless (ges_timeline_add_track (timeline, track));
g_signal_connect (G_OBJECT (layer), "object-moved", G_CALLBACK
(object_moved_cb), &info);
/* Create two 1s sources */
source1 = ges_test_clip_new ();
g_object_set (source1, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
source2 = ges_test_clip_new ();
g_object_set (source2, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);
/* Add source to any position */
GST_DEBUG ("Adding the source to the timeline layer");
fail_unless (ges_simple_layer_add_object (GES_SIMPLE_LAYER
(layer), GES_CLIP (source1), -1));
fail_unless_equals_uint64 (_START (source1), 0);
/* Add source2 to the end */
GST_DEBUG ("Adding the source to the timeline layer");
fail_unless (ges_simple_layer_add_object (GES_SIMPLE_LAYER
(layer), GES_CLIP (source2), -1));
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_START (source2), GST_SECOND);
/* Move source2 before source 1 (newpos:0) */
fail_unless (ges_simple_layer_move_object (GES_SIMPLE_LAYER
(layer), GES_CLIP (source2), 0));
fail_unless_equals_uint64 (_START (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source2), 0);
fail_unless_equals_int (info.new, 0);
fail_unless_equals_int (info.old, 1);
/* Move source2 after source 1 (newpos:0) */
fail_unless (ges_simple_layer_move_object (GES_SIMPLE_LAYER
(layer), GES_CLIP (source2), 1));
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_START (source2), GST_SECOND);
fail_unless_equals_int (info.new, 1);
fail_unless_equals_int (info.old, 0);
/* Move source1 to end (newpos:-1) */
fail_unless (ges_simple_layer_move_object (GES_SIMPLE_LAYER
(layer), GES_CLIP (source1), -1));
fail_unless_equals_uint64 (_START (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source2), 0);
/* position will be decremented, this is expected */
fail_unless_equals_int (info.new, -1);
fail_unless_equals_int (info.old, 0);
/* remove source1, source2 should be moved to the beginning */
gst_object_ref (source1);
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source1)));
fail_unless_equals_uint64 (_START (source2), 0);
g_object_set (source1, "start", (guint64) 42, NULL);
/* re-add source1... using the normal API, it should be added to the end */
fail_unless (ges_layer_add_clip (layer, GES_CLIP (source1)));
fail_unless_equals_uint64 (_START (source2), 0);
fail_unless_equals_uint64 (_START (source1), GST_SECOND);
/* remove source1 ... */
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source1)));
fail_unless_equals_uint64 (_START (source2), 0);
/* ... and source2 */
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source2)));
fail_unless (ges_timeline_remove_track (timeline, track));
fail_unless (ges_timeline_remove_layer (timeline, layer));
gst_object_unref (timeline);
}
GST_END_TEST;
static void
valid_notify_cb (GObject * obj, GParamSpec * unused G_GNUC_UNUSED, gint * count)
{
(*count)++;
}
GST_START_TEST (test_gsl_with_transitions)
{
GESTimeline *timeline;
GESLayer *layer;
GESTrack *track;
GESTestClip *source1, *source2, *source3, *source4;
GESTransitionClip *tr1, *tr2, *tr3, *tr4, *tr5;
GESSimpleLayer *gstl;
gboolean valid;
gint count = 0;
ges_init ();
/* Timeline and 1 Layer */
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
g_signal_connect (G_OBJECT (layer), "notify::valid",
G_CALLBACK (valid_notify_cb), &count);
fail_unless (ges_timeline_add_layer (timeline, layer));
ges_layer_set_priority (layer, 0);
track = ges_track_new (GES_TRACK_TYPE_VIDEO, gst_caps_new_any ());
fail_unless (ges_timeline_add_track (timeline, track));
track = ges_track_new (GES_TRACK_TYPE_AUDIO, gst_caps_new_any ());
fail_unless (ges_timeline_add_track (timeline, track));
/* Create four 1s sources */
source1 = ges_test_clip_new ();
g_object_set (source1, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
/* make this source taller than the others, so we can check that
* gstlrecalculate handles this properly */
source2 = ges_test_clip_new ();
g_object_set (source2, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);
source3 = ges_test_clip_new ();
g_object_set (source3, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND);
source4 = ges_test_clip_new ();
g_object_set (source4, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source4), GST_SECOND);
/* create half-second transitions */
#define HALF_SECOND ((guint64) (0.5 * GST_SECOND))
#define SECOND(a) ((guint64) (a * GST_SECOND))
tr1 = ges_transition_clip_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE);
g_object_set (tr1, "duration", HALF_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND);
tr2 = ges_transition_clip_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE);
g_object_set (tr2, "duration", HALF_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (tr2), HALF_SECOND);
tr3 = ges_transition_clip_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE);
g_object_set (tr3, "duration", HALF_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (tr3), HALF_SECOND);
tr4 = ges_transition_clip_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE);
g_object_set (tr4, "duration", HALF_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (tr4), HALF_SECOND);
tr5 = ges_transition_clip_new (GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE);
g_object_set (tr5, "duration", HALF_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (tr5), HALF_SECOND);
/* simple test scenario with several sources in layer */
/* [0 0.5 1 1.5 2 2.5 3] */
/* 0 */
/* 1 [1-tr1--] */
/* 2 [0--source1----][3-tr2--] */
/* 3 [2---source2-----] */
/* 4 [4---source3---] */
/* 5 [5---source4-----] */
gstl = GES_SIMPLE_LAYER (layer);
/* add objects in sequence */
GST_DEBUG ("Adding source1");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (source1), -1));
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_PRIORITY (source1), 2);
GST_DEBUG ("Adding tr1");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (tr1), -1));
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_PRIORITY (source1), 2);
fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr1), 1);
GST_DEBUG ("Adding source2");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (source2), -1));
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_PRIORITY (source1), 2);
fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr1), 1);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);
fail_unless_equals_uint64 (_START (source2), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (source2), 3);
/* add the third source before the second transition */
GST_DEBUG ("Adding source3");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (source3), -1));
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_PRIORITY (source1), 2);
fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr1), 1);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);
fail_unless_equals_uint64 (_START (source2), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (source2), 3);
fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND);
fail_unless_equals_uint64 (_START (source3), SECOND (1.5));
fail_unless_equals_uint64 (_PRIORITY (source3), 4);
/* now add the second transition */
GST_DEBUG ("Adding tr2");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (tr2), 3));
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_PRIORITY (source1), 2);
fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr1), 1);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);
fail_unless_equals_uint64 (_START (source2), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (source2), 3);
fail_unless_equals_uint64 (_DURATION (tr2), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr2), GST_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr2), 2);
fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND);
fail_unless_equals_uint64 (_START (source3), GST_SECOND);
fail_unless_equals_uint64 (_PRIORITY (source3), 4);
/* fourth source */
GST_DEBUG ("Adding source4");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (source4), -1));
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
fail_unless_equals_uint64 (_START (source1), 0);
fail_unless_equals_uint64 (_PRIORITY (source1), 2);
fail_unless_equals_uint64 (_DURATION (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr1), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr1), 1);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);
fail_unless_equals_uint64 (_START (source2), HALF_SECOND);
fail_unless_equals_uint64 (_PRIORITY (source2), 3);
fail_unless_equals_uint64 (_DURATION (tr2), HALF_SECOND);
fail_unless_equals_uint64 (_START (tr2), GST_SECOND);
fail_unless_equals_uint64 (_PRIORITY (tr2), 2);
fail_unless_equals_uint64 (_DURATION (source3), GST_SECOND);
fail_unless_equals_uint64 (_START (source3), GST_SECOND);
fail_unless_equals_uint64 (_PRIORITY (source3), 4);
fail_unless_equals_uint64 (_DURATION (source4), GST_SECOND);
fail_unless_equals_uint64 (_START (source4), SECOND (2));
fail_unless_equals_uint64 (_PRIORITY (source4), 5);
/* check that any insertion which might result in two adjacent transitions
* will fail */
GST_DEBUG ("Checking wrong insertion of tr3");
fail_if (ges_simple_layer_add_object (gstl, GES_CLIP (tr3), 1));
fail_if (ges_simple_layer_add_object (gstl, GES_CLIP (tr3), 2));
fail_if (ges_simple_layer_add_object (gstl, GES_CLIP (tr3), 3));
fail_if (ges_simple_layer_add_object (gstl, GES_CLIP (tr3), 4));
/* check that insertions which don't cause problems still work */
GST_DEBUG ("Checking correct insertion of tr3");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (tr3), 5));
/* at this point the layer should still be valid */
g_object_get (G_OBJECT (layer), "valid", &valid, NULL);
fail_unless (valid);
fail_unless_equals_int (count, 3);
GST_DEBUG ("Checking correct insertion of tr4");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (tr4), -1));
GST_DEBUG ("Checking correct insertion of tr5");
fail_unless (ges_simple_layer_add_object (gstl, GES_CLIP (tr5), 0));
/* removals which result in two or more adjacent transitions will also
* print a warning on the console. This is expected */
GST_DEBUG ("Removing source1");
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source1)));
/* layer should now be invalid */
g_object_get (G_OBJECT (layer), "valid", &valid, NULL);
fail_unless (!valid);
fail_unless_equals_int (count, 4);
GST_DEBUG ("Removing source2/3/4");
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source2)));
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source3)));
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (source4)));
g_object_get (G_OBJECT (layer), "valid", &valid, NULL);
fail_unless (!valid);
fail_unless_equals_int (count, 4);
GST_DEBUG ("Removing transitions");
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (tr1)));
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (tr2)));
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (tr3)));
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (tr4)));
fail_unless (ges_layer_remove_clip (layer, GES_CLIP (tr5)));
GST_DEBUG ("done removing transition");
gst_object_unref (timeline);
}
GST_END_TEST;
static Suite *
ges_suite (void)
{
Suite *s = suite_create ("ges-simple-layer");
TCase *tc_chain = tcase_create ("basic");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_gsl_add);
tcase_add_test (tc_chain, test_gsl_move_simple);
tcase_add_test (tc_chain, test_gsl_with_transitions);
return s;
}
GST_CHECK_MAIN (ges);

View file

@ -34,7 +34,7 @@ GST_START_TEST (test_text_properties_in_layer)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
@ -46,7 +46,7 @@ GST_START_TEST (test_text_properties_in_layer)
g_object_set (source, "duration", (guint64) GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) layer, (GESClip *) source, 0);
ges_layer_add_clip (layer, (GESClip *) source);
track_element =
ges_clip_find_track_element (GES_CLIP (source), v, GES_TYPE_TEXT_OVERLAY);

View file

@ -121,7 +121,7 @@ GST_START_TEST (test_title_source_in_layer)
ges_init ();
timeline = create_timeline_sync (FALSE);
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
@ -133,7 +133,7 @@ GST_START_TEST (test_title_source_in_layer)
g_object_set (source, "duration", (guint64) GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) layer, (GESClip *) source, 0);
ges_layer_add_clip (layer, (GESClip *) source);
/* specifically test the text property */
g_object_set (source, "text", (gchar *) "some text", NULL);

View file

@ -86,7 +86,7 @@ main (int argc, char **argv)
timeline = ges_timeline_new_audio_video ();
layer = (GESLayer *) ges_simple_layer_new ();
layer = (GESLayer *) ges_layer_new ();
if (!ges_timeline_add_layer (timeline, layer))
return -1;

View file

@ -203,11 +203,7 @@ update_move_up_down_sensitivity (App * app)
static void
update_play_sensitivity (App * app)
{
gboolean valid;
g_object_get (app->layer, "valid", &valid, NULL);
gtk_action_set_sensitive (app->play, (app->n_objects && valid));
gtk_action_set_sensitive (app->play, app->n_objects);
}
/* Backend callbacks ********************************************************/
@ -744,9 +740,9 @@ get_video_patterns (void)
static void
layer_added_cb (GESTimeline * timeline, GESLayer * layer, App * app)
{
if (!GES_IS_SIMPLE_LAYER (layer)) {
if (!GES_IS_LAYER (layer)) {
GST_ERROR ("This timeline contains a layer type other than "
"GESSimpleLayer. Timeline editing disabled");
"GESLayer. Timeline editing disabled");
return;
}
@ -1054,18 +1050,7 @@ app_delete_objects (App * app, GList * objects)
static void
app_move_selected_up (App * app)
{
GList *objects, *tmp;
gint pos;
objects = ges_layer_get_clips (app->layer);
pos = g_list_index (objects, app->selected_objects->data);
ges_simple_layer_move_object (GES_SIMPLE_LAYER (app->layer),
GES_CLIP (app->selected_objects->data), pos - 1);
for (tmp = objects; tmp; tmp = tmp->next) {
gst_object_unref (tmp->data);
}
GST_FIXME ("This function is not implement, please implement it :)");
}
static void
@ -1123,18 +1108,7 @@ on_apply_effect_cb (GtkButton * button, App * app)
static void
app_move_selected_down (App * app)
{
GList *objects, *tmp;
gint pos;
objects = ges_layer_get_clips (app->layer);
pos = g_list_index (objects, app->selected_objects->data);
ges_simple_layer_move_object (GES_SIMPLE_LAYER (app->layer),
GES_CLIP (app->selected_objects->data), pos - 1);
for (tmp = objects; tmp; tmp = tmp->next) {
gst_object_unref (tmp->data);
}
GST_FIXME ("This function is not implement, please implement it :)");
}
static void
@ -1145,8 +1119,10 @@ app_add_file (App * app, gchar * uri)
GST_DEBUG ("adding file %s", uri);
clip = GES_CLIP (ges_uri_clip_new (uri));
ges_timeline_element_set_start (GES_TIMELINE_ELEMENT (clip),
ges_layer_get_duration (app->layer));
ges_simple_layer_add_object (GES_SIMPLE_LAYER (app->layer), clip, -1);
ges_layer_add_clip (app->layer, clip);
}
static void
@ -1184,9 +1160,9 @@ app_add_title (App * app)
GST_DEBUG ("adding title");
clip = GES_CLIP (ges_title_clip_new ());
g_object_set (G_OBJECT (clip), "duration", GST_SECOND, NULL);
ges_simple_layer_add_object (GES_SIMPLE_LAYER (app->layer), clip, -1);
g_object_set (G_OBJECT (clip), "duration", GST_SECOND,
"start", ges_layer_get_duration (app->layer), NULL);
ges_layer_add_clip (app->layer, clip);
}
static void
@ -1197,23 +1173,16 @@ app_add_test (App * app)
GST_DEBUG ("adding test");
clip = GES_CLIP (ges_test_clip_new ());
g_object_set (G_OBJECT (clip), "duration", GST_SECOND, NULL);
g_object_set (G_OBJECT (clip), "duration", GST_SECOND,
"start", ges_layer_get_duration (app->layer), NULL);
ges_simple_layer_add_object (GES_SIMPLE_LAYER (app->layer), clip, -1);
ges_layer_add_clip (app->layer, clip);
}
static void
app_add_transition (App * app)
{
GESClip *clip;
GST_DEBUG ("adding transition");
clip = GES_CLIP (ges_transition_clip_new
(GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE));
g_object_set (G_OBJECT (clip), "duration", GST_SECOND, NULL);
ges_simple_layer_add_object (GES_SIMPLE_LAYER (app->layer), clip, -1);
GST_FIXME ("This function is not implement, please implement it :)");
}
static void
@ -1334,7 +1303,7 @@ app_new (void)
if (!(ges_timeline_add_track (ret->timeline, v)))
goto fail;
if (!(ret->layer = (GESLayer *) ges_simple_layer_new ()))
if (!(ret->layer = ges_layer_new ()))
goto fail;
if (!(ges_timeline_add_layer (ret->timeline, ret->layer)))

View file

@ -76,8 +76,8 @@ main (int argc, gchar ** argv)
tracka = GES_TRACK (ges_audio_track_new ());
trackv = GES_TRACK (ges_video_track_new ());
layer1 = (GESLayer *) ges_simple_layer_new ();
layer2 = (GESLayer *) ges_simple_layer_new ();
layer1 = ges_layer_new ();
layer2 = ges_layer_new ();
g_object_set (layer2, "priority", 1, NULL);
if (!ges_timeline_add_layer (timeline, layer1) ||
@ -92,7 +92,7 @@ main (int argc, gchar ** argv)
/* Add the main audio/video file */
src = ges_uri_clip_new (uri);
g_free (uri);
g_object_set (src, "in-point", inpoint * GST_SECOND,
g_object_set (src, "start", 0, "in-point", inpoint * GST_SECOND,
"duration", duration * GST_SECOND, "mute", mute, NULL);
ges_layer_add_clip (layer1, GES_CLIP (src));
}

View file

@ -49,7 +49,7 @@ main (int argc, gchar ** argv)
tracka = GES_TRACK (ges_audio_track_new ());
/* We are only going to be doing one layer of clips */
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
/* Add the tracks and the layer to the timeline */
if (!ges_timeline_add_layer (timeline, layer))
@ -67,9 +67,8 @@ main (int argc, gchar ** argv)
g_assert (src);
g_free (uri);
g_object_set (src, "duration", GST_SECOND, NULL);
/* Since we're using a GESSimpleLayer, objects will be automatically
* appended to the end of the layer */
g_object_set (src, "start", ges_layer_get_duration (layer),
"duration", GST_SECOND, NULL);
ges_layer_add_clip (layer, (GESClip *) src);
}

View file

@ -104,7 +104,7 @@ main (int argc, gchar ** argv)
tracka = GES_TRACK (ges_audio_track_new ());
/* We are only going to be doing one layer of clips */
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
/* Add the tracks and the layer to the timeline */
if (!ges_timeline_add_layer (timeline, layer))
@ -122,7 +122,8 @@ main (int argc, gchar ** argv)
g_assert (src);
g_free (uri);
g_object_set (src, "duration", GST_SECOND, NULL);
g_object_set (src, "start", ges_layer_get_duration (layer),
"duration", GST_SECOND, NULL);
/* Since we're using a GESSimpleLayer, objects will be automatically
* appended to the end of the layer */
ges_layer_add_clip (layer, (GESClip *) src);

View file

@ -83,7 +83,7 @@ create_timeline (void)
tracka = GES_TRACK (ges_audio_track_new ());
trackv = GES_TRACK (ges_video_track_new ());
layer = (GESLayer *) ges_simple_layer_new ();
layer = ges_layer_new ();
/* Add the tracks and the layer to the timeline */
if (!ges_timeline_add_layer (timeline, layer) ||
@ -95,9 +95,9 @@ create_timeline (void)
src = GES_CLIP (ges_test_clip_new ());
g_object_set (src,
"vpattern", GES_VIDEO_TEST_PATTERN_SNOW,
"duration", 10 * GST_SECOND, NULL);
"start", 0, "duration", 10 * GST_SECOND, NULL);
ges_simple_layer_add_object ((GESSimpleLayer *) layer, GES_CLIP (src), 0);
ges_layer_add_clip (layer, GES_CLIP (src));
pipeline = ges_pipeline_new ();

View file

@ -178,7 +178,7 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri)
return timeline;
/* We are only going to be doing one layer of clips */
layer = (GESLayer *) ges_simple_layer_new ();
layer = (GESLayer *) ges_layer_new ();
/* Add the tracks and the layer to the timeline */
if (!ges_timeline_add_layer (timeline, layer))
@ -287,8 +287,8 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri)
g_free (uri);
}
/* Since we're using a GESSimpleLayer, objects will be automatically
* appended to the end of the layer */
g_object_set (G_OBJECT (clip), "start", ges_layer_get_duration (layer),
NULL);
ges_layer_add_clip (layer, clip);
}