Commit 9dd805a4 authored by Thibault Saunier's avatar Thibault Saunier 🌵

Merging gstreamer-vaapi

parents fc8f36a5 1168d6d5
include: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/ci_template.yml"
Maintainers:
Gwenole Beauchesne - Lead developer
Sreerenj Balachandran - Lead developer
Halley Zhao - MPEG-4:2 decoder
This project is maintained by Intel Corporation.
Contributors (sorted by first name):
Adrian Cox
Alban Browaeys
Changzhi Wei
Cong Zhong
Emilio Lopez
Fabrice Bellet
Feng Yuan
Guangxin Xu
Haihao Xiang
Holger Kaelberer
Jacobo Aragunde Pérez
Jan Schmidt
Javier Jardon
Julien Isorce
Junfeng Xu
Kristian Hogsberg
Lim Siew Hoon
Lionel Landwerlin
Mark Nauwelaerts
Martin Sherburn
Matthew Waters
Matthieu Bouron
Michael Olbrich
Nicolas Dufresne
Olivier Crete
Philip Lorenz
Robert Bradford
Ross Burton
Sebastian Dröge
Simon Farnsworth
Thibault Saunier
Victor Manuel Jaquez Leal
Warly
Xiaowei Li
Yan Yin
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
gstreamer-vaapi
VA-API support to GStreamer
Copyright (C) 2010-2011 Splitted-Desktop Systems
Copyright (C) 2011-2014 Intel Corporation
Copyright (C) 2011 Collabora Ltd.
License
-------
gstreamer-vaapi helper libraries and plugin elements are available
under the terms of the GNU Lesser General Public License v2.1+
Overview
--------
gstreamer-vaapi consists in a collection of VA-API based plugins for
GStreamer and helper libraries.
* `vaapi<CODEC>dec' is used to decode JPEG, MPEG-2, MPEG-4:2, H.264
AVC, H.264 MVC, VP8, VC-1, WMV3, HEVC videos to VA surfaces,
depending on the actual value of <CODEC> and the underlying
hardware capabilities. This plugin is also able to implicitly
download the decoded surface to raw YUV buffers.
* `vaapi<CODEC>enc' is used to encode into MPEG-2, H.264 AVC, H.264
MVC, JPEG, VP8, HEVC videos, depending on the actual value of
<CODEC> (mpeg2, h264, etc.) and the hardware capabilities. By
default, raw format bitstreams are generated, so the result may be
piped to a muxer, e.g. qtmux for MP4 containers.
* `vaapipostproc' is used to filter VA surfaces, for e.g. scaling,
deinterlacing (bob, motion-adaptive, motion-compensated), noise
reduction or sharpening. This plugin is also used to upload raw
YUV pixels into VA surfaces.
* `vaapisink' is used to render VA surfaces to an X11 or Wayland
display. This plugin also features a "headless" mode (DRM) more
suited to remote transcode scenarios, with faster throughput.
Features
--------
* VA-API support from 0.39
* JPEG, MPEG-2, MPEG-4, H.264 AVC, H.264 MVC, VP8, VC-1, HEVC and
VP9 ad-hoc decoders
* MPEG-2, H.264 AVC,H.264 MVC, JPEG, VP8 and HEVC ad-hoc encoders
* OpenGL rendering through VA/GLX or GLX texture-from-pixmap + FBO
* Support for EGL backend
* Support for the Wayland display server
* Support for headless decode pipelines with VA/DRM
* Support for major HW video decoding solutions on Linux (AMD,
Intel, NVIDIA)
* Support for HW video encoding on Intel HD Graphics hardware
* Support for VA Video Processing APIs (VA/VPP)
- Scaling and color conversion
- Image enhancement filters: Sharpening, Noise Reductio, Color
Balance, Skin-Tone-Enhancement
- Advanced deinterlacing: Motion-Adaptive, Motion-Compensated
Requirements
------------
Software requirements
* GStreamer 1.9.x:
libgstreamer1.0-dev (>= 1.9.x)
libgstreamer-plugins-base1.0-dev (>= 1.9.x)
libgstreamer-plugins-bad1.0-dev (>= 1.9.0)
* Renderers:
DRM: libva-dev (>= 1.1.0), libdrm-dev, libudev-dev
X11: libva-dev (>= 1.0.1)
GLX: libva-dev (>= 1.0.3)
Wayland: libva-dev (>= 1.1.0), libwayland-dev (>= 1.0.2)
Hardware requirements
* Intel Eaglelake (G45)
* Intel Ironlake, Sandybridge, Ivybridge, Haswell, Broadwell,
Skylake, etc. (HD Graphics)
* Intel BayTrail, Braswell
* Intel Poulsbo (US15W)
* Intel Medfield or Cedar Trail
* Hardware supported by Mesa VA gallium state-tracker
Usage
-----
VA elements are automatically plugged into GStreamer pipelines. So,
using playbin should work as is.
However, here are a few alternate pipelines that could be manually
constructed.
* Play an H.264 video with an MP4 container in fullscreen mode
$ gst-launch-1.0 -v filesrc location=/path/to/video.mp4 ! \
qtdemux ! vaapidecodebin ! vaapisink fullscreen=true
* Play a raw MPEG-2 interlaced stream
$ gst-launch-1.0 -v filesrc location=/path/to/mpeg2.bits ! \
mpegvideoparse ! vaapimpeg2dec ! vaapipostproc ! vaapisink
* Convert from one pixel format to another, while also downscaling
$ gst-launch-1.0 -v filesrc location=/path/to/raw_video.yuv ! \
videoparse format=yuy2 width=1280 height=720 ! \
vaapipostproc format=nv12 height=480 ! vaapisink
* Encode a 1080p stream in raw I420 format into H.264
$ gst-launch-1.0 -v filesrc location=/path/to/raw_video.yuv ! \
videoparse format=i420 width=1920 height=1080 framerate=30/1 ! \
vaapih264enc rate-control=cbr tune=high-compression ! \
qtmux ! filesink location=/path/to/encoded_video.mp4
Sources
-------
gstreamer-vaapi is Open Source software, so updates to this
framework are really easy to get.
Stable source code releases can be found at:
<https://gstreamer.freedesktop.org/src/gstreamer-vaapi/>
GitLab repository for work-in-progress changes is available at:
<https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi>
Reporting Bugs
--------------
Bugs can be reported in the GStreamer's GitLab system at:
<https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues>
This is GStreamer gstreamer-vaapi 1.17.0.1.
The GStreamer team is thrilled to announce a new major feature release in the
stable 1.0 API series of your favourite cross-platform multimedia framework!
As always, this release is again packed with new features, bug fixes and
other improvements.
The 1.16 release series adds new features on top of the 1.14 series and is
part of the API and ABI-stable 1.x release series of the GStreamer multimedia
framework.
Full release notes will one day be found at:
https://gstreamer.freedesktop.org/releases/1.16/
Binaries for Android, iOS, Mac OS X and Windows will usually be provided
shortly after the release.
This module will not be very useful by itself and should be used in conjunction
with other GStreamer modules for a complete multimedia experience.
- gstreamer: provides the core GStreamer libraries and some generic plugins
- gst-plugins-base: a basic set of well-supported plugins and additional
media-specific GStreamer helper libraries for audio,
video, rtsp, rtp, tags, OpenGL, etc.
- gst-plugins-good: a set of well-supported plugins under our preferred
license
- gst-plugins-ugly: a set of well-supported plugins which might pose
problems for distributors
- gst-plugins-bad: a set of plugins of varying quality that have not made
their way into one of core/base/good/ugly yet, for one
reason or another. Many of these are are production quality
elements, but may still be missing documentation or unit
tests; others haven't passed the rigorous quality testing
we expect yet.
- gst-libav: a set of codecs plugins based on the ffmpeg library. This is
where you can find audio and video decoders and encoders
for a wide variety of formats including H.264, AAC, etc.
- gstreamer-vaapi: hardware-accelerated video decoding and encoding using
VA-API on Linux. Primarily for Intel graphics hardware.
- gst-omx: hardware-accelerated video decoding and encoding, primarily for
embedded Linux systems that provide an OpenMax
implementation layer such as the Raspberry Pi.
- gst-rtsp-server: library to serve files or streaming pipelines via RTSP
- gst-editing-services: library an plugins for non-linear editing
==== Download ====
You can find source releases of gstreamer in the download
directory: https://gstreamer.freedesktop.org/src/gstreamer/
The git repository and details how to clone it can be found at
https://cgit.freedesktop.org/gstreamer/gstreamer/
==== Homepage ====
The project's website is https://gstreamer.freedesktop.org/
==== Support and Bugs ====
We have recently moved from GNOME Bugzilla to GitLab on freedesktop.org
for bug reports and feature requests:
https://gitlab.freedesktop.org/gstreamer
Please submit patches via GitLab as well, in form of Merge Requests. See
https://gstreamer.freedesktop.org/documentation/contribute/
for more details.
For help and support, please subscribe to and send questions to the
gstreamer-devel mailing list (see below for details).
There is also a #gstreamer IRC channel on the Freenode IRC network.
==== Developers ====
GStreamer source code repositories can be found on GitLab on freedesktop.org:
https://gitlab.freedesktop.org/gstreamer
and can also be cloned from there and this is also where you can submit
Merge Requests or file issues for bugs or feature requests.
Interested developers of the core library, plugins, and applications should
subscribe to the gstreamer-devel list:
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
This diff is collapsed.
---
short-description: GStreamer plugins from gstreamer-vaapi
...
# VAAPI Plugin
## Environment variables
GStreamer-VAAPI inspects a few of environment variables to define it
usage.
**GST_VAAPI_ALL_DRIVERS.**
This environment variable can be set, independently of its value, to
disable the drivers white list. By default only intel and mesa va
drivers are loaded if they are available. The rest are ignored. With
this environment variable defined, all the available va drivers are
loaded, even if they are deprecated.
**LIBVA_DRIVER_NAME.**
This environment variable can be set with the drivers name to load. For
example, intel's driver is `i915`, meanwhile mesa is `gallium`.
**LIBVA_DRIVERS_PATH.**
This environment variable can be set to a colon-separated list of paths
(or a semicolon-separated list on Windows). libva will scan these paths
for va drivers.
build_hotdoc = false
if meson.is_cross_build()
if get_option('doc').enabled()
error('Documentation enabled but building the doc while cross building is not supported yet.')
endif
message('Documentation not built as building it while cross building is not supported yet.')
subdir_done()
endif
required_hotdoc_extensions = ['gi-extension', 'gst-extension']
if gst_dep.type_name() == 'internal'
gst_proj = subproject('gstreamer')
plugins_cache_generator = gst_proj.get_variable('plugins_cache_generator')
else
plugins_cache_generator = find_program(join_paths(gst_dep.get_pkgconfig_variable('libexecdir'), 'gstreamer-' + api_version, 'gst-plugins-doc-cache-generator'),
required: false)
endif
plugins_cache = join_paths(meson.current_source_dir(), 'gst_plugins_cache.json')
if plugins_cache_generator.found()
plugins_doc_dep = custom_target('vaapi-plugins-doc-cache',
command: [plugins_cache_generator, plugins_cache, '@OUTPUT@', '@INPUT@'],
input: plugins,
output: 'gst_plugins_cache.json',
)
else
warning('GStreamer plugin inspector for documentation not found, can\'t update the cache')
endif
hotdoc_p = find_program('hotdoc', required: get_option('doc'))
if not hotdoc_p.found()
message('Hotdoc not found, not building the documentation')
subdir_done()
endif
build_hotdoc = true
hotdoc = import('hotdoc')
if not hotdoc.has_extensions(required_hotdoc_extensions)
if get_option('doc').enabled()
error('Documentation enabled but gi-extension missing')
endif
message('@0@ extensions not found, not building documentation'.format(required_hotdoc_extensions))
subdir_done()
endif
message('Plugins: @0@'.format(plugins))
libs_doc = []
plugins_doc = [hotdoc.generate_doc('vaapi',
project_version: api_version,
sitemap: 'sitemap.txt',
index: 'index.md',
gst_index: 'index.md',
gst_smart_index: true,
gst_c_sources: ['../gst/*/*.[ch]',],
gst_cache_file: plugins_cache,
gst_plugin_name: 'vaapi',
dependencies: [gstbase_dep, gstvideo_dep, gstallocators_dep, gstpbutils_dep,
libva_dep, gstlibvaapi_dep, gstgl_dep, libm] + plugins,
)]
/*
* egl_compat.h - EGL compatiliby layer
*
* Copyright (C) 2014 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301
*/
#ifndef EGL_COMPAT_H
#define EGL_COMPAT_H
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "ogl_compat.h"
#ifndef GL_OES_EGL_image
#define GL_OES_EGL_image 1
typedef void *GLeglImageOES;
typedef void (*PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)(GLenum target,
GLeglImageOES image);
typedef void (*PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)(GLenum target,
GLeglImageOES image);
#endif /* GL_OES_EGL_image */
#endif /* EGL_COMPAT_H */
This diff is collapsed.
/*
* gstvaapibufferproxy.c - Buffer proxy abstraction
*
* Copyright (C) 2014 Intel Corporation
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include "sysdeps.h"
#include "gstvaapicompat.h"
#include "gstvaapibufferproxy.h"
#include "gstvaapibufferproxy_priv.h"
#include "gstvaapiutils.h"
#include "gstvaapiobject_priv.h"
#define DEBUG 1
#include "gstvaapidebug.h"
static gboolean
gst_vaapi_buffer_proxy_acquire_handle (GstVaapiBufferProxy * proxy)
{
const guint mem_type = proxy->va_info.mem_type;
VAStatus va_status;
if (proxy->va_info.handle)
return TRUE;
if (!proxy->parent || proxy->va_buf == VA_INVALID_ID)
return FALSE;
GST_VAAPI_OBJECT_LOCK_DISPLAY (proxy->parent);
va_status = vaAcquireBufferHandle (GST_VAAPI_OBJECT_VADISPLAY (proxy->parent),
proxy->va_buf, &proxy->va_info);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (proxy->parent);
if (!vaapi_check_status (va_status, "vaAcquireBufferHandle()"))
return FALSE;
if (proxy->va_info.mem_type != mem_type)
return FALSE;
return TRUE;
}
static gboolean
gst_vaapi_buffer_proxy_release_handle (GstVaapiBufferProxy * proxy)
{
VAStatus va_status;
if (!proxy->va_info.handle)
return TRUE;
if (!proxy->parent || proxy->va_buf == VA_INVALID_ID)
return FALSE;
GST_VAAPI_OBJECT_LOCK_DISPLAY (proxy->parent);
va_status = vaReleaseBufferHandle (GST_VAAPI_OBJECT_VADISPLAY (proxy->parent),
proxy->va_buf);
GST_VAAPI_OBJECT_UNLOCK_DISPLAY (proxy->parent);
if (!vaapi_check_status (va_status, "vaReleaseBufferHandle()"))
return FALSE;
return TRUE;
}
static void
gst_vaapi_buffer_proxy_finalize (GstVaapiBufferProxy * proxy)
{
gst_vaapi_buffer_proxy_release_handle (proxy);
if (proxy->mem) {
gst_memory_unref (proxy->mem);
proxy->mem = NULL;
}
/* Notify the user function that the object is now destroyed */
if (proxy->destroy_func)
proxy->destroy_func (proxy->destroy_data);
gst_vaapi_object_replace (&proxy->parent, NULL);
}
static inline const GstVaapiMiniObjectClass *
gst_vaapi_buffer_proxy_class (void)
{
static const GstVaapiMiniObjectClass GstVaapiBufferProxyClass = {
sizeof (GstVaapiBufferProxy),
(GDestroyNotify) gst_vaapi_buffer_proxy_finalize
};
return &GstVaapiBufferProxyClass;
}
GstVaapiBufferProxy *
gst_vaapi_buffer_proxy_new (guintptr handle, guint type, gsize size,
GDestroyNotify destroy_func, gpointer user_data)
{
GstVaapiBufferProxy *proxy;
g_return_val_if_fail (handle != 0, NULL);
g_return_val_if_fail (size > 0, NULL);
proxy = (GstVaapiBufferProxy *)
gst_vaapi_mini_object_new (gst_vaapi_buffer_proxy_class ());
if (!proxy)
return NULL;
proxy->parent = NULL;
proxy->destroy_func = destroy_func;
proxy->destroy_data = user_data;
proxy->type = type;
proxy->va_buf = VA_INVALID_ID;
proxy->va_info.handle = handle;
proxy->va_info.type = VAImageBufferType;
proxy->va_info.mem_type = from_GstVaapiBufferMemoryType (proxy->type);
proxy->va_info.mem_size = size;
proxy->mem = NULL;
if (!proxy->va_info.mem_type)
goto error_unsupported_mem_type;
return proxy;
/* ERRORS */
error_unsupported_mem_type:
{
GST_ERROR ("unsupported buffer type (%d)", proxy->type);
gst_vaapi_buffer_proxy_unref (proxy);
return NULL;
}
}
GstVaapiBufferProxy *
gst_vaapi_buffer_proxy_new_from_object (GstVaapiObject * object,
VABufferID buf_id, guint type, GDestroyNotify destroy_func, gpointer data)
{
GstVaapiBufferProxy *proxy;
g_return_val_if_fail (object != NULL, NULL);
proxy = (GstVaapiBufferProxy *)
gst_vaapi_mini_object_new (gst_vaapi_buffer_proxy_class ());
if (!proxy)
return NULL;