mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
ges: Port to 0.11 API
This commit is contained in:
parent
efe3bd7842
commit
7cdd9694ff
3 changed files with 38 additions and 25 deletions
|
@ -309,6 +309,7 @@ get_compatible_unlinked_pad (GstElement * element, GstPad * pad)
|
||||||
GstIterator *pads;
|
GstIterator *pads;
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
|
GValue paditem = { 0, };
|
||||||
|
|
||||||
GST_DEBUG ("element : %s, pad %s:%s",
|
GST_DEBUG ("element : %s, pad %s:%s",
|
||||||
GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad));
|
GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad));
|
||||||
|
@ -317,32 +318,28 @@ get_compatible_unlinked_pad (GstElement * element, GstPad * pad)
|
||||||
pads = gst_element_iterate_sink_pads (element);
|
pads = gst_element_iterate_sink_pads (element);
|
||||||
else
|
else
|
||||||
pads = gst_element_iterate_src_pads (element);
|
pads = gst_element_iterate_src_pads (element);
|
||||||
srccaps = gst_pad_get_caps_reffed (pad);
|
srccaps = gst_pad_get_caps (pad, NULL);
|
||||||
|
|
||||||
GST_DEBUG ("srccaps %" GST_PTR_FORMAT, srccaps);
|
GST_DEBUG ("srccaps %" GST_PTR_FORMAT, srccaps);
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
gpointer padptr;
|
switch (gst_iterator_next (pads, &paditem)) {
|
||||||
|
|
||||||
switch (gst_iterator_next (pads, &padptr)) {
|
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
GstPad *testpad = (GstPad *) padptr;
|
GstPad *testpad = g_value_get_object (&paditem);
|
||||||
|
|
||||||
if (gst_pad_is_linked (testpad)) {
|
if (!gst_pad_is_linked (testpad)) {
|
||||||
gst_object_unref (testpad);
|
GstCaps *sinkcaps = gst_pad_get_caps (testpad, NULL);
|
||||||
} else {
|
|
||||||
GstCaps *sinkcaps = gst_pad_get_caps_reffed (testpad);
|
|
||||||
|
|
||||||
GST_DEBUG ("sinkccaps %" GST_PTR_FORMAT, sinkcaps);
|
GST_DEBUG ("sinkccaps %" GST_PTR_FORMAT, sinkcaps);
|
||||||
|
|
||||||
if (gst_caps_can_intersect (srccaps, sinkcaps)) {
|
if (gst_caps_can_intersect (srccaps, sinkcaps)) {
|
||||||
res = testpad;
|
res = gst_object_ref (testpad);
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
} else
|
}
|
||||||
gst_object_unref (testpad);
|
|
||||||
gst_caps_unref (sinkcaps);
|
gst_caps_unref (sinkcaps);
|
||||||
}
|
}
|
||||||
|
g_value_reset (&paditem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
|
@ -354,6 +351,7 @@ get_compatible_unlinked_pad (GstElement * element, GstPad * pad)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_reset (&paditem);
|
||||||
gst_iterator_free (pads);
|
gst_iterator_free (pads);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
|
@ -366,13 +364,19 @@ pad_added_cb (GstElement * timeline, GstPad * pad, GESTimelinePipeline * self)
|
||||||
OutputChain *chain;
|
OutputChain *chain;
|
||||||
GESTrack *track;
|
GESTrack *track;
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
|
GstCaps *caps;
|
||||||
gboolean reconfigured = FALSE;
|
gboolean reconfigured = FALSE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "new pad %s:%s , caps:%" GST_PTR_FORMAT,
|
caps = gst_pad_get_caps (pad, NULL);
|
||||||
GST_DEBUG_PAD_NAME (pad), GST_PAD_CAPS (pad));
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!(track =
|
GST_DEBUG_OBJECT (self, "new pad %s:%s , caps:%" GST_PTR_FORMAT,
|
||||||
ges_timeline_get_track_for_pad (self->priv->timeline, pad)))) {
|
GST_DEBUG_PAD_NAME (pad), caps);
|
||||||
|
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
track = ges_timeline_get_track_for_pad (self->priv->timeline, pad);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (!track)) {
|
||||||
GST_WARNING_OBJECT (self, "Couldn't find coresponding track !");
|
GST_WARNING_OBJECT (self, "Couldn't find coresponding track !");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -466,11 +470,13 @@ pad_added_cb (GstElement * timeline, GstPad * pad, GESTimelinePipeline * self)
|
||||||
sinkpad = get_compatible_unlinked_pad (self->priv->encodebin, pad);
|
sinkpad = get_compatible_unlinked_pad (self->priv->encodebin, pad);
|
||||||
|
|
||||||
if (sinkpad == NULL) {
|
if (sinkpad == NULL) {
|
||||||
GstCaps *caps = gst_pad_get_caps_reffed (pad);
|
GstCaps *caps = gst_pad_get_caps (pad, NULL);
|
||||||
|
|
||||||
/* If no compatible static pad is available, request a pad */
|
/* If no compatible static pad is available, request a pad */
|
||||||
g_signal_emit_by_name (self->priv->encodebin, "request-pad", caps,
|
g_signal_emit_by_name (self->priv->encodebin, "request-pad", caps,
|
||||||
&sinkpad);
|
&sinkpad);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
if (G_UNLIKELY (sinkpad == NULL)) {
|
if (G_UNLIKELY (sinkpad == NULL)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't get a pad from encodebin !");
|
GST_ERROR_OBJECT (self, "Couldn't get a pad from encodebin !");
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -793,6 +799,8 @@ ges_timeline_pipeline_save_thumbnail (GESTimelinePipeline * self, int width, int
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
gpointer data;
|
||||||
|
gsize size;
|
||||||
|
|
||||||
caps = gst_caps_from_string (format);
|
caps = gst_caps_from_string (format);
|
||||||
|
|
||||||
|
@ -807,15 +815,19 @@ ges_timeline_pipeline_save_thumbnail (GESTimelinePipeline * self, int width, int
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = gst_buffer_map (b, &size, NULL, GST_MAP_READ);
|
||||||
|
|
||||||
/* FIXME : Use standard glib methods */
|
/* FIXME : Use standard glib methods */
|
||||||
fp = fopen (location, "w+");
|
fp = fopen (location, "w+");
|
||||||
if (!fwrite (GST_BUFFER_DATA (b), GST_BUFFER_SIZE (b), 1, fp) || ferror (fp)) {
|
if (!fwrite (data, size, 1, fp) || ferror (fp)) {
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
gst_buffer_unmap (b, data, size);
|
||||||
gst_buffer_unref (b);
|
gst_buffer_unref (b);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ do_async_start (GESTimeline * timeline)
|
||||||
gst_element_set_locked_state ((GstElement *) tr_priv->track, TRUE);
|
gst_element_set_locked_state ((GstElement *) tr_priv->track, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
message = gst_message_new_async_start (GST_OBJECT_CAST (timeline), FALSE);
|
message = gst_message_new_async_start (GST_OBJECT_CAST (timeline));
|
||||||
parent_class->handle_message (GST_BIN_CAST (timeline), message);
|
parent_class->handle_message (GST_BIN_CAST (timeline), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ do_async_done (GESTimeline * timeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (timeline, "Emitting async-done");
|
GST_DEBUG_OBJECT (timeline, "Emitting async-done");
|
||||||
message = gst_message_new_async_done (GST_OBJECT_CAST (timeline));
|
message = gst_message_new_async_done (GST_OBJECT_CAST (timeline), FALSE);
|
||||||
parent_class->handle_message (GST_BIN_CAST (timeline), message);
|
parent_class->handle_message (GST_BIN_CAST (timeline), message);
|
||||||
|
|
||||||
timeline->priv->async_pending = FALSE;
|
timeline->priv->async_pending = FALSE;
|
||||||
|
|
|
@ -90,7 +90,7 @@ pspec_hash (gconstpointer key_spec)
|
||||||
static GHashTable *
|
static GHashTable *
|
||||||
ges_track_effect_get_props_hashtable (GESTrackObject * self)
|
ges_track_effect_get_props_hashtable (GESTrackObject * self)
|
||||||
{
|
{
|
||||||
gpointer data;
|
GValue item = { 0, };
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
GParamSpec **parray;
|
GParamSpec **parray;
|
||||||
GObjectClass *class;
|
GObjectClass *class;
|
||||||
|
@ -116,12 +116,12 @@ ges_track_effect_get_props_hashtable (GESTrackObject * self)
|
||||||
it = gst_bin_iterate_recurse (GST_BIN (element));
|
it = gst_bin_iterate_recurse (GST_BIN (element));
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
switch (gst_iterator_next (it, &data)) {
|
switch (gst_iterator_next (it, &item)) {
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
gchar **categories;
|
gchar **categories;
|
||||||
guint category;
|
guint category;
|
||||||
GstElement *child = GST_ELEMENT_CAST (data);
|
GstElement *child = g_value_get_object (&item);
|
||||||
|
|
||||||
factory = gst_element_get_factory (child);
|
factory = gst_element_get_factory (child);
|
||||||
klass = gst_element_factory_get_klass (factory);
|
klass = gst_element_factory_get_klass (factory);
|
||||||
|
@ -153,7 +153,7 @@ ges_track_effect_get_props_hashtable (GESTrackObject * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strfreev (categories);
|
g_strfreev (categories);
|
||||||
gst_object_unref (child);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
|
@ -171,6 +171,7 @@ ges_track_effect_get_props_hashtable (GESTrackObject * self)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue