Commit graph

28 commits

Author SHA1 Message Date
Mathieu Duponchelle
5dc149f4f2 gstbuffer: store meta in add order
The previous implementation of add was implemented as a prepend,
switch to append as that seems like the expected order.
2019-03-04 12:57:02 +00:00
Tim-Philipp Müller
f62ee97592 buffer: store sequence number for metas
For metas where order might be significant if multiple metas are
attached to the same buffer, so store a sequence number with the
meta when adding it to the buffer. This allows users of the meta
to make sure metas are processed in the right order.

We need a 64-bit integer for the sequence number here in the API,
a 32-bit one might overflow too easily with high packet/buffer
rates. We could do it rtp-seqnum style of course, but that's a
bit of a pain.

We could also make it so that gst_buffer_add_meta() just keeps metas in
order or rely on the order we add the metas in, but that seems too
fragile overall, when buffers (incl. metas) get merged or split.

Also add a compare function for easier sorting.

We store the seqnum in the MetaItem struct here and not in the
GstMeta struct since there's no padding in the GstMeta struct.
We could add a private struct to GstMeta before the start of
GstMeta, but that's what MetaItem effectively is implementation-
wise. We can still change this later if we want, since it's all
private.

Fixes #262
2019-02-12 17:53:08 +00:00
Nirbheek Chauhan
febfabb39f misc: Fix various compiler warnings on MinGW
gstharness.c: Use G_GSIZE_FORMAT instead of hard-coding %zu
error: unknown conversion type character 'z' in format [-Werror=format]

gst-inspect.c: GPid is void* on non-UNIX, and we only use it on UNIX
error: initialization makes pointer from integer without a cast [-Werror]

gstmeta.c: Use and then discard value
error: value computed is not used [-Werror=unused-value]

With this, gstreamer builds with -Werror on MinGW
2019-02-05 18:45:54 +05:30
Dardo D Kleiner
ec5e781e6b buffer: Add more exhaustive test for gst_buffer_foreach_meta() meta removal
Existing test for iterating/removing buffer meta data was insufficient
to detect linked list corruption when removing multiple items, and could
also suffer from such corruption in attempting to count remaining items.
Modified the one test and added several others to exercise multiple
scenarios.

Validates fix for issue #332.
2018-12-05 20:50:45 +00:00
Tim-Philipp Müller
f87d38c186 tests: meta: fix msvc compiler warnings
gstmeta.c(167): warning C4090: 'function': different 'const' qualifiers
gstmeta.c(172): warning C4090: 'function': different 'const' qualifiers
gstmeta.c(211): warning C4090: 'function': different 'const' qualifiers
gstmeta.c(216): warning C4090: 'function': different 'const' qualifiers
2018-08-26 11:45:58 +02:00
Mathieu Duponchelle
e838007d09 gstbuffer: fix meta removal in gst_buffer_foreach_meta
When updating the linked list, prev->next = next is correct
if prev is actually updated after being set to the head
of the list at the start.

https://bugzilla.gnome.org/show_bug.cgi?id=788617
2017-10-11 19:57:04 +02:00
Tim-Philipp Müller
3d283665cc tests: meta: add test for gst_buffer_iterate_meta*()
https://bugzilla.gnome.org/show_bug.cgi?id=775727
2016-12-14 18:19:00 +00:00
Tim-Philipp Müller
65ed511c5e tests: remove unused valgrind stuff
Code was also checking the wrong define anyway.
2016-09-26 12:14:14 +01:00
Hyunjun Ko
eaf4153668 meta: transform_func: return FALSE if not supported or failed
https://bugzilla.gnome.org/show_bug.cgi?id=751778
2015-07-07 13:40:17 +03: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
ed19974e25 meta: do metadata registration threadsafe
We need to use g_once to register the metadata implementations
only once.

See https://bugzilla.gnome.org/show_bug.cgi?id=685332
2012-10-03 13:45:22 +02:00
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
68a6f2faaf tests: improve metadata test 2012-03-02 13:02:37 +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
f0105dd81f meta: add return vale to transform
Add a boolean return value so that we can see when a transform fails.
2012-02-28 16:17:47 +01:00
Wim Taymans
549347f81c tests: fix unit test 2012-02-28 12:51:27 +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
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
b84fff07ea memory: Require implementation to implement _share
Require the memory implementations to implement a share operation. This allows
us to remove the fallback share implementation which uses a different allocator
implementation and complicates things too much.
Update design doc a bit.
2011-06-08 12:04:49 +02:00
Sebastian Dröge
54fd068aba meta: Fix compilation of the unit test after removal of the serialize/deserialize functions 2011-05-13 08:38:30 +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
beac9c4a95 buffer: fix remaining unit tests 2011-03-28 20:08:46 +02:00
Wim Taymans
121ab46aa6 memory: remove memory metadata again 2011-03-28 20:08:46 +02:00
Wim Taymans
4a9a59df08 tests: make some tests compile 2011-03-28 20:08:46 +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
f5d1dcbd9a tests: add memory unit test 2011-02-28 09:39:44 +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
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
Renamed from tests/check/gst/gstbuffermeta.c (Browse further)