Commit graph

504 commits

Author SHA1 Message Date
Matthew Waters
41a6448918 gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2016-11-03 16:16:12 +11:00
Nirbheek Chauhan
bb0a83b018 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.
2016-10-27 23:06:26 +05:30
Nirbheek Chauhan
f790863755 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.
2016-10-27 23:06:26 +05:30
Nirbheek Chauhan
83df90ed6c Fix incorrect return type in several functions
All these should return GstFlowReturn, not gboolean
2016-10-27 23:06:26 +05:30
Nirbheek Chauhan
49ab51dc7d 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
2016-10-27 23:06:25 +05:30
Matthew Waters
c36ea6f56f meson: gl: add support for building with dispmanx on the rpi 2016-10-19 17:10:48 +11:00
Matthew Waters
1ffe22240a 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.
2016-10-05 18:28:48 +11:00
Matthew Waters
78e91a731f 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.
2016-09-19 16:58:34 +10:00
Matthew Waters
b5b7a3aec3 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'.
2016-09-09 11:22:47 +10:00
Alessandro Decina
c16d57cc9a 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.
2016-09-05 14:44:24 +10:00
Alessandro Decina
91fea30ff4 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.
2016-08-26 17:44:33 +10:00
Jan Schmidt
9afd71a507 gl: Update glvideomixer doc 2016-08-26 03:25:49 +10:00
Jan Schmidt
9e516b35e3 gl: Add/update docs for glviewconvert, glstereomix
Add some example pipelines for glstereomix, and fix up
the example pipelines for glviewconvert
2016-08-26 03:25:49 +10:00
Jan Schmidt
3ca79c93ba 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.
2016-08-26 03:25:49 +10:00
Xabier Rodriguez Calvar
8ada38e8f4 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
2016-08-25 10:17:43 +03:00
Matthew Waters
9d66a3447f 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.
2016-08-19 16:09:04 +10:00
Haihua Hu
87a86b78b5 glimagesink: Fix horizontal/vertical flip matrizes
They were swapped.

https://bugzilla.gnome.org/show_bug.cgi?id=769371
2016-08-02 14:51:33 +03:00
Matthew Waters
dba5d3a37a caopengllayersink: remove unused to_quit variable
It was always 0 and never set to anything meaningful.
2016-07-26 16:02:11 +10:00
Matthew Waters
5da138d1ae 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.
2016-07-26 14:07:24 +10:00
Matthew Waters
06b4b52a20 glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
2016-07-26 14:07:24 +10:00
Matthew Waters
518e8a3fd2 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().
2016-07-26 14:07:24 +10:00
Matthew Waters
aa109016a3 gl: use GLMemory for accessing textures everywhere
This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
2016-07-26 14:07:24 +10:00
Matthew Waters
f10a67ec44 glfilter: rename draw_texture to draw_fullscreen_quad
And remove unused arguments.
2016-07-26 14:07:24 +10:00
Matthew Waters
e9df4f0890 gleffects: fix xray to use the correct function
Instead of duplicating the sin effect
2016-07-26 14:07:24 +10:00
Matthew Waters
989200820d 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.
2016-06-29 18:04:28 +10:00
Haihua Hu
5e8a650130 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
2016-06-15 19:18:15 +10:00
Matthew Waters
4010faf4a1 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.
2016-06-15 15:08:39 +10:00
Havard Graff
7ecfd7e24d gltestsrc: gltestsrc.h already defines GstGLTestSrc
And redefinition is not allowed.

https://bugzilla.gnome.org/show_bug.cgi?id=766973
2016-05-28 22:20:51 +01:00
Nicolas Dufresne
203e893e10 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
2016-05-25 13:35:59 -04:00
Haihua Hu
a5cb746983 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
2016-05-25 18:28:20 +10:00
Matthew Waters
061a157ef5 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
2016-05-25 18:28:20 +10:00
Arjen Veenhuizen
113d5c143c gltransformation: make the pivot-z property READWRITE
Instead of just being READABLE.

https://bugzilla.gnome.org/show_bug.cgi?id=766818
2016-05-24 23:30:09 +10:00
Guillaume Desmottes
dff46e3239 gltestsrc: fix src_impl leak
https://bugzilla.gnome.org/show_bug.cgi?id=766661
2016-05-24 21:30:19 +10:00
Guillaume Desmottes
fe7dd131f5 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
2016-05-20 17:09:33 +02:00
Guillaume Desmottes
2572e3d25c 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
2016-05-20 17:09:25 +02:00
Matthew Waters
7507b14dcd 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).
2016-05-14 16:35:29 +03:00
Matthew Waters
799efcb133 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.
2016-05-14 16:35:29 +03:00
Matthew Waters
90da62bc25 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.
2016-05-14 16:35:29 +03:00
Matthew Waters
5498e97a11 gl/egl: replace gsteglimagememory with an EGLImage wrapper
That can be passed to GstGLMemoryEGL.

This also ports the dmabuf uploader to GstEGLImage and GstGLMemoryEGL.
2016-05-04 13:31:48 +10:00
Haihua Hu
0cfb0890ce 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
2016-04-29 21:33:29 +10:00
Hyunjun Ko
7bee220af4 gl: caopengllayersink: fix a minor warning
Fix "unused variable" warning

https://bugzilla.gnome.org/show_bug.cgi?id=765292
2016-04-20 10:47:19 +03:00
Sebastian Dröge
bbe2e41653 glimagesink: Fix indentation 2016-04-19 09:30:39 +03:00
Haihua Hu
e4fe0e4ae2 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
2016-04-19 09:29:15 +03:00
Heinrich Fink
44ec245b48 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
2016-04-18 10:32:07 +03:00
Luis de Bethencourt
43a656b296 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
2016-04-12 11:17:15 +01:00
Matthew Waters
417bae7f23 glbasemixer: chain up to the parent implementation 2016-04-12 09:39:32 +10: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
Matthew Waters
dedb94323c glvideomixer: add support for the affine transformation meta 2016-04-05 20:50:24 +10:00
Matthew Waters
0343d58c81 glimagesink: support the affine transformation meta for any texture target 2016-04-05 20:50:14 +10:00
Matthew Waters
a8b860e45d 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.
2016-04-05 16:24:53 +10:00