Commit graph

61 commits

Author SHA1 Message Date
Sebastian Dröge 84a956768d compositor: Don't leak all buffers while crossfading and not all pads are crossfading 2018-07-26 00:20:02 +03:00
Sebastian Dröge b0ae6a5221 compositor: Use 255 as maximum alpha instead of 256
255 will easily become 0 in the blending function as they expect
the maximum value to be 255.

Can be reproduce with

gst-launch-1.0 videotestsrc pattern=ball ! c.sink_0 \
               videotestsrc pattern=snow ! c.sink_1 \
               compositor name=c \
                 sink_0::zorder=0 sink_1::zorder=1 sink_0::crossfade-ratio=0.5 \
                 background=black ! \
               videoconvert ! xvimagesink

crossfade-ratio +/- 0.001 makes it work correctly and the same happens
at e.g. 0.25, 0.75, N*0.0625

https://bugzilla.gnome.org/show_bug.cgi?id=796846
2018-07-23 18:59:33 +03:00
Seungha Yang d95d944a34 compositor: Update conversion info in property setter
... not in getter. Otherwise, video-converter will not be updated
with new width/height

https://bugzilla.gnome.org/show_bug.cgi?id=796828
2018-07-18 14:41:31 +03:00
Sebastian Dröge ea5de0d757 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 0680c3e47d 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 83192bce84 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 e34d4e9bf4 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
Xavier Claessens 83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Mathieu Duponchelle 39d408f3d6 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
Edward Hervey 235feecf46 Update ORC fallback disted code 2018-02-14 14:36:00 +01:00
Tim-Philipp Müller d01297e115 Remove GstAggregator from -bad, moved to core
https://bugzilla.gnome.org/show_bug.cgi?id=739010
2017-12-02 16:14:36 +00: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 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
Mathieu Duponchelle 29c4ecbc25 compositor: improve conversion debugging
https://bugzilla.gnome.org/show_bug.cgi?id=786078
2017-08-10 13:55:59 +02:00
Tim-Philipp Müller 0448cf125b compositor: update disted orc fallback files 2017-08-03 20:14:41 +01: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
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
Nicolas Dufresne 4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Thibault Saunier 78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Sebastian Dröge a064590912 glvideomixer/compositor: Correctly error out if calculating DAR fails
CID 1320700
2017-02-28 13:06:41 +02:00
Sebastian Dröge 951ddc6ece compositor: Reject multiview video
Compositor does not support it currently and it needs special support
for handling this correctly, and is rather non-trivial to implement for
all formats.
2016-12-14 15:36:14 +02:00
Nirbheek Chauhan 42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Edward Hervey 2d778881cb compositor: Check if we get a valid display ratio
As is done everywhere else, and avoids setting bogus values
And remove useless *<val> checks (we always provide valid values and
it's an internal function).

CID #1320700
2016-05-15 14:35:38 +02:00
Sebastian Dröge 619d198a2f compositor: Set blend functions in ::negotiated_caps() instead of ::fixate_caps()
The latter should not change any state but just fixate the caps, while the
former is always called when srcpads caps are decided.

https://bugzilla.gnome.org/show_bug.cgi?id=765324
2016-05-03 16:53:25 +03:00
Reynaldo H. Verdejo Pinochet 58465bc90f Drop usage of 'overlayed' to mean 'overlaid' 2016-04-15 13:39:32 -07:00
Vineeth TM 8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02: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
Nirbheek Chauhan cf786a9399 compositor: Ensure all arguments to CLAMP are signed int
If any of the arguments to CLAMP are unsigned integers, the comparison causes
an automatic conversion of the signed int to unsigned, which causes -1 to become
UINT_MAX and get clamped to the high value of the CLAMP instead of 0.

See 716 at http://c0x.coding-guidelines.com/6.3.1.8.html

Also add a test for this.

https://bugzilla.gnome.org/show_bug.cgi?id=754576
2015-09-04 23:32:36 +02:00
Nirbheek Chauhan db49716c70 compositor: variables in clamp_rectangle() should be signed
x/y/w/h are signed integers. As can be seen in GstCompositorPad.
The prototype for clamp_rectangle was wrong. This commit reverts the change
and fixes the prototype.

This reverts commit bca444ea4a.
2015-08-29 17:27:45 +01:00
Luis de Bethencourt bca444ea4a compositor: remove check for below zero for unsigned value
CLAMP checks both if value is '< 0' and '> max'. Value will never be a negative
number since it is an unsigned integer. Removing that check and only checking if
it is bigger than max by using MIN().

CID 1320707
2015-08-28 15:21:13 +01:00
Nirbheek Chauhan 9b59bb8630 compositor: Actually use the output resolution for clamping
The obscured check in compositor was using the dimensions of the pad to clamp
the h/w of the pad instead of the output resolution, and was doing an incorrect
calculation to do so. Fix that by simplifying the whole calculation by using
corner coordinates. Also add a test for this bug which fell through the cracks,
and just skip all the obscured tests if the pad's alpha is 0.0.

https://bugzilla.gnome.org/show_bug.cgi?id=754107
2015-08-26 15:03:05 +03:00
Mathieu Duponchelle 53b0808042 compositor: update zorder documentation.
It is not bound between 0 and 10000 anymore.
2015-06-14 23:20:38 +02:00
Sebastian Dröge 0034323f49 Release 1.5.1 2015-06-07 10:55:35 +02:00
Sebastian Dröge 3230e51993 compositor/glvideomixer: Don't calculate PAR/DAR with unset GstVideoInfos
Otherwise we divide by zero.
2015-05-21 16:24:48 +03:00
Sebastian Dröge 41c11e3979 compositor: Fix double assignment 2015-05-21 16:19:08 +03:00
Matthew Waters d1419afef1 compositor/glvideomixer: fix up par handling
We were using the wrong formula

https://bugzilla.gnome.org/show_bug.cgi?id=749634
2015-05-21 01:04:38 +10:00
Stefan Sauer 4116d11327 Revert "doc: Workaround gtkdoc issue"
This reverts commit ff6c736fe0.

This is fixed by the gtk-doc 1.23 release.

<para> cannot contain <refsect2>:
http://www.docbook.org/tdg/en/html/para.html
http://www.docbook.org/tdg/en/html/refsect2.html
2015-05-18 20:16:32 +02:00
Nicolas Dufresne ff6c736fe0 doc: Workaround gtkdoc issue
With gtkdoc 1.22, the XML generator fails when a itemizedlist is
followed by a refsect2. Workaround the issue by wrapping the
refsect2 into para.
2015-05-16 23:38:14 -04:00
Matthew Waters 0871b7b43d compositor: implement proper par handling
We were previously failing on different input and output par
2015-05-14 14:58:07 +10:00
Matthew Waters c519169052 compositor: fix rectangle obscure test to clamp against the output frame size
Rather than one of the input pad video info's.

The test checking this was not constraining the output frame size
to ensure that the out of frame stream was not being displayed.
2015-05-13 17:44:30 +10:00
Nirbheek Chauhan 1c60de8ad7 compositor: Only map the frame from a buffer if it will be used
It's a waste of resources to map it if it won't be converted
or used at all. Since we moved the frame mapping down, we need
to use the GST_VIDEO_INFO accessor macros now in the code above
that instead of the GST_VIDEO_FRAME accessor macros.

https://bugzilla.gnome.org/show_bug.cgi?id=746147
2015-05-01 11:27:55 +01:00
Nirbheek Chauhan cc2de817ae compositor: use accessor macros for consistency
https://bugzilla.gnome.org/show_bug.cgi?id=746147
2015-05-01 10:57:08 +01:00
Nirbheek Chauhan e0fd23cb23 compositor: Skip pads that are completely obscured by a higher zorder pad
For each frame, compare the frame boundaries, check if the format contains an
alpha channel, check opacity, and skip the frame if it's going to be completely
overwritten by a higher zorder frame. The check is O(n^2), but that doesn't
matter here because the number of sinkpads is small.

More can be done to avoid needless drawing, but this covers the majority of
cases. See TODOs. Ideally, a reverse painter's algorithm should be used for
optimal drawing, but memcpy during compositing is small compared to the CPU used
for frame conversion on each pad.

https://bugzilla.gnome.org/show_bug.cgi?id=746147
2015-05-01 10:56:32 +01:00
Jan Schmidt d5ca311a0d compositor: Revert most of previous patch.
The calculation doesn't produce the same results.
Keep just the change to divide alpha by 255 instead of 256,
for slightly better accuracy
2015-03-16 04:00:44 +11:00
Jan Schmidt badc0438d6 compositor: Fix blending functions
Correctly calculate alpha in a few places by dividing by 255,
not 256.

Fix the argb and bgra blending functions to avoid an off-by-one
error in the calculations, so painting with alpha = 0xff doesn't
ever bleed through from behind
2015-03-16 00:33:23 +11:00
Vincent Penquerc'h 15d51c1f6c compositor: fix illegal memory access in blend function with negative ypos
https://bugzilla.gnome.org/show_bug.cgi?id=741115
2015-01-19 12:38:13 +00:00
Nirbheek Chauhan 29975746dc compositor: Document the zorder pad property from gstvideoaggregator 2015-01-14 19:21:36 +01:00
Sebastian Dröge ddb535c35d compositor: Don't do any conversions if the pad is completely transparent anyway 2015-01-13 14:54:26 +01:00
Stefan Sauer 4732962c85 gitignore: ignore more files 2015-01-12 22:52:36 +01:00