Commit graph

289 commits

Author SHA1 Message Date
Wim Taymans 6fae137027 meta: add LOCKED flag
Add a new LOCKED flag to the metadata. Refuse removing LOCKED metadata from
a buffer.
Mark the metadata from the bufferpool LOCKED.
Add unit test for LOCKED flag
2012-04-17 15:55:10 +02:00
Wim Taymans 2503dcddfb buffer: improve debug 2012-04-14 10:23:49 +02:00
Wim Taymans 82c92a9c7c buffer: improve arg checking
Allow idx == 0 and length == -1 on empty buffers for the _range methods.
2012-04-12 11:53:00 +02:00
Sreerenj Balachandran fd2ebb5365 buffer: Clean up header files 2012-04-11 09:53:45 +02:00
Alessandro Decina e603d08e87 gstbuffer: fix compile warning 2012-04-05 09:07:18 +02:00
Wim Taymans 8428d3e295 buffer: make get_sizes and _resize with ranges
Make the _get_sizes and _resize methods work on a range of memory to make them
more powerfull.
2012-04-04 09:33:13 +02:00
Wim Taymans f3aad8b430 buffer: reuse more code 2012-04-01 12:02:40 +02:00
Wim Taymans 0e9241cfc6 buffer: make function to find memory in a buffer
Make a function to find the memory blocks for a region in a buffer.
2012-04-01 12:02:40 +02:00
Wim Taymans 113b9dc535 buffer: add peek_memory method
Add a peerk_memory method that simply fetches the memory at an offset without
refcounting or merging.
2012-03-31 17:10:35 +02:00
Wim Taymans 38b96e6c8c buffer: improve the buffer memory methods
gst_buffer_take_memory -> gst_buffer_insert_memory because insert is what the
method does.
Make all methods deal with ranges so that we can replace, merge, remove and map
a certain subset of the memory in a buffer. With the new methods we can make
some code nicer and reuse more code. Being able to deal with a subset of the
buffer memory allows us to optimize more cases later (most notably RTP headers
and payload that could be in different memory objects).
Make some more convenient macros that call the more generic range methods.
2012-03-30 18:15:24 +02:00
Edward Hervey 31ca9f9216 gstbuffer: Fix unitialized variable
gcc 4.5 complains otherwise :(
2012-03-29 15:18:33 +02:00
Wim Taymans 9aa9751938 review some docs 2012-03-28 18:12:23 +02:00
Wim Taymans 3e6238135d buffer: simplify and refactor _span and _merge
Unify the _span and _merge code paths and simplify now that we only use this
internally.
2012-03-28 16:48:51 +02:00
Wim Taymans 315e77bf81 buffer: we always call _span with the buffer size 2012-03-28 16:48:51 +02:00
Wim Taymans 127074986c buffer: move some code around 2012-03-28 16:48:51 +02:00
Wim Taymans 8fc290a27f buffer: we call _span always with 0 offset 2012-03-28 16:48:51 +02:00
Wim Taymans a4c861a4d3 buffer: remove always FALSE function argument 2012-03-28 16:48:50 +02:00
Mark Nauwelaerts 1af261169c buffer: delay buffer unref until buffer no longer needed 2012-03-28 16:39:54 +02:00
Wim Taymans bb876588ac buffer: unify buffer merge methods
Add gst_buffer_append() which appends the memory blocks from one buffer to
another. Remove the old inefficient _merge() and _join() methods which forced a
premature memcpy in most cases.
Remove the _is_span() and _span() methods they are not needed anymore now that
we can _append(). Merging and spanning will be delayed until mapping or maybe
not at all when the element can deal with the different memory blocks.
2012-03-28 12:51:58 +02:00
Wim Taymans a137002ef1 buffer: re-enable _span offset calculations
when we _span two complete buffers, we can copy offsets and timestamps.
2012-03-27 15:16:55 +02:00
Wim Taymans 8ff7a0978d buffer: add more _is_writable checks
Add some checks to assert on writability for functions that modify metadata.
2012-03-27 14:59:06 +02:00
Wim Taymans 7bcc3baf64 buffer: improve gst_buffer_new_wrapped_full()
Make it possible to wrap all kinds of memory by exposing all properties to
gst_buffer_new_wrapped_full(). This makes it possible to also create writable
memory without a free function or memory with extra padding.
2012-03-20 10:20:29 +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 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