Commit graph

370 commits

Author SHA1 Message Date
Sjoerd Simons
12a72d2b08 basetransform: optimize default acceptcaps implementation
Pass the fixed caps we're asked to accept as a filter for the caps
query, so we don't get a fully-expanded set of caps back (which we don't
need and can take a lot of time for intersection).

This reduces the time for camerabin to produce a second frame on a
logitech C910 camera from around 52 seconds to a bit less then 16
seconds on my system.

https://bugzilla.gnome.org/show_bug.cgi?id=702632
2013-06-19 15:11:57 +02:00
Tim-Philipp Müller
4d1cb14c68 basetransform: remove 0.10-ism from docs
gst_buffer_pad_alloc() never existed, and gst_pad_alloc_buffer()
doesn't exist any more either, so don't mention it in the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=694714
2013-05-24 23:01:09 +01:00
Sebastian Dröge
3e515099ec basetransform: Return GST_FLOW_ERROR if the allocator did not allow to allocate a buffer 2013-05-24 14:37:37 +02:00
Tim-Philipp Müller
5a73d15c80 basetransform: don't pass NULL outcaps to transform_size on shutdown
gst_pad_get_current_caps() on the source pad might yield NULL caps
if we're being shut down and the source pad has already been
deactivated by the other thread that's changing state. Just bail
out in that case, instead of passing NULL caps to the transform_size
function, which it might not expect.

Fixes spurious warnings in audioresample shutdown unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=693996
2013-02-21 11:28:12 +00:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Tim-Philipp Müller
4e373aa952 docs: add Since markers for new API and add it to docs and .def file 2012-10-04 11:24:09 +01:00
Wim Taymans
d5b81aba6a basetrans: add an option to prefer passthrough
Basetransform attempts to do passthrough mode regardless of the order of
the transform_caps method. Add a method to disable this.
This is needed for elements like capsfilter that want to transform caps
based on the order of the caps property.
2012-10-04 11:15:36 +02:00
Wim Taymans
664f7141be basetrans: improve some comments 2012-10-04 10:01:19 +02:00
Wim Taymans
0ea3675cf4 basetransform: check acquire result value
Check the result value from _buffer_pool_acquire() and return the
value when allocation failed.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=684285
2012-09-18 21:49:41 +02:00
Wim Taymans
9828f72cda basetrans: whitespace fix 2012-09-14 16:58:10 +02:00
Wim Taymans
3abc720345 docs: fix some docs
from git grep for ffmpegcolorspace and x-raw-
2012-09-13 11:35:41 +02:00
Víctor Manuel Jáquez Leal
fee7080dff basetransform: getters for pool and allocator
Sometimes a transform filter would need the buffer pool or the memory
allocator negotiated by the base class, for example, for querying different
parameters, such as a bigger number of buffers to allocate by the buffer pool.

This patch expose a two getters accessors: one for the buffer pool and the
other for the memory allocator.
2012-08-14 15:45:21 +02:00
Thiago Santos
2a5afba1a1 basetransform: do not error on not-negotiated
Don't error out too early and let upstream decide if it can
workaround a not-negotiated problem

https://bugzilla.gnome.org/show_bug.cgi?id=681198
2012-08-10 13:58:02 -03:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Wim Taymans
82eb275ef9 query: copy structure in _add_allocation_meta()
Make gst_query_add_allocation_meta() take a copy of the passed caps instead of
taking ownership. This makes it easier for the caller in most cases because it
doesn't have to make a copy and deal with NULL values.
2012-07-10 10:31:00 +02:00
Wim Taymans
f362f643ac memory: Make GstAllocator a GstObject
Make GstAllocator a GstObject instead of a GstMiniObject, like bufferpool.
Make a new gstallocator.c file. Make a GstAllocator subclass for the default
allocator.
2012-07-09 16:28:22 +02:00
Wim Taymans
3f80cb272e query: use more generic structure for meta params 2012-07-06 11:49:47 +02:00
Wim Taymans
8173622844 query: add flags to allocation query
Make it possible to add API specific flags to the ALLOCATION query. This makes
it possible to also check what kinds of subfeatures of the metadata API are
supported.
2012-07-06 11:00:38 +02:00
Sebastian Dröge
183cc7e3bf basetransform: Don't return the return value of gst_pad_set_caps()
e.g. it returns FALSE if incompatible caps are set on the pad.
2012-06-08 15:33:34 +02:00
Wim Taymans
56f9d3782d basetransform: fix reconfigure
Use the pad methods to set and check the reconfigure flags
Clear the reconfigure flag before we negotiate so that we don't miss any
reconfigure events while negotiating
2012-06-07 17:59:39 +02:00
Sebastian Dröge
105fa1ffde basetransform/basesrc: Do bufferpool configuration inside the default decide_allocation() implementation
This allows subclasses to override it, as is necessary for e.g. the
video-crop meta. It is now necessary that after decide_allocation()
there is always a allocator and a configured buffer pool inside the
query.
2012-05-01 13:32:41 +02:00
Wim Taymans
a3d5db491c trans: add transform_ip_on_passthrough
Add an option to control if transform_ip is called in passthrough mode or not.
for elements that don't want to look at the data in passthrough mode, this can
avoid some extra processing, mostly in subclasses.
2012-04-02 11:09:50 +02:00
Mark Nauwelaerts
096d36e5c5 basetransform: plug caps leak 2012-03-30 16:53:00 +02:00
Mark Nauwelaerts
41e9ca9b17 basetransform: remove automatic and undocumented setting of always_in_place
... which controls how to (forcibly) deal with (non-)writable data and
is not necessarily related to identical caps.

In particular, it is also not so helpful anymore with a more advanced
GstVideoFilter subclass which always has a transform_ip method currently,
even though its subclass may not have a corresponding _ip method.
2012-03-22 15:24:08 +01:00
Wim Taymans
07c9fba116 basetransform: make more stuff private 2012-03-16 22:51:14 +01:00
Wim Taymans
f9c4b70a98 basetransform: small cleanups 2012-03-16 22:25:38 +01:00
Wim Taymans
db1318ab4a pad: change the semantics of get/pull_range a little
Make it so that one can specify a buffer for get/pull_range where the downstream
element should write into. When passing NULL, upstream should allocate a buffer,
like in 0.10.
We also need to change the probes a little because before the pull probe, there
could already be a buffer passed. This then allows us to use the same PROBE
macro for before and after pulling.
While we're at the probes, make the query probe more powerful by handling the
GST_PAD_PROBE_DROP return value. Returning _DROP from a query probe will now
return TRUE upstream and will not forward the probe to the peer or handler.
Also handle _DROP for get/pull_range properly by not dispatching to the
peer/handler or by generating EOS when the probe returns DROP and no buffer.
Make filesrc handle the non-NULL buffer passed in the get_range function and
skip the allocation in that case, writing directly into the downstream provided
buffer.
Update tests because now we need to make sure to not pass a random value in the
buffer pointer to get/pull_range
2012-03-16 21:37:10 +01:00
Wim Taymans
a7e6c7d2a8 bufferpool: split bufferpool configuration
Make separate methods to control the bufferpool and the allocator used by the
bufferpool.
Make it possible to change the allocator of a pool.
2012-03-15 22:09:02 +01:00
Wim Taymans
83af60019e query: rework the ALLOCATION query
Separate the bufferpool and allocator hints in the allocation query, some
of the values don't always make sense together.
Keep the bufferpool and its configuration together.
Keep the allocator and its parameters together.
Allow for multiple bufferpool configurations in the query.
2012-03-15 20:23:59 +01:00
Wim Taymans
85c9543841 memory: group allocation parameters in a struct
Group the extra allocation parameters in a GstAllocationParams structure to make
it easier to deal with them and so that we can extend them later if needed.
Make gst_buffer_new_allocate() take the GstAllocationParams for added
functionality.
Add boxed type for GstAllocationParams.
2012-03-15 13:42:17 +01:00
Wim Taymans
edd2ffe4d4 memory: Add 0 padding
Change gst_allocator_alloc() so that we can also spicify flags and padding.
Add 2 new flags to mark the memory 0 prefixed/padded. This allows us to
remove some resizes in the base classes.
When allocating memory, memset prefix and padding with 0 when the flags tell
us to.
On resize, clear the zero padding flags if we can't guarantee the memory is
still 0 filled.
Update tests.
2012-03-14 21:32:22 +01:00
Wim Taymans
3d76e6011c query: also include padding in ALLOCATION query
Negotiating padding is needed on second thought so include it in the
ALLOCATION query.
Make the bufferpool take padding into account when allocating.
Make basesrc take padding into account.
Use padding and prefix when allocating in basetransform.
2012-03-14 19:47:10 +01:00
Wim Taymans
934ddcfcfe basetransform: get template caps only once
Get the template caps of the pads only once, avoids unecessary ref
and unrefs.
2012-03-12 19:52:03 +01:00
Wim Taymans
43abf99a8a caps: avoid using in-place oprations
Rework some caps operations so they don't rely on writable caps but instead take
ownership of the input caps and do _make_writable() only when needed.
Remove some const from caps functions, it does not make much sense for
refcounted objects and does not allow us to return a refcount to the const input
caps.
Rework the base classes fixate vmethods to not operate on the caps in-place.
All this saves us around 30% of caps and structure copy and new operations.
2012-03-11 18:57:44 +01:00
Wim Taymans
ed94dbf1d2 basetransform: delay pool activation
Delay the activation of the bufferpool until we actually need a buffer from the
pool.
2012-03-06 15:17:05 +01:00
Wim Taymans
247d2d08f7 basetransform: don't propose_allocation before negotiation
Answer the allocation query with FALSE when we are not negotiated yet because at
that point we have no idea if we need to proxy the allocation query or not.
2012-03-05 15:23:46 +01:00
Wim Taymans
7eae198be2 basetransform: refine metadata filter and transform
Add a vmethod to filter metadata that should be passed upstream. By default,
don't pass anything.
Add a vmethod to transform metadata from the input buffer to the output buffer.
By default, nothing is transformed or copied.
2012-03-02 17:32:28 +01:00
Wim Taymans
3fa69e6e11 basetrans: fix comment 2012-03-02 11:08:55 +01:00
Sebastian Dröge
cfe71423f0 gst: Remove gstmarshal.[ch] completely and use the generic marshaller
Fixes bug #671130.
2012-03-02 11:05:48 +01:00
Wim Taymans
afb9d81be9 basetransform: improve debugging 2012-03-01 17:41:57 +01:00
Wim Taymans
bdcf1dc3cd basetransform: remove metadata tagged with the memory tag
Remove metadata that describes the particular memory of the buffer it is
attached to. We need to do this because in non-passthrough mode we will allocate
new memory for our output buffer.
2012-03-01 17:41:57 +01:00
Wim Taymans
d6a28a6e3a basetransform: improve propose_allocation
Improve the propose allocation vmethod by passing the downstream allocation
query to it. This way the vmethod implementation can use properties of the
downstream allocation to generate the upstream query result. If there is no
downstream quety, it means that the element is working in passthrough mode.
Implement a default decide_allocation.
2012-03-01 17:41:57 +01:00
Wim Taymans
4f6faa3405 basetransform: clear allocation parameters in passthrough
Clear the allocation parameters when we operate in passthrough.
2012-03-01 17:41:57 +01:00
Wim Taymans
beea57dca7 basetransform: fix reconfigure methods
Rename gst_base_transform_suggest to gst_base_transform_reconfigure_sink because
that is what it does. Also remove the caps and size because that is not needed.
Rename gst_base_transform_reconfigure to gst_base_transform_reconfigure_src.
Remove some old unused code in capsfilter.
2012-02-24 11:00:21 +01:00
Wim Taymans
d052c778af basetransform: remove transform lock
This is not needed anymore by the baseclass. subclasses should do their own
locking when needed.
2012-02-23 11:08:26 +01:00
Wim Taymans
c83e02d476 basetrans: cleanups
Clean up the setcaps function.
The passthrough variable is protected with the object lock.
2012-02-23 10:12:44 +01:00
Wim Taymans
f3ca3f89f7 basetransform: improve propose_allocation
Always call the propose_allocation method and provide a default implementation
that passes the query on in passthrough mode so that subclasses can also call
this. Also pass if the transform is in passthrough mode so that the
implementation can adjust its algorithm.
2012-02-22 15:26:05 +01:00
Wim Taymans
90a82c7e81 basetrans: improve fixate_caps function
Make it possible to also implement non-inplace fixate functions. Let the fixate
function make the caps writable when needed because some fixate functions might
not need to modify the caps.
2012-02-22 12:24:34 +01:00
Wim Taymans
810e67900b basetransform: copy metadata when using a pool
also copy the metadata when we allocated a new buffer from a pool
2012-02-20 11:46:36 +01:00
Edward Hervey
7f8be6935a basetransform: Handle return value of decide_allocation vmethod
If it fails, properly propagate the error
2012-02-17 15:11:38 -08:00