Commit graph

286 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
eb911e9eab vaapidecode: move GstCapsFeatures near to its use
Move the handling of the GstCapsFeatures just after it is used, in order to
avoid handling its memory.
2016-04-18 19:07:55 +02:00
Víctor Manuel Jáquez Leal
3531dfa35e vaapidecode: caps negotiation checks
Check that GLUploadTexture is not negotatiated if gstreamer-vaapi is not
compiled with GL support.
2016-04-18 19:07:55 +02:00
Víctor Manuel Jáquez Leal
c5c60e2a33 plugins: remove param in gst_vaapi_plugin_base_decide_allocation() 2016-04-18 19:07:55 +02:00
Víctor Manuel Jáquez Leal
7f0bf08728 vaapidecode: bail early if not caps in decide_allocation() 2016-04-18 19:07:55 +02:00
Víctor Manuel Jáquez Leal
8d42c95b0f plugin: use allowed caps filter from element
Instead of using the srcpad template caps for filtering the peer caps, the
function gst_vaapi_find_preferred_caps_feature(), now receives a new parameter
for the element's allowed caps.

With this modification, the vaapipostproc element simplifies a bit its code.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
2d7d38cb9c plugin: remove function parameter
The native format parameter in gst_vaapi_find_preferred_caps_feature() can be
saved if the out format is used for both: in and out. Thus the code is more
readable.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
79ec3d00ef vaapidecode: warns if driver will do color conversions
If the downstream feature is system memory, the surface has to be mapped,
hence a warning message is logged saying that the driver has to do color
conversions. This might be troublesome because not all the color conversion
combinations are supported by the VA-API drivers, and there is not a reliable
way to know them before hand.

https://bugzilla.gnome.org/show_bug.cgi?id=765223
2016-04-18 18:28:43 +02:00
Víctor Manuel Jáquez Leal
8c26070151 vaapidecode: use macros for GstVideoInfo
Instead of accessing directly to the members of the structure, use the macros.
2016-04-18 16:55:01 +02:00
Víctor Manuel Jáquez Leal
aa16804121 vaapidecode: refactor is_display_resolution_changed()
Make the comparisons more readable and simple.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
49a59f00eb vaapidecode: keep only display_{width,height}
Instead of keeping the structure GstVideoInfo when we are using its width and
height, we only keep these two guints.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
737fca4ddf vaapidecode: decoded_info is valid at src caps update
As decoded_info is assured to be valid when gst_vaapidecode_update_src_caps()
is called, then we don't need to verify or replace it with the sinkpad info
(reference state).

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
3e97d71935 vaapidecode: always a valid format in decoded_info
Always set a valid format in decoded_info class variable.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
ade0c7bb43 vaapidecode: code style fixes
No functional changes.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
80eb682b64 vaapidecode: init {decoded,display}_info at open()
It is required to initialize {decoded,display}_info variables when the decoder
is open, not only at instance initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
3478b27c92 vaapidecode: remove spurious class variables
active, do_pool_renego and do_outstate_renego class variables were used to
indicate when negotiate downstream once, but now that each time a new surface
resolution is pop out a renegotation verified, these variable are not required
anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
8169c6afb1 remove custom allocation query
When resolving bug 753914, a custom allocation query was added, overlapping
the responsibilities of GstVideoDecoder.

But with the merge of the patches from bug 764421 this overlapping was not
required anymore. This patch restores this situation setting the
allocation_caps in the GstVideoCodecState when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-04-18 11:14:04 +02:00
Víctor Manuel Jáquez Leal
6ec2a09729 plugins: disable GL_TEXTURE_UPLOAD if no EGL/GLX
The plugins should not expose the feature meta:GstVideoGLTextureUploadMeta in
their caps templates if they were not compiled either with GLX or EGL support.
2016-04-13 20:35:59 +02:00
Thiago Santos
506c9e2b5b vaapidecode: add stop function
Clear any status on the current stream:

stored frames, caps and decoder configuration

https://bugzilla.gnome.org/show_bug.cgi?id=763460
2016-04-01 09:53:24 -03:00
Víctor Manuel Jáquez Leal
fe08f7ecdc vaapidecode: move gst_vaapidecode_negotiate() code
With it we can remove a function declaration, making the code a bit
more readable.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
2016-03-30 16:22:51 +02:00
Víctor Manuel Jáquez Leal
aac0f50500 docs: generate vaapijpegdec documentation
https://bugzilla.gnome.org/show_bug.cgi?id=764314
2016-03-30 15:07:43 +02:00
Sreerenj Balachandran
fd04a7c046 gst/vaapi: keep precedence for NV12 over I420
Use NV12 as default "assumption" format all over.
NV12 is the default high priority format used my most of the
vaapi-drivers.
2016-03-29 15:02:46 +03:00
Sreerenj Balachandran
75a20deab4 vaapidecode: Use video format derived from decoded surface as default src pad format
Use the surface format derived from first decoded surface
to negotiate the downstream video format capabilities.

https://bugzilla.gnome.org/show_bug.cgi?id=759181
2016-03-29 14:34:37 +03:00
Scott D Phillips
eea3f0cdb2 Add P010 video format support
The P010 video format is the native format used by the vaapi intel driver
for HEVCMain10 decode . Add support for planes and images of this video format.

https://bugzilla.gnome.org/show_bug.cgi?id=759181
2016-03-29 14:34:00 +03:00
Sreerenj Balachandran
959d14ce8a vaapidecode: Fix decide_allocation handling
Set the already configured pool in decide_allocation query
in cases where pool renegotiation is not required.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:09:43 +02:00
Sreerenj Balachandran
6b17ed9060 vaapidecode: Derive and save the decoded surface format
After the decoding of first frame, try to extract the exact
decoded surface format using vaDeriveImage and keep this
as the format in decoded_info.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:09:15 +02:00
Sreerenj Balachandran
859a2b2f4f Make vaapidecode to advertise the cropped values in srcpad, but negotiate pool only if needed
-- Maintaing decoded surface resoluton and actual display resoultion separately
-- Before pushing every frames downstream, check for the requirement of pool negoation and
output_state negotiation: This is needed to avoid multiple issuses with cropping,
multi-resoluton video handling, more complex multi resolution decode scenarios for vp9decode,
possible wrong behaviour from upstream element to report uncropped values etc. Due to these reasons,
We can't just reliably use the resolution change notification from libgstvaapi for pool renegotiation too.
This is slight overhead, but safe enough. Optimization could be possible though.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:08:50 +02:00
Sreerenj Balachandran
c2aa405a3e vaapidecode: Delay the output format setting until we have a decoded surface
This will help to consoidate the out caps negotiation to a single place,
which will make the code simpler, allows to get the exact decoded format
if needed and the selected chroma type too.

https://bugzilla.gnome.org/show_bug.cgi?id=753914
2016-03-24 15:08:27 +02:00
Víctor Manuel Jáquez Leal
1e1d3b1d09 vaapidecode: split out jpeg decoder
Split, as a different element, the JPEG decoder.

https://bugzilla.gnome.org/show_bug.cgi?id=734093
2016-03-11 10:23:08 +01:00
Víctor Manuel Jáquez Leal
96ac9bee8e vaapidecode: register decoder with internal GType
Don't expose the the vaapidecode GType, instead expose a function
which will register element.

This is the first step to split the decoder by codecs.

https://bugzilla.gnome.org/show_bug.cgi?id=734093
2016-03-11 09:42:37 +01:00
Víctor Manuel Jáquez Leal
8aa880786d vaapidecode: remove unused function declaration
There is no need to pre-declare gst_vaapidecode_update_sink_caps(). And fixed
code-style of the other pre-declared functions.
2016-03-10 12:54:39 +01:00
Víctor Manuel Jáquez Leal
548528c817 plugins: proxy information from downstream caps
Propagate to upstream the downstream information, such as fps, par, etc.

This will fix several "getcaps" critical warnings in gst-validate.

https://bugzilla.gnome.org/show_bug.cgi?id=763300
2016-03-08 10:54:04 +01:00
Víctor Manuel Jáquez Leal
861ef4d218 vaapidecode: intersect with filter in getcaps()
In commit 6034734d I forgot to add the caps filter intersection in the
getcaps() vmethod generating a regression when a capsfilter is set in the
pipeline.

This commit adds the caps filter intersection.
2016-03-01 11:35:49 +01:00
Víctor Manuel Jáquez Leal
6034734d73 vaapidecode: use video decoder getcaps()
The usage of getcaps() vmethod is preferred than to handle manually the sink's
caps query.

In order to avoid function declarations, this patch moves the class_init()
method to the end of the file.
2016-02-22 18:01:07 +01:00
Vineeth TM
ac01304cec vaapidecode: Fix videocodec state memory leak
When state is not NULL and either width/height of video info is 0, then state leaks

https://bugzilla.gnome.org/show_bug.cgi?id=762173
2016-02-17 10:45:29 +02:00
Vineeth TM
26abec3e26 vaapidecode: Fix capsfeature memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=762116
2016-02-16 15:10:26 +02:00
Víctor Manuel Jáquez Leal
9b8fb25b8c docs: update plugin documentation
Update all the documentation of elements of the vaapi plugin.

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-02-03 12:17:59 +01:00
Tim-Philipp Müller
24168a2093 vaapi: fix 'ISO C90 forbids mixed declarations and code' compiler warnings
Declare variables at the beginning of a code block, which
is how it's done in GStreamer.

https://bugzilla.gnome.org/show_bug.cgi?id=759192
2016-02-02 16:17:43 +01:00
Sreerenj Balachandran
0a9ce66ec7 vaapidecode: Fix renegotiation for resolution change
Always renegotiate the pool if the immediate frame which going
to be pushed has a different un-cropped resolution than the already
configured one.
2016-02-02 16:17:43 +01:00
Víctor Manuel Jáquez Leal
1c722efe54 Remove old gst version guards
As gstreamer-vaapi now only supports from GStreamer 1.6, this patch removes
all the old GStreamer version guards.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2016-01-25 12:09:40 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Michael Olbrich
b7d7a0197d vaapidecode: don't print an error message for GST_FLOW_FLUSHING 2015-01-27 14:50: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