Commit graph

792 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
bd4395ce9f vaapidecodebin: add postprocessor dynamically
The former approach to left the bin unfinished has some problems: the context
cannot be shared because the vaapidecode is unlinked in many cases, leading to
creating a VADisplay twice.

Initially the bin is fully functional, constructed as

(-----------------------------------)
|            vaapidecodebin         |
|   (-------------)    (-------)    |
|<--| vaapidecode |--->| queue |--->|
|   (-------------)    (-------)    |
(-----------------------------------)

When the context is shared and the VADisplay has VPP capabilities, before
changing to READY state, the bin is reconfigured dynamically, adding the
vaapipostproc element afeter the queue:

(--------------------------------------------------------)
|                       vaapidecodebin                   |
|   (-------------)    (-------)    (---------------)    |
|<--| vaapidecode |--->| queue |--->| vaapipostproc |--->|
|   (-------------)    (-------)    (---------------)    |
(--------------------------------------------------------)

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

https://bugzilla.gnome.org/show_bug.cgi?id=757957
2015-11-16 16:07:07 +01:00
Víctor Manuel Jáquez Leal
ce3d1a6203 vaapidecodebin: delay the bin configuration
Delay the bin configuration until changing to READY state. This is because we
should add the vaapipostproc element until the vaapidecode has emitted the
HAVE_CONTEXT message, so de gst_bin_add() could set the context set to
vaapipostproc.

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

https://bugzilla.gnome.org/show_bug.cgi?id=757957
2015-11-16 16:07:07 +01:00
Sreerenj Balachandran
b9feff206f vaapidecode: Add comments for corner case fixes and fix couple of indentations. 2015-11-13 18:51:27 +02:00
Víctor Manuel Jáquez Leal
1efe569639 plugin: guard pointers to pad query functions
Since gstreamer 1.4 is not required to have pad query functions if the query
vmethods are used.

This patch guards out the pad query functions for gstreamer < 1.4

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

https://bugzilla.gnome.org/show_bug.cgi?id=757629
2015-11-09 16:18:44 +01:00
Víctor Manuel Jáquez Leal
ea802072d1 vaapiencode: use pad query vmethods
GstVideoEncoder, the base class of vaapiencode, added support for pad queries
as virtual methods since gstreamer 1.4. This patch enables those vmethods,
while keeps support for previous versions of gstreamer.

This patch is relevant since GstVideoEncoder takes care of other queries that
we are currently ignoring.

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

https://bugzilla.gnome.org/show_bug.cgi?id=757629
2015-11-09 16:18:44 +01:00
Víctor Manuel Jáquez Leal
75e7a0a36c vaapidecode: return pad's template caps if no display
A caps query can occur before the element has a display. In that case, the
element can return its pad's template. But when the element already has a
display, and the caps probe fails, the element shall return an empty caps, so
the auto-plug could try with another decoder.

If the element has a display and the caps probe works, then the computed caps
should be returned.

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
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
28c366a003 plugin: don't lose previous context at query
When processing the GST_CONTEXT_QUERY we should not lose the previous
context in the query, we should only add our display structure.

This patch copies the old context, if it is there, and stamp our display on
it. Otherwise, a new context is created.

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
ed280f5b84 vaapivideocontext: add gst_vaapi_video_context_set_display()
This function set the display to an already created context. This function is
going to be used later.

Also, gst_vaapi_video_context_new_with_display() now uses this function.

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
ef3fb4afaf plugins: check if display is set in sync
Since the context messages are sync'ed, the display assignation happens in the
same thread, hence we can know if the display was found or not as soon we call
for it.

In order to take advantage of it, gst_vaapi_video_context_prepare() receives,
as a new parameter, the address of the plugin's display, and reports back if
the display was found and set.

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
b45089f0f7 plugins: set display through context
Instead of setting the display to the plugin directly after its creation, do
it through the gstreamer's context mechanism, avoiding double assignations.

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
959c13933d vaapivideocontext: rename context structure
The context structure is named "display" which is too generic. The contrary
happens, for example, with GstGL, what uses the same name as the context, and
its logs make more sense.

This patch renames the context structure with the same name as the
context, thus GST_PTR_FORMAT can pretty print it.

https://bugzilla.gnome.org/show_bug.cgi?id=757598
2015-11-09 16:18:19 +01:00
Víctor Manuel Jáquez Leal
5d0ab36924 vaapivideocontext: refactor gst_vaapi_video_context_prepare()
First, refactorized run_context_query() into _gst_context_run_query(), adding
a new parameter: the pad direction, in order to simplify the code.

Second, added a new helper function: _gst_context_query(), which is a generic
context query function.  It isolates the operation of running the query and
sets the context if found, also it enhances the logs.

_gst_context_query() is similar to the one used in GstGL. Perhaps, in the
future this helper function will be merged into the core libraries of
GStreamer.

Finally, gst_vaapi_video_context_prepare() was rewritten to use
_gst_context_query().

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
7e9ee7f66d vaapivideocontext: refactor context category debug
Refactor the extraction GST_CAT_CONTEXT logging using a only once
initializator, so we could get the debug category from different code
paths, safely.

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
c20318d198 gstvaapivideocontext: fix indentation
gst-indent does not handle correctly some expression like function
declaration with attributes, breaking the following expressions.

This patch makes gst-indent to ignore the attributed function
declartion so the followed function definition is not mangled, such
as happened in commit b4154a

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
1e96fae94c plugin: chain up set_context() vmethod
Since Gstreamer 1.7, set_context() vmethod needs to be chained up with
the parent class in order to broadcast all its contexts when the element
is added into a bin:

http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=d5ded1588920c4471eefe055d09095d9e5e989b5

There is no need to guard the call, because before GStreamer 1.7, the
set_context() vmethod was NULL in the element class, hence the conditional
call make it safe.

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
a2611b7f35 vaapidecodebin: fix a leaked display instance
The display returned by gst_vaapi_video_context_get_display() increments the
references. Thus, we have to unref the returned display.

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

https://bugzilla.gnome.org/show_bug.cgi?id=757595
2015-11-09 15:50:14 +01:00
Sreerenj Balachandran
6722c541a1 VP9: plugins: Add VP9 decoder 2015-11-06 15:19:38 +02:00
Víctor Manuel Jáquez Leal
b76f4825c5 vaapidecode: relax guards for memory:VASurface capsfeature
Though caps features are supported since GStreamer 1.2, there are some
issues with the features caps negotiation in that version. Nonetheless,
those issues are fixed in GStreamer 1.4. So, the memoy:VASurface caps
feature negotiation is relaxed for GStreamer 1.4.

The guard is the same as in vaapisink's caps template.

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

https://bugzilla.gnome.org/show_bug.cgi?id=756686
2015-10-20 12:32:44 +02:00
Víctor Manuel Jáquez Leal
361f55be31 vaapidecode: decide allocation doesn't update srccaps
The received caps query will bring the already negotiated caps, so they are
not expected to change.

This patch removes this verification which is dead code path.

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

https://bugzilla.gnome.org/show_bug.cgi?id=756686
2015-10-20 12:32:44 +02:00
Víctor Manuel Jáquez Leal
6d9f31e305 vaapidecode: use caps to check the features
Instead of calling gst_vaapi_find_preferred_caps_feature(), which is
expensive, we check the caps from the allocation query, to check the
negotiated feature.

In order to do this verification a new utility function has been implemented:
gst_vaapi_caps_feature_contains().

As this new function shared its logic with gst_caps_has_vaapi_surface(), both
have been refactorized.

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

https://bugzilla.gnome.org/show_bug.cgi?id=756686
2015-10-20 12:32:44 +02:00
Víctor Manuel Jáquez Leal
45487fe87c vaapidecode: set format before decide allocation
There is a regression from commit 3d8e5e. It was expected the buffer pool
allocation occur before the caps negotiation, but it is not.

This patch fixes this regression: the caps negotiation is done regardless the
allocation query from downstream.

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

https://bugzilla.gnome.org/show_bug.cgi?id=756686
2015-10-20 12:32:44 +02:00
Sreerenj Balachandran
087e549c1e vaapidecode: Fix buffer copy assertion
Don't try to copy the NULL buffer-codec_data.
2015-10-12 14:13:03 +03:00
Víctor Manuel Jáquez Leal
52b94556ed gstcompat: add gst_buffer_copy_deep() if gst < 1.5
gst_buffer_copy_deep() was added in GStreamer 1.5. If want to use it we should
add an implementation if gstreamer-vaapi is linked to previous versions.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-09-23 17:11:21 +02:00
Víctor Manuel Jáquez Leal
5ab4c15754 vaapidecode: simplify copy of GstVideoCodecState
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-09-23 12:13:41 +02:00
Víctor Manuel Jáquez Leal
2aaafe96b7 build: link libgstvaapi_parse against codec parser
GST_CODEC_PARSER_* variables are defined if builtin codec parsers are disabled
when running configure.

Right now, libgstcodecparsers links only to libgstvaapi, but libgstvaapi_parse
need it if builtin codec parsers are disabled.

This patch adds GST_CODEC_PARSER_* variables to libgstvaapi_parse
compilation. If builtin codec parsers are enable, this variable is null, so it
should work using libgstvaapi, as normal.

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

https://bugzilla.gnome.org/show_bug.cgi?id=754845
2015-09-15 19:36:37 +02:00
Mark Nauwelaerts
6d0c2a8e23 vaapidecode: proper numerator and denominator for forced latency framerate
https://bugzilla.gnome.org/show_bug.cgi?id=755040
2015-09-15 11:01:29 +03:00
Jan Schmidt
b0194a1dc5 multiview: initial attempt at stereo/multiview support
Add support for marking caps and buffers for multiview or
stereoscopic output.

https://bugzilla.gnome.org/show_bug.cgi?id=750835
2015-08-31 17:51:56 +02:00
Víctor Manuel Jáquez Leal
dbedad66df vaapidecode: remove (another) unused variable
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-31 13:13:11 +02:00
Víctor Manuel Jáquez Leal
9d8a014423 vaapidecode: remove unused variable
Thus silence the compilation warnings.
2015-08-28 17:10:40 +02:00
Víctor Manuel Jáquez Leal
b8068874d5 vaapidecode: compilation fix
gst_vaapi_decoder_state_changed() returns void. This patch fixes the
compilation where the toolchain uses restrictive flags as clang.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2015-08-28 16:07:31 +02:00
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
Víctor Manuel Jáquez Leal
188d8fe442 plugins: check if the pool config is already set
In commit 97b768, a regression for GStreamer 1.2 was introduced:

GStreamer 1.2 doesn't check, in gst_buffer_pool_set_config() if the
config option is already set. This patch adds an inline function to
first verify if the option is not in the pool config berfore add it.
2015-04-30 13:51:22 +02:00
Víctor Manuel Jáquez Leal
28b4fc4dd9 vaapipostproc: tune up a couple of log messages
In order to reduce the noise, the query type log was downgrade from INFO to
DEBUG, and the shared display address log message is assigned to the object.
2015-04-29 12:39:50 +02:00
Víctor Manuel Jáquez Leal
97b768675a plugins: check gst_buffer_pool_set_config()
Check the return value of gst_buffer_pool_set_config(). If it fails an error
message is posted in the bus.
2015-04-29 12:27:43 +02:00
Víctor Manuel Jáquez Leal
100d5971b5 plugins: more specific log message
Be more specific in the log message about the reason of creating a new pool.
2015-04-29 12:24:52 +02:00
Víctor Manuel Jáquez Leal
b8268b1f3e plugins: delete unused variable
need_pool is a boolean variable extracted from the allocation query, but it is
not used afterwards.
2015-04-29 12:22:29 +02:00
Olivier Crete
d70a2e8d13 vaapipluginbase: Update the pool if there was no pool in the downstream reply
Fix regression introduced by bd866479, the query after decide_allocation()
always needs a pool in the first slot.

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

https://bugzilla.gnome.org/show_bug.cgi?id=748559
2015-04-29 12:05:07 +02:00
Olivier Crete
be37f45998 videopool: Free members before chaining up finalize
The finalize function in GObject frees the object memory, so
everything else needs to have been freed before.

https://bugzilla.gnome.org/show_bug.cgi?id=748563
2015-04-28 11:16:02 +02:00
Víctor Manuel Jáquez Leal
99f95690b5 vaapidecode: refactor gst_vaapidecode_internal_flush()
This a cosmetic refactor: gst_vaapidecode_internal_flush() removes its only
label; gst_vaapidecode_finish() is more readable and gst_vaapidecode_purge()
shares the same error message of gst_vaapidecode_internal_flush() when flush
fails.
2015-04-21 10:00:36 +02:00
Víctor Manuel Jáquez Leal
dbc8f3f25f vaapidecode: refactor gst_vaapidecode_destroy()
Add the method gst_vaapidecode_purge(). This method releases the
flushed frames from the decoder.

This new method add more readablity to gst_vaapidecode_destroy()
2015-04-20 14:05:47 +02:00
Olivier Crete
11c963a3c1 vaapidecode: Tell the base class about released frames on close
The base class needs to be informed about frames that were still queued
in the decoder on release, otherwise they are leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=747999
2015-04-20 12:50:09 +02:00
Víctor Manuel Jáquez Leal
dedbbdd41b vaapidecode: reduce logging noise
When a frame is rejected by downstream, the message is logged twice. This
patch removes one of those logging messages.

Also, the reject of a frame doesn't mean an alarming error. This patch demotes
the log message from error to info.
2015-04-19 11:20:49 +02:00
Olivier Crete
7e08786e1d vaapidecode: Use the GstVideoDecoder error reporting function
This way, the decoder won't stop on the first decoding error,
in most cases it can recover after some glitchiness.

https://bugzilla.gnome.org/show_bug.cgi?id=744620
2015-04-19 09:26:38 +02:00
Olivier Crete
bd86647970 vaapipluginbase: The allocation query can return without a pool
It is possible to return the min/max/size without actually providing
a pool. This way the source knows how many buffers downstream needs.

https://bugzilla.gnome.org/show_bug.cgi?id=748076
2015-04-19 09:25:56 +02:00
Sreerenj Balachandran
8c7bc7dff8 plugins: Add h265 videoparser element "vaapiparse_h265"
This is a mirror of h265parse element in upstream gst-plugins-bad.
There could be additional patches but all should go to upstream.
This is for making development faster.

Note: vaapiparse_h265 will get build only for GStreamer version >= 1.4
2015-04-17 17:09:30 +03:00
Olivier Crete
6f298f6182 vaapipostproc: Don't create filter on caps query
The problem with this is that creating the filter causes the display to
be selected, and the caps query happens while linking the element. So,
if the downstream or upstream element is using a specific display
object, it won't be propagated correctly to the postproc as it already
has a display at this point.

https://bugzilla.gnome.org/show_bug.cgi?id=747945
2015-04-16 12:36:28 +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
Sreerenj Balachandran
25382f3d91 vaapidecode: Update Author name in plugin metadata 2015-04-13 16:04:59 +03:00
Sreerenj Balachandran
a9b85e451d plugins: Add HEVC decoder
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-04-13 15:43:30 +03:00
Michael Olbrich
a314b682b2 vaapidecode: unref video codec frame twice
We get one reference when the frame is passed to decode_handle_frame()
and create another one in gst_vaapi_decoder_push_frame().

Usually the frame is handled in gst_vaapidecode_push_decoded_frame().
Here the frame is always released twice:
gst_video_decoder_finish_frame() + gst_video_codec_frame_unref() or
gst_video_decoder_drop_frame() + gst_video_codec_frame_unref().

In gst_vaapidecode_reset_full() both references to the frame must be
released as well.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=743226
2015-04-10 12:42:38 +02:00
Sreerenj Balachandran
316abf6520 Remove the gstvaapivideoconverter_*.c source files missed in commit 51b1e4a 2015-04-03 17:45:08 +03: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
Víctor Manuel Jáquez Leal
c561b8da8a update and move gstcompat.h
The purpose of gstcompat.h is to couple the API differences among
gstreamer-1.0 and gstreamer-0.10. Since gstreamer-0.10 is obsolete, the code
in this compatibility layer shall be removed.

Nevertheless, the gstcompat.h header should be kept, if new incompatibilites
appear in the future, but it shall live in gst/vaapi, not in gst-libs.

This patch removes the crumbs defined gstcompat.h and moves it to gst/vaapi.
In order to avoid layer violations, gstcompat.h includes sysdeps.h and all
the includes in gst/vaapi of sysdeps.h are replaced with gstcompat.h

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:08:30 +03:00
Víctor Manuel Jáquez Leal
1256ce613a autotools: remove gstreamer-1.0 support
This patch only removes the support of gstreamer-1.0 in the autotools
scripts. No other files are touched.

In the automake file all the converters were deprecated.

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:05:45 +03:00
Víctor Manuel Jáquez Leal
f5d3c2d85d Remove libgstvaapi-videoutils.so
This library was intended to add the base classes for video decoders which
where not included in gstreamer-0.10.

Since the support of gstreamer-0.10 is deprecated those classes are not
required, thus the whole library is removed.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 17:01:45 +03:00
Víctor Manuel Jáquez Leal
d256f1d283 Removal of gstreamer-0.10 support
This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-0.10.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:55:27 +03:00
Víctor Manuel Jáquez Leal
0311c7c8af autotools: remove gstreamer-0.10 support
This patch only removes the support of gstreamer-0.10 in the autotools
scripts. No other files are touched.

The configuration parameter --gstreamer-api was deleted since now it is always
auto-detected.

The verification of vmethod query in GstBaseSinkClass was removed since it was
added in gstreamer 0.10.35. The same case for GstVideoOverlayComposition and
its format flags.

The precious variable GST_PLUGIN_PATH was removed, while GST_PLUGIN_PATH_1_0
remained.

The automake files were changed accordingly.

Removed, in debian/control, the vaapiupload and vaapidownload descriptions.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-04-03 16:54:54 +03:00
Víctor Manuel Jáquez Leal
71d91c7716 vaapidecode: add drain() vmethod
In GStremer v1.6 a new vmethod drain() was added in GstVideoDecoder
class. This patch implements this new method.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-03-16 23:38:18 +02:00
Víctor Manuel Jáquez Leal
49606b8d25 vaapidecode: remove vmethod reset()
Since in bug #745728 the support for GStreamer 1.0 is going to be dropped,
this patch removes the method reset() which was deprecated in GStreamer 1.2.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-03-16 23:37:29 +02:00
Víctor Manuel Jáquez Leal
1bd810fe99 vaapidecode: handle flush() vmethod
Since GStreamer 1.2 the vmethod reset() in GstVideoDecoderClass was deprecated
and flush() was added.

This patch set the vmethod flush() if the installed GStreamer version is 1.2 or
superior. Otherwise, reset() is set.

v2: 1) In order to avoid symbol collision, the old method gst_vaapidecode_flush()
       was renamed to gst_vaapidecode_internal_flush().
    2) The new vmethod flush() always do a hard full reset.
v3: 1) Call gst_vaapidecode_internal_flush() first in flush() vmethod, in order to
       gather all collected data with  gst_video_decoder_have_frame()

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-03-16 23:36:33 +02:00
Víctor Manuel Jáquez Leal
d8d2f00bd0 vaapidecode: call the correct query function
In commit 2f8c115 (vaapidecode: use the query virtual methods in 1.4)
a bug was introduced: when calling the parent's query function of the
src pad, the one of the sink pad is called instead. This patch fixes
this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=746248
2015-03-16 23:10:53 +02:00
Olivier Crete
8f56b758b6 vaapidecode: Don't crash if a buffer outlives the decoder
Sometimes, for example, when switching video streams but keeping
the same sink, the surface will be released after the decoder is
stopped and replaced. This caused a crash because the release
callback was called on an invalid pointer.
The patch adding an additional reference to the decoder object in the buffer.

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

Signed-off-by: Olivier Crete <olivier.crete@collabora.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-03-06 15:20:01 +02:00
Sreerenj Balachandran
7e19e6a00a vaapidecode: clean-ups (indentation, drop unused variables) 2015-03-06 14:31:21 +02:00
Víctor Manuel Jáquez Leal
2f8c1159e3 vaapidecode: use the query virtual methods in 1.4
GstVideoDecoder, the base class of vaapidecode, added support for
pad queries as virtual methods. This patch enables the use of that
support, while keeping support for lower versions of gstreamer.

This patch is important because GstVideoDecoder takes care of other
queries that might be important in the pipeline managing.

v2: 1) rebase to current master
    2) fix indentation with gst-indent
    3) simplify the patch layout
    4) fix the context query
    5) initialise the filter to NULL
    6) improve the query log message for gst-1.2

https://bugzilla.gnome.org/show_bug.cgi?id=744406
2015-03-06 14:09:22 +02:00
Víctor Manuel Jáquez Leal
98655a195f vaapipostproc: always activate buffer pool
The vaapipostproc has a proxy flag to know if the the buffer pool is
already active. But this fails in some situations where it is needed
to renegotiate the buffer pool.

This patch removes that flag so the renegotiation is done whenever is
required.

https://bugzilla.gnome.org/show_bug.cgi?id=745535
2015-03-06 12:16:17 +02:00
Gwenole Beauchesne
7524b5eea6 vaapisink: fix minor memory leak in debug mode.
The gst_video_colorimetry_to_string() function returns a newly created
string that represents the GstVideoColorimetry value. So, that needs
to be released after usage, in e.g. GST_DEBUG().
2015-03-06 10:37:40 +01:00
Sreerenj Balachandran
73b726418b vaapidecodebin: Avoid usage of "__" prefix in macro names
Avoiding "__" prefix usage in Header File Guards as per
C standard recommendation.
2015-03-03 12:37:41 +02:00
Sreerenj Balachandran
29853f2aae plugins: Disable vaapidecodebin for GStreamer < 1.4
There are autoplugging issues in GStreamer-1.2.
Lets disable vaapidecodebin untill we get some workarounds for this.
2015-03-03 12:31:11 +02:00
Sreerenj Balachandran
8eabe9f377 plugins: Add a vaapidecodebin element
Add a "vaapidecodebin" element to vaapi plugins.

Child Elements: "vaapidecode ! queue ! vaapipostproc"

The Reasons for implementing a new bin element:

-- Help to Autoplug Hardware Accelerated Video Postprocessing element in playbin
with out any dependency to upstream gstreamer.
This is to overcome the *unacceptable* delay in upstream gstreamer to get new
features in. Eg: https://bugzilla.gnome.org/show_bug.cgi?id=687182.
Also customers using older gstreamer versions (1.2 and 1.4) will get the
benefit of autoplugging, hardware accelerated deinterlacing support etc.

-- Help to maintain a single thread implementation in vaapidecode.
This will result a dead-lock free vaapidecode in most of the cases.
More details here: https://bugzilla.gnome.org/show_bug.cgi?id=742605

https://bugzilla.gnome.org/show_bug.cgi?id=745216
2015-03-02 16:51:55 +02:00
Sreerenj Balachandran
5425a05bd4 vaapidecode: re-indent (gst-indent) gstvaapidecode.c 2015-03-02 14:59:16 +02:00
Simon Farnsworth
aafa59f01e vaapidecode: Switch back to Single thread implementation
Because the decoder uses the thread from handle_frame() to decode a frame,
the src pad task creates an unsolveable AB-BA deadlock between
handle_frame() waiting for a free surface and decode_loop() pushing
decoded frames out.

Instead, have handle_frame() take responsibility for pushing surfaces,
and remove the deadlock completely. If you need a separate thread
downstream, you can insert a queue between vaapidecode and its downstream
to get one.

Another justification for the single thread implementation is,
there are two many point of locking in gstreamer-vaapi's current
implementation which can lead to deadlocks.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-03-02 14:46:38 +02:00
Gwenole Beauchesne
336eddffa5 plugins: fix detection of upstream v4l2src element.
Improve check for upstream element that requires DMABUF buffer pool,
e.g. v4l2src element. In particular, make sure to traverse through
any additional capsfilter for instance.

Note: the traversal to the top-most upstream element could be made
more generic, but we are insofar only interested in supporting pipes
similar to v4l2src or v4l2src ! capsfilter, e.g. with an explicit
specification for a desired video camera format, or resolution.
2015-03-02 13:41:29 +01:00
Gwenole Beauchesne
8b91ddac0b plugins: fix allocation of DMABUF memory.
The dmabuf allocator would close the DMABUF handle passed in the init
function gst_dmabuf_allocator_alloc(). So, we need to dup() it so that
to avoid a double close, ultimately in the underlying driver that owns
the DMABUF handle.
2015-03-02 13:41:29 +01:00
Víctor Manuel Jáquez Leal
3d8e5e59a7 vaapidecode: keep src caps and output state in sync
vaapidecode keeps an output state that use the format
GST_VIDEO_FORMAT_ENCODED, while it crafts a different src caps
for a correct negotiation.

I don't see the rational behind this decoupling, it looks like
unnecessary complexity. This patch simplify this logic keeping
in sync the output state and the src caps.

This patch improves the readability of the function
gst_vaapidecode_update_src_caps() and simplify its logic. Also,
the patch validates if the buffer pool has the configuration for
the GL texture upload meta, in order to set the caps feature
meta:GLTextureUpload. Otherwise, the I420 format is set back.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-02-26 12:28:02 +02:00
Víctor Manuel Jáquez Leal
e4f8d14979 vaapidecode: upload meta only if feature and allocation
When vaapidecode finishes the decoding of a frame and pushes it,
if, in the decide_allocation() method, it is determined if the
next element supports the GL texture upload meta feature, the
decoder adds the buffer's meta.

Nonetheless, in the same spirit of the commit 71d3ce4d, the
determination if the next element supports the GL texture upload
meta needs to check both the preferred caps feature *and* if the
allocation query request the API type.

This patch, first removes the unused variable need_pool, and
determines the attribute has_texture_upload_meta using the
preferred caps feature *and* the allocation query.

Also, the feature passed to GstVaapPluginBase is not longer
determined by has_texture_upload_meta, but by the computed
preferred one.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-02-26 12:26:54 +02:00
Víctor Manuel Jáquez Leal
9799875df4 vaapidecode: delayed src caps negotiation
Currently the src caps are set immediately after the sink caps are set, but in
that moment the pipeline might not fully constructed and the video sink has
not negotiated its supported caps and features. As a consequence, in many cases
of playback, the least optimized caps feature is forced. This is partially the
responsible of bug #744039.

Also, vaapidecode doesn't attend the reconfigure events from downstream,
which is a problem too, since the video sink can be changed with different
caps features.

This patch delays the src caps, setting them until the first frame arrives to
the decoder, assuming until that very moment the whole pipeline is already
negotiated. Particularly, it checks if the src pad needs to be reconfigured,
as a consequence of a reconfiguration event from downstream.

A key part of this patch is the new GstVaapiCapsFeature
GST_VAAPI_CAPS_FEATURE_NOT_NEGOTIATED, which is returned when the src pad
doesn't have a peer yet. Also, for a better report of the caps allowed
through the src pad and its peer, this patch uses gst_pad_get_allowed_caps()
instead of gst_pad_peer_query_caps() when looking for the preferred feature.

v3: move the input_state unref to close(), since videodecoder resets at
some events such as navigation.

v4: a) the state_changed() callback replaces the input_state if the media
changed, so this case is also handled.
    b) since the parameter ref_state in gst_vaapidecode_update_src_caps() is
always the input_state, the parameter were removed.
    c) there were a lot of repeated code handling the input_state, so I
refactored it with the function gst_vaapi_decode_input_state_replace().

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2015-02-26 12:24:55 +02:00
Víctor Manuel Jáquez Leal
71d3ce4de2 plugins: upload meta only if feature and allocation
Working on bug #743687, I realized that vaapidecode always adds to its buffer
pool the config option GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META if
the decide_allocation()'s query has GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE.

Nevertheless, there are occasions where the query has the API type, but the
last negotiated caps don't have the feature meta:GstVideoGLTextureUploadMeta.

Under this contradiction, vaapidecode adds the GLTextureUploadMeta API to its
buffer pool configuration, and adds its buffer's meta to each output buffer,
even if the negotiated caps feature is memory:SystemMemory with I420 color
format.

This kind of output buffers chokes ClutterAutoVideosSink, since it uses a map
that relates caps <-> GL upload method. If it receives a buffer with color
format I420, it assumes that it doesn't have a texture upload meta, because
only those with RGB color format has it. Our buffers, with I420 format, say
that they have the upload meta too. In that case the mapped method is a dummy
one which does nothing. I reported this issue in bug #744039 (the patch,
obviously, was rejected).

This patch workarounds the problem: the buffer pool's configuration option
GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META is set if and only if the
query has the GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE *and* the negotiated
caps feature is meta:GstVideoGLTextureUploadMeta.

I have tested these patches with gst-master (1.5), gst-1.4 and gst-1.2 and
in all they seem to work correctly.

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

[adapted to fit current EGL changes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-02-24 15:28:26 +01:00
Gwenole Beauchesne
6a465ae793 plugins: add support for GstVideoGLTextureOrientation.
Add support for GstVideoGLTextureOrientation modes. In particular,
add orientation flags to the GstVaapiTexture wrapper and the GLX
implementations. Default mode is that texture memory is laid out
with top lines first, left row first. Flags indicate whether the
X or Y axis need to be inverted.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
8c93c842ef plugins: add support for BGRA textures.
Some frameworks (EFL) expect BGRA textures for storage. However,
adding support for that broadly into GStreamer framework  implies
two kinds of hacks: (i) libgstgl helpers currently do not support
BGRA textures correctly, (ii) we need to better parse downstream
suggested caps and intersect them with what the VA plugin elements
can offer to them for GL texturing.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
7343ce41cd plugins: fix support for Wayland/EGL running alongside X11.
When multiple display servers are available, the glimagesink element
(from GStreamer 1.4) may not be able to derive a global display in
Wayland. Rather, a "window"-specific display is created. In this case,
the GstGLDisplay handle available through GstGLContext is invalid.

So, try to improve heuristics for display server characterisation in
those particular situations.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
60e96e80cc plugins: add initial support for EGL.
Add initial support for EGL through GstVideoGLTextureUploadMeta.

Fix gst_vaapi_ensure_display() to allocate a GstVaapiDisplay off the
downstream supplied GstGLContext configuration, i.e. use its native
display handle to create a GstVaapiDisplay of type X11 or Wayland ;
and use the desired OpenGL API to allocate the GstVaapiDisplayEGL
wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=741079
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
44013fdaf0 plugins: track video texture size changes.
Sync video texture sizes to GstVideoGLTextureUploadMeta private date,
i.e. GstVaapiVideoMetaTexture, on a regular basis. In particular, we
now update the texture size from the GstVideoMeta, if any, or reset
to some defaults otherwise.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
9aa5eac5e3 plugins: ensure VA display matches GL context expectations.
If a GstGLContext is supplied by the downstream element, then make
sure that the VA plugin element gets a compatible display to what
is requested by the GL context. e.g. re-allocate a VA/GLX display
when a GLX context is provided by the downstream element.
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
d9c082168b plugins: record downstream GstGLContext.
Record GL context supplied by downstream elements. This can be useful,
and further needed, to enforce run-time check that the GL context is
compatible for use by libgstvaapi. e.g. check that we don't create a
VA/GLX display for EGL/X11 contexts.

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

Original-path-by: Matthew Waters <ystreet00@gmail.com>
2015-02-24 15:20:03 +01:00
Gwenole Beauchesne
9b9878c96d vaapidecode: partially revert 0777f35.
Reset the VA decoder after updating the base plugin caps, and most
importantly, after GstVideoDecoder negotiation. The reason behind
this is that the negotiation could trigger a last decide_allocation()
where we could actually derive a new GstVaapiDisplay to use from the
downstream element. e.g. GLX backend.
2015-02-24 15:20:03 +01:00
Sreerenj Balachandran
82e12a933e vaapidecode: Caps query should return the list of all supported caps.
Query caps filtering should be always done on top of allowed caps instead
of existing fixed caps on a particular pad.
This fixes the mvc stream decoding when there is a base view(high profile)
and non-base view(stereo-high profile).
2015-02-19 13:37:09 +02:00
Víctor Manuel Jáquez Leal
7ca0591759 vaapidecode: intersect filter from query caps
According to documentation[1] when receiving a GST_QUERY_CAPS
the return value should be all formats that this elements supports,
taking into account limitations of peer elements further downstream
or upstream, sorted by order of preference, highest preference first.

This patch add those limitations intersecting with the received
filter in the query. Also takes into account the already negotiated
caps. Also adds the processing of the query on the SRC pad.

1. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-nego-getcaps.html

https://bugzilla.gnome.org/show_bug.cgi?id=744406
2015-02-18 13:36:16 +02:00
Víctor Manuel Jáquez Leal
671b1ea305 Fix compiler warnings
This patch fixes some warnings that gcc 4.9 reports.

https://bugzilla.gnome.org/show_bug.cgi?id=744411
2015-02-18 11:46:11 +02:00
Víctor Manuel Jáquez Leal
ce4d3355e1 vaapidecode: Use GST_DEBUG_FUNCPTR for gst_vaapidecode_query()
Hence the function name is shown in the gst-inspect-1.0 information
rather than the memory address.

https://bugzilla.gnome.org/show_bug.cgi?id=744330
2015-02-18 11:22:21 +02:00
Víctor Manuel Jáquez Leal
ee0855dc65 vaapidecode: log flow error name
https://bugzilla.gnome.org/show_bug.cgi?id=744387
2015-02-18 11:21:35 +02:00
Olivier Crete
aaf4165819 vaapidecode: Emit error GstMessage when returning a GST_FLOW_ERROR
This is required in GStreamer, elements should never return
GST_FLOW_ERROR without posting an ERROR message on the bus.

https://bugzilla.gnome.org/show_bug.cgi?id=744620
2015-02-18 11:19:26 +02:00
Sreerenj Balachandran
a664a479a8 plugins: Add VP8 Encoder 2015-02-13 13:45:32 +02:00
Sreerenj Balachandran
004968f506 build: fix make dist when certain conditionals not met.
Fix typo which was preventing the inclusion of jpeg encoder
source files from make dist (when there is no jpeg encoder
API support in libva).
2015-02-06 12:10:51 +02:00
Olivier Crete
fc7e6b19fd vaapidecode: Check the condition after taking the lock
Otherwise the condition could become true before the lock
is taken and the g_cond_signal() could be called
before the g_cond_wait(), so the g_cond_wait() is never
awoken.

https://bugzilla.gnome.org/show_bug.cgi?id=740645
2015-02-04 18:34:59 +02:00
Sreerenj Balachandran
d2e2784a78 plugins: Add JPEG encoder element 2015-02-04 11:18:29 +02:00
Sreerenj Balachandran
b328e880fe Fix compilation error if there is no GL/gl.h header file installed 2015-02-02 11:43:58 +02:00
Gwenole Beauchesne
da6b88692f plugins: drop leftover declaration.
GstVaapiVideoMemory quark is not needed any more, and the actual
implementation was already removed bfore the merge. i.e. this is
an oversight for a hunk that was not meant to be pushed.
2015-01-28 18:09:40 +01:00
Gwenole Beauchesne
82fc406dfd plugins: add support for dma_buf exports (v4l2src).
Allow v4l2src element to connected to vaapipostproc or vaapisink when
"io-mode" is set to "dmabuf-import". In practice, this is a more likely
operational mode with uvcvideo. Supporting v4lsrc with "io-mode" set
to "dmabuf" could work, but with more demanding driver or kernel reqs.

Note: with GStreamer 1.4, v4l2src (gst-plugins-good) needs to be built
with --without-libv4l2.

https://bugzilla.gnome.org/show_bug.cgi?id=743635
2015-01-28 17:36:21 +01:00
Wind Yuan
667749c67e plugins: add support for dma_buf imports.
Allow imports of v4l2 buffers into VA surfaces for further operation
with vaapi plugins, e.g. vaapipostproc or vaapiencode_* elements.

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

[fixed memory leaks, ported to new dma_buf infrastructure, cleanups]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2015-01-28 17:35:16 +01:00
Gwenole Beauchesne
96ce1bc761 videopool: add optional flags for surface pool allocation.
Reword surface pool allocation helpers so that to allow for a simple
form, e.g. gst_vaapi_surface_pool_new(format, width, height); and a
somewhat more elaborated/flexible form with optional allocation flags
and precise GstVideoInfo specification.

This is an API/ABI change, and SONAME version needs to be bumped.
2015-01-27 18:11:45 +01:00
Gwenole Beauchesne
807c4e8248 display: add utility function to check for OpenGL rendering.
Add gst_vaapi_display_has_opengl() helper function to help determining
whether the display can support OpenGL context to be bound to it, i.e.
if the class is of type GST_VAAPI_DISPLAY_TYPE_GLX.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
7d5d3e8640 display: refine the meaning of display type.
Make gst_vaapi_display_get_display_type() return the actual VA display
type. Conversely, add a gst_vaapi_display_get_class_type() function to
return the type of the GstVaapiDisplay instance. The former is used to
identify the display server onto which the application is running, and
the latter to identify the original object class.
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
2101685b7d texture: move to core libgstvaapi base library.
GstVaapiTexture is a generic abstraction that could be moved to the
core libgstvaapi library. While doing this, no extra dependency needs
to be added. This means that a GstVaapitextureClass is now available
for any specific code that needs to be added, e.g. creation of the
underlying GL texture objects, or backend dependent ways to upload
a surface to the texture object.

Generic OpenGL data types (GLuint, GLenum) are also replaced with a
plain guint.

https://bugzilla.gnome.org/show_bug.cgi?id=736715
2015-01-27 18:11:44 +01:00
Gwenole Beauchesne
0a108653f2 texture: add support for cropping rectangle during transfer.
The gst_vaapi_texture_put_surface() function is missing a crop_rect
argument that would be used during transfer for cropping the source
surface to the desired dimensions.

Note: from a user point-of-view, he should create the GstVaapiTexture
object with the cropped size. That's the default behaviour in software
decoding pipelines that we need to cope with.

This is an API/ABI change, and SONAME version needs to be bumped.

https://bugzilla.gnome.org/show_bug.cgi?id=736712
2015-01-27 18:11:44 +01:00
Simon Farnsworth
bee7460f35 pluginutil: Fix clearing of subtitle overlay
dvbsuboverlay signals no subtitles present by not setting
GstVideoOverlayCompositionMeta on a buffer.

Detect this, and remove subtitles whenever we have no overlay composition to
hand.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
2015-01-27 16:25:21 +02:00
Michael Olbrich
22d1acb6d2 vaapipostproc: clear state on stop
Otherwise restarting may fail because the state of vaapipluginbase and
vaapipostproc don't match. e.g. gst_vaapipostproc_set_caps() will skip
initailization and not call gst_vaapi_plugin_base_set_caps()
2015-01-27 16:06:02 +02:00
Michael Olbrich
b7d7a0197d vaapidecode: don't print an error message for GST_FLOW_FLUSHING 2015-01-27 14:50:12 +02:00
Sreerenj Balachandran
09bb0d4b5d Fix compilation error if there is no GL/gl.h header file installed 2015-01-19 11:30:12 +02:00
Gwenole Beauchesne
b8744f5b9a vaapidecode: commit updated srcpad caps to base plugin.
Make sure that the GstVaapiPluginBase instance receives the new src
pad caps whenever they get updated from within the GstVaapiDecoder
decode routines.

This also ensures that downstream elements receive correctly sized
SW decoded buffers if needed.

https://bugs.tizen.org/jira/browse/TC-114
2015-01-15 17:13:52 +01:00
Gwenole Beauchesne
0777f357aa vaapidecode: always reset decoder on ::set_format().
Split GstVideoDecoder::set_format() handler to first update the sink
pad caps and reset the active VA decoder instance based on those, and
then update the src pad caps whenever possible, e.g. when the caps
specify a valid video resolution.
2015-01-15 17:13:52 +01:00
Gwenole Beauchesne
09dcb1e0f7 vaapivideomemory: don't crash when trying to allocate 0x0 images.
In some occasions, a buffer pool is created for pre-initialization
purposes regardless of whether a valid image size is available or
not. However, during actual decode stage, the vaapidecode element
is expected to update the srcpad caps with the new dimensions, thus
also triggering a reset of the underlying bufferpool.
2015-01-15 17:13:52 +01:00
Sreerenj Balachandran
267465d7d0 vaapisink: Protect the X11 API invokations with proper locking
https://bugzilla.gnome.org/show_bug.cgi?id=739808
2014-11-27 11:20:10 +02:00
Gwenole Beauchesne
4be370f9ed vaapipostproc: fix out caps for GLMemory.
If the best downstream capsfeature turns out to be GLMemory, then make
sure to propagate RGBA video format in caps to that element. This fixes
the following pipeline: ... ! vaapipostproc ! glimagesink.
2014-11-24 15:28:36 +01:00
Gwenole Beauchesne
0525f56ac5 vaapipostproc: fix check for compatible src pad capsfilters.
When an explicit output video format is selected, from an src pad
capsfilter, make sure that the downstream element actually supports
that format. In particular, fix crash with the following pipelines:
... ! vaapipostproc ! video/x-raw,format=XXX ! xvimagesink ; where
XXX is a format not supported by xvimagesink.

While doing so, also reduce the set of src pad filter caps to the
actual set of allowed src pad caps.
2014-11-24 15:28:20 +01:00
Gwenole Beauchesne
9c888b8b8e plugins: re-indent all video processing related source code. 2014-11-24 14:11:35 +01:00
Gwenole Beauchesne
cf352336b3 plugins: further fixes to the new "current" storage tracker.
The ensure_surface() and ensure_image() functions shall only relate
to the underlying backing store. The actual current flags are to be
updated only through ensure_{surface,image}_is_current() or very other
particular cases in GstMemory hooks.
2014-11-24 13:20:33 +01:00
Gwenole Beauchesne
5fd643bf49 plugins: fix "current" video memory flags.
If the surface proxy is updated into the GstVaapiVideoMemory, then
it is assumed it is the most current representation of the current
video frame. Likewise, make a few more arrangements to have the
"current " flags set more consistently.
2014-11-21 15:50:35 +01:00
Gwenole Beauchesne
ceb60285ea plugins: ensure VA surface is current prior to using it.
When interacting with SW elements, the buffers and underlying video
memory could be mapped as read/write. However, we need to use those
buffers again as plain VA surfaces, we have to make sure the VA image
is thus committed back to VA surface memory.

This fixes pipelines involving avdec_* and vaapi{postproc,sink}.
2014-11-21 15:29:33 +01:00
Víctor Manuel Jáquez Leal
0e87abc574 plugins: enable memory maps for read & write.
Hence vaapisink can display buffers decoded by gst-libav, or HW decoded
buffers can be further processed in-place, e.g. with a textoverlay.

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

[ported to current git master branch, amended commit message]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-11-19 10:36:27 +01:00
Gwenole Beauchesne
a4d88db0fd plugins: preserve framerate when updating src caps video format.
In the current implementation, gst_video_info_set_format() would reset
the whole GstVideoInfo structure first, prior to setting video format
and size. So, coleteral information like framerate or pixel-aspect-
ratio are lost.

Provide and use a unique gst_video_info_change_format() for overcome
this issue, i.e. only have it change the format and video size, and
copy over the rest of the fields.

https://bugzilla.gnome.org/show_bug.cgi?id=734665
2014-11-18 18:39:32 +01:00
Sreerenj Balachandran
0ddf6b21b9 vaapidecode: increase the rank to GST_RANK_PRIMARY + 1
This is for helping decodebin to autoplug the vaapidecode element.

Decodebin is selecting decoder elements only based on rank and caps.
Without overriding the autoplug-* signals there is no way to autoplug
HW decoders inside decodebin. An easier soulution is to raise the
rank of vaapidecode, so that it gets selected first.

https://bugzilla.gnome.org/show_bug.cgi?id=739332
2014-11-18 18:38:33 +01:00
Gwenole Beauchesne
d1b7dc21f8 vaapidecode: only expose supported profiles when needed.
JPEG and VP8 codecs do not really support the concept of "profile". So,
don't try to expose any set that wouldn't be supported by jpegparse, or
ivfparse for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=739713
https://bugzilla.gnome.org/show_bug.cgi?id=739714
2014-11-14 15:26:07 +01:00
Sreerenj Balachandran
08bbab889b vaapipostproc: Add string representation of VPP functions to ElementFactoy Klass
Added the same Klass specifications used in other upstream
video postprocessing elements like videoconvert, videoscale,
videobalance and deinterlace.
An example use case is for this is to help the playsink
to autoplug the hardware accelerated deinterlacer.
2014-11-12 09:45:50 +01:00
Sreerenj Balachandran
626e180fef vaapipostproc: Tweak the output video format setting to enable the autoplugging
This is a workaround until auto-plugging is fixed when
format=ENCODED + memory:VASurface caps feature are provided.

Use the downstream negotiated video format as the output video format
if the user didn't ask for the colorspace conversion explicitly.
Usecase: This will help to connect elements like videoscale, videorate etc
to vaapipostproc.

https://bugzilla.gnome.org/show_bug.cgi?id=739443
2014-11-12 09:45:50 +01:00
Gwenole Beauchesne
eeb43989c1 vaapipostproc: allow user defined scaling mode.
Add new "scale-method" property to expose the scaling mode to use during
video processing. Note that this is only a hint, and the actual behaviour
may differ from implementation (VA driver) to implementation.
2014-10-29 17:33:48 +01:00
Sreerenj Balachandran
b58bdd1a12 vaapidecode: Expose the supported profiles as caps to upstream
This will allows the playbin to fallback to Software Decoder
if the Hardware Decoder does not support a particular profile.

https://bugzilla.gnome.org/show_bug.cgi?id=730997
2014-10-29 15:46:47 +02:00
Sreerenj Balachandran
7f3795c9fb encode: Attach the codec-data to out caps only based on negotiated caps
Attach the codec_data to out_caps only if downstream needed.
For eg: h264 encoder doesn't need to stuff codec_data to the
src caps if the negotiated caps has a stream format of byte-stream.

https://bugzilla.gnome.org/show_bug.cgi?id=734902
2014-10-29 15:46:12 +02:00
Gwenole Beauchesne
0b6d6d956e vaapisink: clean-ups (indentation, drop unused variables). 2014-09-24 13:49:32 +02:00
Gwenole Beauchesne
48e5bcbe7b vaapisink: fix GstNavigation "key-press" / "key-release" events.
Fix arguments to XkbKeycodeToKeysym() for converting an X11 keycode
to a KeySym. In particular, there is no such Window argument. Also
make sure to check for, and use, the correct <X11/XKBlib.h> header
where that new function is defined. Otherwise, default to the older
XKeycodeToKeysym() function.
2014-09-24 13:49:06 +02:00
Gwenole Beauchesne
039244bf77 vaapisink: fix GstNavigation "mouse-move" event.
Really use the motion event coordinates to propagate the "mouse-move"
event to upper layer, instead of those from a button event. Those are
technically the same though.
2014-09-24 13:48:27 +02:00
Sreerenj Balachandran
33212d9634 vaapisink: implement the GstNavigation interface
This is useful for things like DVD menus, where key/mouse events
would need to be forwarded from the upstream sink element.

https://bugzilla.gnome.org/show_bug.cgi?id=711479
2014-09-16 14:25:40 +03:00
Simon Farnsworth
406aa37373 vaapipostproc: fix deinterlacing from non VA memory buffers.
When we copy a buffer because we're moving it into VA-API memory, we
need to copy flags. Otherwise, interlaced YUV buffers from a capture
source (e.g. V4L2) don't get flagged as interlaced.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
[reversed order of gst_buffer_copy_into() flags to match <1.0 code]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-25 10:07:54 +02:00
Gwenole Beauchesne
b61d993e7d vaapipostproc: add support for GLTextureUploadMeta output.
This allows for vaapipostproc to be chained to the glimagesink element
for instance.

https://bugzilla.gnome.org/show_bug.cgi?id=735231
2014-08-22 18:52:23 +02:00
Gwenole Beauchesne
493337c4b1 vaapipostproc: add support for "download" capability.
Allow implicit conversions to raw video formats, while still keeping
VA surfaces underneath. This allows for chaining the vaapipostproc
element to a software-only element that takes care of maps/unmaps.
e.g. xvimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=720174
2014-08-22 18:20:46 +02:00
Gwenole Beauchesne
9ee46ab32e vaapipostproc: use pooled vaapi video meta.
Use pooled GstVaapiVideoMeta information, i.e. always allocate that on
video buffer allocation. Also optimize copy of additional metadata info
into the resulting video buffer: only copy the video cropping info and
the source surface proxy.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
[fixed proxy leak, fixed double free on error, optimized meta copy]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-22 18:15:31 +02:00
Gwenole Beauchesne
92fcb38ba6 vaapipostproc: fix passthrough mode.
If no explicit output surface format is supplied try to keep the one
supplied through the sink pad caps. This avoids a useless copy, even
if things are kept in GPU memory.

This is a performance regression from git commit dfa70b9.
2014-08-22 15:54:32 +02:00
Sreerenj Balachandran
db111fe72a vaapipostproc: fix output buffer to have a GstVaapiVideoMemory.
https://bugzilla.gnome.org/show_bug.cgi?id=720311

[used new infrastructure through base decide_allocation() impl]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
bc8e7a6734 vaapipostproc: enable advanced deinterlacing with same format.
If only advanced deinterlacing is requested, i.e. deinterlacing is
the only active algorithm to apply with source and output surface
formats being the same, then make sure to enable VPP processing.

Otherwise, allow fallback to bob-deinterlacing with simple rendering
flags alteration.
2014-08-22 15:54:32 +02:00
Sreerenj Balachandran
aa4d1f5a1e vaapivideomemory: avoid NULL pointer unref if GstVaapiImage creation failed.
https://bugzilla.gnome.org/show_bug.cgi?id=735156
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
c257c3232a plugins: fix memory leaks. 2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
d0a9575fc2 plugins: factor out decide_allocation() hook.
Add a default decide_allocation() hook to GstVaapiPluginBase. The caps
feature argument can be used to force a bufferpool with a specific kind
of memory.
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
1ef5a3a200 plugins: allow bufferpool to not allocate vaapi video meta.
Add GST_VAAPI_VIDEO_BUFFER_POOL_ACQUIRE_FLAG_NO_ALLOC params flag that
can be used to disable early allocations of vaapi video metas on buffers,
thus delagating that to the bufferpool user.
2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
038d56bdca plugins: re-indent all GstVaapiVideo* related source code. 2014-08-22 15:54:32 +02:00
Gwenole Beauchesne
dfa70b9e85 vaapipostproc: fix detection of output surface format changes.
Default to I420 format for output surfaces so that to match the usual
GStreamer pipelines. Though, internally, we could still opt for NV12
surface formats, i.e. default format=ENCODED is a hint for that, thus
delegating the decision to the VA driver.
2014-08-21 09:40:06 +02:00
Gwenole Beauchesne
913f2ef68c vaapipostproc: fix construction of allowed sink pad caps.
Fix construction of the set of caps allowed on the sink pad to filter
out unsupported raw video caps with GStreamer >= 1.2.
2014-08-21 09:39:40 +02:00
Gwenole Beauchesne
d82e6a8866 vaapipostproc: improve heuristics for detecting native VA surfaces.
Use the new gst_caps_has_vaapi_surface() helper function to detect
whether the sink pad caps contain native VA surfaces, or not, i.e.
no raw video caps.

Also rename is_raw_yuv to get_va_surfaces to make the variable more
explicit as we just want a way to differentiate raw video caps from
VA surfaces actually.
2014-08-21 09:39:09 +02:00
Gwenole Beauchesne
6d8c5221b2 vaapipostproc: disable discontinuity detection code.
The "discontinuity" tracking code, whereby lost frames are tentatively
detected, is inoperant if the sink pad buffer timestamps are not right
to begin with.

This is a temporary workaround until the following bug is fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=734386
2014-08-21 09:38:53 +02:00
Gwenole Beauchesne
197001768b vaapipostproc: fix heuristic for detecting discontinuity.
In order to make the discontinuity detection code useful, we need to
detect the lost frames in the history as early as the previous frame.
This is because some VA implementations only support one reference
frame for advanced deinterlacing.

In practice, turn the condition for detecting new frame that is beyond
the previous frame from field_duration*2 to field_duration*3, i.e.
nothing received for the past frame and a half because of possible
rounding errors when calculating the field-duration either in this
element (vaapipostproc), or from the upstream element (parser element).

This is a regression introduced with commit faefd62.

https://bugzilla.gnome.org/show_bug.cgi?id=734135
2014-08-21 09:38:18 +02:00
Gwenole Beauchesne
7e9ac1cb98 plugins: fix detection of raw video caps.
Use the new gst_caps_has_vaapi_surface() helper function to better
detect raw video caps, and in particular those from RGB colorspace.

https://bugzilla.gnome.org/show_bug.cgi?id=734665
2014-08-21 09:36:39 +02:00
Gwenole Beauchesne
95d1826dca plugins: add helper for detecting VA surfaces in caps.
Introduce new gst_caps_has_vaapi_surface() helper function to detect
whether the supplied caps has VA surfaces. With GStreamer >= 1.2, this
implies a check for memory:VASurface caps features, and format=ENCODED
for earlier versions of GStreamer.
2014-08-21 09:36:36 +02:00
Sebastian Dröge
3b2e06be6c vaapidecode: start the decoder task again after finishing
This allows the element to accept data again after draining without
a hard reset or caps change happening in between.

https://bugzilla.gnome.org/show_bug.cgi?id=734616
2014-08-20 17:25:07 +02:00
Sebastian Dröge
2af44842c6 vaapidecode: unlock condition variables before shutting down the element
Otherwise threads might wait for them, causing the shutdown of the element
to deadlock on the streaming thread.

https://bugzilla.gnome.org/show_bug.cgi?id=734616
2014-08-20 17:25:07 +02:00
Sebastian Dröge
c551cc7cc3 vaapidecode: reset decoder_finish variable after stopping the decoder thread
Otherwise the element is not usable again after draining/EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=734616
2014-08-20 17:25:04 +02:00
Sebastian Dröge
4ff4563a47 vaapidecode: don't try flushing the decoder instance if we didn't create one yet
This otherwise results in unnecessary error messages.

https://bugzilla.gnome.org/show_bug.cgi?id=734616
2014-08-20 17:24:59 +02:00
Gwenole Beauchesne
7ac501d026 build: fix with --no-undefined linker flags.
https://bugzilla.gnome.org/show_bug.cgi?id=729352
2014-08-01 11:05:01 +02:00
Changzhi Wei
c201f738fe vaapisink: add support for GstColorBalance interface.
https://bugzilla.gnome.org/show_bug.cgi?id=722390

[fixed channel names, simplified range factor, fixed memory leak]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-31 18:49:55 +02:00
Changzhi Wei
5a95cd5645 vaapisink: add support for colorbalance adjustment.
https://bugzilla.gnome.org/show_bug.cgi?id=722390

[fixed and simplified tracking of colorbalance value changes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-31 18:48:46 +02:00
Gwenole Beauchesne
6e92a82138 vaapisink: improve installation of properties.
Simplify the creation and installation process of properties, by first
accumulating them into a g_properties[] array, and next calling into
g_object_class_install_properties().

Also add missing docs and flags to some properties.
2014-07-31 18:48:46 +02:00
Gwenole Beauchesne
d1f83b4570 vaapisink: code clean-ups.
Move code around in a more logical way. Introduce GST_VAAPISINK_CAST()
helper macro and use it wherever we know the object is a GstBaseSink or
any base class. Drop explicit initializers for values that have defaults
set to zero.
2014-07-31 18:48:46 +02:00
Gwenole Beauchesne
1824a80957 vaapisink: re-indent all GstVaapiSink related source code. 2014-07-31 18:48:46 +02:00
Gwenole Beauchesne
30c59af0a0 vaapisink: introduce separate backends.
Introduce new backends vtable so that to have clean separation between
display dependent code and common base code. That's a "soft" separation,
we don't really need dedicated objects.

https://bugzilla.gnome.org/show_bug.cgi?id=722248
2014-07-30 18:38:03 +02:00
Gwenole Beauchesne
24673dc3a4 vaapisink: drop unused "synchronous" mode.
Support for X11 "synchronous" mode was never implemented, and was only
to be useful for debugging. Drop that altogether, that's not going to
be useful in practice.

https://bugzilla.gnome.org/show_bug.cgi?id=733985
2014-07-30 18:35:31 +02:00
Gwenole Beauchesne
81b5ad85b5 vaapisink: drop unused variables.
Drop obsolete, and now unused, video_buffer_pool and video_buffer_size
variables. They got merged into the GstVaapiPluginBase object.
2014-07-30 18:35:31 +02:00
Gwenole Beauchesne
8298d64aad vaapisink: drop GLX rendering and fancy effects.
Rendering with GLX in vaapisink is kind of useless nowadays, including
OpenGL related fancy effects. Plain VA/GLX interfaces are also getting
deprecated in favor of EGL, or more direct buffer sharing with actual
GL textures.

Should testing of interop with GLX be needed, one could still be using
the modern cluttersink or glimagesink elements.

https://bugzilla.gnome.org/show_bug.cgi?id=733984
2014-07-30 18:35:31 +02:00
Holger Kaelberer
4b61cc3cd7 vaapisink: listen to window size changes on X11.
Allow dynamic changes to the window, e.g. performed by the user, and
make sure to refresh its contents, while preserving aspect ratio.

In practice, Expose and ConfigureNotify events are tracked in X11
display mode by default. This occurs in a separte event thread, and
this is similar to what xvimagesink does. Any of those events will
trigger a reconfiguration of the window "soft" size, subsequently
the render-rect when necessary, and finally _expose() the result.

The default of handle_events=true can be changed programatically via
gst_x_overlay_handle_events().

Thanks to Fabrice Bellet for rebasing the patch.

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

[dropped XInitThreads(), cleaned up the code a little]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-30 15:46:14 +02:00
Gwenole Beauchesne
528f486513 vaapidecode: decode and output all pending frames on normal EOS.
The gst_vaapidecode_decode_loop() function is called within a separate
task to fetch and output all frames that were decoded so far. So, if
the decoder_loop_status is forcibly set to EOS when _finish() is called,
then we are bound to exist the task without submitting the pending
frames.

If the downstream element error'ed out, then the gst_pad_push() would
propagate up an error and so we will get it right for cutting off
_finish() early in that case.

This is a regression from 6003596.

https://bugzilla.gnome.org/show_bug.cgi?id=733897
2014-07-29 15:47:46 +02:00
Matthew Waters
6003596e82 vaapidecode: properly return from decode loop on downstream errors.
Fixes a hang/race on shutdown where _decode_loop() had already completed
its execution and _finish() was waiting on a GCond for decode_loop()
to complete.  Also fixes the possible race where _finish() is called
but _decode_loop() endlessly returns before signalling completion
iff the decoder instance returns GST_FLOW_OK.

Found with: ... ! vaapidecode ! {glimagesink,cluttersink}

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

[factored out GST_VIDEO_DECODER_STREAM_UNLOCK() call]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-29 10:21:02 +02:00
Gwenole Beauchesne
b8601cf4c5 vaapisink: fix GstVideoOverlay::expose() implementation.
Now that we always track the currently active video buffer, it is
not necessary to automatically increase its reference since this is
implicitly performed in ::show_frame() through the get_input_buffer()
helper from GstVaapiPluginBase class.

This is a regression from a26df80.
2014-07-28 18:34:13 +02:00
Gwenole Beauchesne
0607898019 vaapidecode: simplify bufferpool configuration.
Rework the logics behind the configuration of an adequate bufferpool,
especially when OpenGL meta or additional capsfeatures are needed.

Besides, for GStreamer >= 1.4, the first capsfeatures that gets matched,
and that is not system memory, is now selected by default.
2014-07-28 18:34:13 +02:00
Gwenole Beauchesne
c5102c72af vaapidecode: fix auto-plugging of vaapisink element.
Make sure to propagate memory:VASurface capsfeature to srcpad caps
only for GStreamer >= 1.5 as the plug-in elements in GStreamer 1.4
core currently miss additional patches available in 1.5-git (1.6).

This is a temporary workaround.
2014-07-28 18:34:13 +02:00
Gwenole Beauchesne
aa2fab43bd vaapisink: allow a specific view component to be displayed.
If a multiview stream is decoded, multiple view components are submitted
as is downstream. It is the responsibility of the sink element to display
the required view components. By default, always select the frame buffer
that matches the view-id of the very first frame to be displayed.

However, introduce a "view-id" property to allow the selection of a
specific view component of interest to display.
2014-07-28 10:29:57 +02:00
Gwenole Beauchesne
a26df804a6 vaapisink: always keep the last displayed buffer around.
Always record the VA surface that is currently being rendered, no matter
the fact we are using texturedblit or overlay. That's because in some
occasions, we need to refresh or resize the displayed contents based on
new events. e.g. user-resized window.

Besides, it's simpler to track the last video buffer in GstVaapiSink than
through the base sink "last-sample".
2014-07-28 10:12:49 +02:00
Gwenole Beauchesne
5ffa82b64c vaapisink: add support for "display-name" property.
Add a "display-name" property to vaapisink so that the end user could
select the desired output. Keep "display-name" in-line with the existing
"display" (GstVaapiDisplayXXX type).

So, for X11 or GLX, the "display-name" is the usual display name as we
know for XOpenDisplay(); for Wayland, the "display-name" is the name used
for wl_display_connect(); and for DRM, the "display-name" is actually the
DRI device name.

https://bugzilla.gnome.org/show_bug.cgi?id=722247
2014-07-25 17:36:12 +02:00
Gwenole Beauchesne
cafb25c4d1 vaapidecode: add support for VideoAlignment bufferpool option.
Always add VideoAlignment bufferpool option if the downstream element
expects its own pool to be used but does not offer it through a proper
propose_allocation() implementation for instance, and that the ALLOCATION
query does not expose the availability of the Video Meta API.

This fixes propagation of video buffer stride information to Firefox.
2014-07-25 15:52:06 +02:00
Gwenole Beauchesne
1d1be0ae76 vaapivideomemory: always prefer native VA surface formats.
Make sure to always prefer native internal formats for the VA surfaces
that get allocated. Also disable "direct-rendering" mode in this case.

This is needed so that to make sure that anything that gets out of the
decoder, or anything that gets into the encoder, is in native format
for the hardware, and thus the driver doesn't need to perform implicit
conversions in there. Interop with SW elements is still available with
fast implementations of VA imaging APIs.
2014-07-25 15:44:58 +02:00
Gwenole Beauchesne
e0e869f536 vaapivideomemory: disallow memory shares across buffers, use a copy.
Forbid shares of GstMemory instances, and rather make copy of it. This
effectively copies the GstMemory structure and enclosed metadata, but
this does not copy the VA surface contents itself. It should though.

This fixes preroll and makes sure to not download garbage for the first
frame when a SW rendering sink is used.
2014-07-24 11:58:29 +02:00
Gwenole Beauchesne
3a762284a2 vaapivideomemory: use an image pool to cache objects.
Use an image pool to hold VA images to be used for downloads/uploads
of contents for the associated surface.

This is an optmization for size. So, instead of creating as many VA
images as there are buffers (then VA surfaces) allocated, we only
maintain a minimal set of live VA images, thus preserving memory
resources.
2014-07-24 06:55:26 +02:00
Gwenole Beauchesne
c3643b42a4 vaapivideomemory: forbid R/W mappings if non direct-rendering mode.
Disable read-write mappings if "direct-rendering" is not supported.
Since the ordering of read and write operations is not specified,
this would require to always download the VA surface on _map(), then
commit the temporary VA image back to the VA surface on _unmap().

Some SW decoding plug-in elements still use R/W mappings though.

https://bugzilla.gnome.org/show_bug.cgi?id=733242
2014-07-24 00:14:09 +02:00
Gwenole Beauchesne
f2ce28e4b7 vaapivideomemory: minor code clean-ups.
Fix error messages introduced in the previous commit for the _map()
imaplementation. Also use the new get_image_data() helper function
to determine the base pixels data buffer from a GstVaapiImage when
updating the video info structure from it.
2014-07-23 23:53:15 +02:00
Gwenole Beauchesne
9cad85a936 vaapivideomemory: add support for raw pixels mappings.
Allow raw pixels of the whole frame to be mapped read-only. i.e. in
cases where the buffer pool is allocated without VideoMeta API, thus
individual planes cannot be mapped.

This is initial support for Firefox >= 30.

https://bugzilla.gnome.org/show_bug.cgi?id=731886
2014-07-23 19:14:47 +02:00
Sreerenj Balachandran
9cb3acc813 vaapivideomemory: fix determination of the surface pool format.
While creating the vaapi video allocator, make sure the associated
surface pool has correct format instead of defaulting to NV12 video
format even though there is no direct rendering support.

https://bugzilla.gnome.org/show_bug.cgi?id=732691
2014-07-23 18:48:32 +02:00
Gwenole Beauchesne
b07de8a7f9 vaapivideomemory: fix association of surface to proxy.
Make sure to always update the VA surface pointer whenever the proxy
changes. This used to only work when the VA surface is written to, in
interop with SW element ("upload" feature), and this now fixes cases
when the VA surface is needed for reading, in interop with SW element
("download" feature).
2014-07-23 18:01:21 +02:00
Gwenole Beauchesne
dac20cecb4 plugins: expose I420 format for interop with SW elements.
Always expose I420 format by default when the VA surface could be
mapped for interoperability with non harware accelerated elements.
However, the default behaviour remains the auto-plugging of vaapi
elements, down to the sink.

Side effect: "direct-rendering" mode is also disabled most of the
times as plain memcpy() from uncached speculative write combining
memory is not going to be efficient enough.
2014-07-23 16:25:08 +02:00
Gwenole Beauchesne
dc6d529830 plugins: allow download capability to vaapidecode element.
Fix support for VA surface download capability in vaapidecode element
for GStreamer >= 1.2. This is a fix to supporting libva-vdpau-driver,
but also the libva-intel-driver while performing hardware accelerated
conversions from the native VA surface format (NV12) to the desired
output VA image format.

For instance, this fixes pipelines involving vaapidecode ! xvimagesink.

https://bugzilla.gnome.org/show_bug.cgi?id=733243
2014-07-22 19:06:52 +02:00
Lionel Landwerlin
334a0ca8bd vaapidecode: make decoder work with playbin
When playbin/decodebin builds the pipeline, it puts decoders and sinks
into different bins and forwards the queries from bins to bins. So in
the initials steps the pipeline is built iteratively by playbin and
looks like this :

[filesrc]

[filesrc] -> [typefind]

[filesrc] -> [typefind] -> [demuxer]

[filesrc] -> [typefind] -> [demuxer] -> [decoder]

At this point the decoder is asked for its SRC caps and it will make a
choice based on what gst_pad_peer_query_caps() returns. The problem is
that the caps returns at that point includes caps features like ANY,
essentially because playbin can plug in additional elements like
videoscale, videoconv or deinterlace.

This patch adds a another call to
gst_vaapi_find_preferred_caps_feature() when the decoder decides its
allocation, to make sure we asks the downstream elements when the
entire pipeline has been built.

https://bugzilla.gnome.org/show_bug.cgi?id=731645
2014-07-03 23:07:51 +02:00
Simon Farnsworth
4d2de696a9 vaapipostproc: don't let tmp_rect go out of scope.
A compiler change showed me that tmp_rect went out of scope before
it was used. Move it to the beginning of the function instead.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
[added guards for GStreamer 0.10 builds]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-07-03 22:59:36 +02:00
Gwenole Beauchesne
700fd242cc build: fix for GStreamer 0.10. 2014-07-03 19:43:04 +02:00
Sreerenj Balachandran
cb9f98f0d5 decoder: h264: add support for NALU "alignment" optimization.
We can avoid scanning for start codes again if the bitstream is fed
in NALU chunks. Currently, we always scan for start codes, and keep
track of remaining bits in a GstAdapter, even if, in practice, we
are likely receiving one GstBuffer per NAL unit. i.e. h264parse with
"nal" alignment.

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

[use gst_adapter_available_fast() to determine the top buffer size]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-19 15:29:12 +02:00
Gwenole Beauchesne
9d417815ab vaapipostproc: don't crash with dynamic framerate (0/1).
Avoid reaching an assert if dynamic framerates (0/1) are used. One
way to solve this problem is to just stick field_duration to zero.
However, this means that, in presence of interlaced streams, the
very first field will never be displayed if precise presentation
timestamps are honoured.

https://bugzilla.gnome.org/show_bug.cgi?id=729604
2014-06-19 14:51:01 +02:00
Simon Farnsworth
1a2c06a81c vaapipostproc: create filter surface pool if it does not exist yet.
ensure_srcpad_buffer_pool() tries to avoid unnecessarily deleting and
recreating filter_pool. Unfortunately, this also meant it didn't create
it if it did not exist.

Fix it to always create the buffer pool if it does not exist.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
2014-06-18 17:30:12 +02:00
Zhao, Halley
faefd62e9b vaapipostproc: reset deinterlacer state when there is a discontinuity.
Reset deinterlacer state, i.e. past reference frames used for advanced
deinterlacing, when there is some discontinuity detected in the course
of processing source buffers.

This fixes support for advanced deinterlacing when a seek occurred.

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

[fixed type of pts_diff variable, fetch previous buffer PTS from the
 history buffer, reduce heuristic for detecting discontinuity]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 17:24:48 +02:00
Gwenole Beauchesne
b3401dbb29 vaapipostproc: add support for crop regions in VPP mode.
Apply video cropping regions stored in GstVideoCropMeta, or in older
GstVaapiSurfaceProxy representation, to VPP pipelines. In non-VPP modes,
the crop meta are already propagated to the output buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=720730
2014-06-18 16:24:52 +02:00
Simon Farnsworth
927fd2e1a8 vaapipostproc: make deinterlace-mode behave as expected.
deinterlace-mode didn't behave in the way you'd expect if you have
past experience of the deinterlace element. There were two bugs:

 1. "auto" mode wouldn't deinterlace "interleaved" buffers, only "mixed".
 2. "force" mode wouldn't deinterlace "mixed" buffers flagged as progressive.

Fix these up, and add assertions and error messages to detect cases that
aren't handled.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 16:24:23 +02:00
Matthieu Bouron
ead38a4d77 vaapidecode: do not discard video info props when the format changed.
gst_video_info_set_format() does not preserve video info properties. In
order to keep important information in the caps such as interlace mode,
framerate, pixel aspect ratio, ... we need to manually copy back those
properties after setting the new video format.

https://bugzilla.gnome.org/show_bug.cgi?id=722276
2014-06-18 13:59:09 +02:00
Matthew Waters
3fbef25e13 vaapidecode: plug a memory leak.
It can happen that there is a pool provided that does not advertise
the vappivideometa. We should unref that pool before using our own.

Discovered with vaapidecode ! {glimagesink,cluttersink}

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

[fixed compilation by adding the missing semi-colon]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 13:58:49 +02:00
Gwenole Beauchesne
abfb5dd06c vaapidecode: parse source data until a frame is obtained.
Parse any pending data until a complete frame is obtained. This is a
memory optimization to avoid expansion of video packets stuffed into
the GstAdapter, and a fix to EOS condition to detect there is actually
pending data that needs to be decoded, and subsequently output.

https://bugzilla.gnome.org/show_bug.cgi?id=731831
2014-06-18 13:47:36 +02:00
Gwenole Beauchesne
5e5d62cac7 vaapisink: fix initialization with "drm" display type.
Force early initializatin of the GstVaapiDisplay so that to make sure
that the sink element display object is presented first to upstream
elements, as it will be correctly featuring the requested display type
by the user.

Otherwise, we might end up in situations where a VA/X11 display is
initialized in vaapidecode, then we try VA/DRM display in vaapisink
(as requested by the "display" property), but this would cause a failure
because we cannot acquire a DRM display that was previously acquired
through another backend (e.g. VA/X11).
2014-06-13 17:42:35 +02:00
Gwenole Beauchesne
eef863f82f plugins: fix initialization with foreign context.
When a new display is settled through GstElement::set_context() (>= 1.2),
or GstVideoContext::set_context() (<= 1.0), then we shall also update the
associated display type.
2014-06-13 17:42:29 +02:00