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

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

3 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

3 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.

3 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

3 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>
3 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

3 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

3 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.

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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.

3 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

3 years agotexture: drop support for VA/GLX interfaces.
Gwenole Beauchesne [Thu, 23 Oct 2014 11:11:54 +0000 (13:11 +0200)]
texture: drop support for VA/GLX interfaces.

The VA/GLX interfaces are obsolete. They used to exist for XvBA, and
ease of use, but they had other caveats to deal with. It's now better
to move on to legacy mode, whereby VA/GLX interop is two be provided
through (i) X11 Pixmap, and (ii) other modern means of buffer sharing.

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

3 years agotexture: add support for cropping rectangle during transfer.
Gwenole Beauchesne [Thu, 23 Oct 2014 09:56:31 +0000 (11:56 +0200)]
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

3 years agotexture: re-indent all GstVaapiTexture related source code.
Gwenole Beauchesne [Thu, 23 Oct 2014 09:22:10 +0000 (11:22 +0200)]
texture: re-indent all GstVaapiTexture related source code.

3 years agosurface: add more fine-grained allocation helper.
Gwenole Beauchesne [Tue, 27 Jan 2015 10:16:34 +0000 (11:16 +0100)]
surface: add more fine-grained allocation helper.

Add new gst_vaapi_surface_new_full() helper function that allocates
VA surface from a GstVideoInfo template in argument. Additional flags
may include ways to
- allocate linear storage (GST_VAAPI_SURFACE_ALLOC_FLAG_LINEAR_STORAGE) ;
- allocate with fixed strides (GST_VAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES) ;
- allocate with fixed offsets (GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS).

3 years agosurface: re-indent all GstVaapiSurface related source code.
Gwenole Beauchesne [Mon, 15 Sep 2014 12:57:57 +0000 (14:57 +0200)]
surface: re-indent all GstVaapiSurface related source code.

3 years agosurfaceproxy: add helper to create a wrapped surface object.
Gwenole Beauchesne [Fri, 23 Jan 2015 15:44:34 +0000 (16:44 +0100)]
surfaceproxy: add helper to create a wrapped surface object.

Add new gst_vaapi_surface_proxy_new() helper to wrap a surface into
a proxy. The main use case for that is to convey additional information
at the proxy level that would not be suitable to the plain surface.

3 years agosurfaceproxy: re-indent all GstVaapiSurfaceProxy related source code.
Gwenole Beauchesne [Fri, 23 Jan 2015 15:37:06 +0000 (16:37 +0100)]
surfaceproxy: re-indent all GstVaapiSurfaceProxy related source code.

3 years agolibs: bump library major version.
Gwenole Beauchesne [Tue, 27 Jan 2015 17:02:56 +0000 (18:02 +0100)]
libs: bump library major version.

3 years agolibs: re-introduce a GST_VAAPI_ID_INVALID value.
Gwenole Beauchesne [Thu, 4 Dec 2014 13:36:35 +0000 (14:36 +0100)]
libs: re-introduce a GST_VAAPI_ID_INVALID value.

Re-introduce a GST_VAAPI_ID_INVALID value that represents
a non-zero and invalid id. This is useful to have a value
that is still invalid for cases where zero could actually
be a valid value.

3 years agolibs: expose GstVaapiMiniObject APIs to all backends.
Gwenole Beauchesne [Tue, 2 Dec 2014 15:51:20 +0000 (16:51 +0100)]
libs: expose GstVaapiMiniObject APIs to all backends.

Make it possible to have all libgstvaapi backends (libs) access to a
common GstVaapiMiniObject API and implementation. This is a minor step
towards full exposure when needed, but restrict it to libgstvaapi at
this time.

3 years agolibs: re-indent all GstVaapiObject related source code.
Gwenole Beauchesne [Tue, 2 Dec 2014 13:15:49 +0000 (14:15 +0100)]
libs: re-indent all GstVaapiObject related source code.

Re-indent and provide additional minor cosmetical changes to the
GstVaapiMiniObject and GstVaapiObject source files.

3 years agopluginutil: Fix clearing of subtitle overlay
Simon Farnsworth [Tue, 27 Jan 2015 14:25:21 +0000 (16:25 +0200)]
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>
3 years agovaapipostproc: clear state on stop
Michael Olbrich [Tue, 27 Jan 2015 14:06:02 +0000 (16:06 +0200)]
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()

3 years agovaapidecode: don't print an error message for GST_FLOW_FLUSHING
Michael Olbrich [Tue, 27 Jan 2015 12:50:12 +0000 (14:50 +0200)]
vaapidecode: don't print an error message for GST_FLOW_FLUSHING

3 years agogstvaapiencoder: Fix the negotiation issue with _ENCODED format handling
Sreerenj Balachandran [Tue, 27 Jan 2015 10:38:45 +0000 (12:38 +0200)]
gstvaapiencoder: Fix the negotiation issue with _ENCODED format handling

Don't error out for the video format GST_VIDEO_FORMAT_ENCODED with in gstvaapiencoder,
since the vaaapi context creation (gstvaapicontext.c) can still use the
default chroma type which is YUV420.

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

3 years agoh264parse: drop patches merged upstream.
Sreerenj Balachandran [Wed, 21 Jan 2015 16:31:22 +0000 (18:31 +0200)]
h264parse: drop patches merged upstream.

0003-h264parse-add-initial-support-for-MVC-NAL-units.patch

3 years agocodecparsers: update to gst-vaapi-branch commit d3b5c1b
Sreerenj Balachandran [Wed, 21 Jan 2015 16:26:12 +0000 (18:26 +0200)]
codecparsers: update to gst-vaapi-branch commit d3b5c1b

8194cac: h264parse: parse SPS subset
64b7f52: h264parse: expose stereo-high profile
774360a: h264parse: add initial support for MVC NAL units
258478f: h264parser: fix stack smashing

3 years agoFix compilation error if there is no GL/gl.h header file installed
Sreerenj Balachandran [Mon, 19 Jan 2015 09:30:12 +0000 (11:30 +0200)]
Fix compilation error if there is no GL/gl.h header file installed

3 years agovaapidecode: commit updated srcpad caps to base plugin.
Gwenole Beauchesne [Thu, 15 Jan 2015 15:23:24 +0000 (16:23 +0100)]
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

3 years agovaapidecode: always reset decoder on ::set_format().
Gwenole Beauchesne [Thu, 15 Jan 2015 15:19:59 +0000 (16:19 +0100)]
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.

3 years agovaapivideomemory: don't crash when trying to allocate 0x0 images.
Gwenole Beauchesne [Thu, 15 Jan 2015 15:14:13 +0000 (16:14 +0100)]
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.

3 years agocodecparsers: update to gst-vaapi-branch commit 191cb2f
Sreerenj Balachandran [Wed, 14 Jan 2015 22:00:16 +0000 (00:00 +0200)]
codecparsers: update to gst-vaapi-branch commit 191cb2f

347605a: h264parse: expose compatible profiles to downstream
d1ea97e: h264parse: Fix periodic SPS/PPS sending work after a seek
24a3126: Revert "h264parse: expose compatible profiles to downstream"
8661740: h264parse: expose compatible profiles to downstream
8b7ef3f: codecparsers: fix some compiler warnings

3 years agoencoder: h264: Fix the period between I/P frames
Sreerenj Balachandran [Thu, 27 Nov 2014 10:11:03 +0000 (12:11 +0200)]
encoder: h264: Fix the period between I/P frames

If the key-frame period is set as one, then ip_period shuld be zero

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

3 years agoencoder: h264: Provide intra_idr_period value for VAEncSequenceParameterBufferH264
Sreerenj Balachandran [Thu, 27 Nov 2014 09:21:03 +0000 (11:21 +0200)]
encoder: h264: Provide intra_idr_period value for VAEncSequenceParameterBufferH264

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

3 years agovaapisink: Protect the X11 API invokations with proper locking
Sreerenj Balachandran [Thu, 27 Nov 2014 09:14:50 +0000 (11:14 +0200)]
vaapisink: Protect the X11 API invokations with proper locking

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

3 years agoencoder: h264: fix pixel-aspect-ratio in encoded stream.
Gwenole Beauchesne [Thu, 27 Nov 2014 09:13:20 +0000 (11:13 +0200)]
encoder: h264: fix pixel-aspect-ratio in encoded stream.

Really report sample aspect ratio (SAR) as present, and make it match
what we have obtained from the user as pixel-aspect-ratio (PAR). i.e.
really make sure VUI parameter aspect_ratio_info_present_flag is set
to TRUE and that the indication from aspect_ratio_idc is Extended_SAR.

This is a leftover from git commit a12662f.

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

3 years agodecoder: mpeg4: fix uninitialized variables.
Gwenole Beauchesne [Tue, 25 Nov 2014 10:46:12 +0000 (11:46 +0100)]
decoder: mpeg4: fix uninitialized variables.

Fix gst_vaapi_decoder_mpeg4_parse() to initialize the packet type to
GST_MPEG4_USER_DATA so that a parse error would result in skipping
that packet. Also fix gst_vaapi_decoder_mpeg4_decode_codec_data() to
initialize status to GST_VAAPI_DECODER_STATUS_SUCCESS.

3 years agoencoder: h264: fix profile limits.
Gwenole Beauchesne [Tue, 25 Nov 2014 10:41:49 +0000 (11:41 +0100)]
encoder: h264: fix profile limits.

Fix ensure_profile_limits() to lower profile to the desired limits,
only if the latter are actually known and the profile needed to be
changed to fit.

3 years agovaapipostproc: fix out caps for GLMemory.
Gwenole Beauchesne [Mon, 24 Nov 2014 14:14:37 +0000 (15:14 +0100)]
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.

3 years agovaapipostproc: fix check for compatible src pad capsfilters.
Gwenole Beauchesne [Mon, 24 Nov 2014 13:25:33 +0000 (14:25 +0100)]
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.

3 years agoplugins: re-indent all video processing related source code.
Gwenole Beauchesne [Mon, 24 Nov 2014 13:10:11 +0000 (14:10 +0100)]
plugins: re-indent all video processing related source code.

3 years agoplugins: further fixes to the new "current" storage tracker.
Gwenole Beauchesne [Mon, 24 Nov 2014 12:20:33 +0000 (13:20 +0100)]
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.

3 years agoplugins: fix "current" video memory flags.
Gwenole Beauchesne [Fri, 21 Nov 2014 14:43:35 +0000 (15:43 +0100)]
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.

3 years agoplugins: ensure VA surface is current prior to using it.
Gwenole Beauchesne [Fri, 21 Nov 2014 14:23:13 +0000 (15:23 +0100)]
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}.

3 years agoplugins: enable memory maps for read & write.
Víctor Manuel Jáquez Leal [Fri, 12 Jul 2013 10:34:15 +0000 (06:34 -0400)]
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>
3 years agoplugins: preserve framerate when updating src caps video format.
Gwenole Beauchesne [Tue, 18 Nov 2014 13:57:02 +0000 (14:57 +0100)]
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

3 years agovaapidecode: increase the rank to GST_RANK_PRIMARY + 1
Sreerenj Balachandran [Tue, 18 Nov 2014 12:07:57 +0000 (14:07 +0200)]
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

3 years agovaapidecode: only expose supported profiles when needed.
Gwenole Beauchesne [Wed, 12 Nov 2014 06:46:53 +0000 (07:46 +0100)]
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

3 years agodecoder: h264: add initial support for repeat-first-field (RFF) flag.
Gwenole Beauchesne [Thu, 13 Nov 2014 14:13:24 +0000 (15:13 +0100)]
decoder: h264: add initial support for repeat-first-field (RFF) flag.

Use the SEI pic_timing() message to track and propagate down the repeat
first field (RFF) flag. This is only initial support as there is one
other condition that could induce the RFF flag, which is not handled
yet.

3 years agodecoder: h264: fix picture ordering count type 0 with previous MMCO5.
Gwenole Beauchesne [Thu, 13 Nov 2014 14:05:19 +0000 (15:05 +0100)]
decoder: h264: fix picture ordering count type 0 with previous MMCO5.

Fix the decoding process for picture order count type 0 when the previous
picture had a memory_management_control_operation = 5. In particular, fix
the actual variable type for prev_pic_structure to hold the full bits of
the picture structure.

In practice, this used to work though, due to the underlying type used to
express a gboolean.

3 years agodecoder: h264: fix detection of top-field-first (TFF) flag.
Gwenole Beauchesne [Thu, 13 Nov 2014 14:00:21 +0000 (15:00 +0100)]
decoder: h264: fix detection of top-field-first (TFF) flag.

Use the SEI pic_timing() message to track the pic_struct variable when
present, or infer it from the regular slice header flags field_pic_flag
and bottom_field_flag. This fixes temporal sequence ordering when the
output pictures are to be displayed.

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

3 years agocodecparsers: update to gst-vaapi-branch commit 3d05d9f.
Gwenole Beauchesne [Fri, 14 Nov 2014 08:54:02 +0000 (09:54 +0100)]
codecparsers: update to gst-vaapi-branch commit 3d05d9f.

1241840 h264: fix derivation of MaxPicNum variable
3bd718e h264: fix GstH264ParserResult documentation typo
b021609 h264parse: set the HEADER flag on buffers containing SPS or PPS
b08e4be h264parse: don't unnecesarily set src_caps

3 years agovaapipostproc: Add string representation of VPP functions to ElementFactoy Klass
Sreerenj Balachandran [Mon, 3 Nov 2014 17:20:43 +0000 (19:20 +0200)]
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.

3 years agovaapipostproc: Tweak the output video format setting to enable the autoplugging
Sreerenj Balachandran [Mon, 3 Nov 2014 17:19:20 +0000 (19:19 +0200)]
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

3 years agovaapipostproc: allow user defined scaling mode.
Gwenole Beauchesne [Wed, 29 Oct 2014 16:30:30 +0000 (17:30 +0100)]
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.

3 years agofilter: add initial support for high quality scaling.
Gwenole Beauchesne [Wed, 29 Oct 2014 15:57:12 +0000 (16:57 +0100)]
filter: add initial support for high quality scaling.

Add support for video scaling options in VPP pipelines. Only the
DEFAULT mode is bound to exist. Others might be folded into that
mode.

3 years agofilter: re-indent all GstVaapiFilter related source code.
Gwenole Beauchesne [Wed, 29 Oct 2014 15:35:46 +0000 (16:35 +0100)]
filter: re-indent all GstVaapiFilter related source code.

3 years agocodecparsers: update to gst-vaapi-branch commit f9d3bde.
Gwenole Beauchesne [Wed, 29 Oct 2014 14:45:50 +0000 (15:45 +0100)]
codecparsers: update to gst-vaapi-branch commit f9d3bde.

2218b02 h264parse: expose parsed profile and level to downstream
3dbfab4 h264parse: return flushing if we get chained while being set to READY
d40fa8b h264: fix frame packing SEI parsing
32d40be h264: Use proper bit_reader api while parsing buffering_period SEI
b3e022e h264: initialize some fields of pic_timing structure
a70661d vc1: fix expected level in sequence-layer parsing unit test
6cee88d vc1: fix level values for simple/main profile
356c189 vc1: add unit test for sequence-layer parsing
ab9f641 vc1: take care of endianness when parsing sequence-layer
8dc8e35 mpeg4: fix vlc table used for sprite trajectory

3 years agovaapidecode: Expose the supported profiles as caps to upstream
Sreerenj Balachandran [Wed, 29 Oct 2014 13:46:47 +0000 (15:46 +0200)]
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

3 years agoencode: Attach the codec-data to out caps only based on negotiated caps
Sreerenj Balachandran [Wed, 29 Oct 2014 13:46:12 +0000 (15:46 +0200)]
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

3 years agoconfigure: echoing installation prefix path
Sreerenj Balachandran [Wed, 29 Oct 2014 13:45:44 +0000 (15:45 +0200)]
configure: echoing installation prefix path

4 years agodisplay: add support for DRM Render-Nodes.
Gwenole Beauchesne [Wed, 24 Sep 2014 08:14:24 +0000 (10:14 +0200)]
display: add support for DRM Render-Nodes.

Add support for DRM Render-Nodes. This is a new feature that appeared
in kernel 3.12 for experimentation purposes, but was later declared
stable enough in kernel 3.15 for getting enabled by default.

This allows headless usages without authentication at all, i.e. usages
through plain ssh connections is possible.

4 years agovaapisink: clean-ups (indentation, drop unused variables).
Gwenole Beauchesne [Wed, 24 Sep 2014 11:44:43 +0000 (13:44 +0200)]
vaapisink: clean-ups (indentation, drop unused variables).

4 years agovaapisink: fix GstNavigation "key-press" / "key-release" events.
Gwenole Beauchesne [Wed, 24 Sep 2014 11:39:55 +0000 (13:39 +0200)]
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.

4 years agovaapisink: fix GstNavigation "mouse-move" event.
Gwenole Beauchesne [Wed, 24 Sep 2014 11:23:17 +0000 (13:23 +0200)]
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.

4 years agovaapisink: implement the GstNavigation interface
Sreerenj Balachandran [Tue, 16 Sep 2014 11:25:40 +0000 (14:25 +0300)]
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

4 years agovaapipostproc: fix deinterlacing from non VA memory buffers.
Simon Farnsworth [Thu, 13 Mar 2014 18:38:33 +0000 (18:38 +0000)]
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>
4 years agovaapipostproc: add support for GLTextureUploadMeta output.
Gwenole Beauchesne [Fri, 22 Aug 2014 13:22:32 +0000 (15:22 +0200)]
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

4 years agovaapipostproc: add support for "download" capability.
Gwenole Beauchesne [Fri, 22 Aug 2014 13:22:32 +0000 (15:22 +0200)]
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

4 years agovaapipostproc: use pooled vaapi video meta.
Gwenole Beauchesne [Fri, 22 Aug 2014 16:10:54 +0000 (18:10 +0200)]
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>
4 years agovaapipostproc: fix passthrough mode.
Gwenole Beauchesne [Fri, 22 Aug 2014 13:17:29 +0000 (15:17 +0200)]
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.

4 years agovaapipostproc: fix output buffer to have a GstVaapiVideoMemory.
Sreerenj Balachandran [Sat, 5 Jul 2014 18:00:34 +0000 (21:00 +0300)]
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>
4 years agovaapipostproc: enable advanced deinterlacing with same format.
Gwenole Beauchesne [Fri, 22 Aug 2014 09:13:36 +0000 (11:13 +0200)]
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.

4 years agovaapivideomemory: avoid NULL pointer unref if GstVaapiImage creation failed.
Sreerenj Balachandran [Thu, 21 Aug 2014 12:04:20 +0000 (15:04 +0300)]
vaapivideomemory: avoid NULL pointer unref if GstVaapiImage creation failed.

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

4 years agoplugins: fix memory leaks.
Gwenole Beauchesne [Fri, 22 Aug 2014 11:25:03 +0000 (13:25 +0200)]
plugins: fix memory leaks.

4 years agoplugins: factor out decide_allocation() hook.
Gwenole Beauchesne [Thu, 21 Aug 2014 12:10:36 +0000 (14:10 +0200)]
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.

4 years agoplugins: allow bufferpool to not allocate vaapi video meta.
Gwenole Beauchesne [Thu, 21 Aug 2014 09:12:39 +0000 (11:12 +0200)]
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.

4 years agoplugins: re-indent all GstVaapiVideo* related source code.
Gwenole Beauchesne [Thu, 21 Aug 2014 08:45:31 +0000 (10:45 +0200)]
plugins: re-indent all GstVaapiVideo* related source code.

4 years agosurfaceproxy: fix copy to propagate view_id.
Gwenole Beauchesne [Fri, 22 Aug 2014 13:12:46 +0000 (15:12 +0200)]
surfaceproxy: fix copy to propagate view_id.

Fix gst_vaapi_surface_proxy_copy() to copy the view-id element, thus
fixing random frames skipped when vaapipostproc element is used in
passthrough mode. In that mode, GstMemory is copied, thus including
the underlying GstVaapiVideoMeta and associated GstVaapiSurfaceProxy.

4 years agovaapipostproc: fix detection of output surface format changes.
Gwenole Beauchesne [Wed, 20 Aug 2014 14:38:45 +0000 (16:38 +0200)]
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.

4 years agovaapipostproc: fix construction of allowed sink pad caps.
Gwenole Beauchesne [Wed, 20 Aug 2014 08:59:53 +0000 (10:59 +0200)]
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.

4 years agovaapipostproc: improve heuristics for detecting native VA surfaces.
Gwenole Beauchesne [Wed, 20 Aug 2014 08:37:02 +0000 (10:37 +0200)]
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.

4 years agovaapipostproc: disable discontinuity detection code.
Gwenole Beauchesne [Tue, 12 Aug 2014 16:33:25 +0000 (18:33 +0200)]
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

4 years agovaapipostproc: fix heuristic for detecting discontinuity.
Gwenole Beauchesne [Thu, 7 Aug 2014 12:57:26 +0000 (14:57 +0200)]
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