Commit graph

83 commits

Author SHA1 Message Date
Matthew Waters
1b0d2b1338 glimagesink: implement as a bin
glupload ! glcolorconvert ! sink

Some properties are manually forwarded.  The rest are available using
GstChildProxy.

The two signals are forwarded as well.
2017-12-09 19:31:57 +00:00
Nicolas Dufresne
bc92b41c7b glimagesink: Only cache pool, don't manage it
GLImage does not use any kind of internal pool. There was some
remaining code and comment stating that it was managing the
pool, and it was in fact setting the active state when doing
to ready state.

* Only create the pool if requested and in propose_allocation
* Cache the pool to avoid reallocation on spurious reconfigure
* Don't try to deactivate the pool (we don't own it)

https://bugzilla.gnome.org/show_bug.cgi?id=745705
2017-12-09 19:31:56 +00:00
Sebastian Dröge
cb59ace574 gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
2017-12-09 19:31:56 +00:00
Xavier Claessens
c8e43e5581 glimagesink: cosmetic cleanup
https://bugzilla.gnome.org/show_bug.cgi?id=745105
2017-12-09 19:31:55 +00:00
Edward Hervey
fcdfdfbfdf glimagesink: Fix debug statement 2017-12-09 19:31:54 +00:00
Edward Hervey
6882d034f3 glimagesink: Sprinkle more debug 2017-12-09 19:31:54 +00:00
Matthew Waters
d44fb3962e glimagesink: log the converted caps 2017-12-09 19:31:54 +00:00
Matthew Waters
68dc0fef6d glcolorconvert: put GstGLSyncMeta on output buffers
allows thread safely using the provided output buffer in a separate
thread
2017-12-09 19:31:54 +00:00
Matthew Waters
530ae2cbb0 glupload/download/convert: provide transform_caps functions
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2017-12-09 19:31:54 +00:00
Matthew Waters
157170011d glimagesink: clobber the alpha channel by default
this can be disabled with the ignore-alpha property
2017-12-09 19:31:54 +00:00
Matthew Waters
598715fc4b glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2017-12-09 19:31:53 +00:00
Matthew Waters
019367c128 glwindow: remove width/height from _draw()
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2017-12-09 19:31:53 +00:00
Nicola Murino
dd928efa51 glimagesink: fix memleak
https://bugzilla.gnome.org/show_bug.cgi?id=743142
2017-12-09 19:31:52 +00:00
Matthew Waters
1dfeae2c42 gl: split glcolorconvert usage from glupload
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2017-12-09 19:31:52 +00:00
Matthew Waters
ba3a3cd783 gl: fixup vao and vbo usage for legacy GL 2017-12-09 19:31:52 +00:00
Matthew Waters
dee5943c0e glimagesink: properly handle the !opengl3 case
https://bugzilla.gnome.org/show_bug.cgi?id=740012
2017-12-09 19:31:51 +00:00
Matthew Waters
4bd62ebb03 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2017-12-09 19:31:51 +00:00
Matthew Waters
892d056a44 gl: remove the use of glu 2017-12-09 19:31:51 +00:00
Matthew Waters
6bb113f685 gl: add a sync meta for synchronizing across GL contexts
A context can create a GLsync object that can be waited on in order
to ensure that GL resources created in one context are able to be
used in another shared context without any chance of reading invalid
data.

This meta would be placed on buffers that are known to cross from
one context to another.  The receiving element would then wait
on the sync object to ensure that the data to be used is complete.
2017-12-09 19:31:51 +00:00
Matthew Waters
96e5304517 glimagesink: use vbo's and vao's for gl3 2017-12-09 19:31:50 +00:00
Matthew Waters
55977523b0 glimagesink: only attempt a resize when the window has already resized
fixes a black startup screen on wayland
2017-12-09 19:31:50 +00:00
Matthew Waters
00506bf183 glupload: rearchitecture for non GLMemory inputs/outputs
Allows other memory types to be implemented/returned/used by the caller.
2017-12-09 19:31:50 +00:00
Vineeth T M
1716e8c481 glimagesink: critical error while seek playback-test(stop state)
If we seek when media is in stop state, playback-test gives
critical error, since context of glimagesink is destroyed during stop.
But since context is not present, we need not handle send_event in glimagesink
Hence adding a condition to check if context is valid.

https://bugzilla.gnome.org/show_bug.cgi?id=740305
2017-12-09 19:31:50 +00:00
Matthew Waters
f0c118c77a glimagesink: don't set the upload to NULL on the drain query
https://bugzilla.gnome.org/show_bug.cgi?id=732694
2017-12-09 19:31:50 +00:00
Julien Isorce
c72498af92 glimagesink: release stored buffers on drain query
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732694
2017-12-09 19:31:49 +00:00
Alessandro Decina
c3612847ef glimagesink: don't make gst_glimage_sink_handle_events call _ensure_gl_setup
gst_glimage_sink_handle_events can be called from the overlay interface and from
the main thread before GL is setup. Before this change, that would call
_ensure_gl_setup() and deadlock on OSX.

Change things so that it's always safe to call gst_glimage_sink_handle_events()
without stuff deadlocking.
2017-12-09 19:31:49 +00:00
Alessandro Decina
ab8990c89f glimagesink: fix possible deadlock on osx
Remove gst_glimage_sink_handle_events call in gst_glimage_sink_init. It was
unnecessary and when the element was instantiated from the main thread, caused a
deadlock in OSX creating the context (thread).
2017-12-09 19:31:49 +00:00
Matthew Waters
d9b724a3d2 glimagesink: clamp the resize width/height to >= 1 to avoid a GL error 2017-12-09 19:31:49 +00:00
Lubosz Sarnecki
64dd17bde6 glimagesink: implement gst_video_overlay_handle_events
https://bugzilla.gnome.org/show_bug.cgi?id=736035
2017-12-09 19:31:49 +00:00
Matthew Waters
0fa95fe809 glimagesink: resize the viewport correctly on a caps change
with force-aspect-ratio=true, if the width or height changed, the
viewport wasn't being updated to respect the new video width and height
until a resize occured.
2017-12-09 19:31:49 +00:00
Lubosz Sarnecki
e173ab2b9d satisfy gst-indent 2017-12-09 19:31:49 +00:00
Matthew Waters
62e3c40d97 gl: propogate other-context using GstContext 2017-12-09 19:31:48 +00:00
Sebastian Dröge
22a1ec13b6 glimagesink: Only finalize the other context in finalize()
Otherwise we change a value of a property when going to READY state,
which is unexpected behaviour.
2017-12-09 19:31:48 +00:00
Sebastian Dröge
3b9b30563e glimagesink: Don't leak other-context 2017-12-09 19:31:48 +00:00
Matthew Waters
6491af9ffc glupload: provide the output buffer that is rendered into
Allows callers to properly reference count the buffers used for
rendering.

Fixes a redraw race in glimagesink where the previous buffer
(the one used for redraw operations) is freed as soon as the next
buffer is uploaded.

1. glimagesink uploads in _prepare() to texture n
1.1 glupload holds buffer n
2. glimagesink _render()s texture n
3. glimagesink uploads texture n+1
3.1 glupload free previous buffer which deletes texture n
3.2 glupload holds buffer n+1
4. glwindow resize/expose
5. glimagesink redraws with texture n

The race is that the buffer n (the one used for redrawing) is freed as soon as
the buffer n+1 arrives.  There could be any amount of time and number of
redraws between this event and when buffer n+1 is actually rendered and thus
replaces buffer n as the redraw source.

https://bugzilla.gnome.org/show_bug.cgi?id=736740
2017-12-09 19:31:46 +00:00
Sanjay NM
4f6e9f4e41 gl: Removed unreachable break, unused variable
https://bugzilla.gnome.org/show_bug.cgi?id=736957
2017-12-09 19:31:46 +00:00
Sebastian Dröge
2c0f8e1107 glimagesink: Add missing break to switch
CID 1232801
2017-12-09 19:31:46 +00:00
Lubosz Sarnecki
e266f6517d glimagesink: expose context
* expose context in draw / reshape callbacks
* add context property

https://bugzilla.gnome.org/show_bug.cgi?id=734482
2017-12-09 19:31:45 +00:00
Matthew Waters
beb9b95d39 glimagesink: unref the window on navigation event
plugs a memory leak
2017-12-09 19:31:45 +00:00
Tim-Philipp Müller
6bbcefe029 opengl: update element docs for 1.x 2017-12-09 19:31:45 +00:00
Vasilis Liaskovitis
7b1a853888 GstGLWindow, GstGLImagesink, x11: Scale navigation events on resized windows
If window is resized, GstStructure pointer values have to be rescaled to
original geometry. A get_surface_dimensions GLWindow class method is added for
this purpose and used in the navigation send_event function.

https://bugzilla.gnome.org/show_bug.cgi?id=703486
2017-12-09 19:31:45 +00:00
Matthew Waters
d3804ee7aa gl: document GST_GL_* environment variables
https://bugzilla.gnome.org/show_bug.cgi?id=733245
2017-12-09 19:31:45 +00:00
Matthew Waters
84a50aefe1 glimagesink: keep the uploaded buffer around on successful redisplay
We might need it later to perform a redisplay.  GstGLUpload will take
of releasing the previous buffer when it receives a new buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=733726
2017-12-09 19:31:44 +00:00
Matthew Waters
e6d5dd04d5 glimagesink: silence gsignal warning
instance '0xblah' has no handler with id '13'
2017-12-09 19:31:44 +00:00
Matthew Waters
884be3de11 glimagesink: remove extra argument from debug call 2017-12-09 19:31:44 +00:00
Vasilis Liaskovitis
c064e4e75e glimagesink: Add navigation interface and callbacks for GstGLWindow mouse/key signals
https://bugzilla.gnome.org/show_bug.cgi?id=703486
2017-12-09 19:31:44 +00:00
Nicolas Dufresne
8196b9629c glimagesink: Keep aspect ratio by default
The expected default behaviour for video sink is to maintain the
aspect ratio. Fix the default value to reflect this. The property
default was already TRUE, but the value was not initially TRUE.
2017-12-09 19:31:44 +00:00
Sebastian Dröge
23eb9beef8 glimagesink: Chain up to the parent class' finalize function 2017-12-09 19:31:44 +00:00
Sebastian Dröge
8f6224c0ed glimagesink: Make sure to always unref the display
Even if we didn't create a context yet.
2017-12-09 19:31:44 +00:00
Matthew Waters
90b86e73e7 glimagesink: replace pointer properties with signals
Based on patch by Mathieu Duponchelle <mathieu.duponchelle@epitech.eu>

https://bugzilla.gnome.org/show_bug.cgi?id=704507
2017-12-09 19:31:42 +00:00