mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
Track: Handle pads
This commit is contained in:
parent
c06e2a9550
commit
9fae1526bb
2 changed files with 40 additions and 0 deletions
|
@ -37,6 +37,11 @@ enum
|
||||||
ARG_CAPS
|
ARG_CAPS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void pad_added_cb (GstElement * element, GstPad * pad, GESTrack * track);
|
||||||
|
|
||||||
|
static void
|
||||||
|
pad_removed_cb (GstElement * element, GstPad * pad, GESTrack * track);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_track_get_property (GObject * object, guint property_id,
|
ges_track_get_property (GObject * object, guint property_id,
|
||||||
GValue * value, GParamSpec * pspec)
|
GValue * value, GParamSpec * pspec)
|
||||||
|
@ -109,6 +114,11 @@ ges_track_init (GESTrack * self)
|
||||||
{
|
{
|
||||||
self->composition = gst_element_factory_make ("gnlcomposition", NULL);
|
self->composition = gst_element_factory_make ("gnlcomposition", NULL);
|
||||||
|
|
||||||
|
g_signal_connect (self->composition, "pad-added", (GCallback) pad_added_cb,
|
||||||
|
self);
|
||||||
|
g_signal_connect (self->composition, "pad-removed",
|
||||||
|
(GCallback) pad_removed_cb, self);
|
||||||
|
|
||||||
if (!gst_bin_add (GST_BIN (self), self->composition))
|
if (!gst_bin_add (GST_BIN (self), self->composition))
|
||||||
GST_ERROR ("Couldn't add composition to bin !");
|
GST_ERROR ("Couldn't add composition to bin !");
|
||||||
}
|
}
|
||||||
|
@ -219,3 +229,32 @@ ges_track_remove_object (GESTrack * track, GESTrackObject * object)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pad_added_cb (GstElement * element, GstPad * pad, GESTrack * track)
|
||||||
|
{
|
||||||
|
GST_DEBUG ("track:%p, pad %s:%s", track, GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
|
/* ghost the pad */
|
||||||
|
track->srcpad = gst_ghost_pad_new ("src", pad);
|
||||||
|
|
||||||
|
gst_pad_set_active (track->srcpad, TRUE);
|
||||||
|
|
||||||
|
gst_element_add_pad (GST_ELEMENT (track), track->srcpad);
|
||||||
|
|
||||||
|
GST_DEBUG ("done");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pad_removed_cb (GstElement * element, GstPad * pad, GESTrack * track)
|
||||||
|
{
|
||||||
|
GST_DEBUG ("track:%p, pad %s:%s", track, GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
|
if (G_LIKELY (track->srcpad)) {
|
||||||
|
gst_pad_set_active (track->srcpad, FALSE);
|
||||||
|
gst_element_remove_pad (GST_ELEMENT (track), track->srcpad);
|
||||||
|
track->srcpad = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_DEBUG ("done");
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct _GESTrack {
|
||||||
GstCaps * caps;
|
GstCaps * caps;
|
||||||
|
|
||||||
GstElement * composition; /* The composition associated with this track */
|
GstElement * composition; /* The composition associated with this track */
|
||||||
|
GstPad * srcpad; /* The source GhostPad */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GESTrackClass {
|
struct _GESTrackClass {
|
||||||
|
|
Loading…
Reference in a new issue