Commit graph

355 commits

Author SHA1 Message Date
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
Wim Taymans d6dfb07692 basetransform: improve prepare_output_buffer
Clean up the prepare_output_buffer function.
Reuse the input buffer when it is writable and when doing an
in-place but non-passthrough transform.
Move the copy-metadata function call to the prepare_output_buffer default
function. If subclasses implement a custom prepare_output_buffer, they must also
copy the metadata themselves.
Remove a useless memory copy because prepare_output_buffer already did that.
2012-02-02 13:10:27 +01:00
Wim Taymans 3075b3c529 basetransform: simplify code
We already checked passthrough a few lines above.
2012-02-02 12:30:14 +01:00
Wim Taymans 39c5f0b28a don't do logic in g_assert... 2012-01-31 12:10:21 +01:00
Wim Taymans 0bd5a78701 query: pass allocator in query
Place the allocator object in the ALLOCATION query instead of the name. This
allows us to exchange allocators that are not in the global pool of allocators.
Update elements for the new api
2012-01-30 16:13:31 +01:00
Wim Taymans af2fc026fc memory: make the allocator refcounted
Add refcounting to the GstAllocator object.
Remove const from functions because the allocator is refcounted now.
Rename the vmethods for consistency
Expose the constructor for GstAllocator and add a destroy notify for the
user_data. This should make it possible to create allocators that are not
registered and shared globally along with the possibility to destroy them
properly.
Update defs with new symbols.
2012-01-30 13:20:36 +01:00
Wim Taymans ae12e4f645 basetransform: avoid caps leak 2012-01-27 11:41:33 +01:00
Wim Taymans e122bae3ad basetransform: fix typo 2012-01-26 19:28:46 +01:00
Wim Taymans a521252845 Add new GstMapInfo
Use a structure to hold info about the mapping. The application then keeps track
of this state and we can use it to unmap the memory again later.
2012-01-25 11:54:23 +01:00
Wim Taymans 252327f87a Update for new gthread API 2012-01-19 09:27:04 +01:00
Sebastian Dröge b56bef1418 basetransform: Always call ::propose_allocation vfunc
And only forward the allocation query if we're working in
passthrough mode if no ::propose_allocation is implemented.
In place buffer transformations will change the buffer
content and require explicit handling of all metas.
2012-01-18 12:07:46 +01:00
Sebastian Dröge 2f93cee988 basetransform: If the filtered peer caps are already empty error out early 2011-12-20 14:37:09 +01:00
Tim-Philipp Müller a1daf846f3 Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	gst/gstobject.h
	libs/gst/check/gstcheck.h
	libs/gst/controller/gstcontroller.c
	plugins/elements/gstidentity.c
	tools/gst-xmlinspect.c
2011-12-04 15:38:09 +00:00
Tim-Philipp Müller 2666450864 Suppress deprecation warnings in selected files, for g_static_rec_mutex_* mostly
GStaticRecMutex is part of our API/ABI, not much we can do here in 0.10.
2011-12-04 14:38:26 +00:00
Tim-Philipp Müller 5889260d5a Work around deprecated thread API in glib master
Add private replacements for deprecated functions such as
g_mutex_new(), g_mutex_free(), g_cond_new() etc., mostly
to avoid the deprecation warnings. We can't change most of
these in 0.10 because they're part of our API and ABI.
2011-12-04 13:35:38 +00:00
Wim Taymans a275d2e863 basetrans: add some more debug 2011-12-01 15:35:26 +01:00