Commit graph

379 commits

Author SHA1 Message Date
Jordan Petridis
c12c7afd06 fix clang 10 warnings
the typesystem checks in g_atomic_pointer_compare_and_exchange
seem to trigger some false positives with clang 10

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/584>
2020-08-04 10:44:16 +00:00
Edward Hervey
62f553873b gstcaps: Move assignment outside loop
s1 and f1 stay the same within the inner loop

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
1d0bda8005 caps: Unify common checks for intersections
Regardless of the intersect method chosen, migrate the same checks
up into the calling function. Same result, just less code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
2020-05-04 12:26:10 +00:00
Juan Navarro
358d4e991a gstcaps: fix out of bounds checks
These two checks could end up allowing out of bounds array access, when
the index equals the array size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/445>
2020-04-22 17:27:31 +00:00
Sebastian Dröge
5edc20188a caps: Don't assert in fixate() on EMPTY/ANY caps and document EMPTY/ANY behaviour on more functions
fixate() will return empty caps if it gets empty caps passed and assert
early if any caps are provided as there's no meaningful way of fixating
any caps.

truncate() and simplify() will return the input caps in case of
any/empty caps as before, but slightly optimized and as documented
behaviour.

Also add tests for this and a few other operations behaviour on
empty/any caps.
2020-03-09 10:10:09 +00:00
Henry Wilkes
412e97beb4 caps: keep ANY caps empty internally
Keep the ANY caps empty internally when appending and merging
caps/structures. Previously, an ANY caps could end up containing
internal structures, which could be fetched by the user, and gave the
caps a non-zero length.

Also, made sure that `gst_caps_set_features_simple` frees the features
if caps is empty.
2020-02-12 14:41:40 +00:00
Henry Wilkes
407e32588d caps: fix is_strictly_equal
Fixed gst_caps_is_strictly_equal() to take into account whether either of
the caps are ANY caps. Previously, two ANY caps could be considered not
strictly equal if one of them still contained some remnant *internal*
structure (this can happen if an ANY caps has emerged from an append or
merge operation). Also, an ANY caps with no remnant internal structures
was considered strictly equal to an EMPTY caps. Similarly, a non-ANY caps
was considered strictly equal to an ANY caps if its remnant internal
structures happened to match.

Also changed gst_caps_is_fixed to take into account that an ANY caps
should not be considered fixed even if it contains a single remnant
internal fixed structure. This affects gst_caps_is_equal(), which uses a
separate method if both caps are fixed. Previously, this meant that a
non-ANY fixed caps was considered equal to an ANY caps if it contained a
single matching remnant internal structure.

Added some tests for these two equality methods, which covers the above
examples, as well as asserts existing behaviour.

Fixes #496
2020-02-12 14:41:40 +00:00
Sebastian Dröge
9fb84ea7f4 gst: Don't pass miniobjects to GST_DEBUG_OBJECT() and similar macros
The argument must be at least a GObject according to the GstLogFunction
definition, and while the default C log function handles miniobjects
just fine this is crashing bindings and user-supplied log functions that
(rightfully) don't expect anything but GObjects.
2019-09-30 11:52:03 +03:00
Sebastian Dröge
26aa7a6d36 caps: Add Since: 1.16 marker to gst_caps_copy() 2019-04-23 14:53:11 +03:00
Guillaume Desmottes
e03f086fae gstcaps: add gst_caps_set_features_simple()
Convenient helper setting a caps feature on all the structures of a
caps.
2018-12-11 16:39:30 +01:00
Seungha Yang
3332e39baa gst: Fix string leak when G_VALUE_COLLECT_INIT() was failed
Returned string should be freed

Fixes #319
2018-11-12 20:12:41 +09:00
Sebastian Dröge
942fc7f79e gst: Add poisoning to more types 2018-08-03 14:31:34 +03:00
Thibault Saunier
b27ee943c2 caps: Add a macro based variant of gst_caps_copy
This way we do not hit the performance overhead of having the method
not inlined but still can use it from bindings.
2018-04-17 14:00:20 -03:00
Thibault Saunier
d1b2d3429c gst: Stop inlining gst_caps_copy
This way it gets exposed to bindings through GObject Introspection.
2018-04-17 10:15:06 -03:00
Arun Raghavan
b5028383ab gst: Fix up a bunch of GIR annotations
This is mostly on nullable return values, and some other minor ones that
I ran across.

https://bugzilla.gnome.org/show_bug.cgi?id=789319
2018-01-27 10:41:24 +00: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
Jan Schmidt
269699f621 caps: Fix null pointer dereference on invalid static caps
A typo in a static caps string may result in failure to
deserialise it, so don't dereference the result without
checking.
2017-01-03 02:21:10 +11:00
Guillaume Desmottes
4a41468ce7 Use MAY_BE_LEAKED_FLAG
This helps having "make check" passing with the leaks tracer enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=766008
2016-06-02 23:14:15 +01:00
Guillaume Desmottes
8daad351a4 caps: add cleanup priv function
Those are allocated in _priv_gst_caps_initialize() so it makes
sense to have a symetric cleanup functions called by gst_deinit().

https://bugzilla.gnome.org/show_bug.cgi?id=765606
2016-04-26 14:29:08 +01:00
Evan Nemerson
d11e657412 docs: annotate C examples as such
https://bugzilla.gnome.org/show_bug.cgi?id=731292
2016-02-15 17:45:15 +00:00
Sebastian Dröge
2c272d74fd caps: Add (transfer full) annotation to simplify() and subtract() return value
https://bugzilla.gnome.org/show_bug.cgi?id=759948
2015-12-29 14:32:47 +02:00
Aurélien Zanelli
2ee33237c8 caps: add 'transfer full' annotation to caps returned by interserction functions
To make clear caller is responsible to unref them.

https://bugzilla.gnome.org/show_bug.cgi?id=759948
2015-12-29 14:30:29 +02:00
Nirbheek Chauhan
b76f046999 caps: clarify docs for a few functions that they don't update things in-place
It is not necessarily clear from the existing introspection tags and
documentation alone.
2015-10-27 11:23:25 +00:00
Vikram Fugro
c12bd5d807 gst: Documentation typo fix in caps & pad APIs
gst_caps_can_intersect() & GST_PAD_IS_ACCEPT_INTERSECT()
documentation typo fix.

https://bugzilla.gnome.org/show_bug.cgi?id=755257
2015-09-19 17:57:55 +02:00
Tim-Philipp Müller
1dd72f56ea debugutils: nicer printing of caps features
Only print interesting caps features, don't
append (memory:SystemMemory) to all caps,
which makes them much more unwieldy and
harder to read. Also use internal function
to get caps features so that our printing
has no side effects on the caps.

https://bugzilla.gnome.org/show_bug.cgi?id=746809
2015-04-01 12:15:30 +01:00
Sebastian Dröge
1f6d5d3ff5 structure/caps: Add gst_{structure,caps}_filter_and_map_in_place()
https://bugzilla.gnome.org/show_bug.cgi?id=739765
2014-12-16 18:22:46 +01:00
Sebastian Dröge
bc11a1b79d caps: Add gst_caps_foreach() and gst_caps_map_in_place()
https://bugzilla.gnome.org/show_bug.cgi?id=739765
2014-12-16 18:22:46 +01:00
George Kiagiadakis
780c83d5c4 caps: unset the parent refcount of the old features before freeing them in gst_caps_set_features()
Otherwise gst_caps_features_free() asserts and the features structure is leaked
2014-06-26 11:16:34 +03:00
Tim-Philipp Müller
8e30a9462c caps: gst_caps_is_any() should return TRUE or FALSE
Not some flag value instead of TRUE. Fixes code like
gst_caps_is_any() == TRUE.

https://bugzilla.gnome.org//show_bug.cgi?id=731704
2014-06-22 12:50:42 +01: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
Edward Hervey
25bcc2d7f6 caps: Don't leak features on error cases
If we fail to parse fields, we would end up leaking the features we
parsed just before

CID #1212152
2014-05-12 16:59:29 +02: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
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
Sebastian Dröge
8d7e11e307 caps: When getting capsfeatures and none are there, store sysmem capsfeatures
... instead of returning a reference to a global instance. The caller might
want to change the global instance otherwise, which causes funny effects like
all global instances being changed and at the same time nothing in the caps
being changed.

As the caps might be immutable while we do this we have to do some magic
with atomic operations.

https://bugzilla.gnome.org/show_bug.cgi?id=723236
2014-02-04 18:47:23 +01:00
Sebastian Dröge
e51e0cb0d3 caps: Don't get us sysmem capsfeatures if we just check for fixed caps 2014-02-04 18:06:26 +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
Thiago Santos
007c0e5fe1 value: fix caps serialization when there are caps inside caps
Wrap caps strings so that it can handle serialization and deserialization
of caps inside caps. Otherwise the values from the internal caps are parsed
as if they were from the upper one

https://bugzilla.gnome.org/show_bug.cgi?id=708772
2013-09-30 16:20:48 -03:00
Sebastian Dröge
9ddcfcf8f4 gst: Add some more Since: 1.2 2013-07-18 14:39:42 +02:00
Sebastian Dröge
91b3890d70 caps: Handle ANY caps features properly in more places 2013-04-06 21:49:25 +02:00
Sebastian Dröge
db6ee700f2 caps: Properly handle ANY caps features in caps operations 2013-04-06 21:09:49 +02:00
Tim-Philipp Müller
cf69475aeb caps: fix caps feature leak
Fixes leaks in 14 core unit tests including
gst/gstcaps.
2013-04-04 23:14:13 +01:00
Wim Taymans
d92ce924e6 caps: update docs, is_subset() works now 2013-04-04 17:46:09 +02:00
Sebastian Dröge
65c650d7d4 capsfeatures: Add GST_CAPS_FEATURES_ANY
This is equal to any other caps features but results in unfixed caps. It
would be used by elements that only look at the buffer metadata or are
currently working in passthrough mode, and as such don't care about any
specific features.
2013-04-02 22:17:22 +02:00
Sebastian Dröge
efcb4023e6 caps: Set features' parent refcount in gst_caps_set_features() too 2013-04-01 10:19:01 +02:00
Sebastian Dröge
ccd2966f7a caps: Set sysmem features if explicitely requested 2013-04-01 10:18:39 +02:00
Sebastian Dröge
7477b25df5 caps: Add new data type for handling caps features to the caps
These are meant to specify features in caps that are required
for a specific structure, for example a specific memory type
or meta.

Semantically they could be though of as an extension of the media
type name of the structures and are handled exactly like that.
2013-03-31 18:15:52 +02:00
Sebastian Dröge
7decc9bef7 caps: Fix gst_static_caps_get(GST_STATIC_CAPS_NONE)
https://bugzilla.gnome.org/show_bug.cgi?id=696435
2013-03-25 09:22:49 +01:00
Tim-Philipp Müller
22036ef1c4 caps, structure, taglist: micro-optimisations
Avoid some unnecessary GValue copying by making use of
gst_structure_id_take_value() where possible.
2012-12-22 16:55:26 +00:00
Wim Taymans
12f835ca43 caps: fix docs 2012-12-05 14:56:48 +01:00