Commit graph

176 commits

Author SHA1 Message Date
Matthew Waters
69da104456 glutils: document functions 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
2b89a2c348 glwindow: remove is_running() function
It isn't necessary in correctly written programs.
2017-12-09 19:32:24 +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
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
3c1c5e9d83 glcontext: remove not thread-safe get/set_error()
Use GError's instead if necessary.
2017-12-09 19:32:21 +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
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
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
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
Matthew Waters
9829245b2b glimagesink: support the affine transformation meta for any texture target 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
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
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
Matthew Waters
b25ce3f334 glimagesink: remove reduntant glimagesink from debug logging 2017-12-09 19:32:14 +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
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
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
Matthew Waters
9fd665c90d glimagesink: wait on the correct sync meta when rendering 2017-12-09 19:32:11 +00:00
Matthew Waters
ad237e792e glimagesink: add support for rendering external-oes textures
https://bugzilla.gnome.org/show_bug.cgi?id=757285
2017-12-09 19:32:11 +00:00
Vineeth TM
15d9267ed5 glimagesink: Fix structure memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=758205
2017-12-09 19:32:11 +00:00
Matthew Waters
b8c1ecf268 glviewconvert: remove set_format
We need the caps to be able to
1. check the caps features
2. get the requested texture-target on input/output
2017-12-09 19:32:11 +00:00
Matthew Waters
bb1ae9042b glimagesink: fix a memory leak if the view conversion fails 2017-12-09 19:32:11 +00:00
Matthew Waters
7c52793e7c glimagesink: balance the creation/destruction of the overlay compositor
Fixes some leaks/possible segfault on when failing to create the compositor.
2017-12-09 19:32:11 +00:00
Matthew Waters
c4452041a8 glimagesink: wait on the provided sync meta provided to glimagesink 2017-12-09 19:32:10 +00:00
Matthew Waters
681cb5b16d glmemory: add support for rectangle textures
Add the various tokens/strings for the differnet texture types (2D, rect, oes)

Changes the GLmemory api to include the GstGLTextureTarget in all relevant
functions.

Update the relevant caps/templates for 2D only textures.
2017-12-09 19:32:10 +00:00
Matthew Waters
c3b69f3478 glimagesink: create a context in NULL_READY
So that it's possible for decoders et al. to request the OpenGL context
in their READY_PAUSED transition with decodebin/playbin.
2017-12-09 19:32:09 +00:00
Matthew Waters
06de6998e5 gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2017-12-09 19:32:09 +00:00
Matthew Waters
f688a8f0b2 glshader: port to using GstGLSLStage objects for string management
A GstGLShader is now simply a collection of stages that are
compiled and linked together into a program.  The uniform/attribute
interface has remained the same.
2017-12-09 19:32:09 +00:00
Matthew Waters
8187171908 gl: chain up to the parent class for GstElement::set_context
https://bugzilla.gnome.org/show_bug.cgi?id=705579
2017-12-09 19:32:08 +00:00
Matthew Waters
bf98930546 gl: sprinkle some debug markers to ease debugging 2017-12-09 19:32:08 +00:00
Matthew Waters
25c109f850 glimagesink: request a resize on caps/3d mode changes
Fixes incorrect aspect ratio on OSX when changing caps or the 3d
output mode.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2017-12-09 19:32:08 +00:00
Matthew Waters
b537e98ae7 glimagesink: avoid updating the viewport in the draw loop
Fixes flashes/incorrect aspect ratio when resizing glimagesink on OSX.
2017-12-09 19:32:08 +00:00
Nicolas Dufresne
369acd42c9 glimagesink: update display size before sending event
This is minor issue, as the reconfigure event is asynchronous.
Basically, update width/height before sending the event.
2017-12-09 19:32:08 +00:00
Nicolas Dufresne
a342d95ca6 glsink: Enable sync meta on pools we offer
As the upload is asynchronous, we need to enable the sync meta to
gain correct rendering. The buffer pool receiver don't know about
that.
2017-12-09 19:32:07 +00:00
Nicolas Dufresne
a3a0e0db30 glimagesink: Move overlay rendering after video rendering
This is mostly cosmetic, but heoretically it reduces the amount of
required object in the context at one point. It also avoids potential
conflicts.
2017-12-09 19:32:07 +00:00
Matthew Waters
83716a0586 glimagesink: take into account non 1/1 par for navigation
The current code was ignoring the par/dar aspect when transforming
from window coordinates to stream coordinates resulting in incorrect
coordinates being sent upstream in the navigation events.
2017-12-09 19:32:07 +00:00
Tim-Philipp Müller
0a2f2426b0 glimagesink: fix allocation meta structure leak
gst_query_add_allocation_meta() does not take ownership
of the structure, for some reason.

CID 1312135
2017-12-09 19:32:06 +00:00
Nicolas Dufresne
1812c19291 composition-overlay: Positions are relative to texture
The coordinate are relative to the texture dimension and not
the window dimension now. There is no need to pass the window
dimension or to update the overlay if the dimension changes.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
8abd2bbe35 gloverlaycompositor: Create own shader object
Make gloverlaycompositor independent of the shader used in the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Nicolas Dufresne
1fae4b199a glimagesink: Properly handle compsositor life time
Should be created in READY_TO_PAUSED, not PAUSED_TO_PLAYING.
Should be cleared in PAUSED_TO_READY.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
91d4cfe2b0 glimagesink: Send reconfigure event when window size changes
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
052b0a1caf glimagesinkbin: Add allocation query for GstVideoOverlayComposition
Adds an GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE query to glupload
and glimagesink.  Detects the query from the downstream elements, so
it is executed only when downstream supports the overlay API.

This makes pipelines with textoverlay ! glupload ! gldownload ! xvimagesink possible.
Uses allocation meta struct for passing the window size upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
dc47e6d3c0 glimagesinkbin: Add GstVideoOverlayCompositionMeta caps features
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Lubosz Sarnecki
1c0ddbd9a8 glimagesink: Upload and draw overlays with GstGLOverlayCompositor
Receives the GstOverlayComposition buffer in the glimagesink and draws them.

https://bugzilla.gnome.org/show_bug.cgi?id=745107
2017-12-09 19:32:06 +00:00
Vineeth TM
5229b50125 glimagesink: use g_clear_error instead of g_error_free
replace g_error_free with g_clear_error, as it internally
checks if error variable is valid or not.

https://bugzilla.gnome.org/show_bug.cgi?id=751823
2017-12-09 19:32:05 +00:00
Nicolas Dufresne
0f3c34f05f glimagesink: Don't leak pool
gst_query_add_allocation_pool is transfer none. Also unref
if there was a configuration error.
2017-12-09 19:32:05 +00:00