Commit graph

8596 commits

Author SHA1 Message Date
Nirbheek Chauhan
72daeee2c4 gstinfo: Add new API for getting debug log lines
If you're using a custom log handler, you had to reverse-engineer the
debug log format and create your own format function. Now, you can
call `gst_debug_log_get_line()` and it will return a string (without
ANSI escape color codes) representation instead.

This is useful in situations when you need to log the ordinary
gst_debug log to a resource that can't be opened as a `FILE` handle.

Also includes a test.
2019-12-25 08:50:17 +05:30
Niels De Graef
0cb3940c94 bin: Add method to find elements by factory name
A common use case of a dynamically built pipeline is that you want to
(conditionally) find a certain element, e.g. the `rtpbin`s in a
`uridecodebin`. If that element has a fixed name inside its parent bin
(and only has a single instance) this can be easily done by
`gst_bin_get_by_name()`.

If there are multiple instances of the element however, you can only use
`gst_bin_iterate_all_by_interface()`, but this doesn't work if you don't
have the specific `GType` (which is often the case, due to plugins being
dynamically loaded). As such, another fallback could be to use the
well-known name of the element's factory (in case of our example, this
is of course `"rtpbin"`).
2019-12-20 14:29:19 +01:00
Stéphane Cerveau
1d549ea324 gstreamer: use of g_value_dup_string
Use helper method to get string from GValue.
2019-12-18 15:57:54 +01:00
Peter Seiderer
4a827e11b4 pluginloader: handle fsync interrupted by signal (EINTR)
According to [1] EINTR is a possible errno for fsync(),
so handle it as all other EINTR (do/while(errno == EINTR)).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2019-12-12 20:49:36 +01:00
Peter Seiderer
96aa27910a registry: handle fsync interrupted by signal (EINTR)
According to [1] EINTR is a possible errno for fsync(),
so handle it as all other EINTR (do/while(errno == EINTR)).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2019-12-12 20:49:36 +01:00
Olivier Crête
0a8d14acc9 Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-10 19:18:32 -05:00
Mathieu Duponchelle
e79def14a5 device, elementfactory: relax floating requirement
Using g_assert() is a bit too extreme, as it will abort the whole
program unless G_DISABLE_ASSERTS is true.

Switch to g_critical()
2019-12-10 13:31:50 +01:00
Sebastian Dröge
020eb2c346 bus: Clean up #ifdefs to compile with debugging enabled in all combinations
Thanks to Roland Jon for finding this.
2019-12-05 08:21:54 +00:00
Mathieu Duponchelle
a90220cce1 device, elementfactory: don't enforce floating status
The reference we receive when calling g_object_new should be
floating, but we can't force it at our level.

Switch from g_object_force_floating() to a simple assertion.

See https://gitlab.freedesktop.org/gstreamer/gst-python/issues/27
2019-12-05 01:44:35 +00:00
Sebastian Dröge
7af50da2c9 bus: Use new GSource dispose function
Without this it is possible that we have a GSource with reference count
0 stored in the GstBus that is currently in the process of being
destroyed. gst_bus_remove_watch() might then access it, increase its
reference count to 1 again, call GSource API on it and then unref it,
which will then finalize it a second time.

The dispose function allows the GSource to be resurrected until it
returned so the above would be safe now.

This caused some spurious crashes during shutdown in various
applications.
2019-12-04 08:24:04 +00:00
Edward Hervey
3b71c4a4e7 GstBuffer: size-related optimization
Avoid calling generic function when it's possible to directly
return/get sizes
2019-11-27 14:25:19 +00:00
Edward Hervey
e3d2eb1f16 GstBuffer: Inline fast-path for merged memory 2019-11-27 14:25:19 +00:00
Tim-Philipp Müller
6c2dfe5ebe docs: mention gst_parse_bin_from_description() in gst_parse_launch() docs 2019-11-27 09:41:36 +00:00
Linus Svensson
47c50b086e datetime: Add constructor for timestamps in microseconds 2019-11-25 13:31:11 +01:00
Stéphane Cerveau
8a20d66b10 gstbuffer: update documentation
remove unclear documentation about GST_BUFFER_FLAG_MARKER
2019-11-18 00:15:31 +00:00
Havard Graff
7b38def8e0 structure: add gst_structure_take
(╯°□°)╯︵ ┻━┻
2019-11-14 10:08:38 +00:00
Wonchul Lee
5c6314d68b event: Fix gir warning
It fixes below gir warnings.
../subprojects/gstreamer/gst/gstevent.c:2246: Warning: Gst:
gst_event_new_instant_rate_sync_time: unknown parameter
'rate_multiplier' in documentation comment, should be 'rate'
../subprojects/gstreamer/gst/gstevent.c:2296: Warning: Gst:
gst_event_parse_instant_rate_sync_time: unknown parameter
'rate_multiplier' in documentation comment, should be 'rate'
2019-11-12 15:19:28 +09:00
Víctor Manuel Jáquez Leal
78041a7748 gst/parse: define pure-parser depending on bison version
After release bison 2.5 the declaration %pure-parser was deprecated
in favor of %define api.pure

Nonetheless, until bison 3.4, the declaration was treated as backward
compatibility, but now bison shows a warning:

  warning: deprecated directive, use ‘%define api.pure’

The patch's approach is to handle both directives according with the
used bison's version, by string replacement at source configuration
stage.
2019-11-05 12:55:08 +01:00
Nayana Topolsky
e8c782d119 pad: clear sticky event tag upon stream-start
When playing gapless there were situations when some sticky events
like tags were stuck at some pad and then revived much later.
Therefore it is better to clear them upon stream-start.

Fixes #360
2019-11-04 12:01:47 +00:00
Seungha Yang
d8b8a13285 taglist: Fix broken empty set character in code
Previous one was not a valid ASCII empty set character.
'tig' and 'git log -p' couldn't represent it as expected.
2019-11-03 19:06:58 +00:00
Jan Schmidt
acf66273f5 pipeline: Instant rate change handling
Implement aggregation of INSTANT_RATE_REQUEST messages and sending of
INSTANT_RATE_SYNC_TIME events.
2019-11-03 19:47:40 +11:00
Sebastian Dröge
74412496cf event/message: Add new instant-rate-sync-time event and instant-rate-request message 2019-11-03 19:47:40 +11:00
Sebastian Dröge
be3c4d00cf event: Add new GST_EVENT_INSTANT_RATE_CHANGE and GST_SEEK_FLAGS_INSTANT_RATE_CHANGE
A seek with that flag set must be non-flushing, not change the playback
direction and start/stop position. A seek handler will then send the new
GST_EVENT_INSTANT_RATE_CHANGE event downstream for downstream elements
to immediately apply the new playback rate before the new in-band segment
event arrives.
2019-11-03 19:47:40 +11:00
Víctor Manuel Jáquez Leal
9707db909d elementfactory: add GST_ELEMENT_FACTORY_TYPE_HARDWARE
This new symbol matches with the elements within "Hardware" class.
2019-11-02 15:11:12 +01:00
Sebastian Dröge
487a3f9a30 bin: Drop need-context messages without source instead of crashing 2019-10-22 09:46:19 +03:00
Tim-Philipp Müller
10d9e18f02 Remove autotools build system 2019-10-13 16:10:42 +01:00
Edward Hervey
6babf1f086 core: Avoid usage of deprecated API
GTimeval and related functions are now deprecated in glib.
Replacement APIs have been present since 2.26
2019-10-10 15:53:16 +02:00
Aaron Boxer
509f6201e1 documentation: fix a number of typos 2019-10-06 11:12:11 -04: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
Mathieu Duponchelle
0dafe6e639 gstvalue: use value_nick for serialization
not value_name . This was causing incorrect launch lines to be
displayed by gst-device-monitor, and the deserialization code
below works with nicks.
2019-09-17 01:09:05 +00:00
Mathieu Duponchelle
a9e2776074 deviceprovider: set the bus to non-flushing before calling klass->start
Not posting DEVICE_ADDED messages while a device provider is being
started makes things awkward for applications, as they have to call
get_devices() after starting the monitor.

This requires redundant code on the application side, and as far as
I understand also could cause race conditions, when a device gets
added between the calls to gst_device_monitor_start() and
gst_device_monitor_get_devices(), causing the application to "see"
the same device twice.
2019-09-16 23:56:44 +00:00
Sebastian Dröge
9cf764b2ec element: Enforce that elements created by gst_element_factory_create/make() are floating
Bindings might have a hard time making sure that the reference is indeed
still floating after returning here.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444
2019-09-12 09:50:17 +00:00
Sebastian Dröge
341ee45155 device: Enforce that elements created by gst_device_create_element() are floating
Bindings might have a hard time making sure that the reference is indeed
still floating after returning here.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444
2019-09-12 09:50:17 +00:00
Sebastian Dröge
1edcf747ee device: gst_device_create_element() is transfer floating, not transfer full
Fixing the annotation fixes leaking of the created element in all
bindings using GObject-Introspection.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444
2019-09-12 09:50:17 +00:00
Niels De Graef
4812c4087f Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-09-09 12:16:24 +00:00
Vivia Nikolaidou
7774aae713 pad: Added gst_pad_get_single_internal_link
gst_pad_iterate_internal_links is usually used to find a single internal
link that a pad has, e.g. to find the corresponding pad of a multiqueue.
Added a helper function that will return either a single internal link,
if there's no other, or NULL.
2019-09-05 11:49:18 +03:00
David Svensson Fors
f8d70b475c miniobject: free qdata array when the last qdata is removed
In cases with many long-lived buffers that have qdata only very
briefly, the memory overhead of keeping an array of 16 GstQData
structs for each buffer can be significant. We free the array when
the last qdata is removed, like it was done in 1.14.

Fixes #436
2019-09-04 16:31:53 +02:00
Nicolas Dufresne
80a76a4b4d bin: Fix minor race when adding to a bin
This patch simply add a null check around a case where a child may have
been unparented concurrently to the deep_add_remove operation. This was
found by accident in the form of an "IS_GST_OBJECT" assertion, but had
no other known side effect in that test.
2019-09-03 15:42:17 -04:00
Niels De Graef
9e69c90869 object: Use g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the
`GParamSpec` that corresponds to the given property name. It's not a
huge performance hit, but it's easily avoidable by using the
`_by_pspec()` variant.
2019-08-25 21:32:44 +02:00
Seungha Yang
e6c43380bb info: Take lock around all prinf on Windows
On Windows, concurrent colored gstreamr debug output and usual
stdout/stderr string will cause broken output on terminal.
Since it's OS specific behavior, that's hard to completely avoid it
but we can protect it at least among our printing interfaces side.
2019-08-24 12:15:56 +00:00
Mathieu Duponchelle
7e87a05e5a docstrings: port ulinks to markdown links 2019-08-23 18:17:41 +02: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
Jan Alexander Steffens (heftig)
1d5a1e8235 element: Added gst_element_get_current_clock_time and gst_element_get_current_running_time
Helper functions for getting the element clock's time, and the clock
time minus base time, respectively.
2019-08-12 12:59:27 +03:00
Sebastian Dröge
533fbf766e registry: Use plugin directory from the build system for relocateable Windows builds
Instead of guessing something based on preprocessor defines and magic.
2019-08-09 07:22:38 +00:00
Thibault Saunier
d6c14e70a1 device-monitor: list hidden providers before listing devices
The way it was implemented could make the list updated after the
list of device was filled with supposdely hidden devices
2019-08-07 15:20:39 -04:00
Tim-Philipp Müller
8841c3a22f message: fix up enum value for GST_MESSAGE_DEVICE_CHANGED
This was added in 1.16 and accidentally duplicated the value of
the existing GST_MESSAGE_REDIRECT.

As the only known user of this message is GStreamer core itself,
and it is quite an obscure message, it seems best to just fix up
the enum value even if that technically breaks API.

Fixes #418
2019-08-06 08:02:09 +00:00
Doug Nazar
7b596ba6c6 info: Fix deadlock in gst_ring_buffer_logger_log
gst_ring_buffer_logger_log calls several functions while formatting
the message which may in turn log a message while we already hold
the mutex. Do all formatting first before acquiring the mutex to
avoid this and reduce the time we hold the mutex.
2019-08-05 15:24:03 +00:00
Sebastian Dröge
55e79c3772 info: Free some more memory on gst_deinit() 2019-07-15 11:35:07 +03:00
Sebastian Dröge
04a7334140 info: Deprecate gst_debug_category_free()
And change it to do nothing at all.

As debug categories don't use reference counting and they can be
retrieved from anywhere at any time by name, it is fundamentally unsafe
to free them at any point in time except for right before the end of the
process.

No code apart from a unit test seems to be currently using the function,
so deprecate it and also change it to do nothing at all.
2019-07-15 11:35:07 +03:00
Jan Schmidt
318a6169f7 gsttracerutils: Fix build with disabled tracer hooks.
Add a stub gst_tracing_get_active_tracers() call when building
with tracer hooks disabled.
2019-07-07 20:42:56 +10:00