ges: Remove custom clip

If you want a custom clip then you have to subclass GESClip,
This class was pre historicall and only used for testing purposes, we
have GESTestClip for that.

https://bugzilla.gnome.org/show_bug.cgi?id=706855
This commit is contained in:
Thibault Saunier 2013-08-26 19:15:08 -04:00
parent a6cf479e49
commit 13aeda606a
13 changed files with 46 additions and 550 deletions

View file

@ -86,7 +86,6 @@ platform as well as Windows. It is released under the GNU Library General Public
<chapter> <chapter>
<title>Convenience classes</title> <title>Convenience classes</title>
<xi:include href="xml/ges-pipeline.xml"/> <xi:include href="xml/ges-pipeline.xml"/>
<xi:include href="xml/ges-custom-source-clip.xml"/>
</chapter> </chapter>
<chapter> <chapter>

View file

@ -621,24 +621,6 @@ ges_transition_clip_get_type
</SECTION> </SECTION>
<SECTION>
<FILE>ges-custom-source-clip</FILE>
<TITLE>GESCustomSourceClip</TITLE>
GESCustomSourceClip
GESFillTrackElementUserFunc
ges_custom_source_clip_new
<SUBSECTION Standard>
GESCustomSourceClipClass
ges_custom_source_clip_get_type
GESCustomSourceClipPrivate
GES_CUSTOM_SOURCE_CLIP
GES_CUSTOM_SOURCE_CLIP_CLASS
GES_CUSTOM_SOURCE_CLIP_GET_CLASS
GES_IS_CUSTOM_SOURCE_CLIP
GES_IS_CUSTOM_SOURCE_CLIP_CLASS
GES_TYPE_CUSTOM_SOURCE_CLIP
</SECTION>
<SECTION> <SECTION>
<FILE>ges-simple-layer</FILE> <FILE>ges-simple-layer</FILE>
<TITLE>GESSimpleLayer</TITLE> <TITLE>GESSimpleLayer</TITLE>
@ -1026,7 +1008,6 @@ ges_asset_request_async
ges_asset_request_finish ges_asset_request_finish
ges_asset_extract ges_asset_extract
ges_list_assets ges_list_assets
ges_asset_custom_source_clip_new
<SUBSECTION Standard> <SUBSECTION Standard>
GESAssetPrivate GESAssetPrivate
GES_ASSET GES_ASSET

View file

@ -1,7 +1,6 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <ges/ges.h> #include <ges/ges.h>
ges_custom_source_clip_get_type
ges_formatter_get_type ges_formatter_get_type
ges_simple_layer_get_type ges_simple_layer_get_type
%ges_text_halign_get_type %ges_text_halign_get_type

View file

@ -11,7 +11,6 @@ libges_@GST_API_VERSION@_la_SOURCES = \
$(built_source_make) \ $(built_source_make) \
ges.c \ ges.c \
ges-enums.c \ ges-enums.c \
ges-custom-source-clip.c \
ges-meta-container.c \ ges-meta-container.c \
ges-simple-layer.c \ ges-simple-layer.c \
ges-timeline.c \ ges-timeline.c \
@ -74,7 +73,6 @@ libges_@GST_API_VERSION@include_HEADERS = \
ges.h \ ges.h \
ges-enums.h \ ges-enums.h \
ges-gerror.h \ ges-gerror.h \
ges-custom-source-clip.h \
ges-meta-container.h \ ges-meta-container.h \
ges-simple-layer.h \ ges-simple-layer.h \
ges-timeline.h \ ges-timeline.h \

View file

@ -1,267 +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-custom-source-clip
* @short_description: Convenience GESSourceClip
*
* #GESCustomSourceClip allows creating #GESSourceClip(s) without the
* need to subclass.
*
* Its usage should be limited to testing and prototyping purposes.
*
* To instanciate a asset to extract GESCustomSourceClip-s the expected
* ID is:
* 'PointerToFuncAsInt!PointerToUDataAsInt'
*
* You should use the #ges_asset_custom_source_clip_new helper to create
* a new GESAsset letting you extract GESCustomSourceClip.
*/
#include "ges-internal.h"
#include "ges-custom-source-clip.h"
#include "ges-source-clip.h"
#include "ges-source.h"
#include "ges-extractable.h"
enum
{
PROP_0,
PROP_FILL_FUNC,
PROP_USER_DATA
};
struct _GESCustomSourceClipPrivate
{
GESFillTrackElementUserFunc filltrackelementfunc;
gpointer user_data;
};
static void ges_extractable_interface_init (GESExtractableInterface * iface);
G_DEFINE_TYPE_WITH_CODE (GESCustomSourceClip, ges_custom_source_clip,
GES_TYPE_SOURCE_CLIP,
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
ges_extractable_interface_init));
static GParameter *
extractable_get_parameters_from_id (const gchar * id, guint * n_params)
{
gchar **func_udata;
GParameter *params = g_new0 (GParameter, 3);
*n_params = 3;
/* We already know that we have a valid ID here */
func_udata = g_strsplit (id, "!", -1);
params[0].name = "fill-func";
g_value_init (&params[0].value, G_TYPE_POINTER);
g_value_set_pointer (&params[0].value,
GUINT_TO_POINTER (g_ascii_strtoll (func_udata[0], NULL, 10)));
params[1].name = "user-data";
g_value_init (&params[1].value, G_TYPE_POINTER);
g_value_set_pointer (&params[1].value,
GUINT_TO_POINTER (g_ascii_strtoll (func_udata[1], NULL, 10)));
params[2].name = "supported-formats";
g_value_init (&params[2].value, GES_TYPE_TRACK_TYPE);
g_value_set_flags (&params[2].value, GES_TRACK_TYPE_CUSTOM);
g_strfreev (func_udata);
return params;
}
static gchar *
extractable_check_id (GType type, const gchar * id)
{
gchar *ret, **strv = g_strsplit (id, "!", -1);
if (g_strv_length (strv) != 2) {
g_strfreev (strv);
return NULL;
}
/* Remove any whitespace */
strv[0] = g_strstrip (strv[0]);
strv[1] = g_strstrip (strv[1]);
ret = g_strjoinv ("!", strv);
g_strfreev (strv);
return ret;
}
static gchar *
extractable_get_id (GESExtractable * self)
{
GESCustomSourceClipPrivate *priv = GES_CUSTOM_SOURCE_CLIP (self)->priv;
return g_strdup_printf ("%i!%i", GPOINTER_TO_INT (priv->filltrackelementfunc),
GPOINTER_TO_INT (priv->user_data));
}
static void
ges_extractable_interface_init (GESExtractableInterface * iface)
{
iface->check_id = (GESExtractableCheckId) extractable_check_id;
iface->get_id = extractable_get_id;
iface->get_parameters_from_id = extractable_get_parameters_from_id;
}
static gboolean
ges_custom_source_clip_fill_track_element (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj);
static GESTrackElement *
ges_custom_source_clip_create_track_element (GESClip * clip, GESTrackType type)
{
return g_object_new (GES_TYPE_SOURCE, "track-type", type, NULL);
}
static void
_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
GESCustomSourceClipPrivate *priv = GES_CUSTOM_SOURCE_CLIP (object)->priv;
switch (property_id) {
case PROP_FILL_FUNC:
priv->filltrackelementfunc = g_value_get_pointer (value);
break;
case PROP_USER_DATA:
priv->user_data = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
ges_custom_source_clip_class_init (GESCustomSourceClipClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GESClipClass *clip_class = GES_CLIP_CLASS (klass);
g_type_class_add_private (klass, sizeof (GESCustomSourceClipPrivate));
clip_class->fill_track_element = ges_custom_source_clip_fill_track_element;
clip_class->create_track_element =
ges_custom_source_clip_create_track_element;
object_class->set_property = _set_property;
/**
* GESCustomSourceClip:fill-func:
*
* The function pointer to create the TrackElement content
*/
g_object_class_install_property (object_class, PROP_FILL_FUNC,
g_param_spec_pointer ("fill-func", "Fill func",
"A pointer to a GESFillTrackElementUserFunc",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
/**
* GESCustomSourceClip:user-data:
*
* The user data that will be passed
*/
g_object_class_install_property (object_class, PROP_USER_DATA,
g_param_spec_pointer ("user-data", "User data",
"The user data pointer that will be passed when creating TrackElements",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
static void
ges_custom_source_clip_init (GESCustomSourceClip * self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
GES_TYPE_CUSTOM_SOURCE_CLIP, GESCustomSourceClipPrivate);
}
static gboolean
ges_custom_source_clip_fill_track_element (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj)
{
gboolean res;
GESCustomSourceClipPrivate *priv;
GST_DEBUG ("Calling callback (timelineobj:%p, trackelement:%p, gnlobj:%p)",
clip, track_element, gnlobj);
priv = GES_CUSTOM_SOURCE_CLIP (clip)->priv;
res = priv->filltrackelementfunc (clip, track_element, gnlobj,
priv->user_data);
GST_DEBUG ("Returning res:%d", res);
return res;
}
/**
* ges_custom_source_clip_new:
* @func: (scope notified): The #GESFillTrackElementUserFunc that will be used to fill the track
* objects.
* @user_data: (closure): a gpointer that will be used when @func is called.
*
* Creates a new #GESCustomSourceClip.
*
* Returns: The new #GESCustomSourceClip.
*/
GESCustomSourceClip *
ges_custom_source_clip_new (GESFillTrackElementUserFunc func,
gpointer user_data)
{
GESCustomSourceClip *src;
GESAsset *asset = ges_asset_custom_source_clip_new (func, user_data);
src = GES_CUSTOM_SOURCE_CLIP (ges_asset_extract (asset, NULL));
gst_object_unref (asset);
return src;
}
/**
* ges_asset_custom_source_clip_new:
* @func: (scope notified): The #GESFillTrackElementUserFunc that will be used to fill the track
* objects.
* @user_data: (closure): a gpointer that will be used when @func is called.
*
* Helper constructor to instanciate a new #GESAsset from which you can
* extract #GESCustomSourceClip-s
*
* Returns: The new #GESAsset
*/
GESAsset *
ges_asset_custom_source_clip_new (GESFillTrackElementUserFunc func,
gpointer user_data)
{
GESAsset *asset;
gchar *id = g_strdup_printf ("%i!%i", GPOINTER_TO_INT (func),
GPOINTER_TO_INT (user_data));
asset = ges_asset_request (GES_TYPE_CUSTOM_SOURCE_CLIP, id, NULL);
g_free (id);
return asset;
}

View file

@ -1,111 +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_CUSTOM_SOURCE_CLIP
#define _GES_CUSTOM_SOURCE_CLIP
#include <glib-object.h>
#include <ges/ges-types.h>
#include <ges/ges-source-clip.h>
G_BEGIN_DECLS
#define GES_TYPE_CUSTOM_SOURCE_CLIP ges_custom_source_clip_get_type()
#define GES_CUSTOM_SOURCE_CLIP(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_CUSTOM_SOURCE_CLIP, GESCustomSourceClip))
#define GES_CUSTOM_SOURCE_CLIP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_CUSTOM_SOURCE_CLIP, GESCustomSourceClipClass))
#define GES_IS_CUSTOM_SOURCE_CLIP(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_CUSTOM_SOURCE_CLIP))
#define GES_IS_CUSTOM_SOURCE_CLIP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_CUSTOM_SOURCE_CLIP))
#define GES_CUSTOM_SOURCE_CLIP_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_CUSTOM_SOURCE_CLIP, GESCustomSourceClipClass))
typedef struct _GESCustomSourceClipPrivate GESCustomSourceClipPrivate;
/**
* GESFillTrackElementUserFunc:
* @object: the #GESClip controlling the track element
* @track_element: the #GESTrackElement
* @gnlobj: the GNonLin object that needs to be filled.
* @user_data: the gpointer to optional user data
*
* A function that will be called when the GNonLin object of a corresponding
* track element needs to be filled.
*
* The implementer of this function shall add the proper #GstElement to @gnlobj
* using gst_bin_add().
*
* Returns: TRUE if the implementer succesfully filled the @gnlobj, else #FALSE.
*/
typedef gboolean (*GESFillTrackElementUserFunc) (GESClip * object,
GESTrackElement * track_element,
GstElement * gnlobj,
gpointer user_data);
/**
* GESCustomSourceClip:
*
* Debugging custom timeline source
*/
struct _GESCustomSourceClip {
GESSourceClip parent;
/*< private >*/
GESCustomSourceClipPrivate *priv;
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
};
/**
* GESCustomSourceClipClass:
*/
struct _GESCustomSourceClipClass {
GESSourceClipClass parent_class;
/*< private >*/
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
};
GType ges_custom_source_clip_get_type (void);
GESCustomSourceClip*
ges_custom_source_clip_new (GESFillTrackElementUserFunc func,
gpointer user_data);
GESAsset*
ges_asset_custom_source_clip_new (GESFillTrackElementUserFunc func,
gpointer user_data);
G_END_DECLS
#endif /* _GES_CUSTOM_SOURCE_CLIP */

View file

@ -29,9 +29,6 @@
/* Type definitions */ /* Type definitions */
typedef struct _GESCustomSourceClip GESCustomSourceClip;
typedef struct _GESCustomSourceClipClass GESCustomSourceClipClass;
typedef struct _GESSimpleLayer GESSimpleLayer; typedef struct _GESSimpleLayer GESSimpleLayer;
typedef struct _GESSimpleLayerClass GESSimpleLayerClass; typedef struct _GESSimpleLayerClass GESSimpleLayerClass;

View file

@ -42,7 +42,6 @@
#include <ges/ges-base-transition-clip.h> #include <ges/ges-base-transition-clip.h>
#include <ges/ges-transition-clip.h> #include <ges/ges-transition-clip.h>
#include <ges/ges-effect-clip.h> #include <ges/ges-effect-clip.h>
#include <ges/ges-custom-source-clip.h>
#include <ges/ges-base-effect-clip.h> #include <ges/ges-base-effect-clip.h>
#include <ges/ges-uri-clip.h> #include <ges/ges-uri-clip.h>
#include <ges/ges-group.h> #include <ges/ges-group.h>

View file

@ -32,31 +32,12 @@ GST_START_TEST (test_ges_init)
GST_END_TEST; GST_END_TEST;
static gboolean
my_fill_track_func (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj, gpointer user_data)
{
GstElement *src;
GST_DEBUG ("timelineobj:%p, trackelement:%p, gnlobj:%p",
clip, track_element, gnlobj);
/* Let's just put a fakesource in for the time being */
src = gst_element_factory_make ("fakesrc", NULL);
/* If this fails... that means that there already was something
* in it */
fail_unless (gst_bin_add (GST_BIN (gnlobj), src));
return TRUE;
}
GST_START_TEST (test_ges_scenario) GST_START_TEST (test_ges_scenario)
{ {
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer, *tmp_layer; GESLayer *layer, *tmp_layer;
GESTrack *track; GESTrack *track;
GESCustomSourceClip *source; GESTestClip *source;
GESTrackElement *trackelement; GESTrackElement *trackelement;
GList *trackelements, *layers, *tracks; GList *trackelements, *layers, *tracks;
@ -85,7 +66,7 @@ GST_START_TEST (test_ges_scenario)
/* Give the Timeline a Track */ /* Give the Timeline a Track */
GST_DEBUG ("Create a Track"); GST_DEBUG ("Create a Track");
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
GST_DEBUG ("Add the track to the timeline"); GST_DEBUG ("Add the track to the timeline");
@ -98,7 +79,7 @@ GST_START_TEST (test_ges_scenario)
/* Create a source and add it to the Layer */ /* Create a source and add it to the Layer */
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
source = ges_custom_source_clip_new (my_fill_track_func, NULL); source = ges_test_clip_new ();
fail_unless (source != NULL); fail_unless (source != NULL);
/* The source will be floating before added to the layer... */ /* The source will be floating before added to the layer... */
@ -180,7 +161,7 @@ GST_START_TEST (test_ges_timeline_add_layer)
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer, *tmp_layer; GESLayer *layer, *tmp_layer;
GESTrack *track; GESTrack *track;
GESCustomSourceClip *s1, *s2, *s3; GESTestClip *s1, *s2, *s3;
GList *trackelements, *layers; GList *trackelements, *layers;
GESTrackElement *trackelement; GESTrackElement *trackelement;
@ -196,7 +177,7 @@ GST_START_TEST (test_ges_timeline_add_layer)
fail_unless (layer != NULL); fail_unless (layer != NULL);
/* Give the Timeline a Track */ /* Give the Timeline a Track */
GST_DEBUG ("Create a Track"); GST_DEBUG ("Create a Track");
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
GST_DEBUG ("Add the track to the timeline"); GST_DEBUG ("Add the track to the timeline");
@ -208,7 +189,7 @@ GST_START_TEST (test_ges_timeline_add_layer)
/* Create a source and add it to the Layer */ /* Create a source and add it to the Layer */
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s1 = ges_custom_source_clip_new (my_fill_track_func, NULL); s1 = ges_test_clip_new ();
fail_unless (s1 != NULL); fail_unless (s1 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s1)); tmp_layer = ges_clip_get_layer (GES_CLIP (s1));
@ -217,7 +198,7 @@ GST_START_TEST (test_ges_timeline_add_layer)
gst_object_unref (tmp_layer); gst_object_unref (tmp_layer);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s2 = ges_custom_source_clip_new (my_fill_track_func, NULL); s2 = ges_test_clip_new ();
fail_unless (s2 != NULL); fail_unless (s2 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s2)); tmp_layer = ges_clip_get_layer (GES_CLIP (s2));
@ -226,7 +207,7 @@ GST_START_TEST (test_ges_timeline_add_layer)
gst_object_unref (tmp_layer); gst_object_unref (tmp_layer);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s3 = ges_custom_source_clip_new (my_fill_track_func, NULL); s3 = ges_test_clip_new ();
fail_unless (s3 != NULL); fail_unless (s3 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s3)); tmp_layer = ges_clip_get_layer (GES_CLIP (s3));
@ -292,7 +273,7 @@ GST_START_TEST (test_ges_timeline_add_layer_first)
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer, *tmp_layer; GESLayer *layer, *tmp_layer;
GESTrack *track; GESTrack *track;
GESCustomSourceClip *s1, *s2, *s3; GESTestClip *s1, *s2, *s3;
GList *trackelements, *tmp, *layers; GList *trackelements, *tmp, *layers;
ges_init (); ges_init ();
@ -307,12 +288,12 @@ GST_START_TEST (test_ges_timeline_add_layer_first)
fail_unless (layer != NULL); fail_unless (layer != NULL);
/* Give the Timeline a Track */ /* Give the Timeline a Track */
GST_DEBUG ("Create a Track"); GST_DEBUG ("Create a Track");
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
/* Create a source and add it to the Layer */ /* Create a source and add it to the Layer */
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s1 = ges_custom_source_clip_new (my_fill_track_func, NULL); s1 = ges_test_clip_new ();
fail_unless (s1 != NULL); fail_unless (s1 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s1)); tmp_layer = ges_clip_get_layer (GES_CLIP (s1));
@ -320,7 +301,7 @@ GST_START_TEST (test_ges_timeline_add_layer_first)
gst_object_unref (tmp_layer); gst_object_unref (tmp_layer);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s2 = ges_custom_source_clip_new (my_fill_track_func, NULL); s2 = ges_test_clip_new ();
fail_unless (s2 != NULL); fail_unless (s2 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s2)); tmp_layer = ges_clip_get_layer (GES_CLIP (s2));
@ -328,7 +309,7 @@ GST_START_TEST (test_ges_timeline_add_layer_first)
gst_object_unref (tmp_layer); gst_object_unref (tmp_layer);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s3 = ges_custom_source_clip_new (my_fill_track_func, NULL); s3 = ges_test_clip_new ();
fail_unless (s3 != NULL); fail_unless (s3 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s3)); tmp_layer = ges_clip_get_layer (GES_CLIP (s3));
@ -393,7 +374,7 @@ GST_START_TEST (test_ges_timeline_remove_track)
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer, *tmp_layer; GESLayer *layer, *tmp_layer;
GESTrack *track; GESTrack *track;
GESCustomSourceClip *s1, *s2, *s3; GESTestClip *s1, *s2, *s3;
GESTrackElement *t1, *t2, *t3; GESTrackElement *t1, *t2, *t3;
GList *trackelements, *tmp, *layers; GList *trackelements, *tmp, *layers;
@ -409,12 +390,12 @@ GST_START_TEST (test_ges_timeline_remove_track)
fail_unless (layer != NULL); fail_unless (layer != NULL);
/* Give the Timeline a Track */ /* Give the Timeline a Track */
GST_DEBUG ("Create a Track"); GST_DEBUG ("Create a Track");
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
/* Create a source and add it to the Layer */ /* Create a source and add it to the Layer */
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s1 = ges_custom_source_clip_new (my_fill_track_func, NULL); s1 = ges_test_clip_new ();
fail_unless (s1 != NULL); fail_unless (s1 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s1)); tmp_layer = ges_clip_get_layer (GES_CLIP (s1));
@ -423,7 +404,7 @@ GST_START_TEST (test_ges_timeline_remove_track)
ASSERT_OBJECT_REFCOUNT (layer, "1 for the timeline", 1); ASSERT_OBJECT_REFCOUNT (layer, "1 for the timeline", 1);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s2 = ges_custom_source_clip_new (my_fill_track_func, NULL); s2 = ges_test_clip_new ();
fail_unless (s2 != NULL); fail_unless (s2 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s2)); tmp_layer = ges_clip_get_layer (GES_CLIP (s2));
@ -432,7 +413,7 @@ GST_START_TEST (test_ges_timeline_remove_track)
ASSERT_OBJECT_REFCOUNT (layer, "1 for the timeline", 1); ASSERT_OBJECT_REFCOUNT (layer, "1 for the timeline", 1);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s3 = ges_custom_source_clip_new (my_fill_track_func, NULL); s3 = ges_test_clip_new ();
fail_unless (s3 != NULL); fail_unless (s3 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s3)); tmp_layer = ges_clip_get_layer (GES_CLIP (s3));
@ -525,7 +506,7 @@ GST_END_TEST;
typedef struct typedef struct
{ {
GESCustomSourceClip **o1, **o2, **o3; GESTestClip **o1, **o2, **o3;
GESTrack **tr1, **tr2; GESTrack **tr1, **tr2;
} SelectTracksData; } SelectTracksData;
@ -550,7 +531,7 @@ GST_START_TEST (test_ges_timeline_multiple_tracks)
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer, *tmp_layer; GESLayer *layer, *tmp_layer;
GESTrack *track1, *track2; GESTrack *track1, *track2;
GESCustomSourceClip *s1, *s2, *s3; GESTestClip *s1, *s2, *s3;
GESTrackElement *t1, *t2, *t3; GESTrackElement *t1, *t2, *t3;
GList *trackelements, *tmp, *layers; GList *trackelements, *tmp, *layers;
SelectTracksData st_data = { &s1, &s2, &s3, &track1, &track2 }; SelectTracksData st_data = { &s1, &s2, &s3, &track1, &track2 };
@ -570,10 +551,10 @@ GST_START_TEST (test_ges_timeline_multiple_tracks)
fail_unless (layer != NULL); fail_unless (layer != NULL);
/* Give the Timeline a Track */ /* Give the Timeline a Track */
GST_DEBUG ("Create Track 1"); GST_DEBUG ("Create Track 1");
track1 = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track1 = GES_TRACK (ges_video_track_new ());
fail_unless (track1 != NULL); fail_unless (track1 != NULL);
GST_DEBUG ("Create Track 2"); GST_DEBUG ("Create Track 2");
track2 = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track2 = GES_TRACK (ges_video_track_new ());
fail_unless (track2 != NULL); fail_unless (track2 != NULL);
GST_DEBUG ("Add the track 1 to the timeline"); GST_DEBUG ("Add the track 1 to the timeline");
@ -590,7 +571,7 @@ GST_START_TEST (test_ges_timeline_multiple_tracks)
/* Create a source and add it to the Layer */ /* Create a source and add it to the Layer */
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s1 = ges_custom_source_clip_new (my_fill_track_func, NULL); s1 = ges_test_clip_new ();
fail_unless (s1 != NULL); fail_unless (s1 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s1)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s1)); tmp_layer = ges_clip_get_layer (GES_CLIP (s1));
@ -598,7 +579,7 @@ GST_START_TEST (test_ges_timeline_multiple_tracks)
gst_object_unref (tmp_layer); gst_object_unref (tmp_layer);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s2 = ges_custom_source_clip_new (my_fill_track_func, NULL); s2 = ges_test_clip_new ();
fail_unless (s2 != NULL); fail_unless (s2 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s2)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s2)); tmp_layer = ges_clip_get_layer (GES_CLIP (s2));
@ -606,7 +587,7 @@ GST_START_TEST (test_ges_timeline_multiple_tracks)
gst_object_unref (tmp_layer); gst_object_unref (tmp_layer);
GST_DEBUG ("Creating a source"); GST_DEBUG ("Creating a source");
s3 = ges_custom_source_clip_new (my_fill_track_func, NULL); s3 = ges_test_clip_new ();
fail_unless (s3 != NULL); fail_unless (s3 != NULL);
fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3))); fail_unless (ges_layer_add_clip (layer, GES_CLIP (s3)));
tmp_layer = ges_clip_get_layer (GES_CLIP (s3)); tmp_layer = ges_clip_get_layer (GES_CLIP (s3));

View file

@ -21,24 +21,6 @@
#include <ges/ges.h> #include <ges/ges.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
static gboolean
my_fill_track_func (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj, gpointer user_data)
{
GstElement *src;
GST_DEBUG ("timelineobj:%p, trackelementec:%p, gnlobj:%p",
clip, track_element, gnlobj);
/* Let's just put a fakesource in for the time being */
src = gst_element_factory_make ("fakesrc", NULL);
/* If this fails... that means that there already was something
* in it */
fail_unless (gst_bin_add (GST_BIN (gnlobj), src));
return TRUE;
}
GST_START_TEST (test_object_properties) GST_START_TEST (test_object_properties)
{ {
GESClip *clip; GESClip *clip;
@ -49,7 +31,7 @@ GST_START_TEST (test_object_properties)
ges_init (); ges_init ();
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
layer = ges_layer_new (); layer = ges_layer_new ();
@ -59,7 +41,7 @@ GST_START_TEST (test_object_properties)
fail_unless (ges_timeline_add_layer (timeline, layer)); fail_unless (ges_timeline_add_layer (timeline, layer));
fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (ges_timeline_add_track (timeline, track));
clip = (GESClip *) ges_custom_source_clip_new (my_fill_track_func, NULL); clip = (GESClip *) ges_test_clip_new ();
fail_unless (clip != NULL); fail_unless (clip != NULL);
/* Set some properties */ /* Set some properties */

View file

@ -23,25 +23,6 @@
#define LAYER_HEIGHT 1000 #define LAYER_HEIGHT 1000
static gboolean
my_fill_track_func (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj, gpointer user_data)
{
GstElement *src;
GST_DEBUG ("timelineobj:%p, trackelementec:%p, gnlobj:%p",
clip, track_element, gnlobj);
/* Let's just put a fakesource in for the time being */
src = gst_element_factory_make ("fakesrc", NULL);
/* If this fails... that means that there already was something
* in it */
fail_unless (gst_bin_add (GST_BIN (gnlobj), src));
return TRUE;
}
GST_START_TEST (test_layer_properties) GST_START_TEST (test_layer_properties)
{ {
GESTimeline *timeline; GESTimeline *timeline;
@ -65,11 +46,11 @@ GST_START_TEST (test_layer_properties)
fail_unless (ges_timeline_add_layer (timeline, layer)); fail_unless (ges_timeline_add_layer (timeline, layer));
fail_if (g_object_is_floating (layer)); fail_if (g_object_is_floating (layer));
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (ges_timeline_add_track (timeline, track));
clip = (GESClip *) ges_custom_source_clip_new (my_fill_track_func, NULL); clip = (GESClip *) ges_test_clip_new ();
fail_unless (clip != NULL); fail_unless (clip != NULL);
/* Set some properties */ /* Set some properties */
@ -162,13 +143,13 @@ GST_START_TEST (test_layer_priorities)
fail_unless (track != NULL); fail_unless (track != NULL);
fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (ges_timeline_add_track (timeline, track));
clip1 = GES_CLIP (ges_custom_source_clip_new (my_fill_track_func, NULL)); clip1 = GES_CLIP (ges_test_clip_new ());
ges_clip_set_supported_formats (clip1, ges_clip_set_supported_formats (clip1,
GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO); GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO);
clip2 = GES_CLIP (ges_custom_source_clip_new (my_fill_track_func, NULL)); clip2 = GES_CLIP (ges_test_clip_new ());
ges_clip_set_supported_formats (clip2, ges_clip_set_supported_formats (clip2,
GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO); GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO);
clip3 = GES_CLIP (ges_custom_source_clip_new (my_fill_track_func, NULL)); clip3 = GES_CLIP (ges_test_clip_new ());
ges_clip_set_supported_formats (clip3, ges_clip_set_supported_formats (clip3,
GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO); GES_TRACK_TYPE_AUDIO | GES_TRACK_TYPE_VIDEO);
fail_unless (clip1 != NULL); fail_unless (clip1 != NULL);

View file

@ -21,31 +21,12 @@
#include <ges/ges.h> #include <ges/ges.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
static gboolean
my_fill_track_func (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj, gpointer user_data)
{
GstElement *src;
GST_DEBUG ("timelineobj:%p, trackelementec:%p, gnlobj:%p",
clip, track_element, gnlobj);
/* Let's just put a fakesource in for the time being */
src = gst_element_factory_make ("fakesrc", NULL);
/* If this fails... that means that there already was something
* in it */
fail_unless (gst_bin_add (GST_BIN (gnlobj), src));
return TRUE;
}
GST_START_TEST (test_gsl_add) GST_START_TEST (test_gsl_add)
{ {
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer; GESLayer *layer;
GESTrack *track; GESTrack *track;
GESCustomSourceClip *source; GESTestClip *source;
GESClip *source2; GESClip *source2;
gint result; gint result;
@ -56,10 +37,10 @@ GST_START_TEST (test_gsl_add)
timeline = ges_timeline_new (); timeline = ges_timeline_new ();
layer = (GESLayer *) ges_simple_layer_new (); layer = (GESLayer *) ges_simple_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer)); fail_unless (ges_timeline_add_layer (timeline, layer));
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (ges_timeline_add_track (timeline, track));
source = ges_custom_source_clip_new (my_fill_track_func, NULL); source = ges_test_clip_new ();
fail_unless (source != NULL); fail_unless (source != NULL);
g_object_set (source, "duration", GST_SECOND, "start", (guint64) 42, NULL); g_object_set (source, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source), GST_SECOND); fail_unless_equals_uint64 (_DURATION (source), GST_SECOND);
@ -115,7 +96,7 @@ GST_START_TEST (test_gsl_move_simple)
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer; GESLayer *layer;
GESTrack *track; GESTrack *track;
GESCustomSourceClip *source1, *source2; GESTestClip *source1, *source2;
siginfo info = { 0, 0 }; siginfo info = { 0, 0 };
ges_init (); ges_init ();
@ -130,10 +111,10 @@ GST_START_TEST (test_gsl_move_simple)
(object_moved_cb), &info); (object_moved_cb), &info);
/* Create two 1s sources */ /* Create two 1s sources */
source1 = ges_custom_source_clip_new (my_fill_track_func, NULL); source1 = ges_test_clip_new ();
g_object_set (source1, "duration", GST_SECOND, "start", (guint64) 42, NULL); g_object_set (source1, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND); fail_unless_equals_uint64 (_DURATION (source1), GST_SECOND);
source2 = ges_custom_source_clip_new (my_fill_track_func, NULL); source2 = ges_test_clip_new ();
g_object_set (source2, "duration", GST_SECOND, "start", (guint64) 42, NULL); g_object_set (source2, "duration", GST_SECOND, "start", (guint64) 42, NULL);
fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND); fail_unless_equals_uint64 (_DURATION (source2), GST_SECOND);

View file

@ -49,30 +49,6 @@
} \ } \
} }
static gboolean
my_fill_track_func (GESClip * clip,
GESTrackElement * track_element, GstElement * gnlobj, gpointer user_data)
{
GstElement *src;
GST_DEBUG ("timelineobj:%p, trackelementec:%p, gnlobj:%p",
clip, track_element, gnlobj);
/* Let's just put a fakesource in for the time being */
src = gst_element_factory_make ("fakesrc", NULL);
/* If this fails... that means that there already was something
* in it */
fail_unless (gst_bin_add (GST_BIN (gnlobj), src));
return TRUE;
}
static inline GESClip *
create_custom_clip (void)
{
return GES_CLIP (ges_custom_source_clip_new (my_fill_track_func, NULL));
}
GST_START_TEST (test_basic_timeline_edition) GST_START_TEST (test_basic_timeline_edition)
{ {
GESAsset *asset; GESAsset *asset;
@ -274,7 +250,7 @@ GST_START_TEST (test_snapping)
ges_init (); ges_init ();
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
timeline = ges_timeline_new (); timeline = ges_timeline_new ();
@ -282,9 +258,9 @@ GST_START_TEST (test_snapping)
fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (ges_timeline_add_track (timeline, track));
clip = GES_CONTAINER (create_custom_clip ()); clip = GES_CONTAINER (ges_test_clip_new ());
clip1 = GES_CONTAINER (create_custom_clip ()); clip1 = GES_CONTAINER (ges_test_clip_new ());
clip2 = GES_CONTAINER (create_custom_clip ()); clip2 = GES_CONTAINER (ges_test_clip_new ());
fail_unless (clip && clip1 && clip2); fail_unless (clip && clip1 && clip2);
@ -572,7 +548,7 @@ GST_START_TEST (test_timeline_edition_mode)
ges_init (); ges_init ();
track = ges_track_new (GES_TRACK_TYPE_CUSTOM, gst_caps_ref (GST_CAPS_ANY)); track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL); fail_unless (track != NULL);
timeline = ges_timeline_new (); timeline = ges_timeline_new ();
@ -580,9 +556,9 @@ GST_START_TEST (test_timeline_edition_mode)
fail_unless (ges_timeline_add_track (timeline, track)); fail_unless (ges_timeline_add_track (timeline, track));
clip = GES_CONTAINER (create_custom_clip ()); clip = GES_CONTAINER (ges_test_clip_new ());
clip1 = GES_CONTAINER (create_custom_clip ()); clip1 = GES_CONTAINER (ges_test_clip_new ());
clip2 = GES_CONTAINER (create_custom_clip ()); clip2 = GES_CONTAINER (ges_test_clip_new ());
fail_unless (clip && clip1 && clip2); fail_unless (clip && clip1 && clip2);