Commit graph

58 commits

Author SHA1 Message Date
George Kiagiadakis
c17521c096 waylandsink: protect access to properties with the OBJECT_LOCK 2014-06-17 13:51:28 +02:00
George Kiagiadakis
d4d46fa43a waylandsink: protect access to the display with a new display_lock
Access is protected only for setting/creating/destroying the display
handle. set_caps() for example is not protected because it cannot be
called before changing state to READY, at which point there will be
a display handle available and which cannot change by any thread at
that point
2014-06-17 13:51:28 +02:00
George Kiagiadakis
c323171dc1 waylandsink: remove the OBJECT_LOCK from set_caps()
It's not really necessary, this method is protected from GstBaseSink with the PREROLL_LOCK
2014-06-17 13:51:28 +02:00
George Kiagiadakis
db8caa9da4 waylandsink: Replace the OBJECT_LOCK with a private render_lock to lock render operations
This is because:
* GST_ELEMENT_WARNING/ERROR do lock the OBJECT_LOCK and we deadlock instantly
* In future commits I want to make use of GstBaseSink functions that also
  lock the OBJECT_LOCK inside this code
2014-06-17 13:51:28 +02:00
George Kiagiadakis
cffb38993d waylandsink: move surface resizing logic to the GstWlWindow and make it be called from the main thread 2014-06-17 13:51:28 +02:00
George Kiagiadakis
07f671fcaf waylandsink: create and maintain the subsurface inside the sink
This means that the given surface in set_window_handle can now be
the window's top-level surface on top of which waylandsink creates
its own subsurface for rendering the video.

This has many advantages:
* We can maintain aspect ratio by overlaying the subsurface in
  the center of the given area and fill the parent surface's area
  black in case we need to draw borders (instead of adding another
  subsurface inside the subsurface given from the application,
  so, less subsurfaces)
* We can more easily support toolkits without subsurfaces (see gtk)
* We can get properly use gst_video_overlay_set_render_rectangle
  as our api to set the video area size from the application and
  therefore remove gst_wayland_video_set_surface_size.
2014-06-17 13:51:27 +02:00
George Kiagiadakis
b806313396 wayland: add public API for creating & using the display handle GstContext 2014-06-17 13:51:27 +02:00
George Kiagiadakis
c62ec6f815 waylandsink: get the external display handle using GstContext
This drops the ugly GstWaylandWindowHandle structure and is much
more elegant because we can now request the display separately
from the window handle. Therefore the window handle can be requested
in render(), i.e. when it is really needed and we can still open
the correct display for getting caps and creating the pool earlier.

This change also separates setting the wl_surface from setting its size.
Applications should do that by calling two functions in sequence:

  gst_video_overlay_set_window_handle (overlay, surface);
  gst_wayland_video_set_surface_size (overlay, w, h);
2014-06-17 13:51:27 +02:00
George Kiagiadakis
bd5ad17e58 waylandsink: drop width/height arguments from gst_wl_window_new_from_surface() 2014-06-17 13:51:27 +02:00
George Kiagiadakis
882e1dd240 waylandsink: fix assertion failure when stopping immediately after starting, without displaying anything
This was triggered in scenarios like
filesrc location=nonexistent_file ! decodebin ! waylandsink
2014-06-17 13:51:27 +02:00
George Kiagiadakis
a543aef5ee waylandsink: Update wl_scaler to version 2 2014-06-17 13:51:26 +02:00
George Kiagiadakis
2f45d91ccd waylandsink: Add myself to the authors list 2014-06-17 13:51:26 +02:00
George Kiagiadakis
c015a96dda waylandsink: create/destroy the display when entering/leaving the READY state instead of PAUSED
This is the only way to get the negotiation working with the dynamic
detection of formats from the display, because the pipeline needs
to know the supported formats in the READY state and the supported
formats can only be known if we open the display.

Unfortunately,in wayland we cannot have a separate connection to
the display from the rest of the application, so we need to ask for a
window handle when going to READY in order to get the display from it.

And since it's too early to create a top level window from the state
change to READY, create it in render() when there is no other window.

This also changes set_window_handle() to not support window handle
changes in PAUSED/PLAYING (because it's complex to handle and useless
in practice) and make sure that there is always a valid display pointer
around in the READY state.
2014-06-17 13:51:26 +02:00
George Kiagiadakis
f6e824ecba waylandsink: Support all video formats supported by the display 2014-06-17 13:51:26 +02:00
George Kiagiadakis
de15c21413 waylandsink: fix crash in case there is no pool because of a caps negotiation error 2014-06-17 13:51:25 +02:00
George Kiagiadakis
a98f589aef waylandsink: increase debug messages 2014-06-17 13:51:25 +02:00
George Kiagiadakis
5bb889a3df waylandsink: Use a boolean in combination with render_cond to comply with GCond's usage documentation 2014-06-17 13:51:25 +02:00
George Kiagiadakis
66f8c1389b waylandsink: Implement expose() and handle resizing properly in non-PLAYING states 2014-06-17 13:51:25 +02:00
George Kiagiadakis
086ac4ee81 waylandsink: Use wl_scaler/wl_viewport to scale the surface in the compositor/hardware 2014-06-17 13:51:25 +02:00
George Kiagiadakis
12444ec84e waylandsink: Set external surfaces and their child objects to use our own event queue
This fixes weird freezes because of frame_redraw_callback() not being
called from the main thread when it should with weston's toy toolkit.

It's also safer to know that frame_redraw_callback() will always be
called from our display thread... Otherwise it could be called after
the sink has been destroyed for example.
2014-06-17 13:51:24 +02:00
George Kiagiadakis
fabc5305be waylandsink: Wait for the frame_cb to redraw and drop frames meanwhile
We are not supposed to redraw until we receive a frame callback and this
is especially useful to avoid allocating too many buffers while the
window is not visible, because the compositor may not call wl_buffer.release
until the window becomes visible (ok, this is a wayland bug, but...).
2014-06-17 13:51:24 +02:00
George Kiagiadakis
51a2c694ad waylandsink: Handle wl_buffer::release and don't reuse buffers that are not released
This is achieved by adding an extra reference on the buffers, which does
not allow them to return to the pool. When they are released, this reference
is dropped.

The rest complexity of this patch (hash table, mutex, flag, explicit release calls)
merely exists to allow a safe, guaranteed and deadlock-free destruction sequence.
See the added comment on gstwaylandsink.c for details.
2014-06-17 13:51:24 +02:00
George Kiagiadakis
e56f305274 waylandsink: implement the GstVideoOverlay & GstWaylandVideo interfaces
This is the initial implementation, without the GstVideoOverlay.expose()
method. It only implements using an external (sub)surface and resizing
it with GstWaylandVideo.
2014-06-17 13:51:24 +02:00
George Kiagiadakis
68133361ec waylandsink: implement with stubs the GstWaylandVideo & GstVideoOverlay interfaces 2014-06-17 13:51:23 +02:00
George Kiagiadakis
26ce7f2344 waylandsink: handle the list of supported formats properly
enum wl_shm_format is not a flags enum, as it may have been in the past,
so multiple formats cannot be stored in a bitfield. Use an array instead.
2014-06-17 13:51:23 +02:00
George Kiagiadakis
f800e2b4fa waylandsink: unref the buffer pool 2014-06-17 13:51:23 +02:00
George Kiagiadakis
a67b08cdd0 waylandsink/waylandpool: ref the display instead of the sink to avoid cyclic references
The reference to the sink is not really needed anyway in waylandpool,
what matters basically is that the display is active as long as the
pool is active, so we really want to reference the display object
instead of the sink.
2014-06-17 13:51:23 +02:00
George Kiagiadakis
253eafd4ef waylandsink: make the display property useful
Let the display property control the name of the display,
like in x(v)imagesink.
2014-06-17 13:51:23 +02:00
George Kiagiadakis
e7650117af waylandsink: access sink->pool in a more atomic fashion 2014-06-17 13:51:22 +02:00
George Kiagiadakis
58a4d247b3 waylandsink: remove the useless wayland_lock 2014-06-17 13:51:22 +02:00
George Kiagiadakis
ac9503ed65 waylandsink: cleanup header includes 2014-06-17 13:51:22 +02:00
George Kiagiadakis
ae6aebd9d5 waylandsink: split window-related code out to a new GstWlWindow class
GstWlWindow also has API ready to support subsurfaces.
2014-06-17 13:51:22 +02:00
George Kiagiadakis
05f0842572 waylandsink: remove callback and redraw_pending variables from the window structure 2014-06-17 13:51:22 +02:00
George Kiagiadakis
f6e72c8725 waylandsink: split video format related functions out to a separate file 2014-06-17 13:51:21 +02:00
George Kiagiadakis
1e45b1480c waylandsink: move struct shm_pool and its related functions to waylandpool.c
And also make the instance of this struct to be owned by the buffer
pool instead of the element, for the sake of isolation
2014-06-17 13:51:21 +02:00
George Kiagiadakis
4208ae6203 waylandsink: remove unused variables 2014-06-17 13:51:21 +02:00
George Kiagiadakis
e600a323b7 waylandsink: process display events in a separate thread
This also moves the display-related code into a new GstWlDisplay class,
which takes care of the new thread
2014-06-17 13:51:20 +02:00
Edward Hervey
6a2e39eefa wayland: Remove dead assignment
We set it just after variable declaration

CID #1197709
2014-04-14 07:56:16 +02:00
Edward Hervey
97426a1caa all: Fix for GST_DISABLE_GST_DEBUG
Where applicable, remove methods that don't do anything different than
the default implementation.
2013-07-29 09:42:12 +02:00
Benjamin Gaignard
3fc6f1d9b7 wayland: Add support for RGBx and RGBA formats
Wayland interface could offer two buffers pixels formats: WL_SHM_FORMAT_XRGB8888 and WL_SHM_FORMAT_ARGB8888.
Update waylandsink to support them and check if the format is really available.

https://bugzilla.gnome.org/show_bug.cgi?id=702112
2013-06-18 14:03:13 +02:00
Joe Konno
8a63face0e waylandsink: do not default to a fullscreen canvas
Defer certain canvas particulars to the player (or the Wayland
compositor). Before this change, a fullscreen canvas was always
requested. This may not be desirable in all cases.

https://bugzilla.gnome.org/show_bug.cgi?id=690442
2012-12-23 15:58:05 +00:00
Sreerenj Balachandran
54e05ee4aa wayland: update to wayland-protocol 0.99
https://bugzilla.gnome.org/show_bug.cgi?id=686520
2012-10-20 13:09:03 +01:00
Tim-Philipp Müller
32ba17cd0f Use gst_element_class_set_static_metadata()
where possible. Avoids some string copies. Also re-indent
some stuff. Also some indent fixes here and there.
2012-10-17 17:46:34 +01:00
Mark Nauwelaerts
578861abea replace gst_element_class_set_details_simple with gst_element_class_set_metadata 2012-09-14 17:27:49 +02:00
Tim-Philipp Müller
4ed3d60bd2 waylandsink: fail gracefully with an error message if we can't connect to wayland
g_return_val_if_fail() is not for error handling, it's for
catching programming errors in public API.

Fixes problem with generic/states unit test.
2012-09-13 01:09:56 +01:00
Sreerenj Balachandran
547d679e9e wayland: use scale fullscreen method.
This makes the compositor scale the surface to fit and preserves
aspect ratio.

https://bugzilla.gnome.org/show_bug.cgi?id=681453
2012-08-21 10:41:31 +01:00
Sreerenj Balachandran
dc81682f4b wayland: respond to ping/pong protocol so we're not deemed unresponsive.
https://bugzilla.gnome.org/show_bug.cgi?id=681453
2012-08-21 10:41:24 +01:00
Sreerenj Balachandran
c803ca4af5 wayland: More fixes based on wayland-0.95.0 and gstreamer-1.0 apis
- bump wayland version to 0.95.0 which will lead to stable 1.0 release
- avoid memcopy and use propose_allocation for GstBufferPool allocation
- using WaylandBufferPool
- shm: Allocate shm buffers through new wl_shm_pool interface
  (the shm buffer allocation is a two step process now: first
  allocate a wl_shm_pool, then allocate a buffer from the pool)

https://bugzilla.gnome.org/show_bug.cgi?id=681453
2012-08-21 10:24:45 +01:00
Tim-Philipp Müller
cc167a237a Fix up FSF address in some source files as well 2012-08-18 20:31:17 +01:00
Tim-Philipp Müller
41a39d93bf celt, opencv, wayland, dvbsub, festival, hls: printf format fixes 2012-07-15 12:27:12 +01:00