vaapi:gstreamer-vaapi.git
2 years agocodecparsers: update to gst-vaapi-branch commit 1f792e4 master
Sreerenj Balachandran [Fri, 3 Apr 2015 20:30:24 +0000 (23:30 +0300)]
codecparsers: update to gst-vaapi-branch commit 1f792e4

87f4a7e: bytereader: add gst_byte_reader_peek_sub_reader() and _get_sub_reader()
7d8ba7a: bytereader: use unchecked inline variant for get_remaining in more places
2528ea6: bytereader: add gst_byte_reader_masked_scan_uint32_peek
2b92a67: h264parse: reset the parser information when caps changes
05eee86: codecparsers: Indent file
e27a38b: codecparsers: Add READ_UE_MAX macro
2036471: Constify some static arrays everywhere

2 years agoRemove the gstvaapivideoconverter_*.c source files missed in commit 51b1e4a
Sreerenj Balachandran [Fri, 3 Apr 2015 14:45:08 +0000 (17:45 +0300)]
Remove the gstvaapivideoconverter_*.c source files missed in commit 51b1e4a

2 years agoRemoval of gstreamer-1.0 support
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:09:08 +0000 (17:09 +0300)]
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>
2 years agoupdate and move gstcompat.h
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:08:30 +0000 (17:08 +0300)]
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>
2 years agoautotools: remove gstreamer-1.0 support
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:05:45 +0000 (17:05 +0300)]
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>
2 years agoRemove the gstreamer-videoutils submodule
Sreerenj Balachandran [Fri, 3 Apr 2015 14:03:38 +0000 (17:03 +0300)]
Remove the gstreamer-videoutils submodule

2 years agoRemove libgstvaapi-videoutils.so
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 14:01:45 +0000 (17:01 +0300)]
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>
2 years agoRemove HAVE_GST_VIDEO_OVERLAY_HWCAPS macro
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 13:55:43 +0000 (16:55 +0300)]
Remove HAVE_GST_VIDEO_OVERLAY_HWCAPS macro

This macro guarded the use of HAVE_GST_VIDEO_OVERLAY_HWCAPS, which was not
defined before gstreamer 0.10.35. Since the support of gstreamer-0.10 is
deprecated these guards are not required.

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>
2 years agoRemoval of gstreamer-0.10 support
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 13:55:27 +0000 (16:55 +0300)]
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>
2 years agoautotools: remove gstreamer-0.10 support
Víctor Manuel Jáquez Leal [Fri, 3 Apr 2015 13:54:54 +0000 (16:54 +0300)]
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>
2 years agovaapidecode: add drain() vmethod
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:38:18 +0000 (23:38 +0200)]
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>
2 years agovaapidecode: remove vmethod reset()
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:37:29 +0000 (23:37 +0200)]
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>
2 years agovaapidecode: handle flush() vmethod
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:36:33 +0000 (23:36 +0200)]
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>
2 years agovaapidecode: call the correct query function
Víctor Manuel Jáquez Leal [Mon, 16 Mar 2015 21:10:53 +0000 (23:10 +0200)]
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

2 years agogitmodules: Use https:// url instead of git:// for submodules.
Sreerenj Balachandran [Sat, 14 Mar 2015 22:36:45 +0000 (00:36 +0200)]
gitmodules: Use https:// url instead of git:// for submodules.

Gitorious is failing to clone repositories over git:// url.

2 years agovaapidisplay: mark X11 display as compatible with EGL
Julien Isorce [Sat, 14 Mar 2015 20:12:19 +0000 (22:12 +0200)]
vaapidisplay: mark X11 display as compatible with EGL

GST_GL_WINDOW=x11 GST_GL_API=gles2 GST_GL_PLATFORM=egl
gst-launch-1.0 ... ! vaapidecode ! glimagesink

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

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
2 years agovaapidecode: Don't crash if a buffer outlives the decoder
Olivier Crete [Fri, 6 Mar 2015 13:20:01 +0000 (15:20 +0200)]
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>
2 years agovaapidecode: clean-ups (indentation, drop unused variables)
Sreerenj Balachandran [Fri, 6 Mar 2015 12:31:21 +0000 (14:31 +0200)]
vaapidecode: clean-ups (indentation, drop unused variables)

2 years agovaapidecode: use the query virtual methods in 1.4
Víctor Manuel Jáquez Leal [Fri, 6 Mar 2015 12:09:22 +0000 (14:09 +0200)]
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

2 years agovaapipostproc: always activate buffer pool
Víctor Manuel Jáquez Leal [Fri, 6 Mar 2015 10:16:17 +0000 (12:16 +0200)]
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

2 years agovaapisink: fix minor memory leak in debug mode.
Gwenole Beauchesne [Mon, 2 Mar 2015 16:04:20 +0000 (17:04 +0100)]
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().

2 years agovaapidecodebin: Avoid usage of "__" prefix in macro names
Sreerenj Balachandran [Tue, 3 Mar 2015 10:37:41 +0000 (12:37 +0200)]
vaapidecodebin: Avoid usage of "__" prefix in macro names

Avoiding "__" prefix usage in Header File Guards as per
C standard recommendation.

2 years agoplugins: Disable vaapidecodebin for GStreamer < 1.4
Sreerenj Balachandran [Tue, 3 Mar 2015 10:31:11 +0000 (12:31 +0200)]
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.

2 years agoplugins: Add a vaapidecodebin element
Sreerenj Balachandran [Mon, 2 Mar 2015 13:19:40 +0000 (15:19 +0200)]
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

2 years agovaapidecode: re-indent (gst-indent) gstvaapidecode.c
Sreerenj Balachandran [Mon, 2 Mar 2015 12:59:16 +0000 (14:59 +0200)]
vaapidecode: re-indent (gst-indent) gstvaapidecode.c

2 years agovaapidecode: Switch back to Single thread implementation
Simon Farnsworth [Mon, 2 Mar 2015 12:46:38 +0000 (14:46 +0200)]
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>
2 years agoplugins: fix detection of upstream v4l2src element.
Gwenole Beauchesne [Mon, 2 Mar 2015 12:28:41 +0000 (13:28 +0100)]
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.

2 years agoplugins: fix allocation of DMABUF memory.
Gwenole Beauchesne [Mon, 2 Mar 2015 10:12:53 +0000 (11:12 +0100)]
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.

2 years agovaapidecode: keep src caps and output state in sync
Víctor Manuel Jáquez Leal [Thu, 26 Feb 2015 10:28:02 +0000 (12:28 +0200)]
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>
2 years agovaapidecode: upload meta only if feature and allocation
Víctor Manuel Jáquez Leal [Thu, 26 Feb 2015 10:26:54 +0000 (12:26 +0200)]
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>
2 years agovaapidecode: delayed src caps negotiation
Víctor Manuel Jáquez Leal [Thu, 26 Feb 2015 10:24:55 +0000 (12:24 +0200)]
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>
2 years agoencoder: h264: add support for more than 2 views
Sreerenj Balachandran [Tue, 24 Feb 2015 15:14:33 +0000 (17:14 +0200)]
encoder: h264: add support for more than 2 views

Add support for H.264 MVC Multiview High profile encoding with
more than 2 views. All views within the same accesss unit are
provided in increasing order of view order index (VOIdx).

Upto 10 view are supported for now.

A new property "view-ids" has been provided for the plugins to
set the view ids (which is an array of guint values) to be used
for mvc encoding.

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

2 years agoplugins: upload meta only if feature and allocation
Víctor Manuel Jáquez Leal [Mon, 23 Feb 2015 15:55:36 +0000 (16:55 +0100)]
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>
2 years agoplugins: add support for GstVideoGLTextureOrientation.
Gwenole Beauchesne [Fri, 20 Feb 2015 14:13:03 +0000 (15:13 +0100)]
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.

2 years agoplugins: add support for BGRA textures.
Gwenole Beauchesne [Mon, 9 Feb 2015 20:09:07 +0000 (21:09 +0100)]
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.

2 years agoplugins: fix support for Wayland/EGL running alongside X11.
Gwenole Beauchesne [Fri, 23 Jan 2015 08:31:57 +0000 (09:31 +0100)]
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.

2 years agoplugins: add initial support for EGL.
Gwenole Beauchesne [Fri, 20 Feb 2015 14:29:17 +0000 (15:29 +0100)]
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

2 years agoplugins: track video texture size changes.
Gwenole Beauchesne [Tue, 9 Dec 2014 10:46:58 +0000 (11:46 +0100)]
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.

2 years agoplugins: ensure VA display matches GL context expectations.
Gwenole Beauchesne [Wed, 3 Dec 2014 14:45:52 +0000 (15:45 +0100)]
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.

2 years agoplugins: record downstream GstGLContext.
Gwenole Beauchesne [Wed, 3 Dec 2014 13:14:30 +0000 (14:14 +0100)]
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>
2 years agoegl: update tests.
Gwenole Beauchesne [Mon, 1 Dec 2014 13:52:39 +0000 (14:52 +0100)]
egl: update tests.

Add initial support for EGL to tests. The new EGL backend can be selected
through the --egl command line option. The OpenGL|ES version can further
be selected with the --gles-version command line option, where the default
of 0 means "desktop" OpenGL.

2 years agoegl: add windowing support.
Gwenole Beauchesne [Tue, 27 Jan 2015 15:21:04 +0000 (16:21 +0100)]
egl: add windowing support.

This provides for some basic EGL window abstraction.

2 years agoegl: add texture abstraction.
Gwenole Beauchesne [Sat, 24 Jan 2015 07:29:57 +0000 (08:29 +0100)]
egl: add texture abstraction.

Add GstVaapiTextureEGL abstraction that can create its own GL texture,
or import a foreign allocated one, while still allowing updates from a
VA surface.

2 years agoegl: allow for EGLImage imports into VA Surfaces.
Gwenole Beauchesne [Tue, 9 Dec 2014 17:14:56 +0000 (18:14 +0100)]
egl: allow for EGLImage imports into VA Surfaces.

Add helpers to import EGLImage objects into VA surfaces. There are
two operational modes: (i) gst_vaapi_surface_new_from_egl_image(),
which allows for implicit conversion from EGLImage to a VA surface
in native video format, and (ii) gst_vaapi_surface_new_with_egl_image(),
which exactly wraps the source EGLImage, typically in RGBA format
with linear storage.

Note: in case of (i), the EGLImage can be disposed right after the
VA surface creation call, unlike in (ii) where the user shall ensure
that the EGLImage is live until the associated VA surface is no longer
needed.

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

2 years agoAdd initial support for EGL.
Gwenole Beauchesne [Fri, 20 Feb 2015 14:27:53 +0000 (15:27 +0100)]
Add initial support for EGL.

Add initial support for EGL to libgstvaapi core library. The target
display server and the desired OpenGL API can be programmatically
selected at run-time.

A comprehensive set of EGL utilities are provided to support those
dynamic selection needs, but also most importantly to ensure that
the GL command stream is executed from within a single thread.

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

2 years agolibs: initialize GValues in a thread-safe manner.
Gwenole Beauchesne [Fri, 30 Jan 2015 20:38:07 +0000 (21:38 +0100)]
libs: initialize GValues in a thread-safe manner.

2 years agolibs: re-indent all GValue related source code.
Gwenole Beauchesne [Fri, 30 Jan 2015 20:35:10 +0000 (21:35 +0100)]
libs: re-indent all GValue related source code.

2 years agovaapidecode: partially revert 0777f35.
Gwenole Beauchesne [Thu, 22 Jan 2015 21:45:24 +0000 (22:45 +0100)]
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.

2 years agovaapidecode: Caps query should return the list of all supported caps.
Sreerenj Balachandran [Thu, 19 Feb 2015 11:37:09 +0000 (13:37 +0200)]
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).

2 years agovaapidecode: intersect filter from query caps
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 11:36:16 +0000 (13:36 +0200)]
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

2 years agoFix compiler warnings
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:46:11 +0000 (11:46 +0200)]
Fix compiler warnings

This patch fixes some warnings that gcc 4.9 reports.

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

2 years agovaapidecode: Use GST_DEBUG_FUNCPTR for gst_vaapidecode_query()
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:22:21 +0000 (11:22 +0200)]
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

2 years agovaapidecode: log flow error name
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:21:35 +0000 (11:21 +0200)]
vaapidecode: log flow error name

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

2 years agoVC1: decoder: Ignore VC1 user BDU's
Víctor Manuel Jáquez Leal [Wed, 18 Feb 2015 09:20:42 +0000 (11:20 +0200)]
VC1: decoder: Ignore VC1 user BDU's

Don't return error if the processed BDU is a user one, just ignore them.
https://bugzilla.gnome.org/show_bug.cgi?id=741237

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2 years agovaapidecode: Emit error GstMessage when returning a GST_FLOW_ERROR
Olivier Crete [Wed, 18 Feb 2015 09:19:26 +0000 (11:19 +0200)]
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

2 years agoplugins: Add VP8 Encoder
Sreerenj Balachandran [Fri, 13 Feb 2015 11:45:32 +0000 (13:45 +0200)]
plugins: Add VP8 Encoder

2 years agoAdd VP8 Encoder to core libgstvaapi.
Sreerenj Balachandran [Fri, 13 Feb 2015 11:42:04 +0000 (13:42 +0200)]
Add VP8 Encoder to core libgstvaapi.

2 years agoconfigure: Add Check for VP8 Encoding API
Sreerenj Balachandran [Fri, 13 Feb 2015 11:40:19 +0000 (13:40 +0200)]
configure: Add Check for VP8 Encoding API

2 years agodecoder: vc1: Rounding control handling for VC1 simple and Main profile
Lim Siew Hoon [Tue, 10 Feb 2015 09:40:16 +0000 (11:40 +0200)]
decoder: vc1: Rounding control handling for VC1 simple and Main profile

Added rounding control handling for VC1 simple and Main profile
based on VC1 standard spec: section 8.3.7

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

Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
2 years agobuild: fix make dist when certain conditionals not met.
Sreerenj Balachandran [Fri, 6 Feb 2015 10:10:51 +0000 (12:10 +0200)]
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).

2 years agoencoder: jpeg: Fix the sampling factor calculation for ENCODED format.
Sreerenj Balachandran [Thu, 5 Feb 2015 11:08:53 +0000 (13:08 +0200)]
encoder: jpeg: Fix the sampling factor calculation for ENCODED format.

If the incoming raw video format is GST_VIDEO_FORMAT_ENCODED,
use native YUV420 format (which is i420) as default.

2 years agoencoder: Only support YUV420 native format as input for now
Sreerenj Balachandran [Thu, 5 Feb 2015 10:13:38 +0000 (12:13 +0200)]
encoder: Only support YUV420 native format as input for now

Practically we should be able to support more formats, for eg:
JPEG Encoder can support YUV422, RGBA and all.
But this is causing more issues which need proper fix here and there.

2 years agovaapidecode: Check the condition after taking the lock
Olivier Crete [Wed, 4 Feb 2015 16:34:59 +0000 (18:34 +0200)]
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

2 years agoplugins: Add JPEG encoder element
Sreerenj Balachandran [Wed, 4 Feb 2015 09:18:29 +0000 (11:18 +0200)]
plugins: Add JPEG encoder element

2 years agogstvaapicontext: Add VAConfigAttribValEncJPEG to the attribute list using for VAConfi...
Sreerenj Balachandran [Wed, 4 Feb 2015 09:17:58 +0000 (11:17 +0200)]
gstvaapicontext: Add VAConfigAttribValEncJPEG to the attribute list using for VAConfig creation.

2 years agogstvaapicontext: Don't use the unsupported Ratecontrol attributes for vaCreateConfig
Sreerenj Balachandran [Wed, 4 Feb 2015 09:17:27 +0000 (11:17 +0200)]
gstvaapicontext: Don't use the unsupported Ratecontrol attributes for vaCreateConfig

Don't add the VAConfigAttribRateControl to the attribute list using
for the vaCreateConfig if it is not supported by the driver.

2 years agogstvaapiencoder: Use hardcoded packed_raw_data flag for JPEG Encoding
Sreerenj Balachandran [Wed, 4 Feb 2015 09:17:06 +0000 (11:17 +0200)]
gstvaapiencoder: Use hardcoded packed_raw_data flag for JPEG Encoding

2 years agogstvaapiencoder: Fix crash when handling rate control mask
Sreerenj Balachandran [Wed, 4 Feb 2015 09:16:37 +0000 (11:16 +0200)]
gstvaapiencoder: Fix crash when handling rate control mask

Having a ratecontrol_mask equal to zero is not a bug, but the driver
might not be supporting any kind of rate control mechanisms.
Eg: JPEG Encoding

2 years agoencoder: Add JPEG Encoder
Sreerenj Balachandran [Wed, 4 Feb 2015 09:16:05 +0000 (11:16 +0200)]
encoder: Add JPEG Encoder

2 years agoencoder_objects: Add QuantizationMatrix and JPEGHuffmanTable
Sreerenj Balachandran [Wed, 4 Feb 2015 09:15:38 +0000 (11:15 +0200)]
encoder_objects: Add QuantizationMatrix and JPEGHuffmanTable

2 years agoEncode: Add support for Picture level Entrypoint
Sreerenj Balachandran [Wed, 4 Feb 2015 09:15:00 +0000 (11:15 +0200)]
Encode: Add support for Picture level Entrypoint

This is useful for JPEG encoding which is utilizing picture level
entrypoint instead of slice level entrypoint like h264,mpeg2 etc.

2 years agoconfigure: Add Check for JPEG encoding API
Sreerenj Balachandran [Wed, 4 Feb 2015 09:14:15 +0000 (11:14 +0200)]
configure: Add Check for JPEG encoding API

2 years agoAUTHORS: Updates
Sreerenj Balachandran [Tue, 3 Feb 2015 11:08:53 +0000 (13:08 +0200)]
AUTHORS: Updates

2 years agoBump version for development.
Sreerenj Balachandran [Tue, 3 Feb 2015 11:08:01 +0000 (13:08 +0200)]
Bump version for development.

2 years ago0.5.10 0.5.10
Sreerenj Balachandran [Tue, 3 Feb 2015 08:00:42 +0000 (10:00 +0200)]
0.5.10

2 years agoNEWS: Updates
Sreerenj Balachandran [Tue, 3 Feb 2015 08:00:23 +0000 (10:00 +0200)]
NEWS: Updates

2 years agoFix compilation error if there is no GL/gl.h header file installed
Sreerenj Balachandran [Mon, 2 Feb 2015 09:43:58 +0000 (11:43 +0200)]
Fix compilation error if there is no GL/gl.h header file installed

2 years agoplugins: drop leftover declaration.
Gwenole Beauchesne [Wed, 28 Jan 2015 17:09:40 +0000 (18:09 +0100)]
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.

2 years agoplugins: add support for dma_buf exports (v4l2src).
Gwenole Beauchesne [Mon, 26 Jan 2015 17:30:47 +0000 (18:30 +0100)]
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

2 years agoplugins: add support for dma_buf imports.
Wind Yuan [Thu, 23 Jan 2014 10:00:09 +0000 (05:00 -0500)]
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>
2 years agosurface: add support for GEM buffer imports.
Gwenole Beauchesne [Mon, 15 Sep 2014 13:27:50 +0000 (15:27 +0200)]
surface: add support for GEM buffer imports.

Add support for GEM buffer imports. This is useful for VA/EGL interop
with legacy Mesa implementations, or when it is desired or required to
support outbound textures for instance.

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

2 years agosurface: add support for dma_buf imports.
Gwenole Beauchesne [Mon, 15 Sep 2014 13:25:09 +0000 (15:25 +0200)]
surface: add support for dma_buf imports.

Add new gst_vaapi_surface_new_with_dma_buf_handle() helper function
to allow for creating VA surfaces from a foreign DRM PRIME fd. The
resulting VA surface owns the supplied buffer handle.

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

2 years agosurface: add initial support for foreign buffer imports.
Gwenole Beauchesne [Tue, 27 Jan 2015 10:19:58 +0000 (11:19 +0100)]
surface: add initial support for foreign buffer imports.

Add gst_vaapi_surface_new_from_buffer_proxy() helper function to
create a VA surface from an external buffer provided throug the
new GstVaapiBufferProxy object.

2 years agosurface: add support for GEM buffer exports.
Gwenole Beauchesne [Mon, 15 Sep 2014 11:47:53 +0000 (13:47 +0200)]
surface: add support for GEM buffer exports.

Add support for GEM buffer exports. This will only work with VA drivers
based off libdrm, e.g. the Intel HD Graphics VA driver. This is needed
to support interop with EGL and the "Desktop" GL specification. Indeed,
the EXT_image_dma_buf_import extension is not going to be supported in
Desktop GL, due to the lack of support for GL_TEXTURE_EXTERNAL_OES targets
there.

This is useful for implementing VA/EGL interop with legacy Mesa stacks,
in Desktop OpenGL context.

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

2 years agosurface: add support for dma_buf exports.
Gwenole Beauchesne [Mon, 15 Sep 2014 09:48:05 +0000 (11:48 +0200)]
surface: add support for dma_buf exports.

Use the new VA buffer export APIs to allow for a VA surface to be
exposed as a plain PRIME fd. This is in view to simplifying interop
with EGL or OpenCL for instance.

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

2 years agoAdd abstraction for exported VA buffers.
Gwenole Beauchesne [Mon, 15 Sep 2014 08:58:51 +0000 (10:58 +0200)]
Add abstraction for exported VA buffers.

The VA buffer export APIs work for a particular lifetime starting from
vaAcquireBufferHandle() and ending with vaReleaseBufferHandle(). As such,
it could be much more convenient to support implicit releases by simply
having a refcount reaching zero.

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

2 years agoAdd missing header file to Makefile
Sreerenj Balachandran [Wed, 28 Jan 2015 16:25:09 +0000 (18:25 +0200)]
Add missing header file to Makefile

Add gstvaapitexture_glx.h to Makefile.am

2 years agovideopool: add optional flags for surface pool allocation.
Gwenole Beauchesne [Tue, 27 Jan 2015 10:44:12 +0000 (11:44 +0100)]
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.

2 years agovideopool: re-indent all GstVaapiVideoPool related source code.
Gwenole Beauchesne [Mon, 26 Jan 2015 22:21:56 +0000 (23:21 +0100)]
videopool: re-indent all GstVaapiVideoPool related source code.

2 years agowindow: add toplevel display indirection for visualid and colormap.
Gwenole Beauchesne [Wed, 10 Dec 2014 19:13:21 +0000 (20:13 +0100)]
window: add toplevel display indirection for visualid and colormap.

Add GstVaapiDisplay::get_{visual_id,colormap}() helpers to help determine
the best suitable window visual id and colormap. This is an indirection in
view to supporting EGL and custom/generic replacements.

2 years agowindow: add toplevel API to determine the colormap.
Gwenole Beauchesne [Wed, 10 Dec 2014 18:58:10 +0000 (19:58 +0100)]
window: add toplevel API to determine the colormap.

Add GstVaapiWindowClass::get_colormap() hook to help determine the
currently active colormap bound to the supplied window, or actually
create it if it does not already exist yet.

2 years agowindow: add toplevel API to determine a visual id.
Gwenole Beauchesne [Wed, 10 Dec 2014 18:36:12 +0000 (19:36 +0100)]
window: add toplevel API to determine a visual id.

Add GstVaapiWindowClass::get_visual_id() function hook to help find
the best suitable visual id for the supplied window. While doing so,
also simplify the process by which an X11 window is created with a
desired Visual, i.e. now use a visual id instead of a Visual object.

2 years agowindow: add generic helper to create windows.
Gwenole Beauchesne [Wed, 10 Dec 2014 17:12:24 +0000 (18:12 +0100)]
window: add generic helper to create windows.

Add a new generic helper function gst_vaapi_window_new() to create
a window without having the caller to check for the display type
himself. i.e. internally, there is now a GstVaapiDisplayClass hook
to create windows, and the actual backend implementation fills it in.
Add new generic helper functions gst_vaapi_texture_new_wrapped()

This is a simplification in view to supporting EGL.

2 years agodisplay: add utility function to check for OpenGL rendering.
Gwenole Beauchesne [Wed, 3 Dec 2014 10:39:24 +0000 (11:39 +0100)]
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.

2 years agodisplay: refine the meaning of display type.
Gwenole Beauchesne [Wed, 10 Dec 2014 17:02:55 +0000 (18:02 +0100)]
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.

2 years agodisplay: cosmetics (helper macros, new internal API names).
Gwenole Beauchesne [Tue, 2 Dec 2014 10:23:29 +0000 (11:23 +0100)]
display: cosmetics (helper macros, new internal API names).

Add more helper macros to the top-level GstVaapiDisplay interfaces.
Rename a few others used internally for improved consistency.

2 years agodisplay: record native display object.
Gwenole Beauchesne [Mon, 1 Dec 2014 16:08:29 +0000 (17:08 +0100)]
display: record native display object.

Record the underlying native display instance into the toplevel
GstVaapiDisplay object. This is useful for fast lookups to the
underlying native display, e.g. for creating an EGL display.

2 years agodisplay: use a recursive mutex for the display cache.
Gwenole Beauchesne [Mon, 1 Dec 2014 15:54:32 +0000 (16:54 +0100)]
display: use a recursive mutex for the display cache.

Use a recursive mutex for the display cache so that a 3rdparty display
object could be initialized during the initialization of the parent
display.

2 years agotexture: add generic helper to create textures.
Gwenole Beauchesne [Thu, 4 Dec 2014 13:36:35 +0000 (14:36 +0100)]
texture: add generic helper to create textures.

Add new generic helper functions gst_vaapi_texture_new_wrapped()
and gst_vaapi_texture_new() to create a texture without having
the caller to uselessly check for the display type himself. i.e.
internally, there is now a GstVaapiDisplayClass hook to create
textures, and the actual backend implementation fills it in.

This is a simplification in view to supporting EGL.

2 years agotexture: move to core libgstvaapi base library.
Gwenole Beauchesne [Thu, 23 Oct 2014 15:44:23 +0000 (17:44 +0200)]
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