Commit graph

171 commits

Author SHA1 Message Date
Niels De Graef
f84394fa49 libs: wayland: add support for XDG-shell protocol
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the XML file is directly provided by the `wayland-protocols`
dependency and generates the protocol marshalling code.

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
2019-02-16 23:55:42 +01:00
Víctor Manuel Jáquez Leal
7afe5311cc vaapisink: x11: trap WM_DELETE_WINDOW message
Register the WM_DELETE_WINDOW message from window manager and
trap it to stop the pipeline cleanly.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/130
2019-01-24 21:11:54 +01:00
He Junyan
7663fa263c plugins: Add more check for allowed raw caps.
The gst_vaapi_plugin_base_get_allowed_raw_caps is used for both sink
pad and src pad, which cause some bugs. For sink pad, we need to verify
vaPutImage() while for the src pad we need to verify vaGetImage().
For vaapidecoderXXX kind of plugins, the case is more complex. We need
to verify whether the decoded result(in some surface, NV12 format most
of the time) can be vaGetImage to some raw image format. Add more check
to fix all these problems.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/123

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2018-12-24 10:46:23 +00:00
Jordan Petridis
d8b3c0495f
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:56:44 +02:00
VaL Doroshchuk
76dbc3e971 vaapisink: don't mask button events for foreign windows
Don't subscribe to button press events when using a foreing window,
because the user created window would trap those events, preveting the
show of frames.

https://bugzilla.gnome.org/show_bug.cgi?id=791615
2018-02-05 11:36:35 +01:00
Víctor Manuel Jáquez Leal
f3650381c3 vaapisink: check for display's color-balance properties
Check for display's color-balance properties, available by the VA-API
driver, before setting them.

Also logs an info message of those unavailable properties.

https://bugzilla.gnome.org/show_bug.cgi?id=792638
2018-01-18 13:18:27 +01:00
Víctor Manuel Jáquez Leal
b063511c05 vaapisink: use GObject setter and getter
Instead of using gst_vaapi_display_set_property() or
gst_vaapi_display_get_property(), this patch set replace it usage
with g_object_set() or g_object_get().

Also the internal helper cb_set_value() is removed since it is not
used anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=788058
2017-09-22 20:06:42 +02:00
Sreerenj Balachandran
782184e781 vaapisink: Fix rendering in drm display
Make sure vaapisink create a va surface backed buffer pool and all
required attributes get assigned correctly for drm display type.

This is needed to make the below pipeline working:
gst-launch-1.0 filesrc location= raw_video.mov ! videoparse format=uyvy
width=320 height=240 framerate=30/1 ! vaapisink display=drm

https://bugzilla.gnome.org/show_bug.cgi?id=786954
2017-09-01 13:48:01 -07:00
Víctor Manuel Jáquez Leal
19444ce184 vaapisink: fix memory leak 2017-08-01 17:29:40 +02:00
Hyunjun Ko
736478d2a7 vaapisink: fail if surface display is different
Replacing GstVaapiDisplay during rendering might be hiding problems
at some cases, even though it's safe currently since we use cache
of GstVaapidisplay.

Play safe by failing if this happens.

https://bugzilla.gnome.org/show_bug.cgi?id=766704
2017-07-26 14:21:54 +02:00
Hyunjun Ko
5ab5113f6f vaapisink: keep handle_events flag except that if user want to set
When state of vaapisink is changed from PLAYING to NULL, the handle_events
flag is set to FALSE, and never recovered, and then event thread is never
going to run.

So we should allow to set the flag only when users try it.

https://bugzilla.gnome.org/show_bug.cgi?id=782543
2017-05-12 16:23:49 +02:00
Víctor Manuel Jáquez Leal
4820d2d09d plugins: handle pixel-aspect-ratio with value 0/1
When downstream negotiates a pixel-aspect-ratio of 0/1, the
calculations for resizing and formatting in vaapipostproc and
vaapisink, respectively, failed, and thus the pipeline.

This patch handles this situation by converting p-a-r of 0/1 to
1/1. This is how other sinks, such as glimagesink, work.

https://bugzilla.gnome.org/show_bug.cgi?id=781759
2017-04-27 11:17:12 +02:00
Víctor Manuel Jáquez Leal
152217064f plugins: when debug disabled, default category is NULL
As in gstreamer-vaapi a common base class is used, the specific
default category is passed to the base-plugin initializator, thus
the log messages are categorized with the used plugin.

Nonetheless, when the gst-debug is disabled in compilation time,
it is needed to pass NULL to the base-plugin initializator. This
patch does that.

https://bugzilla.gnome.org/show_bug.cgi?id=780302
2017-03-20 19:15:39 +01:00
Víctor Manuel Jáquez Leal
c9bd45f05d plugins: handle GL params through context query
If the element instantiated the GL display and context, they should
handle them too through the context query.

https://bugzilla.gnome.org/show_bug.cgi?id=777409
2017-01-27 13:35:40 +01:00
Víctor Manuel Jáquez Leal
42df9ba98c vaapisink: fix gcc compiler warning
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
2017-01-20 16:12:31 +01:00
Víctor Manuel Jáquez Leal
f5360282bc vaapisink: don't use member variable outside lock
Thus a race condition segfault is avoided.

Original-patch-by: Matt Staples <staples255@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=777146
2017-01-18 17:28:33 +01:00
Hyunjun Ko
5e09f57dea vaapisink: ensures raw caps at start()
Calls gst_vaapi_plugin_base_get_allowed_raw_caps() at start() to avoid
race conditions at get_caps(), especially with multiple src elements.

https://bugzilla.gnome.org/show_bug.cgi?id=776303
2016-12-21 11:10:02 +01:00
Víctor Manuel Jáquez Leal
a567955c6d vaapisink: create display at open()
Instead of creating the VA display before setting the bus to the
element, it is created when the element is opened.

Basically, this commit is a revert of
5e5d62cac7

That was done when the GStreamer's context sharing was not mature
enough as now. There is no reason to keep this hack.
2016-11-24 19:07:53 +01:00
Hyunjun Ko
d2e801e87a vaapisink: finish event thread at stop()
The thread that handles window's events should be finished during
pipeline's shutdown, otherwise it will remain alive during pipeline
re-activation, leading to unexpected problems.

This patch fixes failures of intensive_state_change scenario of
gst-validate

https://bugzilla.gnome.org/show_bug.cgi?id=774241
2016-11-11 10:44:27 +01:00
Víctor Manuel Jáquez Leal
0f938be7a4 plugins: fix code style for errors
https://bugzilla.gnome.org/show_bug.cgi?id=773497
2016-10-25 19:38:26 +02:00
Vineeth TM
57313f3f70 vaapi: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763083

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-09-23 12:33:58 +02:00
Víctor Manuel Jáquez Leal
9f4796756d vaapisink: demote a debug message to trace
Reduces noise when debugging.
2016-07-14 12:31:02 +02:00
Hyunjun Ko
e8fabf6a99 vaapisink: add support for GST_TAG_IMAGE_ORIENTATION
https://bugzilla.gnome.org/show_bug.cgi?id=765798
2016-07-05 20:17:12 +02:00
Víctor Manuel Jáquez Leal
aee9166c7f vaapisink: return caps template if no display
If vaapisink received a caps query before getting a VA display, it returned
only the surfaces related caps. This behavior broke the autovideosink
negotiation.

This patch returns the pad's template caps if no VA display, otherwise the
caps are crafted as before.

https://bugzilla.gnome.org/show_bug.cgi?id=767699
2016-06-16 13:18:15 +02:00
Víctor Manuel Jáquez Leal
4dd2464060 plugins: use GstVideoInfo accessors
Instead of access to GstVideInfo members directly, use their accessors
macros. This patch makes more resistance to future changes in GStreamer core.
2016-05-20 21:01:02 +02:00
Víctor Manuel Jáquez Leal
bccdda84b7 plugins: rework set_context() vmethod definition
In bug 757598 was added the set_context() vmethod chain up in
GstVaapiPluginBase. But it is buggy, since the parent_class address is
assigned to the last element which called gst_vaapi_plugin_base_class_init().

No error has shown up since none of the element's base classes redefined
set_context() vmethod from GstElement, so always the correct function was
called. Still this code is wrong and this patch make it right.

Since set_context() is the same code, a macro is used to implement that code
in all the gst-vaapi elements.

https://bugzilla.gnome.org/show_bug.cgi?id=765368
2016-04-22 17:18:18 +02:00
Víctor Manuel Jáquez Leal
d4f00383ed unify caps template for VAAPI encoders and decoders
There is no difference in VAAPI surface caps between encoders and decoders.
Thus, the patch makes a simplification by removing encoders specific caps and
shares the same definition of VAAPI surfaces caps for all the elements.
2016-03-30 16:55:26 +02:00
Scott D Phillips
eea3f0cdb2 Add P010 video format support
The P010 video format is the native format used by the vaapi intel driver
for HEVCMain10 decode . Add support for planes and images of this video format.

https://bugzilla.gnome.org/show_bug.cgi?id=759181
2016-03-29 14:34:00 +03:00
Vineeth TM
24bc53456c vaapisink: Fix event,pad,structure memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=762229
2016-02-18 04:02:53 -03:00
Tim-Philipp Müller
38fbe58999 vaapisink: post message for application for unhandled keyboard/mouse events
Makes (most) keyboard shortcuts work in gst-play-1.0 when
the video window has focus.
2016-02-16 15:44:48 +00:00
Vineeth TM
b54ac96c27 vaapisink: Fix capsfeature memory leak
caps feature allocated is not being freeing in some cases

https://bugzilla.gnome.org/show_bug.cgi?id=762111
2016-02-16 15:10:11 +02:00
Sreerenj Balachandran
1f6d29641d vaapisink: Fix wrong caps advertising
The get_caps() should only report the supported formats.

https://bugzilla.gnome.org/show_bug.cgi?id=761147
2016-02-09 12:18:27 +01:00
Víctor Manuel Jáquez Leal
9b8fb25b8c docs: update plugin documentation
Update all the documentation of elements of the vaapi plugin.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 20:03:47 +01:00
Víctor Manuel Jáquez Leal
bb2248ab66 plugins: fix code style
Minor code style changes by executing gst-indent in gst/vaapi directory.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 12:17:59 +01:00
Víctor Manuel Jáquez Leal
1c722efe54 Remove old gst version guards
As gstreamer-vaapi now only supports from GStreamer 1.6, this patch removes
all the old GStreamer version guards.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-01-25 12:09:40 +00:00
Víctor Manuel Jáquez Leal
8f77d54103 vaapisink: ignore frame if its upload failed
When gst_vaapi_plugin_base_get_input_buffer() fail to copy the input buffer
into a VAAPI buffer, the return value is GST_FLOW_NOT_SUPPORTED, and it was
ignored by the vaapisink, leading to a segmentation fault.

This patch ignores the frame that generated the GST_FLOW_NOT_SUPPORTED
returned by gst_vaapi_plugin_base_get_input_buffer(), avoiding the
segmentation fault, but doing and effort to continue rendering. This is
the same behavior of ximagesink.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=759332
2016-01-14 11:31:17 +01:00
Víctor Manuel Jáquez Leal
d69f747d09 plugins: don't create display at caps query
Caps query can happen before the element has a bus. The display creation should
be should occur on the context negotiation, when the bus is already configured.
Then at caps query no display should be created.

Instead of force the display creation, we graciously fail the allowed_caps()
creation.

This change only applies for vaapidecode and vaapisink. The vaapipostroc, as a
basetransform descendant, seems to be not affected by this, nor the encoders.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=757598
2015-11-09 16:18:19 +01:00
Víctor Manuel Jáquez Leal
b2707c8eec plugins: fix context query handling
The current context query handling design is flawed: the function
gst_vaapi_reply_to_query() returns FALSE either if the query is not a
GST_CONTEXT_QUERY of if the query could not be handled correctly. But the
pad query function should handle differently each case.

This patch changes the gst_vaapi_reply_to_query() for
gst_vaapi_handle_context_query() and changes it usage in all the vaapi plugins
to match the correct context query handling.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=757598
2015-11-09 16:18:19 +01:00
Víctor Manuel Jáquez Leal
66f05af288 refactor vaapi caps strings for pad templates
Refactor the main vaapi caps strings into three macros:
GST_VAAPI_MAKE_SURFACE_CAPS, GST_VAAPI_MAKE_ENC_SURFACE_CAPS and
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS.

Those are in gstvaapipluginutil.h so all the elements could use them, instead
of re-declaring them every time.

No functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-05 14:26:37 +02:00
Víctor Manuel Jáquez Leal
001a5c637d remove gstvaapiuploader
Working on bug #744042 I realized that the gstvaapiuploader is practically not
used.

This patch removes the gstvaapiuploader and add the method
gst_vaapi_plugin_base_get_allowed_raw_caps () that returns the raw caps that
the system can handle, which is used by vaapisink and vaapipostproc.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=752777
2015-08-04 19:32:40 +02:00
Simon Farnsworth
d946e7972e Work around ABBA deadlock between vaapisink and vaapipostproc
vaapisink takes the display lock, then does a gst_buffer_replace which can
take the lock on the gst_vaapi_video_pool.

vaapipostproc asks the gst_vaapi_video_pool for a new surface. This takes
the lock on the gst_vaapi_video_pool; if you're unlucky, there are no free
surfaces, which means that gst_vaapi_surface_create is
called. gst_vaapi_surface_create takes the display lock.

If vaapisink and vaapipostproc are in different threads, and this happens,
you get a deadlock. vaapisink holds the display lock, and wants the
gst_vaapi_video_pool lock. vaapipostproc holds the gst_vaapi_video_pool lock
and wants the display lock.

Work around this by releasing the display lock in vaapisink around the
gst_buffer_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=738249

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-29 13:10:15 +03:00
Víctor Manuel Jáquez Leal
0df96e1c3b vaapisink: error handling if rendering fails
This patch enhance the code path when an error is found when rendering a
buffer.

If the video meta doesn't contain a surface proxy or a surface, a warning
message is printed.

If the rendering backend fails, a error message is posted in the bus.

https://bugzilla.gnome.org/show_bug.cgi?id=749382
2015-06-22 16:38:29 +02:00
Sreerenj Balachandran
34a4748d3d vaapisink: Fix the conditional pad template creation. 2015-06-18 14:55:12 +03:00
Sreerenj Balachandran
28e50ad407 vaapisink: Fix the capsfeature advertisement in padtemplate
This fixes the regression introduced in 64acc74.

If a pad supports multiple set of capsfeatures, it needs to add
multiple equal structures with different feature sets to the caps.
Because caps structures with the same name but with a non-equal
set of caps features are not compatible.

Without this patch, playbin will autoplug xvimagesink instead of vaapisink.

https://bugzilla.gnome.org/show_bug.cgi?id=750095
2015-06-17 14:20:37 +03:00
Adrian Cox
64acc74d17 vaapisink: Expose the overlay capability for compatibility with dvbsuboverlay.
https://bugzilla.gnome.org/show_bug.cgi?id=750095

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-06-17 12:41:28 +03:00
Michael Olbrich
11b9260b6c vaapisink: implement unlock/unlock_stop for wayland
Otherwise wl_display_dispatch_queue() might prevent the pipeline from
shutting down. This can happen e.g. if the wayland compositor exits while
the pipeline is running.

Changes:
* renamed unlock()/unlock_stop() to unblock()/unblock_cancel() in gstvaapiwindow
* splitted the patch removing wl_display_dispatch_queue()

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=747492

https://bugzilla.gnome.org/show_bug.cgi?id=749078
2015-05-15 17:10:37 +02:00
Víctor Manuel Jáquez Leal
77ab913ee6 vaapisink: fix indentation 2015-05-14 16:26:44 +02:00
Víctor Manuel Jáquez Leal
504fdedf84 vaapisink: use GstVideoSink vmethod show_frame()
vaapisink inherits from GstVideoSink, in order to use its functionality (such
as ::show-preroll-frame property), we should use its vmethod show_frame(),
rather than call ourselves render() and preroll().
2015-04-16 11:28:40 +02:00
Víctor Manuel Jáquez Leal
562bd629a6 vaapisink: add 'handoff' signal
This patch adds the signal ::handoff and the property signal-handoffs. If the
property is set TRUE, the signal ::handoff is emitted just after the buffer is
rendered.

Based on Zhao Halley <halley.zhao@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=747905
2015-04-16 11:27:51 +02:00
Víctor Manuel Jáquez Leal
8b36e25f47 Removal of gstreamer-1.0 support
The support for GStreamer 1.0 has been obsoleted in 0.5.10 release.
GStreamer 1.2 is the a minimal requirement for building the gstreamer-vaapi.

This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-1.0.

Thus, all the video converters were removed too.

https://bugzilla.gnome.org/show_bug.cgi?id=745728

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-03 17:09:08 +03:00