Commit graph

106 commits

Author SHA1 Message Date
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
2ed36d91a6 memory: avoid memory leak
Unref the old memory in make_mapped.
Add some debug info
2012-01-27 11:41:33 +01:00
Andoni Morales Alastruey
ade5b3b917 gstmemory: add missing parameter 2012-01-26 15:17:04 +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
252327f87a Update for new gthread API 2012-01-19 09:27:04 +01:00
Tim-Philipp Müller
10d901291e gst: suppress some more deprecated thread api until we fix it up
Which should be soon, since we already depend on an unstable glib for -base.
2012-01-18 01:31:56 +00: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
Matej Knopp
9092fb87f0 Fix printf format build warnings 2012-01-09 13:15:34 +00: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
Wim Taymans
220b324d24 docs: improve memory docs 2012-01-06 10:39:46 +01:00
Wim Taymans
960c580ae2 memory: handle -1 size in unmap
handle -1 in unmap correctly when the offset is modified.
2012-01-06 07:02:36 +01:00
Wim Taymans
e4a58ec71e memory: improve semantics of unmap
Make an unmap call with a different data pointer than the map call update the
offset field. This allows for both offset and size adjustements in the unmap
call.
2012-01-06 06:43:08 +01:00
Wim Taymans
d483ff2db5 memory: add more checks
Add check for mapping and resizing
2012-01-05 18:15:20 +01:00
Wim Taymans
6e0024e76e memory: take offset into account
Take the offset into account whem mapping and unmapping the buffer.
2012-01-05 17:28:28 +01:00
Wim Taymans
8658b2fd68 tests: add unit test for GstMemory
Add a GstMemory unit test
Add some more asserts in GstMemory to catch invalid cases.
2012-01-05 13:11:05 +01:00
Wim Taymans
6ac2371910 docs: fix some docs 2012-01-03 15:03:38 +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
7a285354d2 gst: More introspection annotations 2011-11-10 13:54:03 +01: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
eda44fbc22 memory: fix memory alignment
Fix compilation when POSIX_MEMALIGN is not set.
Debug the configured alignment.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=660300
2011-09-28 18:47:02 +02:00
Wim Taymans
8a1f401dfd docs: fix docs 2011-09-26 20:47:35 +02: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
Josep Torra
178bdccb76 Fix and clarify debug statements
Fixes build on MacOSX

Signed-off-by: Edward Hervey <edward.hervey@collabora.co.uk>
2011-08-10 11:01:58 +02:00
Wim Taymans
aa97daaf0e fix default alignment
A 0 alignment is the default.
2011-08-04 11:00:57 +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
7c475cc60f memory: fix is_span
Subtract the offset of the parent from is_span.
2011-06-10 16:19:46 +02:00
Wim Taymans
17ff81fc7d memory: respect configured alignment
Move the alignment from GstBuffer to GstMemory.
make sure memory is at least aligned to the configured values.
2011-06-10 13:59:31 +02:00
Wim Taymans
b84fff07ea memory: Require implementation to implement _share
Require the memory implementations to implement a share operation. This allows
us to remove the fallback share implementation which uses a different allocator
implementation and complicates things too much.
Update design doc a bit.
2011-06-08 12:04:49 +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
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
Wim Taymans
b05ee3ddb2 memmory: small cleanup 2011-06-02 18:28:17 +02:00
Wim Taymans
c8fc05743d memory: fix alignment calculations
Fix the alignment calculation.
Improve documentation.
2011-06-02 18:13:33 +02:00
Wim Taymans
a13740db3f memory: don't follow the parent in the fallback share 2011-04-06 19:19:55 +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
121b82ce27 buffer: fix subbuffers 2011-03-28 20:08:47 +02:00
Wim Taymans
6f2af5aa87 memory: more fixes
Automatically make the memory of a buffer writable when the buffer is writable
and the memory is asked to mapped WRITE.
Add docs
2011-03-28 20:08:46 +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
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