Commit graph

119 commits

Author SHA1 Message Date
Edward Hervey
f0ba09d10e 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
56fc5bef18 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
13c730776b 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
dd7a90c48e 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
90ec5e580b videoaggregator: use GstFlowReturn for flow returns 2017-10-13 11:46:09 +01:00
Mathieu Duponchelle
ca8d5f2872 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
388b7ee275 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
c28f2f6ce8 videoaggregator: Don't mix up width and height
CID 1416129
2017-08-04 11:08:18 +03:00
Thibault Saunier
806ff70590 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
0478773155 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
68bb5bfecc 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
892693865f 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
31bbfd6773 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
7b1235940f 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
7c53043386 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
39d2526c34 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
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Mathieu Duponchelle
4d63aee36c 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
08c52c931e 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
e07a7bbf29 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
db504c9ea5 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
3d2048e40a 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
Nirbheek Chauhan
a3d58818e8 Fix various gboolean vs GstFlowReturn problems
Caught by building with MSVC which gave warnings for these
2016-07-11 15:02:06 +01:00
Guillaume Desmottes
991d9a6f5f gst-libs: gl, video: use MAY_BE_LEAKED flag
https://bugzilla.gnome.org/show_bug.cgi?id=767162
2016-06-03 00:59:12 +01:00
Olivier Crête
e357e372e1 videoaggregator: Don't wait if input buffer is after output
If the input buffer is after the end of the output buffer, then waiting
for more data won't help. We will never get an input buffer for this point.

This fixes compositing of streams from rtspsrc.

https://bugzilla.gnome.org/show_bug.cgi?id=766422
2016-05-20 10:58:46 -04:00
Tim-Philipp Müller
441072834e videoaggregator: canonicalise function names
Had to be done at some point:
gst_videoaggregator_* -> gst_video_aggregator_*
Also fix up some function names with typos.
2016-05-16 12:27:50 +01:00
Thiago Santos
5fc6284cdc videoaggregator: plug caps leak
It was losing ref of the original 'ret' caps that would be returned
or returning it with 2 references to it.
2016-04-18 13:46:55 -03:00
Thiago Santos
641bb44226 videoaggregator: properly handle interlace-mode restrictions
videoaggregator can't handle interlace-mode changes so it must
always restrict itself to the first interlacing mode it receives.

Tests included

https://bugzilla.gnome.org/show_bug.cgi?id=754495
2016-04-18 13:46:48 -03:00
Matthew Waters
aa2b23fe39 videoaggregator: repect the result of find_best_format in the default update_caps
We weren't using the result of find_best_format at all.

Also, move the find_best_format usage to the default update_caps() to make
sure that it is also overridable.

https://bugzilla.gnome.org/show_bug.cgi?id=764363
2016-04-07 20:30:25 +10:00
Thiago Santos
f231598370 videoaggregator: fix caps queries to allow proper renegotiation
When caps are already negotiated it should be possible to
select formats other than the one that was negotiated. If downstream
allows alpha video caps and it has already negotiated to a non-alpha
format, caps queries should still return the alpha caps as a possible
format as caps renegotiation can happen.

Includes tests (for compositor) to check that caps queries done after
a caps has been negotiated returns complete results

https://bugzilla.gnome.org/show_bug.cgi?id=757610
2016-02-25 11:43:43 -03:00
Matthew Waters
87031b14cb videoaggregator: don't do caps processing that is not overridable
Allows the subclass to completely override the chosen src caps.

This is needed as videoaggregator generally has no idea exactly
what operation is being performed.

- Adds a fixate_caps vfunc for fixation
- Merges gst_video_aggregator_update_converters() into
  gst_videoaggregator_update_src_caps() as we need some of its info
  for proper caps handling.
- Pass the downstream caps to the update_caps vfunc

https://bugzilla.gnome.org/show_bug.cgi?id=756207
2016-01-27 20:36:25 +11:00
Luis de Bethencourt
2288b5e9ec videoaggregator: use GST_STIME_ARGS for GstClockTimeDiff
No need to manually handle negative values of diff, GST_STIME_ARGS does
exactly this.
2015-11-02 17:00:22 +00:00
Tim-Philipp Müller
5409017642 videoaggregator: fix compilation with older glib version
Remove weird use of private gtype defines and fix compilation
with older glib versions such as 2.36.

https://bugzilla.gnome.org/show_bug.cgi?id=755754
2015-09-29 14:40:26 +01:00
Sebastian Dröge
eb97bb0adb videoaggregator: Fix mixup of running times and segment positions
We have to queue buffers based on their running time, not based on
the segment position.

Also return running time from GstAggregator::get_next_time() instead of
a segment position, as required by the API.

Also only update the segment position after we pushed a buffer, otherwise
we're going to push down a segment event with the next position already.

https://bugzilla.gnome.org/show_bug.cgi?id=753196
2015-09-14 19:56:43 +02:00
Thiago Santos
ba97ec74be videoaggregator: fix caps query to properly handle alpha formats
Only accept alpha if downstream has alpha as well. It could
theoretically accept alpha unconditionally if blending is
properly implemented for handle it but at the moment this
is a missing feature.

Improves the caps query by also comparing with the template
caps to filter by what the subclass supports.

https://bugzilla.gnome.org/show_bug.cgi?id=754465
2015-09-11 18:03:26 -03:00
Thiago Santos
8c5b2da124 videoaggregator: lift restriction of changing pixel-aspect-ratio
The videoaggregator can convert PAR, there is no reason for
restricting it.

https://bugzilla.gnome.org/show_bug.cgi?id=754291
2015-09-03 11:18:22 -03:00
Ben Browitt
09b4f050e0 videoaggregator: Always set the pad's buffer_vinfo when storing a buffer
Otherwise it might be unset, and then the buffer is used and
gst_video_frame_map() will crash because of invalid video-info.

https://bugzilla.gnome.org/show_bug.cgi?id=753805
2015-08-20 14:22:49 +03:00
Olivier Crête
e4a1db2287 videoaggregator: Remove broken _clip vfunc
It never does anything.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
2015-07-30 14:00:05 -04:00
Sebastian Dröge
fab880fddc aggregator: Add property to select how to decide on a start time
Before aggregator based elements always started at running time 0,
now it's possible to select the first input buffer running time or
explicitly set a start-time value.

https://bugzilla.gnome.org/show_bug.cgi?id=749966
2015-07-29 14:35:50 +01:00
Thibault Saunier
c28d90de68 videoaggregator: Remove pixel-aspect-ratio field from the caps returned by getcaps
Avoiding not negotiated error while negotiating as we anyway force 1/1
as output
2015-07-06 18:53:38 +02:00
Mathieu Duponchelle
1248b00c80 videoaggregator: simplifies and improves sink_get_caps.
The problem here was that after removing the formats and
all the things we could convert, we then intersected these
caps with the template caps.

Hence if a subclass offered permissive sink templates
(eg all the possible formats videoconvert handles), but only
one output format, then at negotiation time getcaps returned
caps with the format restricted to that format, even though
we do handle conversion.

https://bugzilla.gnome.org/show_bug.cgi?id=751255
2015-06-23 00:57:59 +02:00
Sebastian Dröge
f2617ee0ee videoaggregator: Print some debug output if we change the timestamp offset 2015-06-15 14:29:04 +02:00
Sebastian Dröge
3c9176d7e8 videoaggregator: Add some more debug output 2015-06-15 14:25:43 +02:00
Sebastian Dröge
442114c606 videoaggregator: Don't update the ts-offset before updating the actual configured caps 2015-06-15 14:19:05 +02:00
Sebastian Dröge
9533d1f165 videoaggregator: Remember if the last LATENCY query returned live or not and use the in the QoS messages 2015-06-15 14:18:39 +02:00
Mathieu Duponchelle
3c2fff7165 videoaggregator: No need to artificially bound the zorder.
It is an unsigned integer so the upper bound is G_MAXUINT.
2015-06-14 23:15:25 +02:00
Nirbheek Chauhan
b395c055eb videoaggregator: add "ignore-eos" property for input pads
When set, it causes videoaggregator to repeatedly aggregate the last buffer on
an EOS pad instead of skipping it and outputting silence. This is useful, for
instance, while playing back files seamless one after the other, to avoid
videoaggregator ever outputting silence (the checkerboard pattern).

It is to be noted that if all the pads on videoaggregator have this property set
on them, the mixer will never forward EOS downstream for obvious reasons. Hence,
at least one pad with 'ignore-eos' set to FALSE must send EOS to the mixer
before it will be forwarded downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=748946
2015-06-12 19:44:50 +01:00
Thiago Santos
7b8d819d18 videoaggregator: simplify aggregate returning
Rework special handling with goto/labels to only have one case
and otherwise just return normally.
2015-06-08 12:35:25 -03:00
Thiago Santos
443a3beb8f videoaggregator: refactor caps reconfigure to its own function
Makes the aggregation code shorter and easier to read
2015-06-08 12:34:23 -03:00
Thiago Santos
9f9c723f5d videoaggregator: fixing types in aggregate function
Correctly use boolean and GstFlowReturn types in the function.
2015-06-08 12:33:40 -03:00