Commit graph

422 commits

Author SHA1 Message Date
Mathieu Duponchelle
acdb4ce03d gstvalue: expose gst_value_deserialize_with_pspec()
Typing hints can only be passed to gst_value_deserialize()
through the type of the passed-in value. This means deserialization
can only target the desired type for the top-level elements,
making it for example impossible to deserialize an array of
flags to the expected type.

This commit exposes a new function, gst_value_deserialize_full(),
that takes an optional pspec as the extra parameter, and updates
the deserialization code to pass around that pspec, or the
element_spec when recursively parsing the elements of a list-type
value.

This allows for example passing arrays of flags through the
command line or gst_util_set_object_arg, eg:

foo="<bar,bar+baz>"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/629>
2020-10-03 01:02:55 +02:00
Mathieu Duponchelle
1816f74339 gstutils: fix link in parse_bin_from_description_full doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/475>
2020-07-01 18:56:47 +01:00
Mathieu Duponchelle
ba0ffeb36c utils: fix markdown link to #GstPluginAPIFlags 2020-06-06 01:10:09 +02:00
Mathieu Duponchelle
0c1ce6e8c4 utils: expose GstPluginAPIFlags
These can be passed to gst_type_mark_as_plugin_api, to inform
plugin cache generation.

For now a single flag is specified, "IGNORE_ENUM_MEMBERS", it
can be used for dynamically generated enums to avoid documenting
environment-specific enumeration members. An example is
GstX265EncTune.
2020-06-06 00:38:29 +02:00
Sebastian Dröge
3de23c30e1 utils: Add helper function for marking types as plugin API
This can be used to mark additional types exposed by plugins (i.e.
enums, flags and GObjects) via properties, signals or pad templates as
plugin API. They can then be picked up by the documentation for the
plugin.

Not all types exposed by plugins are documented automatically because
they might come from an external library and should be documented from
there instead.
2020-06-04 15:49:23 -04:00
Johan Sternerup
a4d5c95638 utils: Avoid memory merge in gst_util_dump_buffer()
For buffers with multiple memory chunks, gst_buffer_map() has the side
effect of merging the memory chunks into one contiguous
chunk. Since gst_util_dump_mem() used gst_buffer_map() the internals
of the buffer could actually change as a result of printing it.

For the case of a buffer containing several memory chunks,
gst_memory_map() is now used to obtain the memory address and each
memory chunk is dumped separately preceded by a header line. The
behaviour for a buffer containing a single memory chunk is left unchanged.
2019-08-21 08:37:50 +02:00
Michael Bunk
4bc68bb3fe Fixing various typos 2019-06-20 15:20:27 +00:00
Thibault Saunier
5b2da0835e doc: Fix and add some missing docstrings 2019-05-13 11:33:49 -04:00
Philippe Normand
30a3fe53fa utils: Set default values for position and duration query results
https://bugzilla.gnome.org/show_bug.cgi?id=797066
2018-09-03 12:06:35 +01: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
ea0f8ebce1 gst: add some GIR array annotations 2018-04-13 20:16:33 +02: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
Tim-Philipp Müller
d7a9b08268 utils: use g_get_monotonic_time() as fallback in gst_utils_get_timestamp()
This is a better fit given that the function docs say this
should (only) be used for interval measurements, but also
this seems to give much better granularity on Windows
systems, where before this change there would often be
10-20 lines of debug log with the same timestamp up front.
2018-01-11 18:44:50 +00:00
Edward Hervey
eb6ba249c4 docs: Add documentation for GST_SEQNUM_INVALID
And link to it
2017-12-05 18:20:34 +01:00
Edward Hervey
e5c15f6b96 utils: Never return a group_id of 0, add GST_GROUP_ID_INVALID
Various plugins use special values (0 or G_MAXUINT32) as an
invalid/unset group_id, but nothing guarantees a groupid won't have
that value.

Instead define a value which group_id will never have and make
gst_group_id_next() always return a value different from that.

API: GST_GROUP_ID_INVALID
2017-12-05 18:19:32 +01:00
Edward Hervey
741ff6a371 gstutils: Fix linear regression comparision
The check for dropping precision was wrong when sxx and syy were negative.

if they are negative then "G_MAXINT64 - val" would always overflow

The check was meant to use G_MININT64 (like in the loop contained just
after).
2017-11-24 15:40:14 +01:00
Havard Graff
eb9ac74362 utils: add gst_utils_dump_buffer()
Useful for debugging.
2017-11-24 13:40:33 +01:00
Jan Schmidt
6adb6b478f seqnum: Never return a seqnum of 0, reset GST_SEQNUM_INVALID
Various plugins use the value of '0' as an invalid seqnum value
(qtdemux for matching duplicated seek events, for example). Make
that behaviour explicit, create a GST_SEQNUM_INVALID value,
and ensure gst_util_seqnum_next never returns it.
2017-10-18 02:31:12 +11:00
Tim-Philipp Müller
b1422a2fb8 utils: fix g-ir-scanner warning about bogus transfer annotations
for vararg parameters. Vararg functions are not introspectable anyway,
so might just as well mark them as '(skip)' while we're at it.

gstutils.c:2611: Warning: Gst: invalid "transfer" annotation for <varargs>: only valid for object and GVariant types
2017-08-10 10:30:59 +01:00
Sebastian Dröge
849dfe82f1 utils: Skip gst_calculate_linear_regression() in bindings 2017-08-08 21:20:31 +03:00
Thibault Saunier
3a1f2c22dc utils: Add a function to get a string representation of GstStateChange
API:
    gst_state_change_get_name

https://bugzilla.gnome.org/show_bug.cgi?id=783798
2017-06-20 09:33:31 -04:00
Heekyoung Seo
c30c39b5ad utils: Fix leak in failed case of regression overflow checking
https://bugzilla.gnome.org/show_bug.cgi?id=783978
2017-06-20 10:55:49 +03:00
Sebastian Dröge
30f871d274 gst: Correctly annotate functions taking floating reference parameters and returning floating references
https://bugzilla.gnome.org/show_bug.cgi?id=702960
2017-05-17 10:40:37 +03:00
Sebastian Dröge
2e4c82d850 gst: Handle floating references consistently
If a function takes a floating reference parameter, it should also be
sinked in error cases. Otherwise the function behaves differently
between error and normal cases, which is impossible for bindings to
handle.

https://bugzilla.gnome.org/show_bug.cgi?id=747990
2017-05-17 10:40:37 +03:00
Nicolas Dufresne
2c056563bf gstutils: Add helpers to get/set array properties
This is to help bindings access properties of type GST_TYPE_ARRAY.
This function will get/set the property and convert form/to
GValueArray.

New API:
  gst_util_set_object_array
  gst_util_get_object_array

https://bugzilla.gnome.org/show_bug.cgi?id=753754
2017-03-24 13:30:45 -04: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
Edward Hervey
82c871a8a3 gstutils: Fix a pad leak
When requesting a pad from a template and it's already linked, this
means it was a static pad. Since we only want to return an *available*
pad, we must return NULL ... but we must also remove the reference
we got from getting that static pad.

The "No need to unref" message (which wasn't true for quite some time)
dates back from the very very very first commit introducing the 0.10
features.
2016-11-28 14:02:23 +01:00
Sebastian Dröge
a7d282d272 utils: Export linear regression calculation as public function
It is useful outside the GstClock code too.

https://bugzilla.gnome.org/show_bug.cgi?id=774916
2016-11-28 14:26:50 +02:00
Sebastian Dröge
1b7ab25512 element: Reset the stop position to NONE in seek_simple()
When using seek_simple() in combination with other kinds of seeks, this
becomes problematic. seek_simple() does not reset the stop position to
GST_CLOCK_TIME_NONE but keeps whatever a previous seek did. So for example
when doing a seek_simple() after a rate=-1 seek, we would usually get
assertions that start>stop (and stop being the old stop from the rate=1 seek).

https://bugzilla.gnome.org/show_bug.cgi?id=771104
2016-09-10 10:58:44 +03:00
Tim-Philipp Müller
3623f168e9 streams: sprinkle some Since: markers for docs 2016-06-30 15:07:28 +01:00
Edward Hervey
63f6f05d66 gst: New Stream listing/selection system
* GstStream
* GstStreamCollection
* GST_EVENT_SELECT_STREAMS
* GST_MESSAGE_STREAM_COLLECTION
2016-06-30 12:31:06 +02:00
Sebastian Dröge
1dbb27f3a7 utils: Add gst_pad_link_maybe_ghosting() for consistency
We already had a _full() version, but having that alone seems inconsistent.
Add a non-full version that mirrors the behaviour of gst_pad_link() vs
gst_pad_link_full().
2016-06-08 12:12:28 +03:00
Guillaume Desmottes
30ee36e630 utils: fix element leak in find_common_root()
The root element was not unreffed when iterating over ancestors.

https://bugzilla.gnome.org/show_bug.cgi?id=765961
2016-05-04 12:03:53 +03:00
Matthew Waters
e8c8c27ae8 utils: check the correct element's state on ghosting pads
Checking the current element's state when we're adding pads to
the parent element is checking the wrong thing.

Silences a 'attempting to add an inactive pad to a running element'
warning when adding a ghost pad to a running parent bin of the parent
bin of the element.

https://bugzilla.gnome.org/show_bug.cgi?id=764176
2016-04-06 23:26:41 +10:00
Matthew Waters
f876306638 utils: expose pad_link_maybe_ghosting
This is a useful function to automatically add ghost pads when linking
two elements across bin boundaries without know their exact parentage.

e.g. when using gst_parse_bin_from_description (with or without it ghosting pads),
one can simply retreive the src/sink pads from the bin to link to another pad.

Similar functionality is provided by gst_element_link_pads{_full}() however only
by pad name rather than by actual pads.

API: gst_pad_link_maybe_ghosting_full

https://bugzilla.gnome.org/show_bug.cgi?id=764176
2016-04-06 23:26:41 +10:00
Aurélien Zanelli
94036e86c0 utils: add 'transfer full' annotation to gst_pad_peer_query_caps
https://bugzilla.gnome.org/show_bug.cgi?id=763912
2016-03-21 10:23:53 +02:00
Ben Iofel
53f2fb93e8 utils: fix gir annotation for gst_element_query_convert()
https://bugzilla.gnome.org/show_bug.cgi?id=763895
2016-03-18 20:35:27 +00:00
Tim-Philipp Müller
5ce5549ce0 utils: remove duplicate check 2016-01-20 11:07:17 +00:00
Thiago Santos
1418e9e85c utils: use caps when getting a compatible pad by template
Do not ignore the caps argument when requesting a pad by template.

This is particularly harmful when the pad caps query by default
returns ANY so it will match the first template instead of the
one that actually intersects with the caps.

https://bugzilla.gnome.org/show_bug.cgi?id=751235
2015-06-22 17:18:43 -03:00
Vivia Nikolaidou
6ec3c4bc66 utils: Add gst_bin_sync_children_states()
gst_bin_sync_children_states() will iterate over all the elements of a bin and
sync their states with the state of the bin. This is useful when adding many
elements to a bin and would otherwise have to call
gst_element_sync_state_with_parent() on each and every one of them.

https://bugzilla.gnome.org/show_bug.cgi?id=745042
2015-03-13 12:50:48 +00:00
Tim-Philipp Müller
a988871074 utils: improve warning when linking elements without common ancestor
This comes up quite a lot and it's a common mistake, so let's
try to improve the warning message a little.
2015-03-02 20:31:58 +00:00
Luis de Bethencourt
4245658d28 gstutils: remove incorrect Fixme comment
If the checks were changed to using g_return_if_fail() the GST_DEBUG lines
about the specific failure would be lost.
2015-02-25 16:11:06 +00:00
Luis de Bethencourt
5f027ae453 gstutils: remove obsolete Fixme comment
gst_pad_link_filtered() is very long gone and current
gst_element_link_pads_filtered() doesn't apply to this Fixme comment.
2015-02-25 16:02:39 +00:00
Matthieu Bouron
ee9ca5d48b gstutils: check uri before using it in gst_pad_create_stream_id_internal
If an element implements wrongly the URI query and set the uri to NULL and if
the element calls gst_pad_create_stream_id at some point, it will lead to crash
as the uri is not supposed to be NULL in the gst_pad_create_stream_id_internal
function.

https://bugzilla.gnome.org/show_bug.cgi?id=744520
2015-02-15 17:35:35 +00:00
Sebastian Dröge
27d1901d19 utils: Ghostpads can be request pads too but check if the pad has a template
Otherwise we dereference NULL in some cases and crash.
2014-08-06 14:43:08 +02:00
Sebastian Rasmussen
a041e65503 utils: Unref/release pads in error cases when linking pads
Previously gst_element_link_pads_full() forgot to unreference or release
request pads in several error cases. Also comments were added mentioning
why releasing is not necessary in some places.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733119
2014-08-06 09:58:30 +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
Tim-Philipp Müller
89a5b89388 value: simplify GST_VALUE_HOLDS for our boxed and fundamental types
Boxed types can't be derived from, and we don't support
deriving from our special fundamental types (the code
checks for GType equality in most places.
2014-06-21 01:10:22 +01:00
Evan Nemerson
1fe6d3ad08 introspection: fix some minor annotation bugs
https://bugzilla.gnome.org/show_bug.cgi?id=730982
2014-06-06 15:15:12 -04: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