mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
ext/ladspa/gstsignalprocessor.c
Original commit message from CVS: 2007-01-06 Andy Wingo <wingo@pobox.com> * ext/ladspa/gstsignalprocessor.c (gst_signal_processor_ouija_caps): Move around in the source file... (gst_signal_processor_prepare, gst_signal_processor_do_pulls): Call ouija_caps in prepare() instead of do_pulls(), a bit earlier. This allows us to have caps when we do the pad_alloc_buffer(). (gst_pad_alloc_buffer_and_set_caps): Use self->caps instead of the pad caps, which might not be set yet.
This commit is contained in:
parent
24df4ce38b
commit
2b5fdf422e
2 changed files with 40 additions and 31 deletions
|
@ -1,5 +1,14 @@
|
||||||
2007-01-06 Andy Wingo <wingo@pobox.com>
|
2007-01-06 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* ext/ladspa/gstsignalprocessor.c
|
||||||
|
(gst_signal_processor_ouija_caps): Move around in the source
|
||||||
|
file...
|
||||||
|
(gst_signal_processor_prepare, gst_signal_processor_do_pulls):
|
||||||
|
Call ouija_caps in prepare() instead of do_pulls(), a bit earlier.
|
||||||
|
This allows us to have caps when we do the pad_alloc_buffer().
|
||||||
|
(gst_pad_alloc_buffer_and_set_caps): Use self->caps instead of the
|
||||||
|
pad caps, which might not be set yet.
|
||||||
|
|
||||||
* ext/ladspa/gstsignalprocessor.c:
|
* ext/ladspa/gstsignalprocessor.c:
|
||||||
(gst_signal_processor_add_pad_from_template)
|
(gst_signal_processor_add_pad_from_template)
|
||||||
(gst_signal_processor_fixate): Add a fixate function, to assist in
|
(gst_signal_processor_fixate): Add a fixate function, to assist in
|
||||||
|
|
|
@ -478,6 +478,32 @@ gst_signal_processor_event (GstPad * pad, GstEvent * event)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_signal_processor_ouija_caps (GstSignalProcessor * self)
|
||||||
|
{
|
||||||
|
GstElement *element;
|
||||||
|
GstPad *srcpad;
|
||||||
|
GstCaps *srccaps, *peercaps, *caps;
|
||||||
|
|
||||||
|
/* we have no sink pads, no way to know what caps we should be producing.
|
||||||
|
guess! */
|
||||||
|
|
||||||
|
element = GST_ELEMENT (self);
|
||||||
|
g_return_if_fail (element->sinkpads == NULL);
|
||||||
|
g_return_if_fail (element->srcpads != NULL);
|
||||||
|
srcpad = GST_PAD (element->srcpads->data);
|
||||||
|
|
||||||
|
srccaps = gst_pad_get_caps (srcpad);
|
||||||
|
peercaps = gst_pad_peer_get_caps (srcpad);
|
||||||
|
caps = gst_caps_intersect (srccaps, peercaps);
|
||||||
|
gst_caps_unref (srccaps);
|
||||||
|
gst_caps_unref (peercaps);
|
||||||
|
gst_caps_truncate (caps);
|
||||||
|
gst_pad_fixate_caps (srcpad, caps);
|
||||||
|
gst_signal_processor_setcaps (srcpad, caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
||||||
{
|
{
|
||||||
|
@ -526,6 +552,10 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!self->caps)
|
||||||
|
gst_signal_processor_ouija_caps (self);
|
||||||
|
g_return_val_if_fail (GST_SIGNAL_PROCESSOR_IS_RUNNING (self), 0);
|
||||||
|
|
||||||
/* now allocate for any remaining outputs */
|
/* now allocate for any remaining outputs */
|
||||||
while (srcs) {
|
while (srcs) {
|
||||||
GstSignalProcessorPad *srcpad;
|
GstSignalProcessorPad *srcpad;
|
||||||
|
@ -535,7 +565,7 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
gst_pad_alloc_buffer_and_set_caps (GST_PAD (srcpad), -1,
|
gst_pad_alloc_buffer_and_set_caps (GST_PAD (srcpad), -1,
|
||||||
samples_avail * sizeof (gfloat), GST_PAD_CAPS (srcpad), &srcpad->pen);
|
samples_avail * sizeof (gfloat), self->caps, &srcpad->pen);
|
||||||
|
|
||||||
if (ret != GST_FLOW_OK) {
|
if (ret != GST_FLOW_OK) {
|
||||||
self->flow_state = ret;
|
self->flow_state = ret;
|
||||||
|
@ -591,7 +621,6 @@ gst_signal_processor_process (GstSignalProcessor * self, guint nframes)
|
||||||
|
|
||||||
g_return_if_fail (self->pending_in == 0);
|
g_return_if_fail (self->pending_in == 0);
|
||||||
g_return_if_fail (self->pending_out == 0);
|
g_return_if_fail (self->pending_out == 0);
|
||||||
g_return_if_fail (GST_SIGNAL_PROCESSOR_IS_RUNNING (self));
|
|
||||||
|
|
||||||
elem = GST_ELEMENT (self);
|
elem = GST_ELEMENT (self);
|
||||||
|
|
||||||
|
@ -672,32 +701,6 @@ gst_signal_processor_flush (GstSignalProcessor * self)
|
||||||
self->pending_in = klass->num_audio_in;
|
self->pending_in = klass->num_audio_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_signal_processor_ouija_caps (GstSignalProcessor * self)
|
|
||||||
{
|
|
||||||
GstElement *element;
|
|
||||||
GstPad *srcpad;
|
|
||||||
GstCaps *srccaps, *peercaps, *caps;
|
|
||||||
|
|
||||||
/* we have no sink pads, no way to know what caps we should be producing.
|
|
||||||
guess! */
|
|
||||||
|
|
||||||
element = GST_ELEMENT (self);
|
|
||||||
g_return_if_fail (element->sinkpads == NULL);
|
|
||||||
g_return_if_fail (element->srcpads != NULL);
|
|
||||||
srcpad = GST_PAD (element->srcpads->data);
|
|
||||||
|
|
||||||
srccaps = gst_pad_get_caps (srcpad);
|
|
||||||
peercaps = gst_pad_peer_get_caps (srcpad);
|
|
||||||
caps = gst_caps_intersect (srccaps, peercaps);
|
|
||||||
gst_caps_unref (srccaps);
|
|
||||||
gst_caps_unref (peercaps);
|
|
||||||
gst_caps_truncate (caps);
|
|
||||||
gst_pad_fixate_caps (srcpad, caps);
|
|
||||||
gst_signal_processor_setcaps (srcpad, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_signal_processor_do_pulls (GstSignalProcessor * self, guint nframes)
|
gst_signal_processor_do_pulls (GstSignalProcessor * self, guint nframes)
|
||||||
{
|
{
|
||||||
|
@ -735,9 +738,6 @@ gst_signal_processor_do_pulls (GstSignalProcessor * self, guint nframes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self->caps)
|
|
||||||
gst_signal_processor_ouija_caps (self);
|
|
||||||
|
|
||||||
if (self->pending_in != 0) {
|
if (self->pending_in != 0) {
|
||||||
g_critical ("Something wierd happened...");
|
g_critical ("Something wierd happened...");
|
||||||
self->flow_state = GST_FLOW_ERROR;
|
self->flow_state = GST_FLOW_ERROR;
|
||||||
|
|
Loading…
Reference in a new issue