Commit graph

445 commits

Author SHA1 Message Date
Matthew Waters c7da2adf7f glstereo{mix,split}: allow running on GLES 2/3
It's mostly supported for GLES 2.x, fully supported on GLES 3.x
2017-12-09 19:32:17 +00:00
Matthew Waters d1b3b63c1c gleffects; give each effect a unique long name and description
Gives applications that scrape the factory details more detailed and unique
details on the exact element.

https://bugzilla.gnome.org/show_bug.cgi?id=760566
2017-12-09 19:32:17 +00:00
Matthew Waters c1d49430ec glfilterapp: update for the use of shaders
Fixes black output when placed in pipelines (using the default drawing).

https://bugzilla.gnome.org/show_bug.cgi?id=763365
2017-12-09 19:32:17 +00:00
Vineeth TM cd696a0b79 glimagesink: Fix window memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=763356
2017-12-09 19:32:17 +00:00
Matthew Waters 7b2ab7279f glvideomixer: signal continuation in reset
We want to iterate over all the pads, not just the first one.  Fix by returning
TRUE in the GstAggregatorPadForeachFunc.

Removes a GST_IS_GL_CONTEXT() assertion on shutdown with >2 inputs
using gst-launch.
2017-12-09 19:32:17 +00:00
Wang Xin-yu (王昕宇) 35765bec0e glmixer: iterator didn't advance in continue statement
Leading to a deadlock.

https://bugzilla.gnome.org/show_bug.cgi?id=760873
2017-12-09 19:32:17 +00:00
Matthew Waters 7e108f4763 gl: fix the build
2d287812 was incomplete
2017-12-09 19:32:17 +00:00
Matthew Waters e71e492413 gl: error out if the configured GL API is unsupported by our element
https://bugzilla.gnome.org/show_bug.cgi?id=759801
2017-12-09 19:32:17 +00:00
Matthew Waters 9ac6c546de glimagesink: remove unsed reconfigure variable 2017-12-09 19:32:16 +00:00
Matthew Waters 5694cdd8ca glimagesink: don't push a reconfigure event from the GL thread
Doing so may cause deadlocks when other elements attempt destroy or created
GL resources.

https://bugzilla.gnome.org/show_bug.cgi?id=760559
2017-12-09 19:32:16 +00:00
Wang Xin-yu (王昕宇) 176149039b glvideomixer: don't leak pad's vertex buffer on release_pad
https://bugzilla.gnome.org/show_bug.cgi?id=760873
2017-12-09 19:32:16 +00:00
Matthew Waters c1376c91ef glmixer: Remove usage of GstGLMixerFrameData
Subclasses can just iterate over the list of pads themselves

https://bugzilla.gnome.org/show_bug.cgi?id=760873
2017-12-09 19:32:16 +00:00
Matthew Waters 03fdd2fc82 glmixer: don't hold the object lock while calling into GL
Doing so can deadlock between the GL thread and the object lock e.g.
when performing reconfigure events in glimagesink on a resize event.

https://bugzilla.gnome.org/show_bug.cgi?id=760559
2017-12-09 19:32:16 +00:00
Alessandro Decina ecdb9d6550 glvideoflip: don't ignore method changes when caps aren't set (yet) 2017-12-09 19:32:16 +00:00
Matthew Waters d8c710d143 gleffects: identity: add the shader to the hash table
So that we don't recreate it every frame and leak memory.

https://bugzilla.gnome.org/show_bug.cgi?id=761578
2017-12-09 19:32:16 +00:00
Matthew Waters afd3624b28 gltransformation: reconfigure the src when changing to/from passthrough
Otherwise it's very possible that any GL resources have not been created yet.
2017-12-09 19:32:16 +00:00
Matthew Waters 612ee0089f glvideoflip: correctly update the output caps on method changes
When changing methods we may need different output caps.
2017-12-09 19:32:16 +00:00
Alessandro Decina 2f8f4a5b90 gldownload: allow video/x-raw as input
...and just passthrough. This is useful for pipelines where downstream must be
non-GL but upstream can optionally be GL.
2017-12-09 19:32:16 +00:00
Wang Xin-yu (王昕宇) 46cf23b0a1 glvideomixer: fix checker vbo leak
https://bugzilla.gnome.org/show_bug.cgi?id=760925
2017-12-09 19:32:15 +00:00
Haihua Hu 3fb60ac10c gleffects: fix gleffects fisheye shader compile error
On some embedded systems, sqrt() is not supported in the shader,
use the actual value of sqrt(2) instead.

Signed-off-by: Haihua Hu <b55597@freescale.com>
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=761271
2017-12-09 19:32:15 +00:00
Matthew Waters 931090bf18 glvideomixer: par may not exist in the caps
Fixes a critical in the gst-validate tests:

gst_structure_fixate_field_nearest_fraction: assertion 'gst_structure_has_field
(structure, field_name)
2017-12-09 19:32:15 +00:00
Matthew Waters e03e983e90 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
2017-12-09 19:32:15 +00:00
Matthew Waters f8c6be86c2 glcolorbalance: return HARDWARE from get_balance_type 2017-12-09 19:32:15 +00:00
Matthew Waters 81f0d05d37 glsinkbin: add glcolorbalance element
This makes playbin not plug videobalance as glcolorbalance already exists and
implements the GstColorBalance interface.
2017-12-09 19:32:15 +00:00
Matthew Waters 2cef90184e gl: move control binding proxy implementation from glvideomixer
Other elements may need to use it's functionality
2017-12-09 19:32:15 +00:00
Matthew Waters e3f53deb32 glcolorbalance: create the shader if it doesn't exist in the render callback
Changing the properties may result in glcolorbalance moving from passthrough to
non-passthrough and we weren't creating the shader in that case.
2017-12-09 19:32:15 +00:00
Matthew Waters 5ecc3413fd glvideoflip: incorporate the aspect ratio into the scale_x calculations
1. Otherwise rotating the video will clip and show black bars due to
   gltransformation's implementation.
2. The other option of make gltransformation aspect-agnostic produces
   incorrect output with perspective transformations.
2017-12-09 19:32:15 +00:00
Tim-Philipp Müller e905ace0b0 gl: fix compiler warnings with gcc-6
In file included from effects/gstgleffectrgbtocurve.c:25:0:
effects/gstgleffectscurves.h:174:32: error: 'xray_curve' defined but not used
 static const GstGLEffectsCurve xray_curve = {
...
2017-12-09 19:32:15 +00:00
Matthew Waters a15305ea02 gl: add a videoflip element
Behaves exactly the same as the non-GL videoflip element
2017-12-09 19:32:15 +00:00
Matthew Waters 0e928db89e gltransformation: always build a valid mvp matrix
The default case is to build an identity matrix.
2017-12-09 19:32:14 +00:00
Matthew Waters e8544db8cf gltransformation: support negative scales
A scale of -1.0 means to flip the video.
2017-12-09 19:32:14 +00:00
Matthew Waters d05bd79042 gltransformation: implement passthrough handling 2017-12-09 19:32:14 +00:00
Matthew Waters 1fe2996b01 gltransformation: implement navigation events
Reverses the transformation applied through the properties and forwards the
event.

The process for finding the coordinates on the video are as follows:
1. Convert the given pointer_x and pointer_y to model space at the near and far planes
2. Get the equation of the video plane
3. Find where the ray in 1 intersects the plane
4. Profit!
2017-12-09 19:32:14 +00:00
Matthew Waters b25ce3f334 glimagesink: remove reduntant glimagesink from debug logging 2017-12-09 19:32:14 +00:00
Matthew Waters 731f9928dd gl: implement a colorbalance element
It performs the exact same operation as videobalance but with opengl shaders and
was tested with glvideomixer by comparing frames from videobalance and
glcolorbalance.
2017-12-09 19:32:14 +00:00
Matthew Waters 1d55ce912b glvideomixer: implement glBlendFunc and glBlendEquation
Allows more blending options than just A over B

e.g. frame comparisons are now possible.
  glvideomixer name=m
    sink_0::zorder=0
    sink_1::zorder=1
    sink_1::blend-equation-rgb={subtract,reverse-subtract}
    sink_1::blend-function-src-rgb=src-color
    sink_1::blend-function-dst-rgb=dst-color
  ! glimagesinkelement
  videotestsrc pattern=checkers-4 ! m.sink_0
  videotestsrc pattern=checkers-8 ! m.sink_1
2017-12-09 19:32:14 +00:00
Matthew Waters a0a0e51249 glcolorconvert: implement usage of a buffer pool
Saves unnecessary glGenTextures and glDeleteTextures which may have a
non-trivial cost.
2017-12-09 19:32:14 +00:00
Matthew Waters b43fa6e105 gleffects: fix shader compilation with legacy opengl
All the gleffects shaders can be run against a gles2 or a legacy opengl glsl
compiler but weren't being advertised as such.

Fixes gleffects under desktop opengl < 3.2.
2017-12-09 19:32:14 +00:00
Florent Thiéry ce96cce1f2 glshader: fix usage doc
The property location has been changed in favor of vertex/fragment
string properties; the doc had not been updated and was still referring
to the previous property; also, now the #version header has become mandatory

https://bugzilla.gnome.org/show_bug.cgi?id=759902
2017-12-09 19:32:13 +00:00
Florent Thiéry f18d14db45 glimagesink: Post unhandled navigation events on the bus
Based off xvimagesink implementation

https://bugzilla.gnome.org/show_bug.cgi?id=759869
2017-12-09 19:32:13 +00:00
Lubosz Sarnecki dbcea228b2 glimagesink: Show error when video frame is not mapped.
Adds more meaningful error than
"Failed to convert multiview video buffer", which is always used
when prepare_next_buffer() fails in gst_glimage_sink_prepare().

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2017-12-09 19:32:13 +00:00
Alessandro Decina 28dbe4fffc glmemory: add gst_gl_memory_allocator_get_default
Add gst_gl_memory_allocator_get_default to get the default allocator based on
the opengl version. Allows us to stop hardcoding the PBO allocator which isn't
supported on gles2.

Fixes GL upload on iOS9 among other things.
2017-12-09 19:32:13 +00:00
Matthew Waters 09677a4d30 glimagesink: don't deadlock on resize
Performing any GL function marshalling off the GL thread with glimagesink's
render lock is prone to deadlocks between the GL thread and the non-GL thread.

What can happen is this:
1. non-GL thread attempts to function marshal to the GL thread.
2. while 1 is happening, the winsys gives an event (say resize)
3. This calls back into glimagesink which taks the render lock.
4. As the GL function marshalling is attempting to run on the GL
   and already has glimagesink's render lock locked.  This deadlocks
   as the threads are waiting for each other.
2017-12-09 19:32:13 +00:00
Matthew Waters 1673a6192f glmemorypbo: remove our own alloc()/wrapped()/etc functions
replaced by equivalent functionality within gst_gl_base_memory_alloc()
2017-12-09 19:32:13 +00:00
Vineeth TM 0061913f08 plugins-bad: Fix example pipelines
rename gst-launch --> gst-launch-1.0
replace old elements with new elements(ffmpegcolorspace -> videoconvert, ffenc_** -> avenc_**)
fix caps in examples

https://bugzilla.gnome.org/show_bug.cgi?id=759432
2017-12-09 19:32:12 +00:00
Matthew Waters 76a38dd66a glmemory: base classify and add the pbo memory on top
The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.
2017-12-09 19:32:12 +00:00
Matthew Waters 3545d340b6 gldownload: remove helper api from the library
It was never used by anyone and is not needed anymore with the element
and GstGLMemory's transparent support for downloading textures.
2017-12-09 19:32:12 +00:00
Matthew Waters a1cc1116b5 gltransformation: clear to transparent
Otherwise composition will result in a black frame outside the transformed
video.
2017-12-09 19:32:12 +00:00
Reynaldo H. Verdejo Pinochet 68e668168d Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2017-12-09 19:32:11 +00:00
Sebastian Dröge c9fafe8445 glimagesink: Remove unused variable
gstglimagesink.c: In function 'gst_glimage_sink_on_draw':
gstglimagesink.c:1959:18: error: unused variable 'sync_meta' [-Werror=unused-variable]
   GstGLSyncMeta *sync_meta = NULL;
                  ^
2017-12-09 19:32:11 +00:00