Commit graph

303 commits

Author SHA1 Message Date
Edward Hervey 095356b67e parsebin: Improve elementary stream handling
The goal of parsebin is to figure out which elements to link together in order
to provide elementary streams given any random input.

The problem is that deciding whether a given stream should still have more
elements plugged in or not was dependent on ... the presence of compatible
decoders (sic).

Instead of that, if we can't plug anymore elements on a given stream *and* it is
detected as being an elementary stream, expose it.

Fixes #2118

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4231>
2023-03-21 07:26:37 +00:00
Edward Hervey cf3adbcfb3 urisourcebin: Activate pad before transferring sticky events
Otherwise they get refused since the pad is flushing

Fixes #2384 for good

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4226>
2023-03-20 18:11:26 +00:00
Edward Hervey 7f1c5e2ef3 urisourcebin: Propagate sticky events from parsebin
If sticky events are present on parsebin source pads, we propagate them to the
multiqueue source pads. Those will be propagated on the new urisourcebin source
pads like in the other code paths.

This ensures that STREAM_START event are present on new source pads. If CAPS
event are also present (not guaranteed), they will also be available.

Fixes #2384

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4203>
2023-03-17 23:48:43 +00:00
Tim-Philipp Müller 8759b77a50 gst-plugins-base: re-indent with GNU indent 2.2.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4182>
2023-03-17 03:18:53 +00:00
Edward Hervey b4cadf35bd uridecodebin3: Ensure atomic urisourcebin state change
When dynamically adding and synchronizing the state of urisourcebin, we need to
ensure that no-one else attempts to change the state in case of failures

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4125>
2023-03-08 09:29:57 +00:00
Edward Hervey 3d506a0978 subparse: Properly forward segment seqnum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3913>
2023-02-08 14:12:07 +00:00
Thibault Saunier 4067bbdd91 uridecodebin: Set source element to READY before querying it
Generating the source element is done when uridecodebin is doing the
READY to PAUSED state change, so it is reasonable to set the new source
element to that state.

This also allows detecting early failures with backing libraries or
hardware (checks done in NULL->READY).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3857>
2023-02-08 11:07:21 +00:00
Thibault Saunier 77b6f58074 encodebin: Add timestamper elements when available
Timestamper elements are made to ensure stream timestamp are clean and
ready to be used by muxers, we should make use of them to cleanup
streams before muxing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3779>
2023-01-24 16:31:40 +00:00
Tim-Philipp Müller 8d7eb2eb4f typefindfunctions: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Tim-Philipp Müller 0feb2770e6 encodebin: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Tim-Philipp Müller 165fdac5c6 playback: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Edward Hervey 4c1d01ff57 playback: New playback elements are no longer experimental
The API is not expected to change and it has been used extensively since 1.18.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3761>
2023-01-21 12:28:21 +00:00
Edward Hervey e2773304a2 decodebin3: Remove failing stream from selection
If no decoder is present for a given stream, remove it from the requested
selection.

Fixes #1581 and #1662

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3754>
2023-01-20 08:54:00 +00:00
Edward Hervey 34ea792881 decodebin3: Don't intercept queries if no parsebin present
If we don't use a parsebin, we forward the queries as-is from upstream. There is
no reconfiguration possible within identity.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3754>
2023-01-20 08:54:00 +00:00
Edward Hervey 1a30ed8113 decodebin3: Don't insert parsebin if input is already parsed
This is a temporary workaround until we find a generic solution to indicate that
a stream has already been "parsed".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3754>
2023-01-20 08:54:00 +00:00
Tim-Philipp Müller 64c4bfdf7e uridecodebin3: clear subitem if suburi is set to NULL
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1649

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3730>
2023-01-18 11:43:31 +00:00
Edward Hervey 13ad8c8e4e urisourcebin: Cleanup on failure
This ensures there is a source present/valid *ONLY* in PAUSED and above.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3720>
2023-01-13 16:41:53 +01:00
Edward Hervey 1546ab0d0f urisourcebin: Unset locked state
Some elements still had it in failure cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3720>
2023-01-13 16:41:53 +01:00
Edward Hervey f444e62672 uridecodebin3: Handle state synchronization failures
Properly reset and remove the failing urisourcebin if we failed bringing them up
to the same state as ourselves.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3720>
2023-01-13 16:41:53 +01:00
Edward Hervey 1fe99ebae1 decodebin3: Fix global group-id handling
The goal of the "global" group-id is to fix new inputs that do not come from the
same "source" as others. In order to ensure all "current" streams have the same
group-id we distribute the first valid group-id to all streams.

This commit fixes two issues with that:

* When inputs are unlinked they weren't always properly resetted (it would only
  work if parsebin is used, which is no longer the default in
  uridecodebin3/playbin3).

* When computing the global group-id, take into account unset
  group-id (i.e. GST_GROUP_ID_INVALID).

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3712>
2023-01-11 23:29:05 +00:00
Guillaume Desmottes 22917b140f decodebin3: ensure recalculate_group_id() is called with INPUT lock
This function uses main_input and current_group_id which are protected
by the input lock.
Some calls were already safe but not all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3702>
2023-01-11 18:37:05 +00:00
Guillaume Desmottes cad0768191 uridecodebin3: fix stream leak
GstSourcePad owns the GstStream but was not unreffing it when being
disposed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3617>
2023-01-11 16:44:21 +00:00
Guillaume Desmottes da696477c6 decodebin3: fix dead lock when removing pad
gst_element_remove_pad() is triggering a call to
gst_decodebin3_input_pad_unlink() which needs the input lock as well,
resulting in a dead lock.

Fix #1667

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3614>
2023-01-11 15:06:37 +00:00
Sebastian Dröge fa2b98f957 typefindfunctions: Add missing length check to XML typefinder
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54811

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3690>
2023-01-06 18:10:20 +02:00
Sebastian Dröge 54ff9b2b5f typefindfunctions: Reduce XML typefinder minimum data size from 64 to 32 bytes
64 bytes makes the typefinder fail on very small XML documents on which
it succeeded previously.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3690>
2023-01-06 14:37:31 +02:00
Sebastian Dröge 401ea9f683 typefindfunctions: Check for the SVG namespace URL in addition to <svg and the doctype
Finding the SVG namespace URL gives a clear indication that this is
actually an SVG file while the `<svg>` tag only gives a likely
indication as it's rather short.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3631>
2023-01-04 00:49:47 +00:00
Sebastian Dröge 11520403a5 typefindfunctions: Make XML typefinder more strict
If a XMLDec is found, check also for its end. Similarly, check for the
end of the XML tag we're looking for and make sure that the following
characters are valid.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3632>
2023-01-03 12:07:43 +00:00
Edward Hervey 6beca9f055 urisourcebin: Fix parsebin handling
The goal of !3601 was to make sure we don't end up with non-streams-aware
adaptive demuxers. Since we know that parsebin is streams-aware, just remember
that and handle them that way.

Fixes issues with some scenarios where parsebin might add pads *before* the
collection is posted on the bus

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3658>
2022-12-30 08:46:14 +01:00
Edward Hervey 66b96baf23 uridecodebin3: Fix handling of "expected" pads
The number of expected pads was:
* Defaulting to 1
* Or being overriden by GST_MESSAGE_STREAMS_SELECTED

This fails if upstream isn't a selectable source and has multiple streams, and
would therefore cause failures with multi-stream gapless playback

Fixes #1672

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3658>
2022-12-30 08:46:14 +01:00
Edward Hervey 80e7c31514 uridecodebin3: Avoid repeatedly calling the blocking probe
When skipping an event, we want to unref it and say we handled it. This avoids
being repeatedly called for the same (sticky) events.

The events will be properly propagated once the pad is linked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3658>
2022-12-30 08:46:13 +01:00
Edward Hervey a0655d5131 uridecodebin3: Handle multiple pending pad block probes
It is quite possible to have the blocking probe called from different streaming
threads when all expected pads are present.

* Notify all waiters by using g_cond_broadcast instead of g_cond_signal
* Properly remove the probe after waiting

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3658>
2022-12-30 08:46:13 +01:00
Edward Hervey 74a503c197 urisourcebin: Modify check for streams-aware adaptive demuxers
Using the "GstBin" flags to check if an adaptive demuxer is streams-aware isn't
a good idea since it prevents using elements which aren't bins.

Instead we see if a collection was posted by the demuxer by the time a pad is
added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3601>
2022-12-19 15:23:32 +00:00
Philipp Zabel 2a602afe8a videoconvertscale: fix valid_tags NULL-terminated array of strings
The valid_tags array of strings must be NULL-terminated,
as it is passed to the g_strv_contains() function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3603>
2022-12-19 15:30:42 +01:00
Guillaume Desmottes 1f929ba32f uridecodebin3: fix typo in doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3602>
2022-12-19 14:24:06 +01:00
Edward Hervey 36c3bb0d05 uridecodebin3: Protect against NULL uri/suburi
Fixes #1625

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3511>
2022-12-02 16:55:05 +00:00
Edward Hervey 41017e6c34 uridecodebin3: Always store pending buffering messages
Fixes #1586

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3487>
2022-12-02 09:22:41 +00:00
Tim-Philipp Müller dec3aa55e9 audioconvert, audioresample, audiofilter: fix divide by 0 for input buffer without caps
gst-launch-1.0 audiotestsrc ! udpsink host=127.0.0.1
gst-launch-1.0 udpsrc ! audioconvert ! autoaudiosink

would crash with a floating point exception when clipping the input
buffer owing to a division by zero because no caps event was received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3469>
2022-11-26 08:47:49 +00:00
Edward Hervey 3a63eab2fa uridecodebin3: propagate about-to-finish for new inputs
If the pending next urisourcebin is already draining, make sure we propagate it
when activating it.

Fixes gapless playback of small entries

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
2022-11-23 12:19:22 +00:00
Edward Hervey def2515ae2 uridecodebin3: Remove old fixme
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
2022-11-23 12:19:22 +00:00
Edward Hervey 734a4554f3 (uri)decodebin3: Ensure group-id consistency
Make sure that group-id of a given play item are made consistent from the
start (sources) and all the way through the output.

This ensures that we can reliably detect that we have switched to the next play
item on the output of decodebin3 (and we can therefore properly free/release it)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
2022-11-23 12:19:21 +00:00
Edward Hervey 353691602e uridecodebin3: Fix shutdown procedures in probe
When shutting down, we want to remove the urisourcebin blocking probes ... but
we also want to propagate a GST_FLOW_FLUSHING upstream (and not
GST_FLOW_NOT_LINKED) to make the upstream task gracefully stop instead of
posting an error message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
2022-11-23 12:19:21 +00:00
Edward Hervey 7f5f7b3a77 decodebin3: Properly reset when going back to READY
Clear the remaining stream-related fields when going from PAUSED to READY, and
use when disposing.

Fixes various issues when re-using decodebin3/playbin3

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
2022-11-23 12:19:21 +00:00
Edward Hervey d12534d21d decodebin3: Don't output bogus GST_MESSAGE_STREAMS_SELECTED
When `is_selection_done` is called, it checks that all the requested streams are
present in the active stream list ...

... except there could very well be a (about to be removed) stream from the
previous selection present.

Therefore filter the list of streams we add to the message by the streams which
are actually requested.

Fixes issues when switching between different stream types (ex: video-only to
audio-only).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
2022-11-23 12:19:21 +00:00
Edward Hervey 1774d5c87a parsebin: Don't leak parsepad list on shutdown
Free it as it is down in other cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3443>
2022-11-21 19:02:44 +00:00
Nicolas Dufresne 5980fb76e7 video: Add arbitrary tile dimensions support
In current tile representation, only tiles with power of two
width and height in bytes are supported. This limitation
prevents adding more complex tiles formats.

In this patch, we deprecate tile_ws and tile_hs from GstVideoFormatInfo and
replace if with an array of GstVideoTileInfo. Each plane tiles are then
described with their pixels width/height, line stride and total size.
The helper gst_video_format_info_get_tile_sizes() that depends on the
deprecated API is also being removed. This can simply be removed as it wasn't
in any stable release yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3424>
2022-11-18 22:59:29 +00:00
Edward Hervey db2146d0ea decodebin2: Minor debug fix for decodepad
decodedad might have their name changed when exposing, causing a race when
trying to get their name without taking a lock. Just use GST_PTR_POINTER in
debug statements instead

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3428>
2022-11-18 07:22:23 +00:00
Edward Hervey 92abb8daec urisourcebin: Remove un-needed define
This code hasn't use GValueArray in ages

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 5702568a7e urisourcebin: Use a non-buffering multiqueue for non-streamable URI
Even though buffering is not required, we need to ensure we are dealing with the
interleave (if any) before pushing the elementary streams further downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey c59397354c urisourcebin: Minor doc fix
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Jan Schmidt 6e549b2fe5 uridecodebin3: Don't leak EOS event
Make sure to unref the EOS event in all code paths
when returning GST_PAD_PROBE_HANDLED

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 6bffbe283a playbin3: Move gapless to uridecodebin3
This was the intention from the start, just took me a few years *cough* to
actually implement it properly.

Gapless is handled by re-using as much as possible the same decoders and sinks
if present, and only pre-rolling switching at the sources level (with buffering
if/when needed).

In order to enable "gapless" playback, the "next" uri should be set at any time
between the moment the `about-to-finish` signal is emitted and the moment the
current play item is done. Previously this could only be done with the signal
emission.

This new implementation also allows "Instantaneous URI switching". This allows a
much faster way of switching playback entries while re-using as many elements as
possible. To enable this set `instant-uri` property to TRUE, the default being
FALSE.

API: instant-uri properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 1f2d98028b playbin3: Remove unused code
This was never used, and if ever it's needed at some point for reference it's
available in gstplaybin.c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 78e43a6319 decodebin3: Clear input collection when linked again
The previous collection no longer applies to this input

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 8ce0a23a5e decodebin3: Improve collection merging
If the collections are the same, don't merge them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 0bb2026890 decodebin3: doc cleanup
Remove old/invalid FIXME and cleanup some logs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:47 +00:00
Edward Hervey 4bfbc72663 decodebin3: Remove unused variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey f785b3d584 decodebin3: Allow re-using inputs
DecodebinInput (and their backing parsebin or identity) are no longer released
when the corresponding sinkpad is unlinked, but when it's released.

The parsebin element will be resetted:
* If incoming caps are incompatible (was the case before)
* Or when unlinking and it was previously pull-based

This opens the way to use decodebin3 with changing inputs (i.e. gapless)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 1f8d8b2df6 uridecodebin3: use urisourcebin parse-streams property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 412c4cbca3 urisourcebin: Improve buffering handling
Introduce the option to have the streams be parsed with `parsebin` for
compatible sources (i.e. which are eligible for buffering in the same way as
before this commit).

By parsing the inputs directly, this allows more accurate buffering control:
* Instead of relying on potential bitrate information coming from somewhere
* and *without* being linked downstream

If `parse-streams` is activated and the stream is eligible for buffering, then a
`multiqueue` will be used on the output of `parsebin` in order to handle the
buffering.

API: `parse-streams`
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey fa4a70d7fe parsebin: avoid bogus processing
If a parsebin pad is already exposed, don't try to rename it or cause extra
processing which isn't needed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 5e2606cacd decodebin3: Avoid parsebin usage if not needed
If the incoming streams are already parsed, there is no need to add yet-another
parsebin to process it *IF* that stream is compatible with a decoder or the
decodebin3 output caps.

This only applies if all the following conditions are met:
* The incoming stream can *NOT* do pull-based scheduling
* The incoming stream provides a `GstStream` and `GstStreamCollection`
* The caps are compatible with either the decodebin3 output caps or a decoder
  input

If all those conditions are met, a identity element is used instead of a
parsebin element and the same code paths are taken.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey f010dce6e7 decodebin3: DecodebinInputStream: Hold a ref to srcpad
And move the locking outside of the input stream creation function

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey e8f768212c urisourcebin: Bring high-watermark level in sync with legacy values
It was always 60%. For some reason this crept in during the initial urisourcebin
refactoring.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey b589cf12f2 decodebin3: Don't leak collection when releasing inputs
And refactor the function slightly for clarity

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey e276d3c836 decodebin3: Protect input freeing with the input lock
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey f091d2445f decodebin3: Refactor parsebin output handling
* Instead of creating temporary `PendingPad` structures, always create a
  DecodebinInputStream for every pad of parsebin
* Remove never used `pending_stream` field from DecodebinInputStream
* When unblocking a given DecodebinInput (i.e. wrapping a parsebin), also make
  sure that other parsebins from the same GstStreamCollection are unblocked
  since they come from the same source

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey d14c14dcc4 decodebin3: Store GstStreamCollection from upstream
If upstream provides stream collection, use/store them as soon as possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 64d775a44f urisourcebin: Move adaptive demuxer handling into ChildSrcPadInfo
It's part of that chain of elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey a5f0085cda urisourcebin: Only remove components in PAUSED->READY
With the refactoring, we are guaranteed the components are only created in PAUSED

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 5b41ea2fe8 urisourcebin: Refactor ChildSrcPadInfo and OutputSlot usage
Make an explicit topology/tree of structures:
* ChildSrcPadInfo is created for each source element source pad
* ChildSrcPadInfo contains the chain of optional elements specific to that
  pad (ex: typefind)
* A ChildSrcPadInfo links to one or more OutputSlot, which contain what is
  specific to the output (i.e. optional buffering and ghostpad)
* No longer use GObject {set|get}_data() functions to store those structures and
  instead make them explicit
* Pass those structures around explicitely in each function/callback

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey f42ca96ad9 urisourcebin: Remove duplicate call
We ensure sources are removed in PAUSED->READY->NULL. No need to call it when
creating the source.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 64c81b6972 urisourcebin: Remove pending pad handling
This was needed to support the legacy handling of changing streams (add new
pads, send EOS and remove old pads).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey b6584defd0 urisourcebin: Only expose pads once activation has completed
The following problem could happen:
* Thread 1 : urisourcebin gets activated from READY->PAUSED
* Thread 2 : some element causes a pad to be added to urisourcebin , which gets
linked downstream, which decides to activate upstream to pull-based.
  * That requires "activating" the pads from PUSH to NONE, and then from NONE to PULL
* Thread 1 : the base class state change handlers checks if all pads are
activated

The issue is that since going form PUSH to PULL requires going through NONE,
there is a window during which:
* Thread 1 : The pad was set to NONE (before being set to PULL)
* Thread 2 : The base class activates that pad (to PUSH)
* Thread 1 : The attempt to "activate" to PULL fails (silently or not)

This is very racy, so in order to avoid that, we make sure that we only add pads
once the transition from READY->PAUSED in the parent classes is done.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey a347846698 urisourcebin: Only allow streams-aware adaptive demuxer
We no longer want to deal with elements that use the old-style of stream
switching and instead expose/remove streams as they appear/disappear

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey e7eb9271ee urisourcebin: Simplify initial information collection
When iterating existing pads of a source, directly handle them:
* Raw pads are handled directly
* Pads without caps are connected to a typefind
* Other pads are handled via `handle_new_pad()`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 80770fe0ec urisourcebin: Use iterator function where applicable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 41617834d2 urisourcebin: Document and rename fields
Removes ambiguity when reading the code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey c8b9a7d640 urisourcebin: Remove unused lock/list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 638633dea3 urisourcebin: Check for live source when generating element
Instead of at a later stage

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey e8f9e17744 urisourcebin: Streamline demuxer removal
And since remove_source also removes the dmeuxer, we no longer need to call it
in addition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 577febc29e urisourcebin: Clarify function name and arguments
* The "need_queue" variable is only used in one place, move it there
* Clarify the fact the function also exposes raw_pads

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 586ec1a672 urisourcebin: Error out if a source doesn't expose pads
Looks like this fell through the cracks. If a source element doesn't have
dynamic pads and doesn't provide any source pad ... we should properly error
out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey eebb794a4f streamsynchronizer: Don't leak the syncstream object
It was leaked when breaking out early when handling GST_EVENT_STREAM_START

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3390>
2022-11-12 12:24:21 +01:00
Edward Hervey c00da50c61 encodebasebin: Don't leak muxer pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3390>
2022-11-12 10:33:51 +01:00
Nicolas Dufresne b57135e09c rawvideoparse: Fix support for sub-sampled tile
This element was missed as it does not use the new helpers to calculate the
plane size. The code is relatively simple though, so adding support for
subsample tiles was easy enough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3385>
2022-11-11 11:02:15 +00:00
Talha Khan 6c8b7204e5 videoconvert, videoscaleconvert: fix element description
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3362>
2022-11-08 16:51:58 +00:00
Edward Hervey 24a0e5bdfd subparse: Fix non-closed tag handling.
Unclear what the goal was, but we could end up reading way past the next_tag.

Instead just move everything from after the end tag ('>') to the next_tag.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53040

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3340>
2022-11-05 16:19:53 +00:00
Edward Hervey 93d8b3f660 parsebin: Fix leak
Release the reference on the collection which was given to us when extracting it
from the event/message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>
2022-11-04 17:59:21 +00:00
Sanchayan Maity 673d13f176 playbin3: Fix missing pad unref
GST_TRACERS="leaks" GST_DEBUG="GST_TRACER:7,leaks:6" gst-play-1.0 --use-playbin3 test.mkv

When running a pipeline like above, leaks are observed.

0:00:56.882419132 240637 0x5562c528ccc0 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstConcatPad, address=(gpointer)0x7efd7c0d20a0, description=(string)<'':sink_0>, ref-count=(uint)1, trace=(string);
0:00:56.882429131 240637 0x5562c528ccc0 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstConcatPad, address=(gpointer)0x7efd7c0d2be0, description=(string)<'':sink_0>, ref-count=(uint)1, trace=(string);
0:00:56.882437056 240637 0x5562c528ccc0 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstConcatPad, address=(gpointer)0x7efd7c0d3720, description=(string)<'':sink_0>, ref-count=(uint)1, trace=(string);

gst_element_release_request_pad does not unref the pad. It needs to
be followed by gst_object_unref. Doing that fixes the above leaks.

Use g_ptr_array_new_with_free_func with gst_object_unref as the free
function to unref the pad after release.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3177>
2022-10-28 10:15:42 +05:30
Edward Hervey 0c47735c4a urisourcebin: Fix usage of raw and non-raw source provider
The computation in analyze_source was wrong, and would state that the element
has "all raw source pads" if it had at least one.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3199>
2022-10-18 07:46:06 +00:00
Thibault Saunier e99393520e videorate: Do not close segment when getting a same segment twice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3059>
2022-10-11 11:48:09 -03:00
Thibault Saunier 11b83fb2fc videorate: Handle closing segment on EOS right after caps event
The scenario is what we try in the tests:
- we have a segment with .stop set
- some frame(s) flow
- we get a CAPS event
- we get an EOS (before getting buffers after the CAPS event)

in that case, without that patch, the segment is not properly closed
which is not correct. In this patch we keep track of previous caps until
a new buffer arrives, this way in that situation we set previous caps
again, and close the segment with the previous buffer.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1352
in this specific case

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3059>
2022-10-11 11:48:09 -03:00
Aleksandr Slobodeniuk 89fc20931b decodebin3: allow to call "dispose" multiple times
https://docs.gtk.org/gobject/concepts.html#reference-counts-and-cycles

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3135>
2022-10-10 10:24:52 +00:00
Aleksandr Slobodeniuk 67caa45a4c decodebin3: fix mutex leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3126>
2022-10-06 14:25:27 +00:00
Thibault Saunier 31acfcd875 decodebin3: Do not try to plug a decoder on raw formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3123>
2022-10-06 08:41:49 +00:00
Jan Schmidt e36440e7bb playsink: Hold a reference to the soft volume element
Always hold a reference to the soft volume element
provided by the playsinkaudioconvert bin helper, the
same as when volume is provided by a sink element,
or the soft volume element gets unreffed too soon.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3108>
2022-10-03 18:56:41 +00:00
Jan Schmidt aae7b5416c decodebin3: Make sure event is writable before modifying
Make sure we're operating on a private copy of an event when
modifying it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3107>
2022-10-03 16:40:49 +00:00
Jan Schmidt bf6d30ed79 urisourcebin: Make sure event is writable before modifying.
Make sure we're operating on a private copy of an event before
modifying it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3107>
2022-10-03 16:40:49 +00:00
Jan Schmidt e5828c8295 decodebin3: Don't lose a ref on EOS event
Make sure not to give away the ref on the final EOS
event for which the probe handler is returning GST_PAD_PROBE_REMOVE
when pushing the event manually.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3107>
2022-10-03 16:40:49 +00:00
Edward Hervey c22ddbc187 decodebin3: Fix memory issues with active selection list
This had a couple of issues:
* The backing strings (from GstStream) could disappear
* The actual list wasn't properly reset/freed when decodebin3 was re-used

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3083>
2022-09-27 16:21:25 +02:00
Thibault Saunier bb840bd116 videorate: Add a max-closing-segment-duplication-duration property
This allows users to let videorate fully fill the segments when received
EOS or on new segment, removing an arbitrary limit of 25 duplicates which
might not be what the user wants (for example on low FPS stream in GES,
that sometimes leaded to broken behavior)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3000>
2022-09-20 13:23:02 +00:00
Thibault Saunier e866c1d967 decodebin2: Do not fail if one of the decoders isn't able to output the requested format
when expose-all=False

When trying to find an decoder in that case, we loop over the different
decoder factories, and check that it outputs a format that matches the
requested one (through the :caps property), but if we find a decoder
that do match but later on some other don't we end up failing
autopluging. This patch ensures that we still plug the decoder that can
work.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3011>
2022-09-15 21:03:14 +00:00
Thibault Saunier 1c4950718f discoverer: Fix discovering source that expose raw audio/video
Exposes a "uridecodebin:post-stream-topology" property as the discoverer
needs to have topology information about all streams so we need
`uridecodebin` to always plug decodebins for that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3009>
2022-09-15 19:25:01 +00:00
Thibault Saunier 71eda6e2e6 uridecodebin: Fix some property documentation syntax
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3009>
2022-09-15 19:25:01 +00:00
Thibault Saunier 1c6adcab89 uridecodebin: Ensure that pads caps are set before exposing them
We are supposed to guarantee that pads that are exposed have the caps
set, but for sources that have pad with "all raw caps" templates, we end
up exposing pads that don't have caps set yet, which can break code (in
GES for example).

To avoid that we let uridecodebin plug a `decodebin` after such pads and
let decodebin to handle that for us. In the end the only thing that
decodebin does in those cases is to wait for pads to be ready and expose
them, after that `uridecodebin` will expose those pads.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3009>
2022-09-15 19:25:01 +00:00
Matthew Waters 1e269a3c6d subparse: fix crash when parsing invalid timestamps in mpl2
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49245

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2989>
2022-09-07 07:20:53 +00:00
Thibault Saunier 6a4425e46a meson: Call pkgconfig.generate in the loop where we declare plugins dependencies
Removing some copy pasted code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
Ádám Balázs 55716ac21c gstaudioconvert: doc: Fix mix-matrix example
mix-matrix should contain float elements, modify the example to do so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2966>
2022-08-31 17:24:51 +00:00
Mathieu Duponchelle 8756f523d1 playback: add onvif metadata caps to raw caps
+ remove encoding from x-onvif-metadata caps output by qtdemux

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2889>
2022-08-24 12:21:18 +03:00
Mathieu Duponchelle 31c1e586c3 videoconvert: fix passthrough on equivalent transfer
When the input info and output info are equal, except for the
transfer functions that are *not* equivalent, we need to set up
a converter as we won't be passthrough.

Fixes an assertion in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2929>
2022-08-23 16:02:31 +02:00
Seungha Yang dbc8a7ab18 videoconvert,videoscale: Do conversion in videoconvert and scaling in videoscale
Keep behaving the same as before videoconvertscale port

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2778>
2022-08-16 12:08:36 +00:00
Seungha Yang 0d5c937642 Revert "videoconvertscale: Add properties to disable scaling/converting in videoconvert/videoscale"
This reverts commit cd7a91cef1.

Reverting properties, scaling in videoconvert and converting in
videoscale will be disabled by the other commit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2778>
2022-08-16 12:08:36 +00:00
Khem Raj ce1f1c9eff ssaparse: include required system headers for isspace() and sscanf() functions
Newer compilers ( clang 15 ) have turned stricter and errors out instead
of warning on implicit function declations

Fixes
gstssaparse.c:297:12: error: call to undeclared library function 'isspace' with type 'int (int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    while (isspace(*t))

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2879>
2022-08-14 08:32:05 +00:00
Mathieu Duponchelle efb18ec300 smartencoder: fix detection of avc1
While avc1 is the FourCC, avc is the name used in caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1549>
2022-08-02 15:48:12 +00:00
Mathieu Duponchelle 6bcfce7501 decodebin2: don't reverse stream topology order
This can be important for instance when a container holds multiple
tracks with the same media type, with no indication (eg tags) of
which track is the default one.

In that case, players usually pick the first track by default.

This is especially useful when using smart editing with GES, as
it will result in the same ordering as the input file that was
used as a template.

For reference, this yields the same order as ffprobe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1549>
2022-08-02 15:48:12 +00:00
Mathieu Duponchelle b2c4052531 gstsmartencoder: don't make calculations for invalid DTS
Instead, as the current code relies on having a valid DTS (for lining
up passed through and re-encoded segments), simply compute a DTS
from the PTS if the DTS was invalid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1549>
2022-08-02 15:48:12 +00:00
Edward Hervey f7e75a0208 parsebin: Avoid crash with unknown streams
With the new addition of handling unknown sream types we *could* end up with a
chain which doesn't have a current_pad (it's an intermediary one)

Fixes #1287

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2822>
2022-08-01 22:52:42 +00:00
Seungha Yang 648739012a compositor: Warn when inputs are SDR/HDR mixed
Let user know that the result of mixed SDR/HDR is not guaranteed
to be a good visual quality.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1486>
2022-07-29 13:29:39 +00:00
Seungha Yang 56d47f641f compositor: Add support for all formats
For formats which we don't have fast-path implementation, compositor
will convert it to common unpack formats (AYUV, ARGB, AYUV64 and ARGB64)
then blending will happen using the intermediate formats.
Finally blended image will be converted back to the selected output format
if required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1486>
2022-07-29 13:29:39 +00:00
Seungha Yang 22a4543c5f compositor: Add support for Y444 high bitdepth formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1486>
2022-07-29 13:29:39 +00:00
Seungha Yang 3cab0a9c08 compositor: Add support for I420/I422 high bitdepth formats
Implementation for {I420,I422}_{10,12}_{LE,BE} formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1486>
2022-07-29 13:29:39 +00:00
Seungha Yang 64eb4b8d62 compositor: Calculate background color only once
... instead of do that per fill_color() call in case of RGB format.
Moreover, respect selected GstVideoColorRange

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1486>
2022-07-29 13:29:39 +00:00
Tim-Philipp Müller ccb5d52be5 audiointerleave: fix property docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2785>
2022-07-23 16:03:43 +00:00
Matthew Waters dd4bbb6379 videoconvertscale: ensure writable caps when fixating format
gst_video_convert_scale_get_fixed_format() receives 'othercaps' from
basetransforms' fixate_caps() vmethod which explicitly mentions that
'`othercaps` may not be writable'.

The gst_caps_intersect() call just before may or may not produce new
caps. Particularly in cases like EMPTY or ANY caps on either of the
inputs, only a ref is taken and returned to the caller.

As a result, gst_video_convert_scale_fixate_format() may have attempted
to modify a non-writable caps structure.

Fix by adding a gst_caps_make_writable().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2709>
2022-07-04 19:57:10 +00:00
Tim-Philipp Müller f19f579712 samiparse: clean up some GString usage
There's no need to re-assign the return value of
g_string_append_*() functions and such to the variable
holding the GString. These return values are just for
convenience so function calls can be chained. The actual
GString pointer won't change, it's not a GList after all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>
2022-07-01 17:24:52 +00:00
Tim-Philipp Müller 270d23c8e0 samiparse: micro-optimise entity handling
Avoid relocations and hard-code entity string length
in the struct, since we basically get it for free here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>
2022-07-01 17:24:52 +00:00
Tim-Philipp Müller 84a3b0ef87 samiparse: fix handling of self-closing tags
We would check the wrong string (rest of line rather than element)
for the / suffix of self-closing tags, which is not only wrong but
also has atrocious performance with certain strings like the garbled
nonsense clusterfuzz feeds us, which might cause discoverer to time
out when processing garbled SAMI files.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47461

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2685>
2022-07-01 17:24:52 +00:00
James Hilliard f34ee92999 decodebin3: fix EOS event sequence
See docs:
https://gstreamer.freedesktop.org/documentation/additional/design/seqnums.html?gi-language=c#seqnums-sequence-numbers

Per docs:
When a sink element receives an EOS event and creates a new EOS
message to post, it should copy the seqnum from the event to the
message because the EOS message is a consequence of the EOS event
being received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2588>
2022-06-15 07:19:30 +00:00
Seungha Yang b91093a2e6 playbin3: Configure combiner on pad-added if needed
When collection is updated, decodebin3 exposes pad first and then
streams-selected message is posted.
The condition can cause a situation where playbin3 links non-existing
combiner/playsink pads (since streams-selected is not posted yet) with
new decodebin output pad. This commit will re-check selected/active
streams condition on pad-added and reconfigure output if needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2482>
2022-05-25 13:50:17 +00:00
Edward Hervey 53bb864244 playbin3: Cleanup and refactor combiner sourcecombine
* Remove fields no longer used, or that can be replaced by smaller code
* Rename "channels" to a more meaningful "input pads"
* Directly handle/use combiner pads in the combiners instead of on the playbin3
  main structure

Remove the corresponding combiner sinkpad whenever a uridecodebin3 source pad
goes away
* If used, store the corresponding combiner sink pad in the SourcePad helper
  structure

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2384>
2022-05-06 09:10:09 +02:00
Edward Hervey 17aa70b888 parsebin: Don't modify inexistant GstStream
When handling exposing un-handled streams, we can only replace the GstStream for
those we are creating ourselves (i.e. the fallback collection).

Fixes assertions when the demuxer creates those streams

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2353>
2022-05-04 07:26:39 +00:00
Edward Hervey 4be8b1b0a1 playbin3: Don't use unknown types for default selection
When creating a fallback default selection from a collection, don't attempt to
use unknown stream types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2353>
2022-05-04 07:26:39 +00:00
Sebastian Dröge 2eee3f4ca4 audioconvert: If no channel-mask can be fixated then use a NONE channel layout
Otherwise this is generating caps without a channel-mask, which is
invalid for >1 channels and will always fail negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2350>
2022-05-03 13:41:07 +03:00
Matthew Waters 0f9f179bec subparse: don't deref a potentially NULL variable
If the html SAMI data is malformed, then retrieving the attribute name
may fail.  We then cannot retrieve the attribute value.

Fixes: https://oss-fuzz.com/testcase-detail/4700130671984640
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2317>
2022-04-28 15:35:12 +10:00
Edward Hervey 0125d7525a parsebin: Expose streams of unknown type
This actually respects the existing `expose-all-streams` property by exposing
them and having them present in the stream collection (as streams of type
unknown).

Fixes #1179

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2309>
2022-04-27 16:24:55 +00:00
Edward Hervey 9e2bb037f0 playbin2: Remove dead code
blacklisted_mimes has been empty for ages. Remove the code "using" it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2306>
2022-04-27 13:13:17 +00:00
He Junyan f55b36e6aa videoscale: Fix the src video info error in transfer_colorimetry_from_input()
Pipeline such as:
gst-launch-1.0 -vf videotestsrc ! video/x-raw,format=NV12,colorimetry=\(string\)bt709 \
 ! videoscale ! video/x-raw,format=I420 ! fakesink
Always trigger a error:
ERROR             video-info video-info.c:556:gst_video_info_from_caps: no width property given

Because it is called before the fixate_size(), the src caps' resolution
may be absent or not fixed. That causes that the src video info can not
be created correctly and we can not inherit the colorimetry and chroma-site
from the input caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2289>
2022-04-26 14:17:50 +00:00
Guillaume Desmottes c0d7d5c2c8 videorate: fix assertion when pushing last and only buffer without duration
Fixing this pipeline:
  gst-launch-1.0 filesrc location=sample.png ! pngdec ! videorate ! fakesink

- videorate receives a single buffer with pts = 0, duration = invalid;
- then it receives eos triggering this buffer to be pushed downstream;
- the pushing code was assuming that a duration was set, which is
  impossible as we received a single buffer and no output framerate was
  set either. So the best we can do is to push the buffer without
  duration.

Fix #1177

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2296>
2022-04-26 13:43:56 +00:00
Sebastian Dröge 760b070db9 Revert "videorate: Update the base time on segment updates"
This reverts commit 75b4809ebc.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2186

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2254>
2022-04-22 23:05:57 +00:00
Sebastian Dröge 2599cf573a Revert "videorate: Only "close" the segment if it is discontinous"
This reverts commit 6f7922b4db.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2186

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2254>
2022-04-22 23:05:57 +00:00
Sebastian Dröge 98112a3ddc Revert "videorate: Drop incoming buffers that are outside of the segment"
This reverts commit 24fd80344d.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2186

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2254>
2022-04-22 23:05:57 +00:00
Mathieu Duponchelle 7988acad36 compositor: fix prepare_frame obscuring check
A pad without a buffer or with a GAP buffer cannot obscure a
pad below it. Ignore those when considering whether a pad should
be drawn.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/708>
2022-04-22 17:43:50 +00:00
Mathieu Duponchelle cc3a79d7f1 compositor: a pad without a frame can't obscure the background
Skip those when considering whether the background should be
drawn

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/708>
2022-04-22 17:43:50 +00:00
James Cowgill c8a24146c4 videoscale: Don't copy scaled metas
Returning TRUE from the `transform_meta` function tells
GstBaseTransform to copy the meta into the new buffer. If videoscale
has already transformed a meta by scaling it, it should always return
FALSE to avoid duplicating the meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1630>
2022-04-22 13:00:01 +00:00
Thibault Saunier cd7a91cef1 videoconvertscale: Add properties to disable scaling/converting in videoconvert/videoscale
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/898>
2022-04-20 17:09:20 -04:00
Thibault Saunier f3fd4d7e90 videoconvertscale: Don't claim we can support any kind of memory
Since d0133a2d11 "videoconvert: Allow
passthrough for ANY caps features" videoconvert will always claim that
it supports any kind of memory which is true in very specific case (when
it is running in passthrough mode). To get elements that autoplug
converters depending on the caps running in the pipeline (like
autovideoconvert), we need to have converters no lie about what they can
do when queried `accept_caps` or `query_caps`.

This still accepts any caps feature as before but it introduces
a restriction in the way we handle memory capsfeatures.

We keep previous behaviour in videoconvert and videoscale.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/898>
2022-04-20 17:03:21 -04:00
Thibault Saunier d11f13f476 Introduce the videocolorscale element
Now that videoconvert and videoscale's are both based on
GstVideoConverter and are using the exact same code, it makes much more
sense to have one element doing the two operation, and it can be
more efficient in some cases (one single path for both operations).

This removes the `videoscale` and `videoconvert` plugins but keeps the element
but makes them also do both operations (adding some APIs to each element).

There is a small change in API for the `videoscale:dither` property which
was previously a totally unused boolean, it is now an enum and is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/898>
2022-04-20 17:03:21 -04:00
Xavier Claessens b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Guillaume Desmottes e482b995fb decodebin3: fix collection leak
get_merged_collection() returns an owned stream collection and was
leaked in the else block.

Fix leak when running:
GST_TRACERS=leaks GST_DEBUG="GST_TRACER:7,leaks:6" gst-play-1.0 --use-playbin3 test.mkv

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/954>
2022-04-18 09:41:12 +03:00
hoonhee.lee 3d9f25d322 playbin3: fix missing lock when unknown stream type in pad-removed cb
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2193>
2022-04-16 01:31:18 +00:00