Commit graph

75 commits

Author SHA1 Message Date
Tim-Philipp Müller 1be934f0dd miniobjects: pass copy, dispose and free function to gst_mini_object_init()
So mini objects don't have to poke into the GstMiniObject part
of the structure. Saves lines of code, and seems slightly cleaner.
We don't have proper OO hierarchies or methods here after all.
2012-06-23 20:02:02 +01:00
Tim-Philipp Müller 34895ae332 alllocator: no need to store structure size inside the structure 2012-06-15 10:27:18 +01:00
Wim Taymans 12aefaa078 miniobject: remove the size field
The size field is used by subclasses to store the total allocated size of the
memory for this miniobject. Because miniobject doesn't really do anything with
this field we can move it to the subclasses.
2012-06-14 17:11:11 +02:00
Wim Taymans a1c5b00e72 memory: make GstMemory a miniobject 2012-06-14 16:34:28 +02:00
Wim Taymans db204ea24a memory: fix copy function
Make the copy function map to ref because we can't safely copy the user_data.
2012-06-14 16:34:28 +02:00
Wim Taymans a7793f1fd7 memory: make GstAllocator a miniobject 2012-06-14 16:34:28 +02:00
Sreerenj Balachandran 86e0f4d145 memory: add missing parameter to default_mem_map()
Fixes function signature for correctness.

https://bugzilla.gnome.org/show_bug.cgi?id=675289
2012-05-04 09:22:51 +01:00
Wim Taymans ffed76f258 memory: add size to debug log 2012-04-16 10:32:17 +02:00
Wim Taymans ce67b0e539 docs: update more documentation 2012-03-29 13:34:50 +02: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 592b5bec39 memory: fix maxsize after align
when we align the data pointer, make sure to update the maxsize.
Add some more debug
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 185b3c6a0d memory: add comment 2012-03-08 10:34:41 +01:00
David Schleef bc186f85ed spelling fix 2012-02-23 08:48:40 -08: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
Wim Taymans d09073b755 memory: fix more docs 2012-02-18 01:04:18 +01: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 18ddee3b45 memory: add debug and trace for GstMemory 2012-02-02 15:57:48 +01:00
Wim Taymans d8c12ceb2b memory: add some performce debug info
Add some PERFORMANCE debug lines where we copy and do other suboptimal things.
2012-02-02 12:07:28 +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 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