mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 21:06:17 +00:00
interleave: port to GstCollectPads2
This commit is contained in:
parent
44d001346a
commit
3135cab5a3
2 changed files with 20 additions and 20 deletions
|
@ -227,7 +227,7 @@ static gboolean gst_interleave_sink_setcaps (GstPad * pad, GstCaps * caps);
|
|||
|
||||
static GstCaps *gst_interleave_sink_getcaps (GstPad * pad);
|
||||
|
||||
static GstFlowReturn gst_interleave_collected (GstCollectPads * pads,
|
||||
static GstFlowReturn gst_interleave_collected (GstCollectPads2 * pads,
|
||||
GstInterleave * self);
|
||||
|
||||
static void
|
||||
|
@ -405,9 +405,9 @@ gst_interleave_init (GstInterleave * self, GstInterleaveClass * klass)
|
|||
|
||||
gst_element_add_pad (GST_ELEMENT (self), self->src);
|
||||
|
||||
self->collect = gst_collect_pads_new ();
|
||||
gst_collect_pads_set_function (self->collect,
|
||||
(GstCollectPadsFunction) gst_interleave_collected, self);
|
||||
self->collect = gst_collect_pads2_new ();
|
||||
gst_collect_pads2_set_function (self->collect,
|
||||
(GstCollectPads2Function) gst_interleave_collected, self);
|
||||
|
||||
self->input_channel_positions = g_value_array_new (0);
|
||||
self->channel_positions_from_input = TRUE;
|
||||
|
@ -498,10 +498,10 @@ gst_interleave_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
|||
gst_pad_set_getcaps_function (new_pad,
|
||||
GST_DEBUG_FUNCPTR (gst_interleave_sink_getcaps));
|
||||
|
||||
gst_collect_pads_add_pad (self->collect, new_pad, sizeof (GstCollectData));
|
||||
gst_collect_pads2_add_pad (self->collect, new_pad, sizeof (GstCollectData2));
|
||||
|
||||
/* FIXME: hacked way to override/extend the event function of
|
||||
* GstCollectPads; because it sets its own event function giving the
|
||||
* GstCollectPads2; because it sets its own event function giving the
|
||||
* element no access to events */
|
||||
self->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (new_pad);
|
||||
gst_pad_set_event_function (new_pad,
|
||||
|
@ -547,7 +547,7 @@ not_sink_pad:
|
|||
could_not_add:
|
||||
{
|
||||
GST_DEBUG_OBJECT (self, "could not add pad %s", GST_PAD_NAME (new_pad));
|
||||
gst_collect_pads_remove_pad (self->collect, new_pad);
|
||||
gst_collect_pads2_remove_pad (self->collect, new_pad);
|
||||
gst_object_unref (new_pad);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ gst_interleave_release_pad (GstElement * element, GstPad * pad)
|
|||
|
||||
GST_OBJECT_UNLOCK (self->collect);
|
||||
|
||||
gst_collect_pads_remove_pad (self->collect, pad);
|
||||
gst_collect_pads2_remove_pad (self->collect, pad);
|
||||
gst_element_remove_pad (element, pad);
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ gst_interleave_change_state (GstElement * element, GstStateChange transition)
|
|||
self->segment_position = 0;
|
||||
self->segment_rate = 1.0;
|
||||
gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
|
||||
gst_collect_pads_start (self->collect);
|
||||
gst_collect_pads2_start (self->collect);
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
break;
|
||||
|
@ -632,11 +632,11 @@ gst_interleave_change_state (GstElement * element, GstStateChange transition)
|
|||
}
|
||||
|
||||
/* Stop before calling the parent's state change function as
|
||||
* GstCollectPads might take locks and we would deadlock in that
|
||||
* GstCollectPads2 might take locks and we would deadlock in that
|
||||
* case
|
||||
*/
|
||||
if (transition == GST_STATE_CHANGE_PAUSED_TO_READY)
|
||||
gst_collect_pads_stop (self->collect);
|
||||
gst_collect_pads2_stop (self->collect);
|
||||
|
||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
|
||||
|
@ -876,7 +876,7 @@ gst_interleave_sink_event (GstPad * pad, GstEvent * event)
|
|||
break;
|
||||
}
|
||||
|
||||
/* now GstCollectPads can take care of the rest, e.g. EOS */
|
||||
/* now GstCollectPads2 can take care of the rest, e.g. EOS */
|
||||
ret = self->collect_event (pad, event);
|
||||
|
||||
gst_object_unref (self);
|
||||
|
@ -1157,7 +1157,7 @@ gst_interleave_src_event (GstPad * pad, GstEvent * event)
|
|||
/* check if we are flushing */
|
||||
if (flags & GST_SEEK_FLAG_FLUSH) {
|
||||
/* make sure we accept nothing anymore and return WRONG_STATE */
|
||||
gst_collect_pads_set_flushing (self->collect, TRUE);
|
||||
gst_collect_pads2_set_flushing (self->collect, TRUE);
|
||||
|
||||
/* flushing seek, start flush downstream, the flush will be done
|
||||
* when all pads received a FLUSH_STOP. */
|
||||
|
@ -1192,7 +1192,7 @@ gst_interleave_src_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
||||
gst_interleave_collected (GstCollectPads2 * pads, GstInterleave * self)
|
||||
{
|
||||
guint size;
|
||||
GstBuffer *outbuf;
|
||||
|
@ -1208,7 +1208,7 @@ gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
|||
g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED);
|
||||
g_return_val_if_fail (self->rate > 0, GST_FLOW_NOT_NEGOTIATED);
|
||||
|
||||
size = gst_collect_pads_available (pads);
|
||||
size = gst_collect_pads2_available (pads);
|
||||
|
||||
g_return_val_if_fail (size % width == 0, GST_FLOW_ERROR);
|
||||
|
||||
|
@ -1235,13 +1235,13 @@ gst_interleave_collected (GstCollectPads * pads, GstInterleave * self)
|
|||
memset (GST_BUFFER_DATA (outbuf), 0, size * self->channels);
|
||||
|
||||
for (collected = pads->data; collected != NULL; collected = collected->next) {
|
||||
GstCollectData *cdata;
|
||||
GstCollectData2 *cdata;
|
||||
GstBuffer *inbuf;
|
||||
guint8 *outdata;
|
||||
|
||||
cdata = (GstCollectData *) collected->data;
|
||||
cdata = (GstCollectData2 *) collected->data;
|
||||
|
||||
inbuf = gst_collect_pads_take_buffer (pads, cdata, size);
|
||||
inbuf = gst_collect_pads2_take_buffer (pads, cdata, size);
|
||||
if (inbuf == NULL) {
|
||||
GST_DEBUG_OBJECT (cdata->pad, "No buffer available");
|
||||
goto next;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define __INTERLEAVE_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstcollectpads.h>
|
||||
#include <gst/base/gstcollectpads2.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -49,7 +49,7 @@ struct _GstInterleave
|
|||
GstElement element;
|
||||
|
||||
/*< private >*/
|
||||
GstCollectPads *collect;
|
||||
GstCollectPads2 *collect;
|
||||
|
||||
gint channels;
|
||||
gint padcounter;
|
||||
|
|
Loading…
Reference in a new issue