Commit graph

89 commits

Author SHA1 Message Date
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