ges: Move supported formats from filesource to timelineobject

This is usefull by any subclass of GESTimelineObject
 + Bind it in python
 + Fix the keyfile formatter tests

API: ges_timeline_object_set_supported_formats
API: ges_timeline_object_get_supported_formats
This commit is contained in:
Thibault Saunier 2011-12-01 00:18:30 -03:00
parent 8d15025aae
commit 6386247cc4
6 changed files with 91 additions and 25 deletions

View file

@ -674,6 +674,15 @@
)
)
(define-method set_supported_formats
(of-object "GESTimelineObject")
(c-name "ges_timeline_object_set_supported_formats")
(return-type "none")
(parameters
'("GESTrackType" "supportedformats")
)
)
(define-method set_is_image
(of-object "GESTimelineFileSource")
(c-name "ges_timeline_filesource_set_is_image")
@ -707,6 +716,12 @@
(return-type "const-gchar*")
)
(define-method get_supported_formats
(of-object "GESTimelineObject")
(c-name "ges_timeline_object_get_supported_formats")
(return-type "GESTrackType")
)
(define-method get_supported_formats
(of-object "GESTimelineFileSource")
(c-name "ges_timeline_filesource_get_supported_formats")

View file

@ -301,6 +301,8 @@ ges_timeline_object_get_top_effects
ges_timeline_object_get_top_effect_position
ges_timeline_object_move_to_layer
ges_timeline_object_set_top_effect_priority
ges_timeline_object_set_supported_formats
ges_timeline_object_get_supported_formats
<SUBSECTION Standard>
GES_TIMELINE_OBJECT_DURATION
GES_TIMELINE_OBJECT_INPOINT

View file

@ -44,10 +44,6 @@ struct _GESTimelineFileSourcePrivate
gboolean is_image;
guint64 maxduration;
/* The formats supported by this filesource
* TODO : Could maybe be moved to a parent class */
GESTrackType supportedformats;
};
enum
@ -56,7 +52,6 @@ enum
PROP_URI,
PROP_MAX_DURATION,
PROP_MUTE,
PROP_SUPPORTED_FORMATS,
PROP_IS_IMAGE,
};
@ -81,9 +76,6 @@ ges_timeline_filesource_get_property (GObject * object, guint property_id,
case PROP_MAX_DURATION:
g_value_set_uint64 (value, priv->maxduration);
break;
case PROP_SUPPORTED_FORMATS:
g_value_set_flags (value, priv->supportedformats);
break;
case PROP_IS_IMAGE:
g_value_set_boolean (value, priv->is_image);
break;
@ -109,10 +101,6 @@ ges_timeline_filesource_set_property (GObject * object, guint property_id,
ges_timeline_filesource_set_max_duration (tfs,
g_value_get_uint64 (value));
break;
case PROP_SUPPORTED_FORMATS:
ges_timeline_filesource_set_supported_formats (tfs,
g_value_get_flags (value));
break;
case PROP_IS_IMAGE:
ges_timeline_filesource_set_is_image (tfs, g_value_get_boolean (value));
break;
@ -175,16 +163,6 @@ ges_timeline_filesource_class_init (GESTimelineFileSourceClass * klass)
g_param_spec_boolean ("mute", "Mute", "Mute audio track",
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
* GESTimelineFileSource:supported-formats:
*
* The formats supported by the filesource.
*/
g_object_class_install_property (object_class, PROP_SUPPORTED_FORMATS,
g_param_spec_flags ("supported-formats", "Supported formats",
"Formats supported by the file", GES_TYPE_TRACK_TYPE,
GES_TRACK_TYPE_UNKNOWN, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
* GESTimelineFileSource:is-image:
*
@ -276,7 +254,8 @@ void
ges_timeline_filesource_set_supported_formats (GESTimelineFileSource * self,
GESTrackType supportedformats)
{
self->priv->supportedformats = supportedformats;
ges_timeline_object_set_supported_formats (GES_TIMELINE_OBJECT (self),
supportedformats);
}
/**
@ -360,7 +339,7 @@ ges_timeline_filesource_get_uri (GESTimelineFileSource * self)
GESTrackType
ges_timeline_filesource_get_supported_formats (GESTimelineFileSource * self)
{
return self->priv->supportedformats;
return ges_timeline_object_get_supported_formats (GES_TIMELINE_OBJECT (self));
}
static GESTrackObject *
@ -370,7 +349,7 @@ ges_timeline_filesource_create_track_object (GESTimelineObject * obj,
GESTimelineFileSourcePrivate *priv = GES_TIMELINE_FILE_SOURCE (obj)->priv;
GESTrackObject *res;
if (!(priv->supportedformats & track->type)) {
if (!(ges_timeline_object_get_supported_formats (obj) & track->type)) {
GST_DEBUG ("We don't support this track format");
return NULL;
}

View file

@ -124,6 +124,9 @@ struct _GESTimelineObjectPrivate
GList *mappings;
guint nb_effects;
/* The formats supported by this TimelineObject */
GESTrackType supportedformats;
};
enum
@ -135,6 +138,7 @@ enum
PROP_PRIORITY,
PROP_HEIGHT,
PROP_LAYER,
PROP_SUPPORTED_FORMATS,
PROP_LAST
};
@ -165,6 +169,9 @@ ges_timeline_object_get_property (GObject * object, guint property_id,
case PROP_LAYER:
g_value_set_object (value, tobj->priv->layer);
break;
case PROP_SUPPORTED_FORMATS:
g_value_set_flags (value, tobj->priv->supportedformats);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@ -192,6 +199,10 @@ ges_timeline_object_set_property (GObject * object, guint property_id,
ges_timeline_object_set_priority_internal (tobj,
g_value_get_uint (value));
break;
case PROP_SUPPORTED_FORMATS:
ges_timeline_object_set_supported_formats (tobj,
g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@ -268,6 +279,21 @@ ges_timeline_object_class_init (GESTimelineObjectClass * klass)
g_object_class_install_property (object_class, PROP_HEIGHT,
properties[PROP_HEIGHT]);
/**
* GESTimelineObject:supported-formats:
*
* The formats supported by the object.
*
* Since: 0.10.XX
*/
properties[PROP_SUPPORTED_FORMATS] = g_param_spec_flags ("supported-formats",
"Supported formats", "Formats supported by the file",
GES_TYPE_TRACK_TYPE, GES_TRACK_TYPE_UNKNOWN,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_SUPPORTED_FORMATS,
properties[PROP_SUPPORTED_FORMATS]);
/**
* GESTimelineObject:layer
*
@ -1173,6 +1199,38 @@ update_height (GESTimelineObject * object)
}
}
/**
* ges_timeline_object_set_supported_formats:
* @self: the #GESTimelineObject to set supported formats on
* @supportedformats: the #GESTrackType defining formats supported by @self
*
* Sets the formats supported by the file.
*
* Since: 0.10.XX
*/
void
ges_timeline_object_set_supported_formats (GESTimelineObject * self,
GESTrackType supportedformats)
{
self->priv->supportedformats = supportedformats;
}
/**
* ges_timeline_object_get_supported_formats:
* @self: the #GESTimelineObject
*
* Get the formats supported by @self.
*
* Returns: The formats supported by @self.
*
* Since: 0.10.XX
*/
GESTrackType
ges_timeline_object_get_supported_formats (GESTimelineObject * self)
{
return self->priv->supportedformats;
}
/*
* PROPERTY NOTIFICATIONS FROM TRACK OBJECTS
*/

View file

@ -24,6 +24,7 @@
#include <glib-object.h>
#include <gst/gst.h>
#include <ges/ges-types.h>
#include <ges/ges-track.h>
G_BEGIN_DECLS
@ -282,6 +283,13 @@ ges_timeline_object_set_top_effect_priority (GESTimelineObject *object,
GESTrackEffect *effect,
guint newpriority);
GESTrackType
ges_timeline_object_get_supported_formats (GESTimelineObject * self);
void
ges_timeline_object_set_supported_formats (GESTimelineObject * self,
GESTrackType supportedformats);
G_END_DECLS
#endif /* _GES_TIMELINE_OBJECT */

View file

@ -119,6 +119,7 @@ GST_START_TEST (test_keyfile_save)
KEY ("Object0", "in-point", "0");
KEY ("Object0", "duration", "2000000000");
KEY ("Object0", "priority", "2");
KEY ("Object0", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
KEY ("Object0", "mute", "false");
KEY ("Object0", "vpattern", "100% Black");
KEY ("Object0", "freq", "440");
@ -138,6 +139,7 @@ GST_START_TEST (test_keyfile_save)
KEY ("Object1", "in-point", "0");
KEY ("Object1", "duration", "500000000");
KEY ("Object1", "priority", "1");
KEY ("Object1", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
KEY ("Object1", "vtype", "A bar moves from left to right");
COMPARE;
@ -152,6 +154,7 @@ GST_START_TEST (test_keyfile_save)
KEY ("Object2", "in-point", "0");
KEY ("Object2", "duration", "2000000000");
KEY ("Object2", "priority", "3");
KEY ("Object2", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
KEY ("Object2", "mute", "false");
KEY ("Object2", "vpattern", "100% Black");
KEY ("Object2", "freq", "440");
@ -182,6 +185,7 @@ GST_START_TEST (test_keyfile_save)
KEY ("Object3", "in-point", "0");
KEY ("Object3", "duration", "1000000000");
KEY ("Object3", "priority", "0");
KEY ("Object3", "supported-formats", "GES_TRACK_TYPE_UNKNOWN");
KEY ("Object3", "mute", "false");
KEY ("Object3", "text", "\"the\\\\ quick\\\\ brown\\\\ fox\"");
KEY ("Object3", "font-desc", "\"Serif\\\\ 36\"");