Commit graph

377 commits

Author SHA1 Message Date
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
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
Wim Taymans
54fd50bfe1 buffer: add index to _take_memory()
Add an index to gst_buffer_take_memory() so that we can also insert memory at a
certain offset. This is mostly interesting to prepend a header memory block to
the buffer.
2011-06-13 16:31:53 +02:00
Wim Taymans
d837268a77 buffer: add more debug 2011-06-13 12:04:28 +02:00
Wim Taymans
468dbbbaaf buffer: pass the allocator as const 2011-06-13 11:50:42 +02:00
Wim Taymans
eeb07b3f3d buffer: add support for buffer in memory
Fix the code to support allocating the buffer and memory in one memory block.
Add an extra variable to store the memory of the buffer.
This code is disabled still because of complications.
2011-06-10 16:47:29 +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
b27ee30a35 buffer: make new _buffer_allocate method
Make a new method to allocate a buffer + memory that takes the allocator and the
alignment as parameters. Provide a macro for the old method but prefer to use
the new method to encourage plugins to negotiate the allocator properly.
2011-06-10 13:49:23 +02:00
Wim Taymans
4a424c379f buffer: fix typo in docs 2011-06-09 11:13:55 +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
539cceab88 buffer: pass the right alignment 2011-06-02 18:28:54 +02:00
Wim Taymans
b5456cc6f4 caps: remove caps from buffers and pads
Remove the GstCaps from buffers and pads. We now use CAPS events to negotiate
formats between element.
2011-05-09 16:21:28 +02:00
Edward Hervey
b84afab3fa gstbuffer: Fix unitialized variables 2011-05-09 13:45:49 +02:00
Wim Taymans
d43cdfbf37 buffer: avoid using buffer caps 2011-05-08 12:37:44 +02:00
Wim Taymans
c4751ec8c1 Revert "context: use context on buffers instead of caps"
This reverts commit 9ef1346b1f.

Way to much for one commit and I'm not sure we want to get rid of the pad caps
just like that. It's nice to have the buffer and its type in onw nice bundle
without having to drag the complete context with it.
2011-05-05 13:17:08 +02:00
Wim Taymans
9ef1346b1f context: use context on buffers instead of caps
Put the srcpad context on buffers instead of caps. This allows us to associate
all the relevant info contained in events with a buffer.
2011-05-04 18:59:47 +02:00
Wim Taymans
b8c1e81328 buffer: add method to compare buffer data
Add method to compare the data in a buffer.
2011-04-19 18:57:43 +02:00
Wim Taymans
df85690cfd buffer: add FIXME 2011-04-11 10:20:10 +02: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
f332b700d5 buffer: make memory writable in _peek
Make the memory writable when we are asked to _peek with MAP_WRITE.
Improve debugging of miniobject.
2011-04-06 19:00:28 +02:00
Wim Taymans
7cae289036 docs: update docs 2011-03-30 19:01:13 +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
db230b6121 design: update docs 2011-03-30 13:04:34 +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
edbfc492bb buffer: implement COPY_MERGE 2011-03-29 17:17:46 +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
d9becdcd27 buffer: optimize memory handling 2011-03-29 13:51:25 +02:00
Wim Taymans
a6d2490b10 buffer: move implementation details in private struct 2011-03-29 11:31:30 +02:00
Wim Taymans
6da19ffeb2 buffer: more buffer updates 2011-03-29 11:07:36 +02:00
Wim Taymans
121b82ce27 buffer: fix subbuffers 2011-03-28 20:08:47 +02:00
Wim Taymans
9ff103b3a5 buffer: implemet trim and set_size 2011-03-28 20:08:47 +02:00
Wim Taymans
826a7d83d4 buffer: more fixes 2011-03-28 20:08:47 +02:00
Wim Taymans
a12373b2ee buffer: add more methods 2011-03-28 20:08:47 +02:00
Wim Taymans
beac9c4a95 buffer: fix remaining unit tests 2011-03-28 20:08:46 +02:00
Wim Taymans
f35847a094 buffer: fix unit test 2011-03-28 20:08:46 +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
d82c8bd2af memory: port code to new buffer data API 2011-03-28 20:08:45 +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
fa0d993372 meta: implement transform function
Replace subbuffer and copy vmethods by a more generic transform function that
can then be parametrised by transform specific data. This should allow us to
implement make-writable and more future transform functions.
2011-03-08 17:11:23 +00:00
Wim Taymans
b11ede5984 bufferpool: add more debug info 2011-03-04 12:06:11 +01:00
Wim Taymans
673d90fb99 buffer: release buffer to pool in dispose
Use the dispose method to release the buffer to the pool when it is configured.
2011-03-02 11:57:06 +01:00
Wim Taymans
a55bc30f81 buffer: add pool to buffer structure
Keep a pointer to the bufferpool. Release the buffer to the pool when
finalizing. Make sure the pool sets itself as the pool member of buffers that it
sends out.
2011-03-02 11:33:24 +01:00
Wim Taymans
58060d7528 meta: separate add and get methods
Make separate api for getting and adding metadata. This allows us to pass extra
parameters to the init functions when creating metadata, which is needed for
specific API implementations.
Add beginnings of memory metadata.
2011-02-27 19:40:45 +01:00
Wim Taymans
9a3f158c73 buffer: remove useless method
Remove the method to retrieve metadata by api. One will always use the
GstMetaInfo to get metadata.
2011-02-26 18:14:36 +01:00
Wim Taymans
23aa5508f3 buffer: remove owner_priv now that we have metadata
Now that we have metadata we can remove the owner_priv field.
2011-02-25 16:31:11 +01:00
Wim Taymans
6f4a733063 metadata: Rename to GstMeta
Rename to the shorter GstMeta
Add docs
Add api to get metadata by API
2011-02-25 13:15:25 +01:00
Philippe Normand
376089db14 buffer: fix memory corruption 2011-02-25 10:34:52 +01:00
Wim Taymans
8468dadc77 buffermeta: add beginnings of buffer metadata
Add first implementation of arbitrary buffer metadata. We use a simple linked
linked of slice allocated metadata chunks. Future implementations could use
something more performant.
Add get, remove, iterate methods to handle the metadata.
2011-02-25 10:34:47 +01:00
Wim Taymans
b108e3b999 miniobject: cleanups
Use the stored size in the miniobject to free the miniobject.
Refactor some init methods.
2011-02-23 16:48:00 +01:00
Wim Taymans
70be8d8d95 improve type registration 2011-02-23 10:35:36 +01:00
Wim Taymans
cdde34f0ee fix compilation 2011-02-23 10:35:36 +01:00
Wim Taymans
6c18c9508d miniobject: more boxed type fixing
More miniobject fixing, leaks horribly somewhere..
2011-02-23 10:35:09 +01:00
Wim Taymans
fda9686b35 miniobject: work on making caps a boxed type
More work on making miniobject a simple allocated struct.
2011-02-23 10:34:08 +01:00
Wim Taymans
086aac764d miniobject: make miniobject a boxed type
First attempt at making miniobject a simple boxed type.
2011-02-23 10:33:44 +01:00
Wim Taymans
52978bd4e6 buffer: clarify docs 2011-01-24 16:35:25 +01:00
Tim-Philipp Müller
8a7fc1d8c9 Revert "micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers"
This reverts commit 6aa8ca37ee.

See http://article.gmane.org/gmane.comp.video.gstreamer.devel/32282
2010-12-26 21:21:43 +00:00
Tim-Philipp Müller
3256c708be docs: gst: more gobject introspection annotations
Many of these are superfluous, added for clarity.
2010-12-07 18:37:04 +00:00
Edward Hervey
6aa8ca37ee micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers 2010-12-03 12:03:42 +01:00
Tim-Philipp Müller
59209b1891 buffer: add guard to buffer_set_caps() that checks if caps are simple 2010-10-13 14:54:23 +01:00
Tim-Philipp Müller
8e932639ba buffer: only warn if metadata is not writable when it should be, don't return as well
Make sure we execute the same code path in git versions and in releases,
so just warn when metadata isn't writable when we want it to be instead
of bailing out.
2010-04-30 13:09:34 +01:00
Tim-Philipp Müller
8a4aed855a buffer: fix printf format
Use %u to print unsigned integers.
2010-03-11 09:39:23 +00:00
Stefan Kost
a184419ec5 buffer: allow configurable memory alignment. Fixes #596832
The alignment guaranteed by malloc is not always sufficient. E.g. vector
instructions or hardware subsystems want specifically aligned buffers. The
attached patch will use posix_memalign if available to allocate buffers.
The desired alignment can be set when running configure using the new
--with-buffer-alignment option.
2010-03-11 10:00:28 +02:00
Benjamin Otte
22f87a529f Fixes -Wundef warnings
... and adds that flag to configure.ac

https://bugzilla.gnome.org/show_bug.cgi?id=611692
2010-03-10 20:46:09 +01:00
Wim Taymans
1c5a6768cc buffer: remove unneeded casts 2009-12-27 19:33:25 +01:00
Wim Taymans
67bd9529d0 buffer: remove subbuffer subclass
Move the parent buffer pointer into the GstBuffer struct so that we can
remove the subbuffer class and type. This is interesting because it allows us to
more naturally implement methods to get the real type and parent
of a subbuffer (See #545501).
It should also be slightly faster because there is no extra object hierarchy to
initialize and free.
2009-12-26 00:02:17 +01:00
Wim Taymans
aa33db85cc gstbuffer: add additional checking for writability
Check for metadata writability when setting caps on buffer or when copying
metadata flags. Only enable these extra assertions in git versions.
This should help us find bad elements.
2009-08-06 18:47:32 +02:00
Edward Hervey
43dba6cefc miniobjects: Don't chain up to empty finalize method.
If ever we do anything in mini_object_finalize, we should make sure the 4
core miniobject finalize methods chain back up again.
2009-06-24 11:00:27 +02:00
Wim Taymans
791fa43812 buffer: avoid memory leaks
Avoid leaking the caps of the dest buffer and avoid doing needless caps
refs.
When the source and target buffers are the same, return immediatly.
2009-05-27 16:19:34 +02:00
Edward Hervey
6c1dce01d1 gstbuffer: copy new buffer flags when copying metadata. 2009-05-12 11:22:11 +02:00
Wim Taymans
13515a7535 gstbuffer: avoid typechecks in finalize
Avoid useless typechecking in the finalize of buffers and subbuffers.
2009-05-11 22:35:08 +02:00
Sebastian Dröge
e7ccf786c3 gst: Use G_DEFINE_TYPE and friends or at least g_once_init_* in the _get_type() functions 2009-04-04 10:20:36 +02:00
Wim Taymans
3cc67ebab7 gst/gstbuffer.c: Avoid costly typechecking for trivially correct pointers.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_finalize):
Avoid costly typechecking for trivially correct pointers.
* gst/gstpoll.c: (gst_poll_wait):
Add some G_LIKELY here and there.
* libs/gst/base/gstadapter.c: (gst_adapter_push):
Add some debug info.
2008-11-13 18:09:45 +00:00
Andy Wingo
267d0ba8f3 gst/gstbuffer.h (GST_BUFFER_FREE_FUNC): New API, a free function that will be called on the malloc_data to free it. B...
Original commit message from CVS:
2008-10-06  Andy Wingo  <wingo@pobox.com>

* gst/gstbuffer.h (GST_BUFFER_FREE_FUNC): New API, a free function
that will be called on the malloc_data to free it. Basically a way
to avoid subclassing when all you need is a different free
function, i.e. free() instead of g_free().

* gst/gstbuffer.c (gst_buffer_finalize): Free malloc_data via
calling the free function.
(gst_buffer_init): Initialize the free function to g_free.
2008-10-06 18:01:42 +00:00
Stefan Kost
f09aa1dd08 gst/gstbuffer.c: Copy selected buffer-flags when creating subbuffers.
Original commit message from CVS:
* gst/gstbuffer.c:
Copy selected buffer-flags when creating subbuffers.
Fixes #516395.
2008-02-15 12:33:00 +00:00
Sebastian Dröge
109511b55b Properly chain up finalize functions to the parent class.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_class_init), (gst_buffer_finalize):
* gst/gstevent.c: (gst_event_class_init), (gst_event_finalize):
* gst/gstmessage.c: (gst_message_class_init),
(gst_message_finalize):
* gst/gstquery.c: (gst_query_class_init), (gst_query_finalize):
* plugins/elements/gstfilesrc.c: (gst_mmap_buffer_class_init),
(gst_mmap_buffer_finalize):
Properly chain up finalize functions to the parent class.
2008-02-12 12:04:43 +00:00
Wim Taymans
c7d40b0a25 gst/gstbuffer.c: Update some comments.
Original commit message from CVS:
* gst/gstbuffer.c:
Update some comments.
* tools/gst-inspect.c: (print_element_properties_info):
Improve printing of flags.
2008-01-09 12:19:31 +00:00
Tim-Philipp Müller
99a41cefe3 g_type_class_ref() other types as well, see #349410 and #64764.
Original commit message from CVS:
* gst/gst.c: (init_post):
* gst/gstevent.c: (_gst_event_initialize):
* gst/gstquery.c: (_gst_query_initialize):
* libs/gst/dataprotocol/dataprotocol.c (gst_dp_init):
g_type_class_ref() other types as well, see #349410 and #64764.
* gst/gstbuffer.c: (_gst_buffer_initialize):
* gst/gstmessage.c: (_gst_message_initialize):
Simplify existing g_type_class_ref().
2007-11-01 21:50:05 +00:00
Michael Smith
aacc87e07c gst/gstbuffer.c: Make it once again possible to free GstBuffers in the default build.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_finalize):
Make it once again possible to free GstBuffers in the default
build.
The poisoning scribbles on parts of the miniobject we need in
order to free it.
Fixes #480341
2007-09-26 17:00:22 +00:00
Sebastian Dröge
93634c30c2 gst/gstbuffer.c: Implement poisoning for GstBuffer if --enable-poisoning is specified.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_finalize):
Implement poisoning for GstBuffer if --enable-poisoning is specified.
When finalizing a buffer the complete struct is filled with 0xff,
thus making a use of the buffer after the final unref impossible.
2007-09-13 08:42:55 +00:00
Tim-Philipp Müller
9299939987 gst/gstbuffer.c: Also do a g_type_class_ref() for the subbuffer type in the init function.
Original commit message from CVS:
* gst/gstbuffer.c:
Also do a g_type_class_ref() for the subbuffer type in
the init function.
2007-09-11 18:59:09 +00:00
Tim-Philipp Müller
2c5a8cdb31 API: add gst_buffer_try_new_and_alloc() plus unit test (#431940).
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbuffer.c: (gst_buffer_try_new_and_alloc):
* gst/gstbuffer.h:
* tests/check/gst/gstbuffer.c: (GST_START_TEST),
(gst_buffer_suite):
API: add gst_buffer_try_new_and_alloc() plus unit test (#431940).
2007-04-26 10:00:49 +00:00
Wim Taymans
db43de1985 Add metadata copy functions. Fixes #393099.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbuffer.c: (gst_buffer_copy_metadata), (_gst_buffer_copy):
* gst/gstbuffer.h:
Add metadata copy functions. Fixes #393099.
* gst/gstutils.c: (gst_buffer_stamp):
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buffer):
Use new metadata copy functions.
2007-03-09 16:30:38 +00:00
Wim Taymans
87a78cc03d gst/gstbuffer.c: Copy duration/offset_end/caps when creating a subbuffer of the complete parent.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_make_metadata_writable),
(gst_buffer_create_sub):
Copy duration/offset_end/caps when creating a subbuffer of the
complete parent.
Make the subbuffer read-only when we make the metadata writable for
now. Fixes #351768.
* tests/check/gst/gstbuffer.c: (GST_START_TEST):
Added check for metadata copy when creating subbuffers.
2006-08-21 09:30:04 +00:00
Wim Taymans
3254e4d752 gst/: Small doc updates.
Original commit message from CVS:
* gst/gstbuffer.c:
* gst/gsttask.c: (gst_task_join):
Small doc updates.

* gst/gstpad.c: (gst_pad_activate_pull), (gst_pad_activate_push),
(gst_pad_stop_task):
When pad (de)activation failed for some reason, restore the old
activation mode and set the pad to flushing instead of assuming the
pad is deactivated.
If the _task_join() failed, reinstall the task on the pad so that it can
be stopped later and return an error.
2006-08-14 07:35:09 +00:00
Wim Taymans
c75651326f gst/gstbuffer.c: Avoid function call for known types by keeping the buffer and subbuffer GType global.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_get_type), (gst_buffer_new),
(gst_subbuffer_get_type), (gst_buffer_create_sub):
Avoid function call for known types by keeping the buffer and
subbuffer GType global.
* plugins/elements/gstfilesrc.c: (gst_file_src_create_read):
Random silly optimisations in read() path.
2006-07-26 10:39:58 +00:00
Wim Taymans
fa9bb7929e No point in checking if the size of the subbuffer > 0, the code handles it correclty as demonstrated by unit test.
Original commit message from CVS:
* gst/gstbuffer.c: (_gst_buffer_copy), (gst_buffer_create_sub):
* tests/check/gst/gstbuffer.c: (GST_START_TEST),
(gst_buffer_suite):
No point in checking if the size of the subbuffer > 0, the
code handles it correclty as demonstrated by unit test.
Also add a unit test for the zero sized _new_and_alloc and
_copy. Fixes #346663.
2006-07-05 17:09:18 +00:00
Wim Taymans
0dc1fb9c67 gst/gstbuffer.c: Init _type for consistency.
Original commit message from CVS:
* gst/gstbuffer.c: (gst_buffer_get_type), (gst_buffer_finalize),
(_gst_buffer_copy), (gst_buffer_is_metadata_writable),
(gst_subbuffer_finalize), (gst_buffer_create_sub),
(gst_buffer_is_span_fast), (gst_buffer_span):
Init _type for consistency.
Use _FLAGS macro to avoid type check.
Avoid unneeded type checks in subbufer code.
2006-06-12 09:23:43 +00:00
Thomas Vander Stichele
5178830021 whitespace fixes
Original commit message from CVS:
whitespace fixes
2006-06-06 08:50:40 +00:00