diff options
author | Andy Wingo <wingo@pobox.com> | 2007-01-06 17:22:12 +0000 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2007-01-06 17:22:12 +0000 |
commit | 2b5fdf422e62d17fe018bf207aa363402dbbce24 (patch) | |
tree | d6aa00fd283adc74ca5818a97444bd35a552d1e3 | |
parent | 24df4ce38b6c81d7627ce256c6c488e09d3bd4a2 (diff) | |
download | gst-plugins-bad-2b5fdf422e62d17fe018bf207aa363402dbbce24.tar.gz gst-plugins-bad-2b5fdf422e62d17fe018bf207aa363402dbbce24.tar.bz2 gst-plugins-bad-2b5fdf422e62d17fe018bf207aa363402dbbce24.zip |
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.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ext/ladspa/gstsignalprocessor.c | 62 |
2 files changed, 40 insertions, 31 deletions
@@ -1,5 +1,14 @@ 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: (gst_signal_processor_add_pad_from_template) (gst_signal_processor_fixate): Add a fixate function, to assist in diff --git a/ext/ladspa/gstsignalprocessor.c b/ext/ladspa/gstsignalprocessor.c index 7e025778..e0b92397 100644 --- a/ext/ladspa/gstsignalprocessor.c +++ b/ext/ladspa/gstsignalprocessor.c @@ -478,6 +478,32 @@ gst_signal_processor_event (GstPad * pad, GstEvent * event) 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 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 */ while (srcs) { GstSignalProcessorPad *srcpad; @@ -535,7 +565,7 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes) ret = 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) { 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_out == 0); - g_return_if_fail (GST_SIGNAL_PROCESSOR_IS_RUNNING (self)); elem = GST_ELEMENT (self); @@ -673,32 +702,6 @@ gst_signal_processor_flush (GstSignalProcessor * self) } 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 gst_signal_processor_do_pulls (GstSignalProcessor * self, guint nframes) { GList *sinkpads; @@ -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) { g_critical ("Something wierd happened..."); self->flow_state = GST_FLOW_ERROR; |