Commit graph

3266 commits

Author SHA1 Message Date
Matthew Waters ad20a945de gl: update sys dependants for function removals
4315a4b54d forgot to change the androidmedia/videotoolbox/caopengllayer
sources as required.
2017-12-09 19:32:26 +00:00
Matthew Waters 69da104456 glutils: document functions 2017-12-09 19:32:26 +00:00
Matthew Waters de6c39189f glutils: privatise matrix multiplication/videoaffinetransformation retrieval 2017-12-09 19:32:26 +00:00
Matthew Waters ceda9dc1aa gl/utils: also take care of the local GL context in query functions
Simplifies a deduplicates a lot of code in elements retrieving/setting
the local OpenGL context.
2017-12-09 19:32:26 +00:00
Matthew Waters d00a13f01d glutils: remove trivial helper function
gst_gl_caps_replace_all_caps_features() is only used in two places and can
be trivially reproduced.
2017-12-09 19:32:26 +00:00
Matthew Waters cfc16f6dae gl: remove custom control binding proxy
Use the existing GstProxyControlBinding instead.
2017-12-09 19:32:25 +00:00
Haihua Hu 09952ddc4b gl/effects: use non-PBO GLMemory for internal textures
middle textures in gleffects do not need to use GstGLMemoryPBO as they
aren't transfering data to/from the GPU. This will cost too much DMA
memory and cause performance issue. Change the allocator to use non-PBO
GstGLMemory.

https://bugzilla.gnome.org/show_bug.cgi?id=776072
2017-12-09 19:32:25 +00:00
Sebastian Dröge faf1e388f7 glvideomixer: Reject multiview video
glvideomixer does not support it currently and it needs special support
for handling this correctly, and is rather non-trivial to implement for
all formats.
2017-12-09 19:32:25 +00:00
Sebastian Dröge aeb5d4edaf gst: Don't declare variables inside the for loop header
This is a C99 feature.
2017-12-09 19:32:25 +00:00
Florent Thiéry 2faef638ed gldownload: fix element description (was "OpenGL uploader") 2017-12-09 19:32:25 +00:00
Matthew Waters 737505f7ed gl: remove empty BUGS file
We use bugzilla for bug tracking
2017-12-09 19:32:24 +00:00
Matthew Waters 695601b7e0 gl/build: add missing build files
3f7b549881 was incomplete :(
2017-12-09 19:32:24 +00:00
Matthew Waters 8a1d31f6ab gl/utils: move gen_shader() to the plugin and remove del_shader()
gst_gl_context_del_shader() can be replaced by a g_object_unref().
gst_gl_context_gen_shader() should be replaced by using GstGLSLStage.
2017-12-09 19:32:24 +00:00
Matthew Waters 2b89a2c348 glwindow: remove is_running() function
It isn't necessary in correctly written programs.
2017-12-09 19:32:24 +00:00
Matthew Waters 85feb6d6f2 glfiltershader: expand the docs slightly
Add an example OpenGL shader
2017-12-09 19:32:24 +00:00
Matthew Waters 181dacc77e glfilter: remove display_init/reset
They are mirrors of GstGLBaseFilter's gl_start() and gl_stop() virtual methods
so use them instead.
2017-12-09 19:32:23 +00:00
Matthew Waters 18ac98c58b gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2017-12-09 19:32:23 +00:00
Nirbheek Chauhan 48fcf632bd plugins: Use explicit type conversion from enums
MSVC warns about this because it's a C++ compiler, and this actually
results in useful things such as the incorrect 'gboolean' return value
for functions that return GstFlowReturn, so let's do explicit
conversions to reduce the noise and increase its efficacy.
2017-12-09 19:32:23 +00:00
Nirbheek Chauhan 503822eb20 Explicitly define float constants as float
With MSVC, this gives the following warning:

warning C4305: 'function': truncation from 'double' to 'gfloat'

Apparently, MSVC does not figure out what type to use for constants
based on the assignment. This warning is very spammy, so let's try to
fix it.
2017-12-09 19:32:23 +00:00
Nirbheek Chauhan 9758f25430 Fix incorrect return type in several functions
All these should return GstFlowReturn, not gboolean
2017-12-09 19:32:23 +00:00
Nirbheek Chauhan 0d37cc3b11 ext/gl: Don't define boolean on Windows with MSVC
The headers we include already define boolean on Windows with MSVC, and
it leads to a typedef redefinition error with jpeglib.h which tries to
redefine it in jmorecfg.h
2017-12-09 19:32:23 +00:00
Matthew Waters 99f5ac40db meson: gl: add support for building with dispmanx on the rpi 2017-12-09 19:32:23 +00:00
Matthew Waters c0cb6eacb5 gluploadelement: fix leak of upload library object
When only linking the element, the upload object will be created from
_transform_caps() but will never be unreffed as the only case is in _stop().

Add an unref if non-NULL to a new finalize handler for this case.
2017-12-09 19:32:23 +00:00
Matthew Waters cb0f02c78a glcolorbalance: reconfigure on passthrough changes
Fixes an assertion when moving from passthrough to non-passthrough

Without an explicit reconfigure, glfiter won't have created the GL
resources such as the FBO, GL bufferpool, etc and basetransform will
allocate sysmem buffers instead.
2017-12-09 19:32:22 +00:00
Matthew Waters 8d60fa2327 meson: add some starting build files for GL
Currently only works on linux with egl/glx + wayland/x11 but the general
principals have been layed out for adding the other GL platforms/winsys'.
2017-12-09 19:32:22 +00:00
Alessandro Decina acd33a240f glupload: create the GstGLUpload object in ::transform_caps
Previously it was created in the init function and destroyed in ::stop, which
lead to segfaults when reusing the element.

Now the upload object is created in ::transform_caps if it is NULL, which is the
earliest we need it. The other vfuncs already bail out if the upload object is
NULL, which means that negotiation wasn't done.
2017-12-09 19:32:22 +00:00
Alessandro Decina cc9f65f191 gstglupload: make the GLMemoryUpload method output the correct texture-target
Now when used with video/x-raw as input, the GLMemoryUpload method checks for
->tex_target in input GLMemory(es) and sets the output texture-target
accordingly.

Fixes video corruption with a pipeline like avfvideosrc ! video/x-raw !
glimagesink where on macos avfvideosrc pushes RECTANGLE textures but glupload
was configuring texture-target=2D as output.
2017-12-09 19:32:22 +00:00
Jan Schmidt bcc29643db gl: Update glvideomixer doc 2017-12-09 19:32:22 +00:00
Jan Schmidt fb0f015dfe gl: Add/update docs for glviewconvert, glstereomix
Add some example pipelines for glstereomix, and fix up
the example pipelines for glviewconvert
2017-12-09 19:32:22 +00:00
Jan Schmidt 97bef4e8a5 glstereomix: Fix caps negotiation
The videoaggregator negotiation sequence changed some time
back and broke glstereomix. Instead of doing nego incorrectly
in the find_best_format() vfunc, do it directly in the
update_caps() method.
2017-12-09 19:32:22 +00:00
Xabier Rodriguez Calvar ab0a0e6fcb glvideoflip: implement GstVideoDirection interface
It implements now this interface with its video-direction
property. Values are changed to GstVideoOrientationMethod but they have
the same value than the originals.

https://bugzilla.gnome.org/show_bug.cgi?id=768687
2017-12-09 19:32:22 +00:00
Matthew Waters 8f82ec9254 gltransformation: rewrite the inverse transformation logic
It now returns the correct values for both orthographic and perspective
projections and takes into account the aspect ratio of the video, handles
the Y-flipping in GL and by us and uses some more helpers from graphene.
2017-12-09 19:32:22 +00:00
Haihua Hu e41e98a127 glimagesink: Fix horizontal/vertical flip matrizes
They were swapped.

https://bugzilla.gnome.org/show_bug.cgi?id=769371
2017-12-09 19:32:21 +00:00
Matthew Waters 994e457e3b caopengllayersink: remove unused to_quit variable
It was always 0 and never set to anything meaningful.
2017-12-09 19:32:21 +00:00
Matthew Waters b3d8e09839 glfilter: rewrite subclasses for filter_texture() occuring on GL thread
There's no need for the jump to an extra thread in most cases, especially
when relying solely on a shader to render.  We can use the provided
render_to_target() functions to simplify filter writing.
2017-12-09 19:32:21 +00:00
Matthew Waters 3c1c5e9d83 glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
2017-12-09 19:32:21 +00:00
Matthew Waters 4bbda2b626 glframebuffer: rewrite for a more consistent API
Facilities are given to create fbo's and attach GL memory (renderbuffers
or textures).  It also keeps track of the renderable size for use with
effective use with glViewport().
2017-12-09 19:32:21 +00:00
Matthew Waters 7f10822de4 gl: use GLMemory for accessing textures everywhere
This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
2017-12-09 19:32:21 +00:00
Matthew Waters c7dd43f21a glfilter: rename draw_texture to draw_fullscreen_quad
And remove unused arguments.
2017-12-09 19:32:21 +00:00
Matthew Waters f12e404564 gleffects: fix xray to use the correct function
Instead of duplicating the sin effect
2017-12-09 19:32:21 +00:00
Matthew Waters 1153684a94 glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2017-12-09 19:32:21 +00:00
Haihua Hu 8a92c66440 gleffects: fix little rectangle that appears at the center of squeeze and tunnel effects
These two shader will calculate the vector length and use it as denominator.
But length could be zero which will cause undefine behaviour. Add protection for
this condition

https://bugzilla.gnome.org/show_bug.cgi?id=767635
2017-12-09 19:32:20 +00:00
Matthew Waters 2a545d3bd1 gldeinterlace: remove dead code accessing filter->in_tex_id
It's not set by anyone or anything and gldeinterlace is the only user of it now.
2017-12-09 19:32:20 +00:00
Havard Graff 61120b8c86 gltestsrc: gltestsrc.h already defines GstGLTestSrc
And redefinition is not allowed.

https://bugzilla.gnome.org/show_bug.cgi?id=766973
2017-12-09 19:32:20 +00:00
Nicolas Dufresne e369cee5de caopengllayersink: Don't cache buffer pool
Pools cannot be used by the two elements at the same time.

https://bugzilla.gnome.org/show_bug.cgi?id=766611
2017-12-09 19:32:20 +00:00
Haihua Hu 3cf27dd1c8 glimagesink: support video rotation using transform matrix
Add "rotate-method" to glimagesink and apply transform matrix
to vertex coordinate to control rotation.

https://bugzilla.gnome.org/show_bug.cgi?id=765795
2017-12-09 19:32:20 +00:00
Matthew Waters 3548dc5af9 glvideomixer: fix race retrieving the GL context from the display
_get_gl_context() can be called concurrently from either propose_allocation() or
decide_allocation().  If it so happens that this happens at the same time,
the check for whether we already had a GL context was outside the lock.  Inside
the lock and loop, the first thing that happens is that we unref the current GL
context (if valid) as if there was a conflict adding it to the display.  If the
timing was unlucky, subsequent use of the GL context would be referencing an
already unreffed GL context object resulting in a critical:

g_object_ref: assertion 'object->ref_count > 0' failed

https://bugzilla.gnome.org/show_bug.cgi?id=766703
2017-12-09 19:32:20 +00:00
Arjen Veenhuizen d7512e85b4 gltransformation: make the pivot-z property READWRITE
Instead of just being READABLE.

https://bugzilla.gnome.org/show_bug.cgi?id=766818
2017-12-09 19:32:20 +00:00
Guillaume Desmottes 7a00688122 gltestsrc: fix src_impl leak
https://bugzilla.gnome.org/show_bug.cgi?id=766661
2017-12-09 19:32:20 +00:00
Guillaume Desmottes a12ce7a150 gltestsrc: fix shaders ref counting
The gltestsrc element uses two shaders: color_shader and snow_shader.
Those are alternatively assigned to the SrcShader->shader pointer and
their reference was transferred to it. Only the SrcShader->shader was
unreffed (in _src_shader_deinit()) so only one shader was properly
freed, the other one was leaked.

Fixed this by giving an extra ref to SrcShader->shader and unreffing the
2 shaders in _src_smpte_free().

https://bugzilla.gnome.org/show_bug.cgi?id=766661
2017-12-09 19:32:20 +00:00
Guillaume Desmottes 8cf9e94c63 glmosaic: fix shader leak
gst_gl_mosaic_init_shader() is called twice with test_glmosaic so the
first shader was leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=766661
2017-12-09 19:32:19 +00:00
Matthew Waters 8ebea54758 gltransformation: use the affine transformation meta if available downstream
We can avoid a render pass if downstream supports the affine transformation meta
and increase the performance of some pipelines involving gltransformation.

Implemented by checking for the affine transformation in the allocation query
from downstream and combining our matrix with that of upstream's (or creating
our own).
2017-12-09 19:32:19 +00:00
Matthew Waters 2d62b2910c gl: take the affine transformation in NDC
Provide a function to get the affine matrix in the meta in terms of NDC
coordinates and use as a standard opengl matrix.

Also advertise support for the affine transformation meta in the allocation
query.
2017-12-09 19:32:19 +00:00
Matthew Waters d23808a877 glbasemixer: actually attempt to propose an allocation upstream
We were always failing the allocation query as a flag was never being set to
signal a successful negotiation.  Fix by setting the required flag on a
successful caps event from upstream.
2017-12-09 19:32:19 +00:00
Matthew Waters 5efc2e8705 gl/egl: replace gsteglimagememory with an EGLImage wrapper
That can be passed to GstGLMemoryEGL.

This also ports the dmabuf uploader to GstEGLImage and GstGLMemoryEGL.
2017-12-09 19:32:19 +00:00
Haihua Hu 0d1a65e86b gl: enable gldeinterlace on OpenGL ES
1.Porting the exist deinterlace shader and OpenGL callback
  to be compatible with OpenGL ES.
2.Add a our blur vertical shader to gldeinterlace.
3.Add a property named “method” to let user choose which
  deinterlace function to use. Default to choose blur vertical
  method for better performance.

[Matthew Waters]: fix name of greedyh in method property (was greedhy) and port
to git master.

https://bugzilla.gnome.org/show_bug.cgi?id=764873
2017-12-09 19:32:19 +00:00
Hyunjun Ko 40182f7959 gl: caopengllayersink: fix a minor warning
Fix "unused variable" warning

https://bugzilla.gnome.org/show_bug.cgi?id=765292
2017-12-09 19:32:19 +00:00
Sebastian Dröge 139ab08cde glimagesink: Fix indentation 2017-12-09 19:32:19 +00:00
Haihua Hu b43af664bc glimagesink: need to clean window_id when state change form READY to NULL
When application change pipeline state NULL->READY and then READY->NULL,
glimagesink will not clear glsink->window_id. After that, when application
change state NULL->READY, the new_window_id is equal to window_id, glimagesink
will not set window handle. It will use the internal window but not the window
create by application.

https://bugzilla.gnome.org/show_bug.cgi?id=765241
2017-12-09 19:32:19 +00:00
Heinrich Fink 981beba52d gl/caopengllayersink: Actually unset caps_change flag after resize
Otherwise, the sink would execute "on_resize" for each frame.

https://bugzilla.gnome.org/show_bug.cgi?id=765194
2017-12-09 19:32:19 +00:00
Luis de Bethencourt 73110e6985 gltestsrc: don't dereference null pointer
funcs can be NULL, it is one of the two conditions of the OR statement
above, so confirm it isn't before dereferencing with funcs->free.

CID 1358388
2017-12-09 19:32:19 +00:00
Matthew Waters 458c3067e4 glbasemixer: chain up to the parent implementation 2017-12-09 19:32:19 +00:00
Matthew Waters 7f8e09523f 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
2017-12-09 19:32:19 +00:00
Matthew Waters aae649dc75 glvideomixer: add support for the affine transformation meta 2017-12-09 19:32:18 +00:00
Matthew Waters 9829245b2b glimagesink: support the affine transformation meta for any texture target 2017-12-09 19:32:18 +00:00
Matthew Waters b9f77bf92b glmixer: set the current texture to 0 before mapping
If we fail mapping, we don't want to use undefined video data in the subclass.
2017-12-09 19:32:18 +00:00
Matthew Waters 366d7ac90b glmixerbin: proxy the start-time-* properties from aggregator 2017-12-09 19:32:18 +00:00
Matthew Waters e5c43ab7fb gl/build: add missing '\' at the end of the line in MakeFile.am
Otherwise the following elements aren't included in the correct variable.

Fixes error in 'make distcheck' failing to find gstgltestsrc.h
2017-12-09 19:32:18 +00:00
Matthew Waters 79935c7ee3 gldifferencematte: port to gl3/gles2 2017-12-09 19:32:18 +00:00
Matthew Waters cdcd234613 gltestsrc: port to gles2/gl3
This makes gltestsrc work everywhere \o/

- workaround RPi returning invalid values for positive coords in the
  checker shader
- reduce the number of iterations in the mandelbrot shader for gles2

https://bugzilla.gnome.org/show_bug.cgi?id=751540
2017-12-09 19:32:18 +00:00
Matthew Waters 55eaa869ea gltestsrc: port smpte pattern to shaders
Loosely based on patch by
Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=751540
2017-12-09 19:32:18 +00:00
Matthew Waters b7ab7aa349 gltestsrc: implement the circular method
https://bugzilla.gnome.org/show_bug.cgi?id=759801
2017-12-09 19:32:18 +00:00
Matthew Waters 309005b12d gltestsrc: add a generic src framework
Any unsupported pattern (circular) results in an error
2017-12-09 19:32:18 +00:00
Matthew Waters 5a68528419 glsterosplit: remove internal glupload/glcolorconvert
They are provided separately as elements and no other element contains the
internal references to glupload/glcolorconvert.
2017-12-09 19:32:18 +00:00
Vineeth TM e92bbb2a83 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2017-12-09 19:32:18 +00:00
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