Commit graph

349 commits

Author SHA1 Message Date
Matthew Waters
eb71ee4040 buffer: locking memory exclusively may fail
Attempt to return a copy of the memory instead.

https://bugzilla.gnome.org/show_bug.cgi?id=750172
2015-06-03 20:41:44 +10:00
Jan Schmidt
b0c072711d gstbuffer: Add a note about metas needing to be copied last 2015-06-03 00:48:17 +10:00
Sebastian Dröge
a5ab02733a buffer: Check return value of meta transform function in gst_buffer_copy_into()
... by printing some debug output whenever copying a GstMeta fails.

https://bugzilla.gnome.org/show_bug.cgi?id=748119
2015-04-20 09:23:43 +02:00
Sebastian Dröge
21da311743 buffer: Use the correct enum type to fix a compiler warning
gstbuffer.c:522:58: error: implicit conversion from enumeration type 'GstBufferFlags' to
      different enumeration type 'GstBufferCopyFlags' [-Werror,-Wenum-conversion]
  if (!gst_buffer_copy_into (copy, (GstBuffer *) buffer, flags, 0, -1))
       ~~~~~~~~~~~~~~~~~~~~                              ^~~~~
gstbuffer.c:534:46: error: implicit conversion from enumeration type 'GstBufferCopyFlags' to
      different enumeration type 'GstBufferFlags' [-Werror,-Wenum-conversion]
  return gst_buffer_copy_with_flags (buffer, GST_BUFFER_COPY_ALL);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~          ^~~~~~~~~~~~~~~~~~~
./gstbuffer.h:433:31: note: expanded from macro 'GST_BUFFER_COPY_ALL'
  ...((GstBufferCopyFlags)(GST_BUFFER_COPY_METADATA | GST_BUFFER_COPY_MEMORY))
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-03-14 13:37:09 +00:00
Thiago Santos
96eaeadc0f gstbuffer: add gst_buffer_copy_deep
A variant of gst_buffer_copy that forces the underlying memory
to be copied.

This is added to avoid adding an extra reference to a GstMemory
that might belong to a bufferpool that is trying to be drained.
The use case is when the buffer copying is done to release the
old buffer and all its resources.

https://bugzilla.gnome.org/show_bug.cgi?id=745287
2015-03-13 18:37:04 +00:00
Sebastian Dröge
6e47237e66 buffer: Document that gst_buffer_copy_region() accepts -1 as size to copy until the end
It's just a wrapper around gst_buffer_copy_into() after all.
2015-01-29 12:10:49 +01:00
William Manley
e9e620cd37 docs: Fix GstBuffer typo "memory bock" -> "memory block"
https://bugzilla.gnome.org/show_bug.cgi?id=737117
2014-09-23 19:31:21 +03:00
William Manley
f6b053d375 docs: Improve gst_buffer_get_meta() to clear up confusion
I was confused by the existence of `gst_buffer_get_meta` as it suggested
to me that you should only attach one of any type of GstMeta to a buffer.
It's perfectly fine to attach multiple from a single API so I'm
documenting that here.

https://bugzilla.gnome.org/show_bug.cgi?id=737129
2014-09-23 19:30:15 +03:00
Arnaud Vrac
f0deb37a86 buffer: do not touch memory tag flag when copying buffer flags
The tag memory flag will be set later if the memory is also copied. This
patch avoids buffers being freed needlessly in bufferpools.

https://bugzilla.gnome.org/show_bug.cgi?id=735574
2014-08-28 12:20:12 +03:00
Evan Nemerson
5d80cf12ba introspection: add nullability annotations to out and inout params
https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:59:15 +02: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
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
Nicolas Dufresne
ec69ad4e8a buffer: Only set TAG_MEMORY if the memory has been replaced
Currently we set TAG_MEMORY as soon a resize changes the size of one
of the memory. This has the side effect that buffer pool cannot know if
the memory have simply been resized, or if the memorys has been replaced.
This make it hard to actually implement _reset(). Instead, only set the
TAG_MEMORY if one or more memory has been replaced, and do a light
sanity check of the size.

https://bugzilla.gnome.org/show_bug.cgi?id=727109
2014-04-26 15:03:04 -04: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
Edward Hervey
c7295cf4b9 gstbuffer: Fix range iteration
We want to iterate over items idx to idx + length

We use the len variable as the corrected number of memory to iterate
and then properly go over all items.

Fixes the issue where specifying any idx different from 0 had no effect

Spotted by clang static analyzer
2014-04-11 13:45:21 +02:00
Wim Taymans
ee348fe7cb buffer: don't clear TAG on NULL buffer
When the buffer fails to copy, don't clear the TAG on the NULL pointer.
2014-03-24 16:11:30 +01:00
Tim-Philipp Müller
313f01ab79 buffer: invert meaning of GST_BUFFER_FLAG_TAG_MEMORY
It's nicer to only have it set when something noteworthy
happened and otherwise unset.

https://bugzilla.gnome.org/show_bug.cgi?id=725862
2014-03-07 20:43:44 +00:00
Stefan Sauer
cbfafd212b buffer: add return values to g_return_if_fail
FIxes previous commit.
2014-02-27 18:28:15 +01:00
Stefan Sauer
c068b225fe docs: convert the examples to use gtk-doc markup, instead of docbook
The gtk-doc markup is less intrusive and better handled when creating docs for
language bindings. The titles (where used) where not adding much.
2014-02-27 18:11:35 +01:00
Wim Taymans
659785d896 buffer: add function to check writability of memory
Check if memory is writable in a buffer and thus is exclusively owned by
this buffer.
2014-02-27 16:39:50 +01:00
Wim Taymans
5bca002f4b buffer: add a new flag to track memory changes
Add a flag to check if the memory changed in a buffer.
2014-02-27 15:43:13 +01:00
Wim Taymans
86f506e9d8 buffer: remove wrong comment
Refcount and writability are not related for memory objects.
2014-02-27 15:43:13 +01:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Sebastian Rasmussen
b40fa2b8c3 docs: cosmetic changes in references/decriptions
* fix typo GstBufferFlag -> GstBufferFlags
 * fix typo GstFeatures -> GstCapsFeatures
 * fix typo GstAllocatorParams -> GstAllocationParams
 * fix typo GstContrlSources -> GstControlSource
 * do not refer to gstcheck as an object
 * make references gtk_init() and tcase_set_timeout() not be references
 * gst_element_get_pad() renamed gst_element_get_static_pad()
 * gst_clock_id_wait_async_full() renamed gst_clock_id_wait_async()
 * _drop_element() is really gst_queue_array_drop_element()
 * gst_pad_accept_caps() was removed, do not refer to it
 * separate GST_META_TAG_MEMORY_STR declaration from description
 * do not describe removed gst_collect_pads_collect()
 * correctly link to GstElementClass' virtual set_context()

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=719614
2013-12-02 21:01:08 +00:00
Tim-Philipp Müller
4afa63a8ba gst: g_memmove() is deprecated
Just use plain memmove(), g_memmove() is deprecated in
recent GLib versions.

https://bugzilla.gnome.org/show_bug.cgi?id=712811
2013-11-21 15:04:04 +00:00
Tim-Philipp Müller
9f669e5ea5 docs: cosmetic since marker fixes 2013-11-16 16:09:40 +00:00
Olivier Crête
f90f3cde5f buffer: Fix gst_buffer_memcmp() where the buffer is smaller than size
Also add unit tests for gst_buffer_memcmp

https://bugzilla.gnome.org/show_bug.cgi?id=706162
2013-08-20 14:41:27 -04:00
Sebastian Dröge
98d8cdfda4 buffer: Update since marker for gst_buffer_extract_dup() to 1.0.10 2013-08-18 11:49:08 +02:00
Tim-Philipp Müller
6e107e90ed buffer: fix Since: marker for new gst_buffer_extract_dup() 2013-07-26 18:36:04 +01:00
Paul HENRYS
db80044513 buffer: Fix wrong size/index handling when merging memory
https://bugzilla.gnome.org/show_bug.cgi?id=702617
2013-06-19 10:39:30 +02:00
Edward Hervey
e1f520f27c gstbuffer: Use internal function for buffer_new_wrapped
Shaves ~10% instruction calls from the total cost

https://bugzilla.gnome.org/show_bug.cgi?id=701633
2013-06-05 11:15:34 +02:00
Tim-Philipp Müller
65c2ecb4f3 buffer: allow calling _fill() with a NULL data pointer if size is 0 bytes 2013-05-08 10:25:36 +01:00
Wim Taymans
396b49ec4d buffer: add _gst_max_memory() function
Add the a function to query the maximum amount of memory blocks that can be
added to a buffer. Also improve the docs for _insert_memory().
2013-04-11 14:31:01 +01:00
Olivier Crête
ec16d6b0a4 buffer: Add annotations and pygi friendly extraction function
API: gst_buffer_extract_dup
2013-03-27 13:07:03 -04:00
Sebastian Dröge
64affd3e61 buffer: Fix memory copying logic in copy_into()
https://bugzilla.gnome.org/show_bug.cgi?id=695035
2013-03-03 12:06:36 +01:00
Sebastian Dröge
ce1c1cf214 buffer: Gracefully handle gst_memory_copy() returning NULL without crashing
gst_buffer_copy_into() and gst_buffer_resize_range() can now fail.
2013-02-27 10:11:23 +01:00
Sebastian Dröge
2ca0046934 buffer: Fix inverted logic for deciding if memory should be shared or copied
https://bugzilla.gnome.org/show_bug.cgi?id=694717
2013-02-26 09:09:25 +01:00
Sebastian Dröge
209f081ab8 buffer: If sharing a GstMemory fails, fall back to copying it 2013-02-24 09:46:01 +01:00
Wim Taymans
1fcef378bd buffer: add option to deep copy a buffer
Add a buffer copy flag to force a memory copy in all cases.
2013-02-16 14:59:02 +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
Tim-Philipp Müller
dddcc31c42 docs: fix up docs a bit 2012-08-11 23:41:33 +01:00
Evan Nemerson
f169081290 buffer: mark gst_buffer_wrapped* data as array
https://bugzilla.gnome.org/show_bug.cgi?id=678301
2012-08-10 15:05:26 +01:00
Evan Nemerson
237f707c75 buffer: convert gst_buffer_* macros to functions
GObject Introspection does not support macros.
This is needed for bindings. We can still add back
macros or inline functions again later if we think
it's worth it.

https://bugzilla.gnome.org/show_bug.cgi?id=678301
2012-08-10 15:04:12 +01:00
Tim-Philipp Müller
579d1a3eca buffer, defaultmem: add option to poison memory before freeing it
Might be useful to track down certain bugs.
2012-08-04 13:37:32 +01:00
Jens Georg
d89219eba3 buffer: Update annotations
https://bugzilla.gnome.org/show_bug.cgi?id=680805
2012-07-30 16:07:38 +01:00
Wim Taymans
8c864712e6 buffer: make _foreach_meta more powerful
Make _foreach_meta return FALSE when the foreach function returned FALSE.
2012-07-17 12:57:59 +02:00
Wim Taymans
c8e83cde78 buffer: add more debug 2012-07-17 12:50:24 +02:00
Wim Taymans
070f7c4e1c buffer:fix debug category 2012-07-05 11:19:16 +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