Commit graph

8819 commits

Author SHA1 Message Date
tyler-aicradle
ea33144147 systemclock: fall back to g_get_monotonic_time
This allows us to cover the case where we're on some unknown system that
doesn't have a known native precision monotonic time source. Sadly this
reintroduces some of the complexity removed in previous commits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/829>
2021-05-27 16:01:17 -05:00
tyler-aicradle
5328941632 systemclock: reorg real and mono time functions for macOS and win32
This simplifies the pre-processor checks a little to make it easier to
follow the code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/829>
2021-05-27 09:44:29 -05:00
tyler-aicradle
d8237f150c systemclock: Use g_get_real_time on Windows and macOS for realtime clock
These targets previously were unable to produce wall clock times when
using GstSystemClock, this change makes it possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/829>
2021-05-27 09:25:29 -05:00
tyler-aicradle
bb77f41abf systemclock: Reorganize defined checks for parts of GstSystemClock
The gst_system_clock_get_internal_time and
gst_system_clock_get_resolution functions had some nested defined checks
making this code somewhat harder to reason about and much harder to
change. The logical meaning of the checks has changed but the actual
code coming out of the pre-processor should not have changed
significantly. The main logical change was flattening the checks for
existence of posix timing functionality, from what I can tell these
functions aren't available on Windows where they were trying to be
included. I have checked the Linux and macOS output and they are
functionally unchanged.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/829>
2021-05-27 09:25:24 -05:00
Tim-Philipp Müller
dd22ec68d2 buffer: rename new gst_buffer_new_copy() to gst_buffer_new_memdup()
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/826

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/827>
2021-05-24 19:01:58 +01:00
Tim-Philipp Müller
04fe2233f0 buffer: add gst_buffer_new_copy() convenience function
More convenient and discoverable variant of the fairly widely-used
gst_buffer_new_wrapped(g_memdup(data,size),size).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/826>
2021-05-23 07:32:09 +00:00
Nikolay Sivov
41ee497b90 gstutils: Fix typo in the comment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/813>
2021-05-06 22:20:57 +03:00
Chris White
b48e32ab00 gst_child_proxy_get_property: accept G_VALUE_INIT
gst_child_proxy_get_property() can now take a value initialized to
G_VALUE_INIT.  This parallels the corresponding change in
g_object_get_property(), GLib 2.60+.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/724#note_738531

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/809>
2021-05-06 10:35:51 +03:00
François Laignel
1a8dfdfc54 Introduce gst_element_request_pad_simple
The name `gst_element_get_request_pad()` is confusing to people
learning GStreamer. `gst_element_request_pad_simple()` aims at
providing the exact same functionality, while making it more
explicit it is a simplified `gst_element_request_pad()`.

`gst_element_request_pad_simple()` is consistent with other
functions such as `gst_element_seek_simple`.

This commit deprecates `gst_element_get_request_pad()` so that a
compilation warning is emitted when used and incite developers
to use the more explicit `gst_element_request_pad_simple()`.

See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/743#note_886586

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/802>
2021-05-04 15:49:32 +02:00
Miguel Paris
fad603011d pad: clear probes holding mutex
Protect clearing probes against concurrent modification which might happen
due to dispose does NOT guarantee that the object is not used anymore, as
it could be referenced again and so being continued used.
So, as in the rest of places where probes hook list is used, on dispose
it should be accessed holding the mutex "GST_OBJECT_LOCK (pad);" as
GHookList is not thread-safe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/798>
2021-04-19 14:58:43 +02:00
Chris White
c711c8ed39 allocator: add gst_allocation_params_new()
This permits creating GstAllocationParams instances on the heap, which
is useful for language bindings that can handle GBoxed types.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/683

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/788>
2021-04-10 10:46:28 -04:00
Jose Quaresma
9f95805869 gstpluginloader: when env var is set do not fall through to system plugin scanner
If we set a custom GST_PLUGIN_SCANNER env var, then we probably want to use that and only that.

Falling through to the one installed on the system is problamatic in cross-compilation
environemnts, regardless of whether one pointed to by the env var succeeded or failed.

taken from:
http://cgit.openembedded.org/openembedded-core/commit/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-gst-gstpluginloader.c-when-env-var-is-set-do-not-fal.patch?id=0db7ba34ca41b107042306d13a6f0162885c123b

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/669>
2021-04-07 22:56:47 +00:00
Chris White
96b10c158f caps: Add gst_caps_features_new_single()
For use with a single feature now that gst_caps_features_new() is
G_GNUC_NULL_TERMINATED.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774#note_855357

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
2021-04-01 20:55:13 -04:00
Chris White
7954eaaf25 typefind: add gst_type_find_suggest_empty_simple()
For cases where you only need a media type and no other fields.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774#note_848664

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
2021-04-01 20:55:09 -04:00
Chris White
a38d06cb1c gst: Add missing G_GNUC_NULL_TERMINATED markers
Functions that require NULL as their last vararg are marked so the
compiler can warn on missing NULL.

Also, document the NULL terminator for gst_make_element_message_details()
and gst_tracer_record_new().

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/669

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
2021-04-01 20:53:26 -04:00
Pieter Willem Jordaan
c899d0a52c systemclock: Fix deadlock on clock_nanosleep
Always use the monotonic clock's diff and end time for clock_nanosleep to have predictable behaviour even with other clock types.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/779>
2021-03-31 21:16:36 +02:00
Sebastian Dröge
96a5000210 bin: Don't special-case G_SIGNAL_RUN_CLEANUP stage in latency signal accumulator
This signal don't run the class handler in the CLEANUP stage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/776>
2021-03-26 14:12:03 +00:00
Aaron Boxer
d7d12f6aaa gst: enforce gst_deinit one call per process
unit tests do not need to call deinit as it is already called in exit handler

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/236>
2021-03-24 21:14:22 +00:00
Aaron Boxer
2e0a21c9c2 gst: disable indent for parse_goption_arg
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/236>
2021-03-24 21:14:22 +00:00
Stéphane Cerveau
178c7d2732 device provider: add custom register macro
This macro allows to register a device provider with
a custom function which gives more flexibility when
registering it (see v4l2 register).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/773>
2021-03-19 10:15:49 +00:00
Matthew Waters
3d887c7f07 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/775>
2021-03-19 04:15:19 +00:00
Mathieu Duponchelle
12661d90a3 value: fix parsing of explicit value casts
Since acdb4ce03d , parsing of the
value for a property can use the pspec to determine what type
a value should be casted to.

However, this broke the case where the value is explicitly casted
to a type (eg <(float) 0.0>). In that situation, we want to respect
the casting decision, and only use the pspec to perform "implicit"
casts.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/881

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/772>
2021-03-17 14:11:39 +01:00
Guillaume Desmottes
44bdad58f6 clock: define AUTO_CLEANUP_FREE_FUNC for GstClockID
GstClockID is secretly a gpointer so we can't use g_autoptr(),
instead user can do:
  g_auto (GstClockID) clock_id = 0;

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/769>
2021-03-11 15:41:16 +01:00
Stéphane Cerveau
0da1721364 element: remove useless ret test
The ret test is unrelevant and confusing.
We dont want the code to fail and the register
to succeed by example.
In the case of a conditional element_init,
the element should be defined with
GST_ELEMENT_REGISTER_DEFINE_CUSTOM instead
of GST_ELEMENT_REGISTER_DEFINE_WITH_CODE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/768>
2021-03-08 16:37:31 +01:00
Stéphane Cerveau
a4b5d8bb60 meson: add uninstalled var for bash-completion
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/766>
2021-02-26 11:18:54 +01:00
Guillaume Desmottes
3e27558095 miniobject: add GST_TYPE_MINI_OBJECT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/764>
2021-02-24 13:13:07 +01:00
Mathieu Duponchelle
670596abdb docs: standardize debugutils documentation
* add a SECTION comment

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/760>
2021-02-17 18:36:22 +01:00
Mathieu Duponchelle
d7e2861398 docs: standardize GstControlSource, GstDateTime documentation
* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/759>
2021-02-16 17:05:16 +00:00
Mathieu Duponchelle
45d11f6590 docs: standardize GstContext, GstControlBinding documentation
* Document virtual methods in standalone comments, in order to properly
  annotate them

* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Mark GstControlBinding ABI field as private

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/758>
2021-02-15 15:27:14 +01:00
Mathieu Duponchelle
d5ae9f293a docs: standardize GstClock documentation
* Don't mention explicitly that API is MT safe, this implies that
  other API is not. GStreamer API is assumed to be MT safe, thread
  safety should only be explicitly mentioned when API is *not* MT safe

* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Document virtual methods in standalone comments, so that parameters
  can be documented. This is not critical here, as parameters do not
  need annotations / specific documentation, but serves as an up to
  date example

* Document enumeration members in standalone comments, so that their
  Since tag is accounted for by gobject-introspection

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/756>
2021-02-15 13:44:48 +00:00
Stéphane Cerveau
3952e19c2a features: remove extra G_BEGIN_DECLS/G_END_DECLS
_GST_ELEMENT_REGISTER_DEFINE_BEGIN
_GST_ELEMENT_REGISTER_DEFINE_END was introducing
an extra extern "C" in case of c++ build.

Add missing ";" in GST_ELEMENT_REGISTER_DECLARE

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/757>
2021-02-15 12:21:49 +01:00
Mathieu Duponchelle
c53ea138c6 docs: standardize GstCapsFeatures, GstChildProxy documentation
* Don't mention explicitly that API is MT safe, this implies that
  other API is not. GStreamer API is assumed to be MT safe, thread
  safety should only be explicitly mentioned when API is *not* MT safe

* Document virtual methods in standalone comments, in order to properly
  annotate them

* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/755>
2021-02-11 16:43:14 +01:00
Mathieu Duponchelle
3f5042d74e docs: standardize GstCaps documentation
* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Reword the warnings for caps nestability in light of the 1.20
  improvements

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/754>
2021-02-10 14:20:30 +01:00
Jan Schmidt
da3886acac pad: Improve the documentation for GstPadProbeReturn.
Explain that GST_PAD_PROBE_PASS will pass data even if there is
another pad probe that says to block, and that GST_PAD_PROBE_REMOVE
passes data and potentially unblocks the pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/749>
2021-02-10 13:43:28 +11:00
Jan Schmidt
170f694198 pad: Fix for multiple blocking probes interaction.
Change the way the marshalled flag in the internal ProbeMarshall state
is handled when iterating over pad probes so that it only counts
probes that still exist and would be called when retrying.

This improves the way that removing a blocking probe works when
there are multiple blocking probes for different conditions (data vs
events for example).

As a side-effect, probes aren't put into the the called_probes array
unless they actually match the current probe type and would be called,
potentially reducing the number of hooks that get stored in the
called_probes array, and the cost of the looping check on retries.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/658

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/749>
2021-02-10 13:43:28 +11:00
Mathieu Duponchelle
5df982fd10 docs: standardize GstBus documentation
* Don't mention explicitly that API is MT safe, this implies that
  other API is not. GStreamer API is assumed to be MT safe, thread
  safety should only be explicitly mentioned when API is *not* MT safe

* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Document virtual methods and the class structure

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/753>
2021-02-09 15:32:29 +01:00
Mathieu Duponchelle
12639aad34 docs: standardize GstBufferPool documentation
* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Document virtual methods in standalone comments, so that parameters
  can be documented. This is functionally useful here, as parameters
  require annotations, and should make the class more usable by
  bindings.

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/752>
2021-02-08 15:17:05 +01:00
Mathieu Duponchelle
85763437c7 docs: standardize GstBufferList documentation
* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/752>
2021-02-08 14:31:09 +01:00
Mathieu Duponchelle
e552630bd0 docs: fix GST_BUFFER_COPY_DEEP comment title
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/752>
2021-02-08 14:30:24 +01:00
Mathieu Duponchelle
d28fb55873 docs: standardize GstBuffer documentation
* Don't mention explicitly that API is MT safe, this implies that
  other API is not. GStreamer API is assumed to be MT safe, thread
  safety should only be explicitly mentioned when API is *not* MT safe

* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Document enumeration members in standalone comments, so that their
  Since tag is accounted for by gobject-introspection

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/748>
2021-02-05 14:56:12 +01:00
Mathieu Duponchelle
69c790c025 docs: standardize GstBin documentation
* Don't mention explicitly that API is MT safe, this implies that
  other API is not. GStreamer API is assumed to be MT safe, thread
  safety should only be explicitly mentioned when API is *not* MT safe

* Don't repeat what annotations are stating with respect to ownership
  transfer, nullability

* Document virtual methods in standalone comments, so that parameters
  can be documented. This is not critical here, as parameters do not
  need annotations / specific documentation, but serves as an up to
  date example

* Document enumeration members in standalone comments, so that their
  Since tag is accounted for by gobject-introspection

* Misc cleanup / typo fixes / addition of links

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/747>
2021-02-04 16:21:38 +01:00
Mathieu Duponchelle
50ab7f1ba2 docs: reformat and cleanup GstBin SECTION comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/747>
2021-02-04 16:21:38 +01:00
Mathieu Duponchelle
a1974341fe docs: clean up GstAllocator documentation
In particular, there is no need to explicitly mention free
functions / ownership transfers, this should be obvious from
the annotations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/745>
2021-02-02 16:41:28 +01:00
Mathieu Duponchelle
a127286666 docs: sort GstAllocator doc so that GstAllocator appears first
The default ordering is alphabetical, causing GstAllocationParams
to appear first in the page if left auto-sorted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/745>
2021-02-02 16:34:03 +01:00
Mathieu Duponchelle
596a85b7be docs: cleanup gst.c documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/745>
2021-02-02 16:19:46 +01:00
Sebastian Dröge
d7b0b6b6db info: Don't leak log function user_data if the debug system is compiled out
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/742>
2021-01-31 12:12:09 +02:00
Aleksandr Slobodeniuk
ec83432140 gstvalue: fix compilation warning in "holds" macros
GST_VALUE_HOLDS_... macros may cause -Waddress warning
on gcc if GValue is allocated on stack:

gstvalue.h:145:46: warning: the comparison will always
evaluate as ‘true’ for the address of ‘v’ will never
be NULL [-Waddress]

 #define GST_VALUE_HOLDS_CAPS(x)         ((x) != NULL &&
  G_VALUE_TYPE(x) == _gst_caps_type)

Fixes #653

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/738>
2021-01-28 16:15:13 +00:00
Henry Wilkes
5eba2b83b7 gstvalue: preserve parse behaviour with warning
Preserve the previous behaviour where:
    name, val="5";
passed to gst_structure_from_string would have resulted in an int value,
rather than a string, despite the quote marks.

This will be changed to being interpreted as a string in the future, but
for the time being we will issue a warning about this to give users time
to fix their code to no longer rely on this bug.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/303>
2021-01-19 15:56:00 -03:00
Henry Wilkes
445df0c799 gstvalue: make gst_string_unwrap less strict
Allow a string in gst_string_unwrap to include unescaped characters that
are not in GST_STRING_IS_ASCII. This extra leniency allows
gst_structure_from_string to, e.g., receive
    name, val=(string)"string with space";

Note that many gst tests, and potentially users, exploited this behaviour
by giving
    name, val="string with space";
i.e. without the (string) type specifier. This was allowed before
because, without a type specifier, the string was passed to
_priv_gst_value_parse_string with unescape set to TRUE, *rather* than
being sent to gst_string_unwrap. This caused a difference in behaviour
between strings that are or are not preceded by (string). E.g.
    name, val=(string)"string with space";
would fail, whilst
    name, val="string with space";
would not. And
    name, val=(string)"\316\261";
would produce a val="α", whereas
    name, val=(string)"\316\261";
would produce a val="316261" (a bug).

The current behaviour is to treat both of these cases the same, which is
desirable. But in order to not break potentially common usage of this
discrepancy (it was in our own tests), the best option is to make string
parsing less strict in general.

New behaviour would be for
    name, val=(string)"string with space";
to pass and give val="string with space", and
    name, val="\316\261";
would produce a val="α".

Also changed deserializing string test to expect successes where
previously a failure was expected.

In a similar way, this also effected the deserializing of GstStructure,
GstCaps, GstTagList and GstCapsFeatures. So, now
    name, val=(structure)"sub-name, sub-val=(string)\"a: \\316\\261\";";
will also pass and give sub-val="a: α". Note that the quote marks
and backslash still need to be escaped for the sub-structure, but other
characters need not be.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/303>
2021-01-19 13:25:07 +00:00
Henry Wilkes
7f267395a6 structure: don't unescape values before deserializing
No longer call _priv_gst_value_parse_string with unescape set to TRUE
before passing a value to gst_value_deserialize in
_priv_gst_value_parse_value. This latter function is called by
gst_structure_from_string and gst_caps_from_string.

When gst_structure_to_string and gst_caps_to_string are called, no
escaping is performed after calling gst_value_serialize. Therefore, by
unescaping the value string, we were introducing an additional operation
that was not performed by the original *_to_string functions. In
particular, this has meant that the derialization functions for many
non-basic types are incomplete reverses of the corresponding
serialization function (i.e., if you pipe the output of the
serialization function into the deserialization function it could fail)
because they have to compensate for this additional escaping operation,
when really this should be the domain of the deserialization functions
instead.

Correspondingly changed a few deserialization functions.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/452

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/303>
2021-01-19 13:25:07 +00:00