Commit graph

179 commits

Author SHA1 Message Date
Jonathan Matthew
754c3038be basetransform: use input position for queries if we have no output position 2010-10-29 15:45:04 +02:00
Wim Taymans
ce919c0573 basetransform: fix reverse negotiation
When the downstream element suggests a new format, pass the suggestion
upstream if we can't convert to it.

Fixes #633147
2010-10-29 12:03:48 +01:00
Sebastian Dröge
14023fff89 basetransform: Report the output position on POSITION queries on the srcpad
There can be a difference between input and output last_stop.

Fixes bug #629410.
2010-10-10 18:18:23 +02:00
Havard Graff
51d20158be basetransform: Make a WARNING into a DEBUG statement
Fixes bug #630437.
2010-09-23 21:55:04 +02:00
Wim Taymans
90d65cb446 basetransform: avoid useless memcpy
Because of the awkward refcounting in prepare_output_buffer, we might end up
with writable buffers that point to the same data. Check for those cases so that
we avoid a useless memcpy and keep valgrind quiet.

Fixes #628176
2010-09-23 18:23:39 +02:00
Wim Taymans
f8abf35000 basetransform: recover from invalid downstream suggestions
When we are handling a buffer and need to allocate an output buffer, handle the
case when downstream suggests us a format that we can't convert the input buffer
to. In that case, check if there is another format available downstream instead
of failing.

Fixes #621332 and see also #614296
2010-08-26 15:18:47 +02:00
Stefan Kost
2237af4b6b debug: logging improvements
Use the event serialisation. Log formats name instead of number.
2010-08-05 10:31:50 +03:00
Rob Clark
29289ee79e basetransform fix for upstream caps-renegotiation
If initially pass-through caps are negotiated between a transform element's
sink and src pads, but then the downstream element returns different caps
on a buffer from pad_alloc(), basetransform gets stuck with proxy_alloc=TRUE
even though the upstream peer doesn't accept the caps, causing
gst_pad_peer_accept_caps() to be called on each buffer in _buffer_alloc():

    if (!gst_caps_is_equal (newcaps, caps)) {
      GST_DEBUG_OBJECT (trans, "caps are new");
      /* we have new caps, see if we can proxy downstream */
>>    if (gst_pad_peer_accept_caps (pad, newcaps)) {
        /* peer accepts the caps, return a buffer in this format */
        GST_DEBUG_OBJECT (trans, "peer accepted new caps");

which is taking ~40ms/frame.

This patch does two things.  (1) if the buffer returned from pad_alloc() has
new caps, trigger the decision whether to proxy the buffer-alloc to be
revisited, and (2) disable proxy if peer does not accept new caps.  (The first
part may not be strictly needed, but seemed like a good idea.)

Note that this issue would not arise except in case of downstream elements
who have on their template-caps, some that would be suitable for pass-through,
but at runtime pick more restrictive caps (for ex, after querying a driver for
what formats it actually supports).
2010-07-27 17:34:49 +02:00
Thiago Santos
574e6ab423 basetransform: Try suggesting caps on bad caps pad_alloc
When basetransform received an unsupported caps on pad_alloc
it just returned not-negotiated. This patch makes it query
the allowed caps between his sinkpad and upstream's srcpad
to find a caps to suggest.

This happens when dinamically switching pipeline elements
and upstream pad_allocs with the previous caps that was
being used.

Fixes #614296
2010-07-26 14:49:14 -03:00
Sebastian Dröge
29a35e70e1 basetransform: Allow the subclass to add new fields to caps when getting new caps from downstream
This was already done in all other cases where new caps are handled
except upstream negotiation.
2010-07-17 21:30:18 +02:00
Sebastian Dröge
e2db318921 basetransform: Implement POSITION query
Fixes bug #623541.
2010-07-16 17:26:22 +02:00
Wim Taymans
f80a824a2f basetransform: reevaluate proxy_alloc when reconfigured
When we reconfigure the transform element, make sure we reevaluate the proxying
of buffer_alloc the next time around.

Fixes #621332
2010-06-14 16:20:18 +02:00
Wim Taymans
76f7a001fc basetransform: add accept_caps vmethod
Allow subclasses to override the acceptcaps function because in some cases a
custom implementation can be much much faster than the default one.

See #621190
2010-06-14 12:45:20 +02:00
Olivier Crête
828f2a3389 basetransform: Assume size is the same if no transform_size/get_unit_size
Subclasses that don't implemen transform_size should be assumed to produce output
buffers of the same size.

https://bugzilla.gnome.org/show_bug.cgi?id=621334
2010-06-14 10:52:22 +02:00
Stefan Kost
9b5bc5199e basetransform: avoid a caps-copy
We can simply truncate the caps, as 'othercaps' is the result of intersect
operations and thus ours and writable.
2010-06-05 23:20:50 +03:00
Thiago Santos
7558fed51b basetransform: Refactor caps suggestion on pad_alloc
Refactor the handling of sink suggestion caps variable
so that it always has a ref to the caps it points to.

Makes the code clearer.
2010-03-29 16:05:32 -03:00
Robert Swain
9b6f93dcf3 basetransform: Implement QoS message posting
And some more for bug #322947
2010-03-18 16:57:17 +01:00
Thiago Santos
a6a3c129d1 basetransform: Accept non-fixed caps suggestions
When doing pad_allocs, use non-fixed caps suggestions and
try to fixate them before using. This makes possible to
have suggested buffer size with 0 in basetransform just
to signal upstream a renegotiation is needed

Fixes #576234
Fixes #609046
2010-03-16 17:12:37 -03:00
Sebastian Dröge
743cde4b49 basetransform: Only use suggested caps in buffer allocation if a size was suggested too 2010-01-17 08:23:48 +01:00
Sebastian Dröge
0a0c32ef88 basetransform: Handle buffers with NULL caps correctly
This means that the caps didn't change so don't try to handle
the NULL caps as the new caps.
2010-01-14 20:19:05 +01:00
Stefan Kost
f63ecd04a8 pad: rename new api from _refed to _reffed.
Due to popular demand rename the new api as we still can.
API: gst_pad_get_caps_reffed(), gst_pad_peer_get_caps_reffed()
2009-11-05 12:54:32 +02:00
Tim-Philipp Müller
daecaf0e8a Remove GST_DEBUG_FUNCPTR where they're pointless
There's not much point in using GST_DEBUG_FUNCPTR with GObject
virtual functions such as get_property, set_propery, finalize and
dispose, since they'll never be used by anyone anyway. Saves a
few bytes and possibly a tenth of a polar bear.
2009-10-28 00:44:24 +00:00
Stefan Kost
fcc5d783df pad: add variants of gst_pad_get_caps() that don't copy caps. Fixes #590941
In most places in core and baseclasses we just need the caps to do caps-
intersections. In that case ref'ed caps are enough (no need to copy).
This patch also switches the code to use the new functions.
API: gst_pad_get_caps_refed(), gst_pad_peer_get_caps_refed()
2009-10-07 22:41:30 +03:00
Thijs Vermeir
0dd051eeb3 Check suggested caps for proxy alloc
Because we are trying to resolve a suggestion here we don't need
to check on caps for proxy_alloc but we need to check on the
suggested caps instead.
2009-08-28 18:04:50 +02:00
Stefan Kost
04470fc794 basetransform: use new _caps_can_intersect() 2009-08-06 15:30:33 +03:00
Stefan Kost
cfacd2cbb3 basetransform: only check caps_is_fixed() if they changed
The previous code could call gst_caps_is_fixed() for the same caps many times.
2009-08-06 15:30:33 +03:00
Wim Taymans
a2a973eafd basetransform: clarify _caps_is_equal() 2009-08-06 10:53:25 +02:00
Wim Taymans
ec4d259b67 basetransform: refactor metadata modifications
Check when we need to touch the metadata of the output buffer after selecting
the output buffer so that we have everything in one place.
Also take flags and timestamp modifications into account.
2009-08-06 10:53:22 +02:00
Wim Taymans
db6ce33e3a basetransform: enable optimisation
When we have the same input as output caps, reuse the input caps object. After
the caps refcounting has been sorted out now, we can finally enable this
optimisation.
2009-08-06 10:53:07 +02:00
Wim Taymans
6cf64beb79 basetransform: fix refcounting problem
Add some more debug info.
Make sure that the output buffer has writable metadata before we attempt to set
caps on it.

fixes #583999
2009-08-06 10:52:34 +02:00
Kipp Cannon
6bc2bf8307 basetransform: Improve debug output in gst_base_transform_acceptcaps()
Fixes bug #589524.
2009-08-06 06:41:57 +02:00
Sebastian Dröge
6fd97a6d64 basetransform: Don't unset GAP flag if working in passthrough mode
Fixes bug #589314.
2009-08-06 06:41:57 +02:00
Stefan Kost
3ce0c64b45 basetransform: take size once 2009-07-14 08:32:24 +02:00
Stefan Kost
2288f9f6ec basetransform: make comment a FIXME comment 2009-07-06 19:52:44 +01:00
Stefan Kost
e778c5fd8b logging: fix unused variable warning when disabling debug logs.
The var was NULL anyway, bacause of the ifdefs there, the message makes no
sense including it.
2009-04-15 23:35:35 +03:00
Sebastian Dröge
d12034ab4b gst: Use g_once_init* or G_DEFINE_TYPE 2009-04-04 10:59:39 +02:00
Edward Hervey
9bf1d7247a basetransform: move unused variable in the #if 0 block.
That variable is only used by the code which has been if 0'd
2009-04-03 12:57:24 +02:00
Edward Hervey
00cbbc87c7 Remove unused variables detected by LLVM's Clang static analyzer. 2009-04-03 12:56:48 +02:00
Thijs Vermeir
8a080229c7 Force reconfigure of basetransform to recheck alloc request
While reconfiguring a basetransform element we need also to recheck
the alloc request. Because it's possible that due to caps changes
the proxy_alloc state is not correct anymore.
(Re-commit after discusion with Wim on IRC)
2009-02-02 18:23:41 +01:00
Wim Taymans
c786c5224a Revert "Check suggested caps for proxy alloc"
This reverts commit 50afd45957.

It breaks the interactive test-scale unit test.
2009-01-30 10:45:17 +01:00
Wim Taymans
a371ea6e5f Revert "Force reconfigure of basetransform to recheck alloc request"
This reverts commit 3a4602d771.

It breaks the interactive test-scale unit test.
2009-01-30 10:45:16 +01:00
Stefan Kost
45a17154b7 Add logging in failure case. Add more details to a todo comment. 2009-01-29 17:46:52 +02:00
Thijs Vermeir
50afd45957 Check suggested caps for proxy alloc
Because we are trying to resolve a suggestion here we don't need
to check on caps for proxy_alloc but we need to check on the suggested
caps instead.
2009-01-29 13:58:55 +01:00
Thijs Vermeir
3a4602d771 Force reconfigure of basetransform to recheck alloc request
While reconfiguring a basetransform element we need also to recheck
the alloc request. Because it's possible that due to caps changes
the proxy_alloc state is not correct anymore.
2009-01-29 13:53:01 +01:00
Thijs Vermeir
3f054f1bae Fix typo 2009-01-25 18:06:44 +01:00
Stefan Kost
7dd8b92448 gst/gstdebugutils.c: Add some ideas, how to make the graph smaller.
Original commit message from CVS:
* gst/gstdebugutils.c:
Add some ideas, how to make the graph smaller.
* gst/gstutils.c:
Add a comment from a debug session.
* libs/gst/base/gstbasetransform.c:
Log more context.
* libs/gst/controller/gstinterpolationcontrolsource.c:
Indet.
* plugins/elements/gstcapsfilter.c:
Fix typo in docs.
2009-01-01 21:27:06 +00:00
Wim Taymans
b90bef8ee5 libs/gst/base/gstbasetransform.*: Add vmethod that is called before we start the transform and which can be used to c...
Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buffer),
(gst_base_transform_getrange), (gst_base_transform_chain):
* libs/gst/base/gstbasetransform.h:
Add vmethod that is called before we start the transform and which can
be used to configure the transform, such as dynamic properties.
2008-12-08 18:35:44 +00:00
Wim Taymans
c577a143b9 libs/gst/base/gstbasetransform.c: Revert quick accepcaps attempt, it's not fully equivalent to the old behaviour and ...
Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_acceptcaps):
Revert quick accepcaps attempt, it's not fully equivalent to the old
behaviour and thus causes regressions.
2008-11-24 15:27:55 +00:00
Wim Taymans
0cca473acf libs/gst/base/gstbasetransform.c: Rename a variable to make the code clearer.
Original commit message from CVS:
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_acceptcaps):
Rename a variable to make the code clearer.
2008-11-22 15:09:20 +00:00
Wim Taymans
c0e491cdca libs/gst/base/gstbasetransform.c: Add beginnings of a more optimized acceptcaps function than the default core one.
Original commit message from CVS:
* libs/gst/base/gstbasetransform.c: (gst_base_transform_init),
(gst_base_transform_getcaps), (gst_base_transform_find_transform),
(gst_base_transform_acceptcaps), (gst_base_transform_getrange):
Add beginnings of a more optimized acceptcaps function than the default
core one.
2008-11-21 17:14:48 +00:00