Commit graph

106 commits

Author SHA1 Message Date
Sebastian Dröge 942fc7f79e gst: Add poisoning to more types 2018-08-03 14:31:34 +03:00
luz.paz 4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Mark Nauwelaerts 9fb56a32f5 gst: fix some GIR annotations
Mostly related to out parameters and their transfer
2018-02-18 12:16:36 +01:00
Thibault Saunier a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Julien Isorce 47fd993d4d memory: log with GST_INFO instead GST_ERROR when subclass map failed.
Add unit test to ensure that.

It can be a normal execution path to do some map trials and there is
no need to worry the user in that case.

The application has to check the return value of gst_memory_map.

https://bugzilla.gnome.org/show_bug.cgi?id=765600
2016-11-21 21:06:31 +00:00
Matthew Waters d61ba38118 memory: provide a mem_map_full that takes the GstMapInfo
Follow up of 7130230ddb

Provide the memory implementation the GstMapInfo that will be used to
map/unmap the memory.  This allows the memory implementation to use
some scratch space in GstMapInfo to e.g. track different map/unmap
behaviour or store extra implementation defined data about the map
in use.

https://bugzilla.gnome.org/show_bug.cgi?id=750319
2015-06-12 16:12:10 +10:00
Matthew Waters 7130230ddb memory: provide a mem_unmap function that takes the flags to unmap
There are gstmemory's available that operate in two memory domains
and need to ensure consistent access between these domains.

Imagine a scenario where e.g. the GLMemory is mapped twice in both
the GPU and the CPU domain.  On unmap or a subsequent map, it would
like to ensure that the most recent data is available in the memory
domain requested.  Either by flushing the writes and/or initiating a
DMA transfer.  Without knowing which domain is being unmapped, the
memory does not know where the most recent data is to transfer to
the other memory domain.

Note: this still does not allow downgrading a memory map.

https://bugzilla.gnome.org/show_bug.cgi?id=750319
2015-06-03 20:41:59 +10:00
Matthew Waters e9c15d5321 memory: gst_memory_share may fail to exclusively lock the parent memory
Now that locking exclusively dows not always succeed, we need to signal
the failure case from gst_memory_init.

Rather than introducing an API or funcionality change to gst_memory_init,
workaround by checking exclusivity in the calling code.

https://bugzilla.gnome.org/show_bug.cgi?id=750172
2015-06-03 20:41:44 +10:00
Prashant Gotarne 6a8f65936b memory: add check for writablity in resize
Add guard to gst_memory_resize() to make sure the
memory to be resized is actually writable.

https://bugzilla.gnome.org/show_bug.cgi?id=747392
2015-04-06 13:32:20 +01:00
Ilya Konstantinov 82abdae1bb memory: improve docs for _copy() and _share() 2015-04-02 17:45:54 +01:00
Evan Nemerson 2759882379 introspection: add missing (nullable) annotations to return values
Support for (nullable) was added to G-I at the same time as nullable
return values.  Previous versions of G-I will not mark return values as
nullable, even when an (allow-none) annotation is present, so it is
not necessary to add (allow-none) annotations for compatibility with
older versions of G-I.

https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:56:38 +02:00
Sebastian Dröge db1e4422b6 gst: Store more basic type GTypes in variables
Micro optimization to change a function call to a variable access
for all our basic types.
2014-06-19 08:06:55 +02:00
Evan Nemerson e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Tim-Philipp Müller 6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Sebastian Dröge 81f9a22228 memory/buffer: Initialise GstMapInfo to zeroes if mapping fails
This should allow for more meaningful errors. Dereferencing NULL
is more useful information than dereferencing a random address
happened to be on the stack.
2014-04-16 19:49:56 +02:00
Alessandro Decina 2b84b4bd97 memory: explicitly cast to GstLockFlags to avoid compiler warnings 2013-11-04 11:53:56 +01:00
Wim Taymans 4df4fd33b1 memory: add method to check memory type
Add a method to check if a memory was allocated from an allocator of
a given type.

API: gst_memory_is_type()
2013-02-26 15:37:24 +01:00
Wim Taymans f37fc1d299 memory: don't unref allocator too soon
Unref the allocator *after* we have freed the memory. We also need to keep
a ref to the allocator around because following the now freed memory would
lead to crashes.
2013-02-26 14:40:38 +01:00
Sebastian Dröge d50190ba55 memory: Keep a reference to the allocator
Otherwise the allocator might get freed while it's still used
by the memory
2013-02-24 09:46:01 +01:00
Tim-Philipp Müller 666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Wim Taymans f362f643ac memory: Make GstAllocator a GstObject
Make GstAllocator a GstObject instead of a GstMiniObject, like bufferpool.
Make a new gstallocator.c file. Make a GstAllocator subclass for the default
allocator.
2012-07-09 16:28:22 +02:00
Wim Taymans 6e7c469b48 memory: remove unused macros 2012-07-09 16:28:22 +02:00
Wim Taymans 408df31a48 memory: expose the GstAllocation structure
Expose the GstAllocation structure and provide an _init function. This makes it
easier to make 'subclasses' of the allocator that contain more info.
It also allows us to expose the flags on the allocator miniobject.
Make a flag to note that the allocator uses a custom alloc function.
2012-07-06 17:24:32 +02:00
Wim Taymans 50cf7f6a08 memory: add gst_memory_init()
Add a method that memory implementations can call to initialize the standard
GstMemory structure.
Move the parent handling in the _free handler.
Rearrange some internal function parameters so that the order is consistent.
Add more memory examples
2012-07-05 17:11:01 +02:00
Wim Taymans 3b16efa1d1 miniobject: add lock functionality to GstMiniObject
Move the locking methods from GstMemory to GstMiniObject.
Add a miniobject flag to enable LOCKABLE objects. LOCKABLE objects can
use the lock/unlock API to control the access to the object.
Add a minobject flag that allows you to lock an object in readonly mode.
Modify the _is_writable() method to check the shared counter for LOCKABLE
objects. This allows us to control writability separately from the refcount for
LOCKABLE objects.
2012-07-05 11:19:16 +02:00
Wim Taymans 4b322e37f8 memory: fix is_exclusive 2012-07-05 11:19:16 +02:00
Wim Taymans 1b52aca7ea memory: small cleanup 2012-07-05 11:19:16 +02:00
Wim Taymans 9a20741b0a memory: Fix the NO_SHARE flag in the constructor
The NO_SHARE flag does not influence the exclusiveness of the buffer initially
but only if a _share operation can be done. Otherwise, we would not be able to
WRITE map a buffer memory because it would have a share count of at least 2.
2012-07-05 11:19:16 +02:00
Wim Taymans 4a0dd59808 memory: only check the locking refcount 2012-07-05 11:19:16 +02:00
Wim Taymans 70c1513eac memory: cleanup the locking code
cleanup and fix the locking code
2012-07-05 11:19:15 +02:00
Wim Taymans 93f279cd5a memory: expose the internal locking api
Expose the internally used methods for locking and unlocking the object. Pass
the access mode to the unlock function for extra checks and because we need it
for the EXCLUSIVE locks.
Make some new defines to specify the desired locking.
Add a new EXCLUSIVE lock mode which will increment the shared counter. Objects
with a shared counter > 1 will not be lockable in WRITE mode.
2012-07-05 11:19:15 +02:00
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