Commit graph

61 commits

Author SHA1 Message Date
Matthew Waters
3b89d8a23c glwindow: pass display to implementation's _new()
So they have to opportunity to fail if they cannot handle the
display connection.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2015-07-27 18:23:29 +10:00
Julien Isorce
d843b9e8c3 glwindow: move main loop/context creation back to init/finalize
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=750199
2015-06-01 14:09:34 +01:00
Matthew Waters
360f0be2a8 glwindow: fix compiler error
gstglwindow.c:1118:544: error: 'return' with no value, in function returning non-void [-Werror]
   g_return_if_fail (GST_GL_IS_WINDOW (window));
2015-05-31 16:53:14 +10:00
Matthew Waters
fac0cdc7ac glwindow: handle gst_video_overlay_set_render_rectangle 2015-05-31 16:04:13 +10:00
Julien Isorce
c5f8c789a3 glwindow_x11: use parent default implementation 2015-05-27 17:10:32 +01:00
Julien Isorce
9364fc5d7f glwindow: initialize debug in class_init
Useful if one uses gst_gl_window_x11_new directly
instead of gst_gl_window_new.
2015-05-27 17:10:08 +01:00
Julien Isorce
072183ce61 glwindow: provides some default implementations to factorize with all backends 2015-05-27 17:08:11 +01:00
Matthew Waters
ab9eb432fb glwindow: track context activation properly
We only need to deactivate/reactivate the context iff it was already
active.
2015-04-21 12:55:24 +10:00
Julien Isorce
e1e17dcadb glwindow: remove unused gl_thread field 2015-03-22 19:12:15 +01:00
Edward Hervey
4220fe41be gl: Fix context leaks
Introduced by a12ca13750
2015-03-03 17:36:06 +01:00
Edward Hervey
a12ca13750 glwindow: Deactivate window before changing handle
When setting a new window handle, we need to ensure all implementations
will detect the change.

For that we deactivate the context before setting the window handle, then
reactivate the context

https://bugzilla.gnome.org/show_bug.cgi?id=745090
2015-02-24 17:42:13 +01:00
Sebastian Dröge
475dfaedc1 glwindow: Remove assertion in gst_gl_window_show() for subclasses not implementing it
On Android and iOS we can't create a window ourselves, so also can't just show
one. That's not a problem and an assertion is not really needed here.
2015-02-17 01:04:38 +02:00
Matthew Waters
6cf97eb221 glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2015-01-29 22:26:37 +11:00
Matthew Waters
ab48bb6f0f 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.
2015-01-23 16:11:31 +11:00
Hyunjun Ko
a2e2507dbe gl: Correct invalid comment text 2014-11-12 11:29:41 +11:00
Julien Isorce
7d0de0577a gl: do not raise a critical msg if the backend does not handle window events
Fix "assertion 'window_class->handle_events != NULL' failed"
if not using a X11 window.
2014-11-12 00:07:06 +00:00
Lubosz Sarnecki
6702811e14 glimagesink: implement gst_video_overlay_handle_events
https://bugzilla.gnome.org/show_bug.cgi?id=736035
2014-11-06 16:04:11 +11:00
Tim-Philipp Müller
ebcee78fab gl: fix Since marker for gst_gl_window_run_navigation() 2014-11-03 00:17:41 +00:00
Matthew Waters
f36d6daf51 gl: sprinkle some Since markers 2014-10-31 21:29:25 +11:00
Vasilis Liaskovitis
3c3b78508f GstGLWindow: Introduce navigation thread
This thread dispatches navigation events. It is needed to avoid deadlocks
between window backend threads that emit navigation events (e.g. X11/GMainLoop
thread) and consumers of navigation events such as glimagesink, see
https://bugzilla.gnome.org/show_bug.cgi?id=733661

GstGlWindow_x11 thread is changed to invoke the navigation thread for navigation
dispatching, instead of emiting the event itself. Othe backends beside X11 do
not dispatch navigation events yet, but should use this thread when dispatching
these events in the future.

The navigation thread is currently part of GstGLWindow and not implemented in
separate subclasses / backends. This will be needed in the future.

gst_gl_window_x11_get_surface_dimensions is also changed to use a cached value
of the window's width, height. These values are now retrieved in the X11
thread, function gst_gl_window_x11_handle_event. This change is needed because
otherwise the XGetWindowAttributes gets called from the navigation thread,
leading to xlib aborting due to multithreaded access (if XInitThreads is not
called before, as is the case for gst-launch)
2014-09-09 21:47:02 +10:00
Vasilis Liaskovitis
4dacc4ba55 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
2014-08-07 13:55:02 +10:00
Sebastian Dröge
eab38c5b21 glwindow: Constify string parameters to the send_*_event() functions 2014-07-24 12:23:03 +02:00
Vasilis Liaskovitis
41632d486b GstGLWindow : Add mouse-event and key-event signals for navigation
https://bugzilla.gnome.org/show_bug.cgi?id=703486
2014-07-24 12:48:44 +10:00
Matthew Waters
da35876537 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2014-05-30 10:29:37 +10:00
Matthew Waters
c247be334a gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2014-05-08 15:33:43 +10:00
Matthew Waters
8743301af9 gl/window: fix string length check for eagl 2014-05-06 21:08:30 +10:00
Sebastian Dröge
ae81268565 gl: Add support for iOS EAGL platform
https://bugzilla.gnome.org/show_bug.cgi?id=703341
2014-04-12 22:25:13 +02:00
Matthew Waters
b67af0e314 gl/window: add a dummy window class
Effective for the case where we have a platform that does not
require a native window.  We require a mainloop to run the GL
commands which is currently operated by GstGLWindow.
2014-03-17 10:44:32 +01:00
Matthew Waters
0d1d42b205 [890/906] x11: add display subclass
GstGLDisplayX11 holds the display connection and name.  Each thread requires
it's own X11 Display connection (initialised from name) due to the fact that
we do not want to call XInitThreads().  Doing so would result in segfaults
when integrating with GUI toolkits Gtk, Qt, etc.

The Display connection is for OpenGL platforms where a constant display is
required in order to share contexts (egl).  In the case of a wrapped context
(added later), we do not have GstGLWindow to retreive the display from so a
'master' connection is used instead.
2014-03-15 18:37:06 +01:00
Matthew Waters
7b031f648c [863/906] window: hold a ref to our GstGLDisplay 2014-03-15 18:37:05 +01:00
Matthew Waters
cf7838a0b6 [862/906] window: remove set_need_lock
No-one is using it.  The only code that did was the x11 one which
doesn't need it anymore.
2014-03-15 18:37:05 +01:00
Matthew Waters
3049627b87 [859/906] window: provide some documetation 2014-03-15 18:37:05 +01:00
Julien Isorce
f506e80686 [841/906] osx: allow x11/glx backend and set default runtime to cocoa/nsgl
https://bugzilla.gnome.org/show_bug.cgi?id=719757
2014-03-15 18:37:04 +01:00
Julien Isorce
6fcd8b7206 [835/906] gstglwindow: remove unused fields 2014-03-15 18:37:03 +01:00
Julien Isorce
e5ed59e61c [834/906] gstglwindow: clear mutex 2014-03-15 18:37:03 +01:00
Julien Isorce
c775bf584b [831/906] glimagesink: avoid to overload the drawer if already drawing
Especially if the application calls gst_video_overlay_expose a lot
2014-03-15 18:37:03 +01:00
Julien Isorce
979633ed1f [820/906] gstglwindow: if available use wayland instead dispmanx on rpi 2014-03-15 18:37:02 +01:00
Matthew Waters
db1c7a242b [818/906] window: add send_message_async vmethod
- provide a default synchronous send_message
- make context creation threadsafe again
2014-03-15 18:37:02 +01:00
Julien Isorce
561a71c244 [803/906] raspberrypi: add support for dispmanx
See https://bugzilla.gnome.org/show_bug.cgi?id=703342
2014-03-15 18:37:01 +01:00
Matthew Waters
95c08c2ee2 [794/906] context: add subclasses for the different platforms (egl, glx, wgl, etc)
- most code taken from the Window subclasses
- tested combinations: xEGL, GLX, Wayland+EGL, Cocoa (under GNUStep), WGL (Wine)
2014-03-15 18:37:01 +01:00
Matthew Waters
cf5e910d9b [793/906] add a GstGLContext object that will be the basis of OpenGL contexts
At the moment it just sits in between GstGLDisplay and GstGLWindow
performing some of the stuff that GstGLWindow used to do.
2014-03-15 18:37:01 +01:00
Sebastian Dröge
2b6e54d416 [752/906] glwindow: Add destroy notifies for the data of the callbacks
And actually call the close callback when the window is closed.
2014-03-15 18:36:58 +01:00
Sebastian Dröge
a77992c658 [735/906] gl: Add support for Android
https://bugzilla.gnome.org/show_bug.cgi?id=703340
2014-03-15 18:36:57 +01:00
Julien Isorce
dd7e054e2c [732/906] build: fix repeated typedefs
Write forward declarations in another way to avoid
repeated typedefs "error: redefinition of typedef".
Raised when using i686-apple-darwin11-llvm-gcc-4.2
It seems that C apple compiler does not support
C11 feature.

https://bugzilla.gnome.org/show_bug.cgi?id=703885
2014-03-15 18:36:57 +01:00
Julien Isorce
ba19813816 [723/906] gstglwindow: close has to be called in the glthread.
Indeed 'glXMakeCurrent (window_x11->device, None, NULL);'
has to be called in the thread where the glcontext is actually
current.
Otherwise glXDestroyContext may crash.
2014-03-15 18:36:57 +01:00
Matthew Waters
c748fb7999 [710/906] window: fail if the user specifies an GL api that we cannot work with
It would've been caught later in an g_assert anyway.
2014-03-15 18:36:56 +01:00
Matthew Waters
c60d94f1bc [708/906] display: a cleanup and removal of old code 2014-03-15 18:36:56 +01:00
Matthew Waters
ac4db593f8 [705/906] x11: don't shutdown in _finalize
The window's loop could be still running when _finalize is called
and if we destroy the display connection it will never be closed.

Add _open and _close vfuncs to GstGLWindow so that subclasses can
start up and shutdown at the right time.
2014-03-15 18:36:56 +01:00
Matthew Waters
13067b104c [704/906] Use gst_object_[un]ref so we can get refcounts in the log 2014-03-15 18:36:56 +01:00
Matthew Waters
dbeb6a911b [701/906] display: move context creation into window 2014-03-15 18:36:55 +01:00