Commit graph

48 commits

Author SHA1 Message Date
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 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 69d56a2927 memory: add user_data to GstMapInfo
Add extra pointers to GstMapInfo so that implementations can use these to store
extra info.
2012-02-23 15:32:33 +01:00
Wim Taymans 7b0e4f27fb memory: make _new_wrapped take user_data and notify
Make it possible to configure a GDestroyNotify and user_data for
gst_memory_new_wrapped() this allows for more flexible wrapping of foreign
memory blocks.
2012-02-22 02:10:21 +01:00
Edward Hervey f730ab02a4 doc fixups 2012-02-17 15:53:58 -08:00
Wim Taymans c6a1bed1ad memory: more work on refcount and writability
Rename _is_writable() with _is_exclusive because the writability does not depend
on the amount of references to the memory object anymore.
Add accessor macros for the memory flags.
Rename the GstBuffer _peek_memory() method to _get_memory() and return a
reference to the memory now that we can do this without affecting writability
of the memory object. Make it possible to also make this function merge the
buffer memory.
Add methods to replace memory in a buffer. Make some convience macros for the
buffer memory functions.
Fix unit tests.
2012-02-13 18:04:03 +01:00
Wim Taymans 16d9a9efbe memory: add memory type
Add memory type when registering memory allocators. Add getter for the memory
type.
2012-01-30 16:13:31 +01:00
Wim Taymans f8c6cd196e memory: add boxed GType for the allocator 2012-01-30 13:28:34 +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 9c9848e952 memory: add flags to the mapinfo 2012-01-25 11:54:23 +01:00
Wim Taymans 203dd6fbe1 memory: make guint8 * for easy usage 2012-01-25 11:54:23 +01:00
Wim Taymans 93074b899c memory: add method to create mapped memory
Add a method to create a GstMemory with the desired mapping. Makes a copy of the
memory if it is currently in use.
2012-01-25 11:54:23 +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 a1d7bd02e4 memory improvements
Make the memory object simply manage the data pointer and the maxsize and move
the offset and size handling to common functionality.
Use the READONLY flag to set a readonly lock.
Remove the data and size fields from the unmap method. We need an explicit
resize operation instead of using the unmap function.
Make internal helper lock and unlock functions.
Update unit test and users of the old API.
2012-01-19 12:51:41 +01:00
Wim Taymans c96d5a330c memory: make writability check into a method
Use a method to check for writability instead of a macro so that we can change
the implementation more easily.
2012-01-16 15:57:35 +01:00
Wim Taymans 80f4716a61 memory: check semantics of nested mappings
Count how many mappings are currently active and also with what access pattern.
Update the design doc with restrictions on the access patterns for nested
mappings.
Check if nested mappings obey the access mode restrictions of the design doc.
Add various unit tests to check the desired behaviour.
2012-01-06 13:10:18 +01:00
Matej Knopp efdd0a2a82 win32: fix exported variables for VS 2010
https://bugzilla.gnome.org/show_bug.cgi?id=666219
2011-12-27 23:26:07 +00:00
Wim Taymans 079a86b78b memory: make subclasses add other flags
Add GST_MAP_FLAG_LAST so that implementations can add additional flags when
mapping memory.
2011-12-19 17:00:18 +01:00
Wim Taymans d1a8695470 fix docs 2011-11-14 10:27:01 +01:00
Wim Taymans 4a7c3b929a .h: fix header files
Ensure correct indentation and :retab.
Make sure all structures have padding
Fix up some old ABI additions.
2011-11-11 17:30:03 +01:00
Tim-Philipp Müller 541d79d886 buffer, memory: make size arguments where -1 is allowed signed 2011-11-11 01:47:30 +00:00
Edward Hervey abab1b1d01 gstmemory: Register a GBoxed GType
Allows using it from g-i
2011-11-10 13:54:02 +01:00
Wim Taymans f3b0d3cdbe init: add _get_type() functions
Remove gst_mini_object_register() and add a GST_DEFINE_MINI_OBJECT macro to
define a _get_type() function for the boxed miniobject.
Remove a bunch of custom _get_type() functions and replace them with the
miniobject macro.
Rename some _init method to _priv_*_initialize() like the rest of them.

Inspired by patch from Johan Dahlin and see bug #657603
2011-08-29 15:34:30 +02:00
Wim Taymans 8461249f22 buffer: fix negative offsets some more
Allow for negative offsets when doing memory copy and share.
Add fast path in the _get_sizes() function.
Fix resize for negative offset and expanding the buffer.
Add some unit tests.
2011-07-11 18:00:52 +02:00
Wim Taymans abf6293639 buffer: add api to get the current memory offset
Also return the offset in a GstMemory block with the get_sizes() method. This
allows us to figure out how much prefix there is unused.
Change the resize function so that a negative offset can be given. This would
make it possible to resize the buffer so that the prefix becomes available.
Add gst_buffer_get_sizes() to return the offset and maxsize as well as the size.
Also change the buffer resize method so that we can specify a negative offset
to remove prefix bytes.
2011-07-11 16:24:16 +02:00
Wim Taymans 3884badea6 memory: rename GstMemoryAllocator -> GstAllocator
simplify the name of the allocator object.
2011-06-22 11:42:46 +02:00
Wim Taymans 3e5c5fb034 memory: expose default alignment
Export the gst_memory_alignment variable so that others can know the default
configured alignment of the system.
2011-06-10 16:46:12 +02:00
Wim Taymans f6dc8eba34 memory: cleanups and improve docs
Make the fallback copy use the same memory allocator as the original object.
Improve some docs.
Require an alloc function when registering an allocator.
Remove gst_memory_allocator_get_default() and merge the feature in
gst_memory_allocator_find()
Fix locks on the hashtable.
Remove defined but not-implemented gst_memory_span() method.
2011-06-08 11:03:50 +02:00
Wim Taymans cfd3faef5a memory: pass user_data to the alloc function
Pass the user data that was passed to _register to the alloc function of an
allocator.
2011-06-07 17:54:33 +02:00
Wim Taymans 70e799c8fc memory: fix some typos 2011-06-07 17:34:17 +02:00
Wim Taymans acb3ee9b2c memory: use allocators to allocate memory
Rename the GstMemoryImpl to GstMemoryAllocator because that's really what it is.
Add an alloc vmethod to the allocator members.
Improve registration of allocators.
Add methods to get and set the default allocator
Always use an allocator to allocate memory, use the default allocator when NULL
is passed.
Add user_data to the allocator Info so that we can pass extra info to the
allocator new method.
2011-06-07 16:19:33 +02:00
Tim-Philipp Müller 4b920eb5d2 docs: update for API changes
Also remove GST_PAD_CHECKGETRANGEFUNC macro
2011-06-05 18:57:56 +01:00
Wim Taymans a5e1ec0edc memory: add NO_SHARE flag to memory
Add a NO_SHARE flag to memory to indicate that it should not be shared
between buffers.
2011-04-07 16:02:43 +02:00
Wim Taymans 800def04e2 docs: update documentation 2011-03-30 18:45:08 +02:00
Wim Taymans ebb14d95b2 buffer: more API tweaks
_trim -> _resize
_create_sub -> copy_region
2011-03-30 16:47:55 +02:00
Wim Taymans 030fcde837 memory: further memory tweaking
Allow for automatic merging of memory block in the _map function and automatic
freeing of the temporary memory.
Remove some unneeded functions.
Add possibility to force writable spanned memory.
2011-03-29 19:17:55 +02:00
Wim Taymans 4e32ac8463 buffer: clean up _span and add more g_return_if.. 2011-03-29 16:52:21 +02:00
Wim Taymans a12373b2ee buffer: add more methods 2011-03-28 20:08:47 +02:00
Wim Taymans 38ffe30745 memory: more work on implementing buffer memory 2011-03-28 20:08:46 +02:00
Wim Taymans 1af328e785 memory: more work on porting the unit tests 2011-03-28 20:08:46 +02:00
Wim Taymans 1eed0785af memory: more fixes
Fix span and is_span
Implement buffer memory
2011-03-28 20:08:45 +02:00
Wim Taymans 6015312cf1 WIP use memory in buffer 2011-03-28 20:08:45 +02:00
Wim Taymans dd74a925c9 memory: more improvements 2011-03-28 20:08:45 +02:00
Wim Taymans b35c0df940 memory: more memory improvements 2011-03-28 20:08:45 +02:00
Wim Taymans 1a7e600f39 memory: add more memory operations 2011-03-28 20:08:45 +02:00
Wim Taymans 063abd4cf1 memory: add memory implementation 2011-03-28 20:08:45 +02:00
Wim Taymans 4fef929ed0 memory: add API for handling memory blocks
Adds some API to handle memory blocks.
2011-03-28 20:08:45 +02:00