Commit graph

266 commits

Author SHA1 Message Date
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
6ffba69d65 buffer: small optimizations
shortcut heavy work when buffer_resize does nothing.
Avoid an extra _ref when mapping a buffer.
Add some G_LIKELY.
2012-03-09 16:14:02 +01:00
Wim Taymans
5cd35d6386 meta: add boolean to signal a region copy
Add a boolean to the metadata copy transform that signals if a only a
region is copied.
2012-03-02 12:45:23 +01:00
Wim Taymans
e80296cf46 meta: split registration of API and implementation
Split out the registration of the metadata API and its implementation. Make a
GType for each metadata API. This allows us to store extra information with the
API type such as the tags.
Change the buffer API so that we can get the metadata using the API GType.
Change the query API so that we use the metadata API GType in the allocation
query instead of a string.
Update netaddress and unit tests
2012-02-29 17:37:09 +01:00
Wim Taymans
6b22a63f1b meta: flesh out the metadata transform
Flesh out the transform method. Add a type and extra info to the transform
function so that implementation can transform the metadata.
Remove the copy function and replace with the more generic transform.
2012-02-24 10:28:56 +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
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
a46f0862cd gst: improve debugging 2012-02-06 09:46:47 +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
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
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
0ca5115722 buffer: improve docs 2012-01-16 12:24:20 +01:00
Wim Taymans
ad9450e1c0 buffer: ensure writable memory in memset 2012-01-06 13:32:55 +01:00
Wim Taymans
87ada5664a buffer: add foreach function for the metadata 2011-12-22 16:02:05 +01:00
Wim Taymans
4bc7ff8e3e meta: add metadata flags
Add metadata flags so that we can set extra properties of the metadata
2011-12-22 16:02:05 +01:00
Wim Taymans
dc23684b12 buffer: add copy flag for meta
Add a flag to control if the meta should be copied or not instead of always
copying.
2011-12-01 15:34:06 +01:00
Wim Taymans
5be6ad56a5 buffer: avoid < -1 sizes 2011-11-11 10:00:35 +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
Vincent Penquerc'h
86a45f236e gstbuffer: remove incorrect assertion
Offset and sizes have no bearing on each other here.
2011-11-10 14:17:33 +00:00
Edward Hervey
7a285354d2 gst: More introspection annotations 2011-11-10 13:54:03 +01:00
Wim Taymans
79aeef49b8 buffer: update docs 2011-11-08 13:13:55 +01:00
Stefan Sauer
93941a2517 buffer: improve parameter docs 2011-11-08 09:15:30 +01:00
Wim Taymans
80fc568747 buffer: add pts/dts to buffers 2011-10-28 12:15:44 +02:00
Wim Taymans
90a4f75650 buffer: improve docs 2011-10-04 18:55:09 +02:00
Wim Taymans
8a1f401dfd docs: fix docs 2011-09-26 20:47:35 +02:00
Wim Taymans
a952de69dd miniobject: change to GST_DEFINE_MINI_OBJECT_TYPE
Append _TYPE to the macro for consistency with other similar macros.
2011-08-29 17:06:18 +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
Wim Taymans
4145598972 gst: add some _priv prefixes to private methods 2011-08-29 13:27:26 +02:00
Wim Taymans
b5ef693e88 buffer: always copy all buffer flags when asked
Don't try to be smart and copy only a subset of buffer flag
2011-08-25 16:20:21 +02:00
Wim Taymans
aefa1c67f8 buffer: return processed number of bytes
Make _fill, _extract and _memset return the actual number of bytes that were
handled in case the buffer size is less than the specified size.
2011-08-16 18:29:29 +02:00
Wim Taymans
8698a8c94e buffer: rename PREROLL -> LIVE flag
Rename the GST_BUFFER_FLAG_PREROLL to GST_BUFFER_FLAG_LIVE and give the new flag
a meaning. The old PREROLL flag never had a clear meaning.
2011-08-16 17:32:20 +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
Edward Hervey
2d4ddc3a08 gstbuffer: Clarify doc 2011-08-08 11:51:26 +02:00
Wim Taymans
ee235a6b07 miniobject: avoid race in bufferpool release
Avoid playing with the refcount to decide when a buffer has been recycled by the
dispose function. The problem is that we then temporarily can have a buffer with
a refcount > 1 being acquired from the pool, which is not writable. Instead use
a simple boolean return value from the dispose function to inform the called
that the object was recycled or not.
2011-07-25 12:53:10 +02:00
Wim Taymans
cc16dd8498 buffer: improve debug message 2011-07-15 11:51:54 +02:00
Wim Taymans
1a3f48f427 buffer: fix resize function some more
Don't remove memory blocks from the buffer when we clip and resize, instead set
the memory offset and size to 0. This allows us to make the buffer larger again
later.
2011-07-12 14:07:57 +02:00
Wim Taymans
a19baf77e7 buffer: improve size handling
Also handle the case where multiple empty memory blocks are in the buffer.
Add unit test for this.
2011-07-12 13:40:35 +02:00
Wim Taymans
a5ee20db3f buffer: fix _resize some more
Add more debug.
Alow resize to 0 bytes.
Do clipping correctly.
Add more unit tests. Also add a failing test: when we resize to 0 and then
try to resize back to the original size it fails because the memory was
removed.
2011-07-12 12:00:58 +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
6b3572feab buffer: fix _resize better 2011-07-11 16:42:56 +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
Mark Nauwelaerts
21e0d113cf buffer: add some memory wrapped buffer allocation helpers 2011-07-11 14:43:19 +02:00
Tim-Philipp Müller
75c81c2120 buffer: make idx argument to gst_buffer_take_memory() signed
Since -1 is acceptable, it should be signed.
2011-07-08 13:53:35 +01:00
Wim Taymans
806cf03fbc buffer: add memset function 2011-07-07 11:02:09 +02:00
Tim-Philipp Müller
a1f6e02149 buffer: fix guards for gst_buffer_take_memory()
Since idx = -1 makes it default to idx=len, len is also
a valid input idx.
2011-07-06 12:09:28 +01:00
Wim Taymans
3884badea6 memory: rename GstMemoryAllocator -> GstAllocator
simplify the name of the allocator object.
2011-06-22 11:42:46 +02:00
Thiago Santos
00c891a823 gstbuffer: Minor fix to docs
Adds missing parameter to docs of gst_buffer_copy_region
2011-06-19 13:17:06 -03:00