mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
Add 'caps' property on Track
This commit is contained in:
parent
cafbc229e8
commit
d8444f3844
5 changed files with 50 additions and 5 deletions
|
@ -260,6 +260,10 @@ ensure_gnl_object (GESTrackObject * object)
|
|||
res =
|
||||
ges_timeline_object_fill_track_object (object->timelineobj, object,
|
||||
object->gnlobject);
|
||||
if (res) {
|
||||
/* Set some properties on the GnlObject */
|
||||
g_object_set (object->gnlobject, "caps", object->track->caps, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
object->valid = res;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <glib-object.h>
|
||||
#include <gst/gst.h>
|
||||
#include <ges/ges-types.h>
|
||||
#include <ges/ges-timeline-object.h>
|
||||
#include <ges/ges-track.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -31,11 +31,22 @@
|
|||
|
||||
G_DEFINE_TYPE (GESTrack, ges_track, GST_TYPE_BIN);
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_CAPS
|
||||
};
|
||||
|
||||
static void
|
||||
ges_track_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GESTrack *track = GES_TRACK (object);
|
||||
|
||||
switch (property_id) {
|
||||
case ARG_CAPS:
|
||||
gst_value_set_caps (value, track->caps);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
|
@ -45,7 +56,12 @@ static void
|
|||
ges_track_set_property (GObject * object, guint property_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GESTrack *track = GES_TRACK (object);
|
||||
|
||||
switch (property_id) {
|
||||
case ARG_CAPS:
|
||||
ges_track_set_caps (track, gst_value_get_caps (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
|
@ -81,6 +97,11 @@ ges_track_class_init (GESTrackClass * klass)
|
|||
object_class->set_property = ges_track_set_property;
|
||||
object_class->dispose = ges_track_dispose;
|
||||
object_class->finalize = ges_track_finalize;
|
||||
|
||||
g_object_class_install_property (object_class, ARG_CAPS,
|
||||
g_param_spec_boxed ("caps", "Caps",
|
||||
"Caps used to filter/choose the output stream",
|
||||
GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -93,9 +114,9 @@ ges_track_init (GESTrack * self)
|
|||
}
|
||||
|
||||
GESTrack *
|
||||
ges_track_new (void)
|
||||
ges_track_new (GstCaps * caps)
|
||||
{
|
||||
return g_object_new (GES_TYPE_TRACK, NULL);
|
||||
return g_object_new (GES_TYPE_TRACK, "caps", caps, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -106,6 +127,20 @@ ges_track_set_timeline (GESTrack * track, GESTimeline * timeline)
|
|||
track->timeline = timeline;
|
||||
}
|
||||
|
||||
void
|
||||
ges_track_set_caps (GESTrack * track, const GstCaps * caps)
|
||||
{
|
||||
GST_DEBUG ("track:%p, caps:%" GST_PTR_FORMAT, track, caps);
|
||||
|
||||
g_return_if_fail (GST_IS_CAPS (caps));
|
||||
|
||||
if (track->caps)
|
||||
gst_caps_unref (track->caps);
|
||||
track->caps = gst_caps_copy (caps);
|
||||
|
||||
/* FIXME : update all trackobjects ? */
|
||||
}
|
||||
|
||||
gboolean
|
||||
ges_track_add_object (GESTrack * track, GESTrackObject * object)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,8 @@ struct _GESTrack {
|
|||
|
||||
GESTimeline * timeline;
|
||||
|
||||
GstCaps * caps;
|
||||
|
||||
GstElement * composition; /* The composition associated with this track */
|
||||
};
|
||||
|
||||
|
@ -57,9 +59,10 @@ struct _GESTrackClass {
|
|||
|
||||
GType ges_track_get_type (void);
|
||||
|
||||
GESTrack* ges_track_new (void);
|
||||
GESTrack* ges_track_new (GstCaps * caps);
|
||||
|
||||
void ges_track_set_timeline (GESTrack * track, GESTimeline *timeline);
|
||||
void ges_track_set_caps (GESTrack * track, const GstCaps * caps);
|
||||
|
||||
gboolean ges_track_add_object (GESTrack * track, GESTrackObject * object);
|
||||
gboolean ges_track_remove_object (GESTrack * track, GESTrackObject * object);
|
||||
|
|
|
@ -70,12 +70,14 @@ GST_START_TEST (test_ges_scenario)
|
|||
|
||||
/* Give the Timeline a Track */
|
||||
|
||||
track = ges_track_new ();
|
||||
track = ges_track_new (GST_CAPS_ANY);
|
||||
fail_unless (track != NULL);
|
||||
|
||||
fail_unless (ges_timeline_add_track (timeline, track));
|
||||
fail_unless (track->timeline == timeline);
|
||||
fail_unless (g_list_find (timeline->tracks, track) != NULL);
|
||||
fail_unless ((gpointer) gst_element_get_parent (track) ==
|
||||
(gpointer) timeline);
|
||||
|
||||
/* Create a source and add it to the Layer */
|
||||
|
||||
|
@ -89,7 +91,6 @@ GST_START_TEST (test_ges_scenario)
|
|||
/* Make sure the associated TrackObject is in the Track */
|
||||
fail_unless (GES_TIMELINE_OBJECT (source)->trackobjects != NULL);
|
||||
|
||||
|
||||
/* Now remove the timelineobject */
|
||||
fail_unless (ges_timeline_layer_remove_object (layer,
|
||||
GES_TIMELINE_OBJECT (source)));
|
||||
|
|
Loading…
Reference in a new issue