Commit graph

560 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
32d1c5adff vaapidecode: renegotiate if caps are not equal
The use of gst_caps_is_always_compatible() for this optimization may lead to
false positives. It is better to stick to gst_caps_is_strictly_equal() to know
if it is required a re-negotiation.

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

https://bugzilla.gnome.org/show_bug.cgi?id=750835
2015-08-29 00:27:05 +03:00
Sreerenj Balachandran
6eba201f32 vaapidecode: Rework the re-negotiation code to handle multi resoultion videos
Delaying the pool re-negotiation untill we push all decoded (and queued)
frames downstream. Otherwise for the multi-resolution videos, the
GstVideoVideoMemory will be having wrong resolution and which leads
to nasty behaviours, especially when using software renderers.

sample media file: RAP_B_Bossen_1.bin
case explained:
The first SPS Nal will report resoultion of 448x256 and having crop rectangles to
get the final resoultion 416x240.
Starting from 25 th frame, the resolution will change to 416x240. But parser
elements won't report this since the effective croped resolution is same in
both cases. Here the core libgstvaapi will detect this through it's internal
parsing and do all context/pool destory/reset stuffs. Also it will notify this
change to plugins in advance. But if the plugin try to do re-negotiaion of pool
immediately, this will not sync with the resolution of already decoded and queued
frames and which will lead to failure in gst_video_frame_map() in downstream(if we use the
software renderer). So we have to delay the pool renegotiation in vaapidecode,
untill we push all decoded frames downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2015-08-29 00:18:57 +03:00
Sreerenj Balachandran
ba8fcf5435 vaapidecode: Always keep a copy of input codec state
Currently we are sharing the input GstVideoCodecState with
GstVaapiDecoder(gst-libs/gst/vaapi) by just doing ref and unref for
each caps change. This is troublesome in many cases, for eg: if
resoultion changes with in a singe stream. Because, when ever there
is a resolution change, GstVideoDecoder will first change the Codec_state->caps
fields with new resolution, but since we are using the same codecstate (ref)
in gstvaapidecode.c, the caps check for input caps change will always fail.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2015-08-28 23:43:47 +03:00
Víctor Manuel Jáquez Leal
18a8b87975 Revert "Marking rank of vaapidecodebin as GST_RANK_MARGINAL for now."
This reverts commit 3ccb198b51.
2015-08-13 17:34:42 +02:00
Víctor Manuel Jáquez Leal
7f34c6e17d vaapidecodebin: check for postproc instance
If the VPP's deinterlace-method is set, first we should check if the postproc
is already instanced to set it. Otherwise we just store it until the VPP is
added into the bin.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749554
2015-08-13 17:34:42 +02:00
Víctor Manuel Jáquez Leal
ee5d8ee202 vaapidecodebin: ensure VPP before going to READY
There are sometimes that the VA-API display context is not shared among the
pipeline, but it is important to know it before going to READY state (when the
pipeline is already linked).

One instance of this case is this:

gst-launch-1.0 filesrc location=media ! decodebin ! vaapipostproc ! vaapisink

This patch adds a new function in gstvaapipluginutil called
gst_vaapi_create_test_display(). Its purpose is to create a disposable VA-API
display, which only will be used for verify if the VAEntrypointVideoProc is
available by the hardware. Afterwards, it should be unrefed.

If the vaapidecodebin is going to READY state, and the element still doesn't
know if VPP is available, the last resort is to create a new instance of the
VA-API display and test for it.

https://bugzilla.gnome.org/show_bug.cgi?id=749554
2015-08-13 17:34:42 +02:00
Víctor Manuel Jáquez Leal
1e061c54e1 vaapidecodebin: post an error message if fails
If the construction of the bin fails, post an error message in the bus.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749554
2015-08-13 17:34:42 +02:00
Víctor Manuel Jáquez Leal
0004301714 vaapidecodebin: has_vpp as a tri-state variable
has_vpp can be UNKNOWN while the context message hasn't being received.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749554
2015-08-13 17:34:42 +02:00
Víctor Manuel Jáquez Leal
f0d6b0ac3f gstvaapivideomemory: native format with no derived image
If USE_NATIVE_FORMATS is defined we bail out before configuring the surface
info based on the derived image configuration.

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

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-13 17:20:19 +02:00
Víctor Manuel Jáquez Leal
ceb70c3ca6 surface pool config based on video info
First added the function gst_vaapi_video_format_get_best_native(), which
returns the best native format that matches a particular chroma type:

YUV 4:2:0 -> NV12, YUV 4:2:2 -> YUY2, YUV 4:0:0 -> Y800

RGB32 chroma and encoded format map to NV12 too.

That format is used to configure, initially, the surface's pool for the
allocator.

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

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-13 17:20:19 +02:00
Víctor Manuel Jáquez Leal
940dc1a18e gstvaapivideomemory: refactor gst_vaapi_video_allocator_new()
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-13 17:20:19 +02:00
Víctor Manuel Jáquez Leal
de1bc55ceb gstvaapivideocontext: remove unused parameter
gst_vaapi_video_context_prepare() received an unused parameter. This patch
removes it and the structure passed by the caller.

This a left over of "Removal of gstreamer-1.0 support" (commit 8b36e25f).

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-06 19:07:13 +02: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
343739e281 gstvaapipostproc: fix code style
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-05 14:26:00 +02:00
Victor Jaquez
9bdf43a843 plugins: reduce the noise of warnings
Those messagse should be attached to the object, also the lack of
caps is not an error, in particular in the case of JPEG encoding.

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

https://bugzilla.gnome.org/show_bug.cgi?id=744042
2015-08-04 19:42:48 +02:00
Víctor Manuel Jáquez Leal
954037cd24 vaapipostroc: GLTextureUploadMeta in sink template
Advertise GLTextureUploadMeta in sink caps template.

https://bugzilla.gnome.org/show_bug.cgi?id=752130
2015-08-04 19:37:33 +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
Víctor Manuel Jáquez Leal
b601bf0df6 vaapidecode: don't lost GLTextureUpload on seek
When seeking, the decoder is reset, but the buffer pool is not
re-negotiated, but in reset_full() the code forgets if the negotiated buffer
pool has the GLTextureUpload meta.

The decoder knows that GLTextureUpload meta was negotiated in
decide_allocation(), but this method is not called when seeking.

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

https://bugzilla.gnome.org/show_bug.cgi?id=752929
2015-08-04 19:20:48 +02:00
Víctor Manuel Jáquez Leal
c76fe74297 plugins: don't use gst_pad_get_allowed_caps()
gst_pad_get_allowed_caps() query the pad and the peer pad. In the case
decoders, that is OK, but in the case of the postproc might lead loops,
since the gst_base_transform_query_caps() forwards the query upstream
and forth.

Instead of gst_pad_get_allowed_caps() we only query the peer with
gst_pad_peer_query_caps() using the pad's template as filter.

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

https://bugzilla.gnome.org/show_bug.cgi?id=752558
2015-08-04 19:05:25 +02:00
Gwenole Beauchesne
939bdb08a5 decoder: add initial infrastructure for marking corrupted output.
Add initial infrastructure in core codec library and vaapidecode to mark
corrupted frames as such. A corrupted frame is such a frame that was
reconstructed from invalid references for instance.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-07-20 15:25:46 +02:00
Sreerenj Balachandran
3ccb198b51 Marking rank of vaapidecodebin as GST_RANK_MARGINAL for now.
Unfortunately vaapidecodebin element is not seems to be stable
enough for autoplugging ahead of vaapidecode.
Lowering the rank for now (cosidering the immediate 0.6 release).

See this: https://bugzilla.gnome.org/show_bug.cgi?id=749554

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-07-07 20:57:20 +03:00
Víctor Manuel Jáquez Leal
9984678398 vaapipostproc: no format convert on GL tex upload meta
When GL texture upload meta is negotiated, vaapipostproc shall not modify the
color format of the buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=748184
2015-07-03 13:31:47 +02:00
Víctor Manuel Jáquez Leal
b4d9c0a79a vaapidecodebin: notify if vpp is disabled
When the system is aware that VPP is not available by the VA driver,
it would be useful to notify to the user that the disable-vpp property
has changed.

https://bugzilla.gnome.org/show_bug.cgi?id=749554
2015-07-02 12:29:35 +02:00
Víctor Manuel Jáquez Leal
5c799b35f7 vaapidecodebin: enable vpp if it is available
Instead of creating and adding VPP into the bin at setup, we wait until
we are sure the VA driver supports it. We know that when the VA video
context is received by the bin. Afterwards, it is decided to instanciate
and link the VPP or not.

This is more efficient and safer than waiting the VPP to fail and then
disable it.

https://bugzilla.gnome.org/show_bug.cgi?id=749554
2015-07-02 12:29:35 +02:00
Sreerenj Balachandran
b4154ac85c gst/vaapi: Switch to upstreram like indentation.
gst-indent for all gst/vaapi/*.c source files
2015-06-30 09:44:18 +03:00
Sreerenj Balachandran
f1bc4f8461 vaapidecodebin: Add property to disable VPP
Adding a new propery "disable-vpp", enabling it will prevent
the insertion of vaapipostproc child element.

This is helpful in debugging, specifically to narrow-down the
vaapidecodebin/vaapipostproc related negotiation issues.

No support for run-time disabling for now.

https://bugzilla.gnome.org/show_bug.cgi?id=745901
2015-06-30 09:35:37 +03:00
Sreerenj Balachandran
d14a201699 vaapipostproc: Fix wrong selection of passthrough mode.
The Current code path is falling back to passthorugh mode if there is no
vpp property set by the user explictily. But we should not use the
passthrough mode if the negotiated src pad caps have a differnt color space
format than sink pad caps (Even though the user didn't set the format property
explicitly).

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-29 13:35:59 +03:00
Sreerenj Balachandran
a1eef1c355 vaapipostproc: prevent advanced-deinterlacing of non-native video formats.
This is a workaround to deal with the va-intel-driver for non-native
formats while doing advanced deinterlacing. The format of reference surfaces must
be same as the format used by the driver internally for motion adaptive
deinterlacing and motion compensated deinterlacing.

A permanent solution could be to do the color space conversion internally
for reference surfaces.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-06-29 13:20:28 +03: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
Jacobo Aragunde Pérez
76060c9542 vaapidecodebin: expose deinterlace-method property from inner vaapipostproc
https://bugzilla.gnome.org/show_bug.cgi?id=745901
2015-06-25 16:16:45 +02:00
Víctor Manuel Jáquez Leal
eb510e23ce vaapipostproc: log negotiated caps 2015-06-22 17:15:50 +02:00
Víctor Manuel Jáquez Leal
700f010766 vaapipostproc: remove useless debug message 2015-06-22 17:13:00 +02:00
Víctor Manuel Jáquez Leal
e2d60c83a6 vaapidecode: log negotiated src/sink caps 2015-06-22 17:13:00 +02: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
Olivier Crete
3241296f67 vaapipluginbase: Override downstream allocation reply if no pool
If the downstream replied without a pool, then override it.

https://bugzilla.gnome.org/show_bug.cgi?id=748559
2015-06-17 09:53:29 +03:00
Víctor Manuel Jáquez Leal
cbc2d15bec vaapipostproc: add color balance interface
https://bugzilla.gnome.org/show_bug.cgi?id=720376
2015-06-12 19:22:01 +02:00
Víctor Manuel Jáquez Leal
1ef8c10aa8 vaapipostproc: add skin tone enhancement
Added the 'skin-tone-enhancement' property to vaapostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=744088
2015-06-08 18:00:05 +02:00
Víctor Manuel Jáquez Leal
2492afa86c vaapidecode: remove unneeded casting
And a code-style fix
2015-06-01 18:40:26 +02:00
Víctor Manuel Jáquez Leal
26cedfa9fa vaapidecode: calculate decoding latency
This is a naïve approach to the calculation of the VA-API decoding latency. It
takes into consideration when the frame-rate has some insane value.

https://bugzilla.gnome.org/show_bug.cgi?id=740419
2015-06-01 18:37:02 +02:00
Alban Browaeys
22f4d8b768 build: don't compile HEVC encoder if not supported
Fix:
(gst-plugin-scanner:16681): GStreamer-WARNING **: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so: undefined symbol: gst_vaapi_encoder_h265_get_default_properties

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

Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-27 23:49:18 +03:00
Sreerenj Balachandran
eaf57cc90b HEVC_Encode: Add HEVC(h265) Encoder plugin
https://bugzilla.gnome.org/show_bug.cgi?id=748874

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-05-25 11:58:20 +03:00
Víctor Manuel Jáquez Leal
89e41fc8e3 build: use git.mk
This patch handles dinamically the gitignore files with git.mk[1].

Removed the automake variable MAINTAINERCLANFILES in most of the
Makefile.am files since now it is handled by the top one.

1. https://github.com/behdad/git.mk/blob/master/git.mk

https://bugzilla.gnome.org/show_bug.cgi?id=749321
2015-05-18 16:14:46 +02: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
ef7dc4eaf6 build: fix make distcheck
This patch fixes several issues found when running the `make distcheck`
target:

- In commit c561b8da, the update of gstcompat.h in Makefile.am was
  forgotten.
- In commit c5756a91 add the simple_encoder_source_h in EXTRA_DIST was
  forgotten.
- vpx.build.stamp is not generated at all, only vpx.configure.stamp.
- The make target distcleancheck failed because some autogenerated files
  were not handled with the DISTCLEANFILES variable.

Note: `make distcheck -jXX` is not currently supported.
2015-05-13 15:21:07 +02:00
Víctor Manuel Jáquez Leal
3024640d4f plugins: remove gstreamer-0.10 crumbs
GstVideoContext was used in gstreamer-0.10, which is not supported anymore.
Still, its definition was still in the code. This patch removes it.

https://bugzilla.gnome.org/show_bug.cgi?id=749113
2015-05-12 12:19:57 +02:00
Gwenole Beauchesne
5993b0d60f vaapidecode: add guards for disabled codecs.
Fix link when building plugin elements without HEVC support. e.g. don't
try to call into gst_vaapi_decoder_h265_set_alignment() if there is no
support HEVC enabled in libgstvaapi.

Also, drop disabled codecs from static template caps. Add the missing
HEVC static template caps into vaapidecodebin too.
2015-05-04 14:27:23 +02:00