Commit graph

8314 commits

Author SHA1 Message Date
Nirbheek Chauhan 3c5edc76e5 meson: Use new find_program fallback syntax
We use this syntax in libs/gst/helpers/meson.build already.
2017-12-05 12:26:44 +05:30
Sebastian Dröge 16de48ae03 gst: gst_element_remove_pad() is transfer none for the pad
While the refcount of the pad is decreased, it's the refcount that is
owned by the parent (i.e. the element) and not the one passed in by the
caller.

Fixes a memory leak in bindings.
2017-12-04 18:10:23 +02:00
Jan Alexander Steffens (heftig) d9b20492f3 devicemonitor: Avoid maybe-uninitialized compiler warning
On Arch Linux x86_64, gcc 7.2.0-3, -Og -g3:

gstdevicemonitor.c: In function ‘bus_sync_message’:
gstdevicemonitor.c:276:8: error: ‘matches’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This commit also simplifies the code a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=789983
2017-12-04 10:56:44 +00:00
Sebastian Dröge 464f840a23 gst: Annotate various strings as type filename if they represent a path/filename 2017-12-03 14:48:54 +02:00
Tim-Philipp Müller 9b944f7fd0 info: always check match patterns for new debug categories
Not only if a match pattern was set originally via GST_DEBUG.
Patterns might be set programmatically as well after all.
2017-12-02 12:51:17 +00:00
Tim-Philipp Müller 67e9d13950 info: fix performance issue with registering categories after gst_init()
When registering a new debug category after gst_init(), simply check
the existing patterns against that new category.

No need to iterate over all categories and recheck them all against
the existing patterns.

Also, no need to re-parse the existing pattern string set via GST_DEBUG
and add the same set of match patterns all over again to the existing
list of match patterns every time we register a new debug category.

Combined with iterating all debug categories on a change this would
make adding debug categories after gst_init() very very very slow.
2017-12-02 12:51:17 +00:00
Nicolas Dufresne 4bb5da9c28 plugin-scanner: Measure string length in bytes
g_strndup() wants a number of bytes to copy, so use strlen intead of
UTF-8 strlen function.
2017-12-01 13:42:00 -05:00
Thibault Saunier 4f4157ddb2 Revert "preset: Do not save deprecated properties"
This reverts commit 81e10f6123.

A mistake lead to committing it twice in a weird way.
2017-11-26 13:31:58 -03:00
Thibault Saunier 81e10f6123 preset: Do not save deprecated properties
It will g_warn upon deserialization and we should not use
those anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=789871
2017-11-26 13:28:10 -03:00
Thibault Saunier e45873c6ec taglist: Avoid assertions when getting tag nick from unregister tag
With serialized GstDiscovererInfos we might end up trying to use
tags that have not been registered.
2017-11-26 12:53:54 -03:00
Thibault Saunier 28d142e6da preset: Do not save deprecated properties
It will g_warn upon desarialization and we should not use
those anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=789871
2017-11-26 12:53:54 -03:00
Tim-Philipp Müller 8cc7c3f6aa tools: gst-inspect: print pad properties where we know the subclass type 2017-11-26 00:17:27 +00:00
Edward Hervey a066522ad9 gstinfo: Use free instead of g_free
Because
2017-11-25 13:07:12 +01:00
Edward Hervey 4ac09c73f6 gstinfo: Don't leak array of strings
The array provided by backtrace_symbols needs to be freed.
2017-11-25 12:44:11 +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
Mikhail Fludkov 6577f5e91e gsttraceutils: actually disable tracing system hooks if configured
`./configure --disable-gst-tracer-hooks` didn't do anything, hooks were
always enabled regardless of the option. It works correctly in the
Meson build though.
2017-11-24 13:40:34 +01:00
Havard Graff eb9ac74362 utils: add gst_utils_dump_buffer()
Useful for debugging.
2017-11-24 13:40:33 +01:00
Stian Selnes 512cec3dea pad: gst_pad_activate_mode() always succeed if same mode
Checking that the pad is in the correct mode before the parent is
checked makes the call always succeed if the mode is ok.

This fixes a race with ghostpad where gst_pad_activate_mode() could
trigger a g_critical() if the ghostpad is unparented while the
proxypad is deactivating, for instance if the ghostpad is released.
More specifically, gst_ghost_pad_internal_activate_push_default()'s
call to gst_pad_activate_mode() would fail if ghostpad doesn't have a
parent. With this patch it will return true of mode is already
correct.
2017-11-24 13:40:31 +01:00
Tim-Philipp Müller b63ed9e066 ghostpad: return TRUE if target pad was already set
The state is as it should be, so no reason to return
FALSE really, everything's good.
2017-11-24 13:39:39 +01:00
Tim-Philipp Müller 3203a10821 ghostpad: access internal pad with lock held 2017-11-24 13:39:39 +01:00
Havard Graff e515aa06fe ghostpad: fix race-condition while tearing down
An upstream query will take a ref on the internal proxypad, and can
hence end up owning the last reference to that pad, causing a crash.
2017-11-24 13:39:36 +01:00
Tim-Philipp Müller 7ea4152323 gstvalue: allocate slightly larger than needed tables at startup
If we pre-allocate only *exactly* as many nodes as we need for the
core types, we are practically guaranteed a re-alloc when external
code like GstVideoTimeCode or GstEncodingProfile register their
own GstValue things. So allocate a bit more than strictly needed.
2017-11-23 13:56:51 +01:00
Mathieu Duponchelle c01949a99e pad templates: Allow specifying GType
See https://bugzilla.gnome.org/show_bug.cgi?id=731301

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-11-22 16:44:08 +01:00
Matthew Waters 86abf49c23 gst: add a promise object
An object that can be waited on and asked for asynchronous values.
In much the same way as promise/futures in js/java/etc

A callback can be installed for when the promise changes state.

Original idea by
Jan Schmidt <jan@centricular.com>

With contributions from
Nirbheek Chauhan <nirbheek@centricular.com>
Mathieu Duponchelle <mathieu@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=789843
2017-11-23 00:48:30 +11:00
Edward Hervey 40c5396c24 registrychunks: Make sure we use aligned memory
This is in the same vein as for all other features. Some systems
might not allow unaligned read.
2017-11-20 17:01:04 +01:00
Edward Hervey d915dd4b20 gstpad: Make pad (de)activation atomic
The following could happen previously:
* T1: calls gst_pad_set_active()
* T2: currently (de)activating it
* T1: gst_pad_set_active() returns, caller assumes that the pad has
  completed the requested (de)activation ... whereas it is not
  the case since the actual (de)activation in T2 might still be
  going on.

To ensure atomicity of pad (de)activation, we use a internal
variable (and cond) to ensure only one thread at a time goes through
the actual (de)activation block

https://bugzilla.gnome.org/show_bug.cgi?id=790431
2017-11-16 10:55:36 +01:00
Edward Hervey 80262013ca gstpad: Make calls to GstPadActivateFunction MT-safe
checking whether we already were in the target GstPadMode was being
done too early and there was the risk that we *would* end up
(de)activating a pad more than once.

Instead, re-do the check for pad mode when entering the final pad
(de)activation block.

https://bugzilla.gnome.org/show_bug.cgi?id=790431
2017-11-16 08:29:22 +01:00
Nicolas Dufresne 7595c38a73 paramspec: Move condition check inside the g_return
It's mostly a debug check and crash avoidance, it's better to
keep all the condition inside the macro.
2017-11-10 12:09:41 -05:00
Nicolas Dufresne 98f4ff8331 paramspec: Add missing since for _spec_array() 2017-11-10 12:09:41 -05:00
Tim-Philipp Müller d106390adc element: add gst_element_foreach_*pad()
Add convenience API that iterates over all pads, sink pads or
source pads and makes sure that the foreach function is called
exactly once for each pad.

This is a KISS implementation. It doesn't use GstIterator and
doesn't try to do clever things like resync if pads are added
or removed while the function is executing. We can still do that
in future if we think it's needed, but in practice it will
likely make absolutely no difference whatsoever, since these
things will have to be handled properly elsewhere by the element
anyway if they're important.

After all, it's always possible that a pad is added or removed
just after the iterator finishes iterating, but before the
function returns.

This is also a replacement for gst_aggregator_iterate_sink_pads().

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-11-02 15:59:22 +00:00
Edward Hervey fb56ad6bee gstvalue: Cast GST_MAKE_FOURCC arguments
To make it explicit that we are dealing with uint32 targets

Avoids erroneous  runtime error: left shift of negative value -1

https://bugzilla.gnome.org/show_bug.cgi?id=789700
2017-10-31 12:02:18 +01:00
Edward Hervey c0c9a531ef event: Don't allow invalid SELECT_STREAMS event creation
Asking to select no streams makes no sense and can create various
issues.

If one doesn't one any stream it should deactivate (or not use) the
element in question.
2017-10-27 09:53:06 +02:00
Edward Hervey 4844adf193 gst: Fix build with option parsing disabled 2017-10-25 17:10:15 +02:00
Stefan Sauer 05ce354d3e segment: clarify the segment docs for the duration 2017-10-20 16:15:01 +02:00
Stefan Sauer 38dd43df29 Revert "segment: also intialize the duration"
This reverts commit f1baaae175.
2017-10-20 16:11:44 +02:00
Stefan Sauer f1baaae175 segment: also intialize the duration
If start and stop are set, calculate the duration and set it too.
2017-10-20 14:30:42 +02: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
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
Ashish Kumar 0ca70247fc device-provider: gst_device_provider_unhide_provider() always fails
https://bugzilla.gnome.org/show_bug.cgi?id=788520
2017-10-05 09:42:39 +01:00
Havard Graff fee176d253 meson: remove vs_module_defs
The GST_EXPORT should handle it.
2017-10-05 09:35:41 +01:00
Edward Hervey ebad8c0094 bin: iterate_sorted: Ensure sources are always returned last
For linked elements, the resulting gst_bin_iterate_sorted() will
properly return elements from sink to sources.

If we have some elements that are not linked, we *still* want to
ensure that we return:
* In priority any sinks
* Last of all any sources
* And in between any element which is neither source nor sink

For this to work, when looking for the next candidate element,
not only check the degree order, but if there are two candidates
with the same degree order, prefer the non-source one.

Amongst other things, this fixes the case where we activating a
bin containing unlinked sources and other elements. Without this
we could end up activating sources (which might start adding pads
to be linked) before other (to which those new source element pads
might be linked) are not activated

https://bugzilla.gnome.org/show_bug.cgi?id=788434
2017-10-03 07:56:39 +02:00
Stefan Sauer eb329eec1c structure: add a todo comment
Printing NULL is confusing when the type is e.g. a GArray that is not empty.
2017-10-02 16:23:31 +02:00
Stefan Sauer e584886d06 query: doc consistency
Mention that it is the 'buffer size', like we do elsewhere.
2017-10-02 13:14:21 +02:00
Mathieu Duponchelle 2138acabe5 gst: Modify behaviour of gst_get_main_executable_path
To actually return the path of the executable, not its
directory.

https://bugzilla.gnome.org/show_bug.cgi?id=788256
2017-09-27 20:59:54 +02:00
Mathieu Duponchelle 895bb7bcd6 gst: API: gst_get_main_executable_path()
This is useful for plugins that need to inspect the
folder of the main executable in order to determine the
set of features they will expose, for example:

https://github.com/centricular/gstreamer-vst3

https://bugzilla.gnome.org/show_bug.cgi?id=788214
2017-09-27 20:59:54 +02:00
Mathieu Duponchelle 49e230ad1a gst: Do not try to determine executable path on iOS.
The method used relies on "libproc.h", which is only available
on OSX.

https://bugzilla.gnome.org/show_bug.cgi?id=788234
2017-09-27 13:56:15 +02:00
Mathieu Duponchelle c9815957d3 gst: Fix typo in windows function name.
GetModuleFilename -> GetModuleFileName

https://bugzilla.gnome.org/show_bug.cgi?id=788234
2017-09-27 13:56:15 +02:00
Mathieu Duponchelle a5e168071c plugin dependencies: fix 6cddce7663
There were a few errors:

* The plugin scanner now accepts executable path as an argument.
  In case it is NULL, argc == 2

* We find the executable path in init_pre instead of gst_init,
  allowing this to work when gst is initialized through the
  option group (eg gst-inspect)

* There was a semi-colon missing in the __APPLE__ #ifdef
2017-09-26 15:15:27 +02:00
Mathieu Duponchelle 6cddce7663 plugin: API: GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE
When a plugin declares a dependency using this flag, all the
relative paths are considered to be relative to the path of
the main executable.

We try to determine the path of the executable portably,
with implementations provided for Linux, Windows and Mac.

If retrieval of the path fails, we will not detect changes.

In order for the main executable path to be the same when
scanning a plugin in a child process, a new variable is
exposed in gst_private.h, _gst_executable_path

https://bugzilla.gnome.org/show_bug.cgi?id=788152
2017-09-26 13:12:00 +02:00
Sebastian Dröge f649f0a44f info: GstStackTraceFlags were added in 1.12 2017-09-17 18:55:43 +03:00