Commit graph

514 commits

Author SHA1 Message Date
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