Commit graph

147 commits

Author SHA1 Message Date
Sebastian Dröge 5ebf6c2fac videoaggregator: We can only convert the format if a GstVideoAggregatorConvertPad is used
Otherwise assume that we can at least support any framerate.
2019-07-18 08:43:14 +03:00
Thibault Saunier 287897e465 doc: Fix some gtk-doc comments 2019-05-13 11:34:08 -04:00
Mathieu Duponchelle a35d500eae videoaggregator: fix buffer skipping with pad offsets
The ->skip_buffer implementation in videoaggregator replicates
the behaviour of the aggregate method to determine whether a
buffer can be skipped
(https://bugzilla.gnome.org/show_bug.cgi?id=781928).

This fixes a typo that made it so the start time of the buffer
was calculated against the output segment, not the segment of
the relevant sinkpad, which caused buffers to be skipped when
for example a sinkpad had received a segment which base had
been modified by a pad offset somewhere along the way.

This simply makes the calculation of the buffer start time
identical to the calculation in aggregate()
2019-03-08 07:40:25 +00:00
Olivier Crête 6a8c15f3bd video-aggregator: Sync property values to output timestamp
The properties need to be change at every output frame based on the output
time because they may change even though the input frame is not changing.
2019-03-07 14:43:06 -05:00
George Kiagiadakis 358ed9f9b4 videoaggregator: remove broken rate adjustment
The start_time and end_time in this context have already
been adjusted for the input's rate by converting them to running
time above. What is needed afterwards is to compare these
with the output's start/stop running time, which also takes
into account the rate, so we are comparing equal things.

Multiplying these with the output's rate here is only breaking
this logic. In most cases the input and output rate is the same,
so this multiplication effectively reverses the rate adjustment
that happened while converting to running time, which is why
we see the video playing with the original rate in tests.

Fixes #541
2019-01-18 11:33:33 +01:00
Sebastian Dröge 8430e47006 videoaggregator: Make sure to hold object lock while iterating sink pads
They might otherwise just change while we iterate.
2018-08-16 10:03:19 +03:00
Tim-Philipp Müller b342955a64 videoaggregator: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 01:47:29 +02:00
Seungha Yang 5934fb1bb6 videoaggregator: Fix string leak
gst_video_colorimetry_to_string() returns allocated memory which
must be freed.

https://bugzilla.gnome.org/show_bug.cgi?id=796596
2018-06-15 10:17:14 -04:00
Tim-Philipp Müller ecd58f2775 videoaggregator: log an ERROR if we're going to return a flow error 2018-06-11 13:48:09 +01:00
Olivier Crête 91692122d3 videoaggregator: Remove custom get_next_time implementation
GstAggregator now has the same thing in the simple implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=795486
2018-05-16 22:24:18 +02:00
Sebastian Dröge c43bae0a42 videoaggregator: Set video-meta option on buffer pool configuration correctly
CID 1435451
2018-05-07 17:53:32 +03:00
Sebastian Dröge 4291ee94c4 videoaggregator: First override set/get_property vfuncs, then install properties
Gives assertions otherwise.
2018-05-07 09:17:16 +02:00
Mathieu Duponchelle 1492fb4ef9 videoaggregator: expose converter-config on convert pads
This in order to allow users control over the conversion
process, for example the scaling method.
2018-05-06 16:45:43 +02:00
Sebastian Dröge 049877e5d0 videoaggregator: Fix up documentation some more 2018-05-06 16:43:32 +02:00
Sebastian Dröge 9d6d46f4cb videoaggregator: Clean up header and update docs a bit 2018-05-06 16:22:01 +02:00
Sebastian Dröge dbb21615c4 videoaggregator: Rename get_output_buffer() to create_output_buffer()
For consistency with GstAudioAggregator.
2018-05-06 16:05:28 +02:00
Sebastian Dröge 429e6c8532 videoaggregator: Validate pool configuration and create a new pool if it just does not work
Also pass the given allocator to the pool if one is set.
2018-05-06 15:49:36 +02:00
Sebastian Dröge 33a8e28207 videoaggregator: Switch to a GstVideoAggregatorConvertPad subclass
This moves all the conversion related code to a single place, allows
less code-duplication inside compositor and makes the glmixer code less
awkward. It's also the same pattern as used by GstAudioAggregator.
2018-05-06 15:22:51 +02:00
Sebastian Dröge b73b7230d2 videoaggregator: Remove sink_non_alpha_caps class field
This is only used for caching reasons and should never actually be in
the public API. If this is ever a bottleneck later, caching around a
class private struct could be implemented.
2018-05-05 16:32:19 +02:00
Sebastian Dröge 233ee9f077 videoaggregator: Move needs_alpha pad field to the private struct
And also trigger renegotiation if the value has changed.

https://bugzilla.gnome.org/show_bug.cgi?id=795836
2018-05-05 16:32:19 +02:00
Sebastian Dröge 1c8110ab17 videoaggregator: Move aggregated_frame and the pad buffer into the private struct
The aggregated_frame is now called prepared_frame and passed to the
prepare_frame and cleanup_frame virtual methods directly. For the
currently queued buffer there is a method on the video aggregator pad
now.
2018-05-05 16:32:19 +02:00
Sebastian Dröge 8b231d502c videoaggregator: Move property storage to private pad struct 2018-05-04 17:18:12 +02:00
Sebastian Dröge 51c359dda6 videoaggregator: Rename ignore-eos pad property to repeat-after-eos
What it does is to repeat the last frame forever after EOS, it does not
literally ignore EOS.
2018-05-04 16:46:00 +02:00
Sebastian Dröge a240fb7997 videoaggregator: Move GstChildProxy implementations into leaf classes
Not every subclass will want to expose the pads via the interface.

https://bugzilla.gnome.org/show_bug.cgi?id=739011
2018-05-04 16:13:16 +02:00
Sebastian Dröge c13357f22b videoaggregator: Get rid of separate header for the aggregator pad 2018-05-04 15:35:52 +02:00
Mathieu Duponchelle b59da8eced Port to latest GstAggregator segment API
The aggregator segment is now exposed on the src pad

https://bugzilla.gnome.org/show_bug.cgi?id=793946
2018-03-01 15:37:06 +01:00
Mathieu Duponchelle a4f609f847 videoaggregatorpad: implement skip_buffer
Skip buffers from sources with a framerate higher than the output
framerate.

https://bugzilla.gnome.org/show_bug.cgi?id=781928
2018-01-23 20:19:38 +01:00
Tim-Philipp Müller 944f74b834 Update for renamed aggregator pad API
https://bugzilla.gnome.org/show_bug.cgi?id=791204
2018-01-23 09:01:00 +00:00
Edward Hervey eb491b9a62 videoaggregator: Don't leak string
The result of gst_video_colorimetry_to_string () needs to be free'd
2017-11-25 12:49:43 +01:00
Mathieu Duponchelle 14f886b7b0 aggregator: Remove klass->sinkpads_type
This posed problems for the python bindings (and possibly others).

Instead, subclasses now use add_pad_template_with_gtype.

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-11-22 16:52:29 +01:00
Tim-Philipp Müller 96e9eb1fd3 videoaggregator: use new gst_element_foreach_sink_pad()
Instead of gst_aggregator_iterate_sinkpads() which will
soon be removed.

https://bugzilla.gnome.org/show_bug.cgi?id=785679
2017-11-02 13:02:14 +00:00
Tim-Philipp Müller eca9739bca videoaggregator: drop ABI compat in padding for new struct member
Don't really have to do that while it's in -bad and most users
are in-tree anyway.
2017-11-02 11:57:24 +00:00
Tim-Philipp Müller 6c79262b6e videoaggregator: use GstFlowReturn for flow returns 2017-10-13 11:46:09 +01:00
Mathieu Duponchelle 5322026885 videoaggregator: use colorimetry from find_best_format.
This increases the chances that we won't need to do any conversion
for a given pad.

https://bugzilla.gnome.org/show_bug.cgi?id=786078
2017-08-10 13:55:59 +02:00
Mathieu Duponchelle 7305f50512 videoaggregator: improve find_best_format heuristic.
The goal here is to minimize the work needed to bring all images
to a common format. A better criteria than the number of pads
with a given format is the number of pixels with a given format.

https://bugzilla.gnome.org/show_bug.cgi?id=786078
2017-08-10 13:55:59 +02:00
Sebastian Dröge 088a5cec64 videoaggregator: Don't mix up width and height
CID 1416129
2017-08-04 11:08:18 +03:00
Thibault Saunier effb593a93 compositor: Add support for crossfade blending
Crossfading is a bit more complex than just having two pads with the
right keyframes as the blending is not exactly the same.

The difference is in the way we compute the alpha channel, in the case
of crossfading, we have to compute an additive operation between
the destination and the source (factored by the alpha property of both
the input pad alpha property and the crossfading ratio) basically so
that the crossfade result of 2 opaque frames is also fully opaque at any
time in the crossfading process, avoid bleeding through the layer
blending.

Some rationnal can be found in https://phabricator.freedesktop.org/T7773.

https://bugzilla.gnome.org/show_bug.cgi?id=784827
2017-08-03 12:59:43 -04:00
Mathieu Duponchelle 027a62a9d1 videoaggregator: fix gaps at end of streams.
When the pad has received EOS, its buffer may still be mixed
any number of times, when the pad's framerate is inferior
to the output framerate.

This was introduced by my patch in
https://bugzilla.gnome.org/show_bug.cgi?id=782962, this patch
also correctly addresses the initial issue.
2017-07-06 04:02:38 +02:00
Olivier Crête da4913f2f6 videoaggregator: Declare that it supports the video meta on input
https://bugzilla.gnome.org/show_bug.cgi?id=782918
2017-05-21 18:17:54 +02:00
Olivier Crête af28bcab13 videoaggregator: Create normal video pool as a fallback
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Olivier Crête 4a571db4c7 videoaggregator: Get the buffer from the pool if available
https://bugzilla.gnome.org/show_bug.cgi?id=746529
2017-05-21 13:24:29 +02:00
Olivier Crête b488a560ed videoaggregator: Return to parent on reconfigure
The caps negotiation is now in the parent, so need to return there
if a reconfiguration is needed, otherwise it will loops forever.
2017-05-21 12:45:07 +02:00
Matthew Waters 719498601f aggregator: add simple support for caps handling
Modelled off the videoaggregator caps handling as that seems the most
mature aggregtor-using implementation that has caps handling there is.

https://bugzilla.gnome.org/show_bug.cgi?id=776931
2017-05-20 16:21:17 +02:00
George Kiagiadakis 2a60a9f66f videoaggregator: delay using new caps from a sink pad until the next buffer in the queue is taken
When caps changes while streaming, the new caps was getting processed
immediately in videoaggregator, but the next buffer in the queue that
corresponds to this new caps was not necessarily being used immediately,
which resulted sometimes in using an old buffer with new caps. Of course
there used to be a separate buffer_vinfo for mapping the buffer with its
own caps, but in compositor the GstVideoConverter was still using wrong
info and resulted in invalid reads and corrupt output.

This approach here is more safe. We delay using the new caps
until we actually select the next buffer in the queue for use.
This way we also eliminate the need for buffer_vinfo, since the
pad->info is always in sync with the format of the selected buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=780682
2017-05-20 16:21:16 +02:00
Thibault Saunier 2bf2696945 docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Mathieu Duponchelle a7c46e4a08 videoaggregator: Do not mix the same buffer twice when EOS.
When entering this code path, we know that:

We received EOS on this pad.
We consumed all its buffers.

In any case, we want to replace vaggpad->buffer with NULL,
otherwise we will end up mixing the same buffer twice.

https://bugzilla.gnome.org/show_bug.cgi?id=781037
2017-04-07 18:55:54 +02:00
George Kiagiadakis 7ac883cebf videoaggregator: redo src caps negotiation if a sink pad's caps have changed in the meantime
https://bugzilla.gnome.org/show_bug.cgi?id=755782
2017-03-06 17:20:56 +02:00
Sebastian Dröge dd18a6eb45 videoaggregator: Remove unlock() if set_info() fails
There is not mutex locked here that needs to be unlocked.
2016-12-14 15:35:42 +02:00
Sebastian Dröge 8644352155 videoaggregator: Mark pad as needing reconfiguration again if it failed
And return FLUSHING instead of NOT_NEGOTIATED on flushing pads.

https://bugzilla.gnome.org/show_bug.cgi?id=774623
2016-11-18 12:22:44 +02:00
Jan Schmidt 4f537c636a videoaggregator: Handle if update_caps() returns EMPTY
Don't assume the returned caps from update_caps() is
non-empty.
2016-08-26 03:25:49 +10:00