trackobject: Implement the GESExtractable interface

This commit is contained in:
Thibault Saunier 2012-11-19 23:42:47 -03:00
parent 04c8b4a7d9
commit ca0bcfcd50
3 changed files with 63 additions and 5 deletions

View file

@ -31,12 +31,18 @@
*/
#include "ges-internal.h"
#include "ges-extractable.h"
#include "ges-track-object.h"
#include "ges-timeline-object.h"
#include <gobject/gvaluecollector.h>
G_DEFINE_ABSTRACT_TYPE (GESTrackObject, ges_track_object,
G_TYPE_INITIALLY_UNOWNED);
static void ges_extractable_interface_init (GESExtractableInterface * iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GESTrackObject, ges_track_object,
G_TYPE_INITIALLY_UNOWNED,
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
ges_extractable_interface_init));
struct _GESTrackObjectPrivate
{
@ -371,6 +377,11 @@ ges_track_object_init (GESTrackObject * self)
priv->maxduration = GST_CLOCK_TIME_NONE;
}
static void
ges_extractable_interface_init (GESExtractableInterface * iface)
{
}
static inline gboolean
ges_track_object_set_start_internal (GESTrackObject * object, guint64 start)
{

View file

@ -89,6 +89,8 @@ struct _GESTrackObject {
GESTrackObjectPrivate *priv;
GESAsset *asset;
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING_LARGE];
};

View file

@ -24,12 +24,17 @@
*/
#include "ges-internal.h"
#include "ges-extractable.h"
#include "ges-track-object.h"
#include "ges-track-effect.h"
#include "ges-track-parse-launch-effect.h"
G_DEFINE_TYPE (GESTrackParseLaunchEffect, ges_track_parse_launch_effect,
GES_TYPE_TRACK_EFFECT);
static void ges_extractable_interface_init (GESExtractableInterface * iface);
G_DEFINE_TYPE_WITH_CODE (GESTrackParseLaunchEffect,
ges_track_parse_launch_effect, GES_TYPE_TRACK_EFFECT,
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
ges_extractable_interface_init));
static void ges_track_parse_launch_effect_dispose (GObject * object);
static void ges_track_parse_launch_effect_finalize (GObject * object);
@ -47,6 +52,46 @@ enum
PROP_BIN_DESCRIPTION,
};
static gchar *
extractable_check_id (GType type, const gchar * id, GError ** error)
{
GstElement *effect = gst_parse_bin_from_description (id, TRUE, error);
if (effect == NULL)
return NULL;
gst_object_unref (effect);
return g_strdup (id);
}
static GParameter *
extractable_get_parameters_from_id (const gchar * id, guint * n_params)
{
GParameter *params = g_new0 (GParameter, 2);
params[0].name = g_strdup ("bin-description");
g_value_init (&params[0].value, G_TYPE_STRING);
g_value_set_string (&params[0].value, id);
*n_params = 1;
return params;
}
static gchar *
extractable_get_id (GESExtractable * self)
{
return g_strdup (GES_TRACK_PARSE_LAUNCH_EFFECT (self)->priv->bin_description);
}
static void
ges_extractable_interface_init (GESExtractableInterface * iface)
{
iface->check_id = (GESExtractableCheckId) extractable_check_id;
iface->get_parameters_from_id = extractable_get_parameters_from_id;
iface->get_id = extractable_get_id;
}
static void
ges_track_parse_launch_effect_get_property (GObject * object,
guint property_id, GValue * value, GParamSpec * pspec)