5 years agodecoder: fix memory leak when processing interlaced pictures.
Gwenole Beauchesne [Tue, 11 Jun 2013 13:11:34 +0000 (15:11 +0200)]
decoder: fix memory leak when processing interlaced pictures.

Fix memory leak when processing interlaced pictures and that occurs
because the first field, represented as a GstVideoCodecFrame, never
gets released. i.e. when the picture is completed, this is generally
the case when the second field is successfully decoded, we need to
propagate the GstVideoCodecFrame of the first field to the original
GstVideoDecoder so that it could reclaim memory.

Otherwise, we keep accumulating the first fields into GstVideoDecoder
private frames list until the end-of-stream is reached. The frames
are eventually released there, but too late, i.e. too much memory
may have been consumed.

5 years agoplugins: simlpify gst_vaapi_create_display() helper.
Gwenole Beauchesne [Mon, 15 Jul 2013 09:58:31 +0000 (11:58 +0200)]
plugins: simlpify gst_vaapi_create_display() helper.

Simplify gst_vaapi_create_display() helper as gst_vaapi_display_XXX_new()
performs the necessary validation checks for the underlying VA display
prior to returning to the caller. So, if an error occurred, then NULL is
really returned in that case.

5 years agoplugins: add gst_vaapi_create_display() helper.
Víctor Manuel Jáquez Leal [Fri, 24 May 2013 09:04:01 +0000 (05:04 -0400)]
plugins: add gst_vaapi_create_display() helper.

Signed-off-by: Gwenole Beauchesne <>
5 years agoplugins: don't reallocate pool allocator for the same caps.
Gwenole Beauchesne [Fri, 12 Jul 2013 15:47:07 +0000 (17:47 +0200)]
plugins: don't reallocate pool allocator for the same caps.

If the video buffer pool config doesn't have new caps, then it's not
necessary to reinstantiate the allocator. That could be a costly
operation as we could do some extra heavy checking in there.

5 years agoplugins: fix ref counting of GstVaapiVideoMemory allocator.
Gwenole Beauchesne [Fri, 12 Jul 2013 15:14:49 +0000 (17:14 +0200)]
plugins: fix ref counting of GstVaapiVideoMemory allocator.

Fix reference counting issue whereby gst_memory_init() does not hold
an extra reference to the GstAllocator. So, there could be situations
where the last instance of GstVaapiVideoAllocator gets released before
a dangling GstVaapiVideoMemory object, thus possibly leading to a crash.

5 years agovaapiupload: use implicit color conversion to NV12.
Gwenole Beauchesne [Fri, 12 Jul 2013 13:15:07 +0000 (15:15 +0200)]
vaapiupload: use implicit color conversion to NV12.

Always perform conversion of sources buffers to NV12 since this is
the way we tested for this capability in ensure_allowed_caps(). This
also saves memory bandwidth for further rendering. However, this may
not preserve quality since the YUV buffers are down-sampled to 4:2:0.

5 years agopool: fix deallocation of video pools.
Gwenole Beauchesne [Fri, 12 Jul 2013 13:01:01 +0000 (15:01 +0200)]
pool: fix deallocation of video pools.

The queue of free objects to used was deallocated with g_queue_free_full().
However, this convenience function shall only be used if the original queue
was allocated with g_queue_new(). This caused memory corruption, eventually
leading to a crash.

The correct solution is to pair the g_queue_init() with the corresponding
g_queue_clear(), while iterating over all free objects to deallocate them.

5 years agovaapidownload: fix src caps format error.
Wind Yuan [Wed, 13 Mar 2013 09:44:52 +0000 (17:44 +0800)]
vaapidownload: fix src caps format error.

This fixes direct linking of vaapidownload element to xvimagesink with
VA drivers supporting vaGetImage() from the native VA surface format to
a different VA image format. i.e. color conversion during download.

Signed-off-by: Gwenole Beauchesne <>
5 years agovaapidownload: fix debug string for image formats.
Gwenole Beauchesne [Thu, 11 Jul 2013 16:26:37 +0000 (18:26 +0200)]
vaapidownload: fix debug string for image formats.

The image is now expressed as a standard GstVideoFormat, which is not
a FOURCC but rather a regular enum value.

This is a regression introduced in commit 09397fa.

5 years agoimage: add support for raw YUY2/UYVY image copies.
Wind Yuan [Wed, 24 Apr 2013 02:39:03 +0000 (10:39 +0800)]
image: add support for raw YUY2/UYVY image copies.

Implement raw image copies for YUY2 format. Add support for UYVY format
too, with the same copy function as for YUY2. Even though components
ordering differs, copying line strides is essentially the same.

Signed-off-by: Gwenole Beauchesne <>
5 years agoplugins: clean-up video uploader helper.
Gwenole Beauchesne [Wed, 10 Jul 2013 13:15:11 +0000 (15:15 +0200)]
plugins: clean-up video uploader helper.

Fix gst_vaapi_uploader_get_buffer() to not assign caps since they
were already negotiated beforehand, and they are not used from the
buffer in upstream elements.

Clean-up gst_vaapi_uploader_ensure_caps() to use the new image caps
represented as a GstVideoInfo.

5 years agoplugins: use GstVideoInfo in video uploader helper.
Gwenole Beauchesne [Wed, 10 Jul 2013 13:03:43 +0000 (15:03 +0200)]
plugins: use GstVideoInfo in video uploader helper.

5 years agoplugins: allow creation of VA surfaces with explicit pixel format.
Gwenole Beauchesne [Wed, 10 Jul 2013 08:34:24 +0000 (10:34 +0200)]
plugins: allow creation of VA surfaces with explicit pixel format.

Adapt GstVaapiVideoMemory allocator to support creation of VA surfaces
with an explicit pixel format. This allows for direct rendering to
VA surface memory from a software decoder.

5 years agosurface: fix surface pool creation with an explicit pixel format.
Gwenole Beauchesne [Wed, 10 Jul 2013 12:20:30 +0000 (14:20 +0200)]
surface: fix surface pool creation with an explicit pixel format.

Fix creation of surface pool objects to honour explicit pixel format
specification. If this operation is not supported, then fallback to
the older interface with chroma format.

5 years agosurface: try to determine the underlying VA surface format.
Gwenole Beauchesne [Wed, 10 Jul 2013 11:58:55 +0000 (13:58 +0200)]
surface: try to determine the underlying VA surface format.

If a VA surface was allocated with the chroma-format interface, try to
determine the underlying pixel format on gst_vaapi_surface_get_format(),
or return GST_VIDEO_FORMAT_ENCODED if this is not a supported operation.

5 years agosurface: allow creation with explicit pixel format.
Gwenole Beauchesne [Tue, 9 Jul 2013 17:08:37 +0000 (19:08 +0200)]
surface: allow creation with explicit pixel format.

Make it possible to create VA surfaces with a specific pixel format.
This is a new capability brought in by VA-API >= 0.34.0. If that
capability is not built-in (e.g. using VA-API < 0.34.0), then
gst_vaapi_surface_new_with_format() will return NULL.

5 years agosurface: add helper function to get chroma type from GstVideoFormat.
Gwenole Beauchesne [Wed, 10 Jul 2013 07:48:40 +0000 (09:48 +0200)]
surface: add helper function to get chroma type from GstVideoFormat.

Add gst_video_format_get_chroma_type() helper function to determine
the GstVaapiChromaType from a standard GStreamer video format. It is
possible to reconstruct that from GstVideoFormatInfo but it is much
simpler (and faster?) to use the local GstVideoFormatMap table.

5 years agosurface: add new chroma formats.
Gwenole Beauchesne [Tue, 9 Jul 2013 17:13:39 +0000 (19:13 +0200)]
surface: add new chroma formats.

Add new chroma formats available with VA-API >= 0.34.0. In particular,
this includes "RGB" chroma formats, and more YUV subsampled formats.
Also add a new from_GstVaapiChromaType() helper function to convert
libgstvaapi chroma type to VA chroma format.

5 years agopool: fix image pool to check for the video format to use.
Gwenole Beauchesne [Wed, 10 Jul 2013 11:32:15 +0000 (13:32 +0200)]
pool: fix image pool to check for the video format to use.

Make gst_vaapi_image_pool_new() succeed, and thus returning a valid
image pool object, only if the underlying VA display does support the
requested VA image format.

5 years agoUse GstVideoInfo for video pools.
Gwenole Beauchesne [Wed, 10 Jul 2013 11:07:37 +0000 (13:07 +0200)]
Use GstVideoInfo for video pools.

Get rid of GstCaps to create surface/image pool, and use GstVideoInfo
structures instead. Those are smaller, and allows for streamlining
libgstvaapi more.

5 years agoAdd more video formats.
Gwenole Beauchesne [Tue, 9 Jul 2013 16:03:36 +0000 (18:03 +0200)]
Add more video formats.

Add new video format mappings to VA image formats:
- YUV: packed YUV (YUY2, UYVY), grayscale (Y800) ;
- RGB: 32-bit RGB without alpha channel (XRGB, XBGR, RGBX, BGRX).

5 years agoimage: fix debug message with video format.
Gwenole Beauchesne [Wed, 10 Jul 2013 13:52:20 +0000 (15:52 +0200)]
image: fix debug message with video format.

Fix debug message string with image format expressed with GstVideoFormat
instead of the obsolete format that turned out to be a fourcc.

This is a regression from git commit e61c5fc.

5 years agotests: port to new video format API.
Gwenole Beauchesne [Tue, 9 Jul 2013 13:28:31 +0000 (15:28 +0200)]
tests: port to new video format API.

5 years agoplugins: port to new video format API.
Gwenole Beauchesne [Tue, 9 Jul 2013 13:44:35 +0000 (15:44 +0200)]
plugins: port to new video format API.

5 years agolibs: use GstVideoInfo wherever possible.
Gwenole Beauchesne [Tue, 9 Jul 2013 14:26:11 +0000 (16:26 +0200)]
libs: use GstVideoInfo wherever possible.

In particular, use gst_video_info_from_caps() helper function in VA image
for implementating gst_vaapi_image_get_buffer() [vaapidownload] and
gst_vaapi_image_update_from_buffer() [subpictures] in GStreamer 0.10 builds.

5 years agolibs: drop GstVaapiImageFormat helpers.
Gwenole Beauchesne [Tue, 9 Jul 2013 14:38:05 +0000 (16:38 +0200)]
libs: drop GstVaapiImageFormat helpers.

Drop GstVaapiImageFormat helpers since everything was moved to the new
GstVideoFormat based API. Don't bother with backwards compatibility and
just bump the library major version afterwards.

5 years agolibs: port to new video format API.
Gwenole Beauchesne [Tue, 9 Jul 2013 12:03:01 +0000 (14:03 +0200)]
libs: port to new video format API.

5 years agoAdd new video format API.
Gwenole Beauchesne [Tue, 9 Jul 2013 13:29:59 +0000 (15:29 +0200)]
Add new video format API.

Leverage GstVideoFormat utilities from core GStreamer to provide an
adaptation layer to VA image formats.

5 years agoNEWS: updates.
Gwenole Beauchesne [Tue, 9 Jul 2013 09:13:59 +0000 (11:13 +0200)]
NEWS: updates.

5 years agovaapisink: fix creation of GLX texture.
Gwenole Beauchesne [Mon, 8 Jul 2013 16:32:00 +0000 (18:32 +0200)]
vaapisink: fix creation of GLX texture.

Fix creation of GLX texture, to not depend on the GstCaps video size that
could be wrong, especially in presence of frame cropping. So, use the size
from the source VA surfaces.

An optimization could be to reduce the texture size to the actual visible
size on screen. i.e. scale down the texture size to match the screen dimensions,
while preserving the VA surface aspect ratio. However, some VA drivers don't
honour that.

5 years agompeg2: add support for video cropping.
Sreerenj Balachandran [Mon, 18 Feb 2013 14:28:27 +0000 (16:28 +0200)]
mpeg2: add support for video cropping.

If the stream has a sequence_display_extenion, then attach the
display_horizontal/display_vertical dimension as the cropping
rectangle width/height to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <>
5 years agovc1: add support for video cropping.
Sreerenj Balachandran [Mon, 18 Feb 2013 13:05:37 +0000 (15:05 +0200)]
vc1: add support for video cropping.

If the Advanced profile has display_extension fields, then set the display
width/height dimension as cropping rectangle to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <>
5 years agoh264: add support for video cropping.
Sreerenj Balachandran [Fri, 15 Feb 2013 16:50:26 +0000 (18:50 +0200)]
h264: add support for video cropping.

If the encoded stream has the frame_cropping_flag set, then associate
the cropping rectangle to GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <>
5 years agotests: add basic support for video cropping.
Gwenole Beauchesne [Mon, 8 Jul 2013 15:01:21 +0000 (17:01 +0200)]
tests: add basic support for video cropping.

Change generic decoder of sample I-frame to return a GstVaapiSurfaceProxy
instead of a plain GstVaapiSurface. This means that we can now retrieve
the frame cropping rectangle from the surface proxy, along with additional
information if ever needed.

5 years agoplugins: add support for video cropping.
Gwenole Beauchesne [Mon, 8 Jul 2013 12:50:42 +0000 (14:50 +0200)]
plugins: add support for video cropping.

Add support for GstVideoCropMeta in GStreamer >= 1.0.x builds and gst-vaapi
specific meta information to hold video cropping details. Make the sink
support video cropping in X11 and GLX modes.

5 years agoplugins: add helper functions to set the render rectangle.
Sreerenj Balachandran [Fri, 15 Feb 2013 16:24:24 +0000 (18:24 +0200)]
plugins: add helper functions to set the render rectangle.

Some video clips may have a clipping region that needs to propogate to
the renderer. These helper functions make it possible to attach that
clipping region, as a GstVaapiRectangle, the the video meta associated
with the buffer.

Signed-off-by: Sreerenj Balachandran <>
signed-off-by: Gwenole Beauchesne <>

5 years agosurfaceproxy: allow for NULL cropping rectangle.
Gwenole Beauchesne [Mon, 8 Jul 2013 12:47:24 +0000 (14:47 +0200)]
surfaceproxy: allow for NULL cropping rectangle.

Make it possible associate an empty cropping rectangle to the surface
proxy, thus resetting any cropping rectangle that was previously set.
This allows for returning plain NULL when no cropping rectangle was
initially set up to the surface proxy, or if it was reset to defaults.

5 years agosurfaceproxy: clean-up helper macros.
Gwenole Beauchesne [Mon, 8 Jul 2013 09:41:59 +0000 (11:41 +0200)]
surfaceproxy: clean-up helper macros.

Always use the GST_VAAPI_SURFACE_PROXY() helper macro to cast from a
proxy macro argument to a GstVaapiSurfaceProxy pointer.

5 years agosurface: add simple surface info accessors as helper macros.
Gwenole Beauchesne [Mon, 8 Jul 2013 09:43:27 +0000 (11:43 +0200)]
surface: add simple surface info accessors as helper macros.

Add helper macros to retrieve the VA surface information like size
(width, height) or chroma type. This is a micro-optimization to avoid
useless function calls and NULL pointer re-checks in internal routines.

5 years agodecoder: add support for video cropping.
Sreerenj Balachandran [Fri, 15 Feb 2013 16:42:12 +0000 (18:42 +0200)]
decoder: add support for video cropping.

Add gst_vaapi_picture_set_crop_rect() helper function to copy the video
cropping information from raw bitstreams to each picture being decoded.
Also add helper function to surface proxy to propagate that information
outside of libgstvaapi. e.g. plug-in elements or standalone applications.

Signed-off-by: Sreerenj Balachandran <>
Signed-off-by: Gwenole Beauchesne <>
5 years agocodecparsers: update to gst-vaapi-branch commit f90de0a.
Gwenole Beauchesne [Mon, 8 Jul 2013 15:30:30 +0000 (17:30 +0200)]
codecparsers: update to gst-vaapi-branch commit f90de0a.

f90de0a h264: fix calculation of the frame cropping rectangle
535515c h264: parse the cropping rectangle separately

5 years agocodecparsers: update to gst-vaapi-branch commit 0f68a71.
Gwenole Beauchesne [Fri, 5 Jul 2013 17:03:41 +0000 (19:03 +0200)]
codecparsers: update to gst-vaapi-branch commit 0f68a71.

0f68a71 mpeg2: fix video packet header size checks

5 years agompeg2: reset quantization matrices on new sequence headers.
Zhong Cong [Fri, 7 Jun 2013 12:08:43 +0000 (20:08 +0800)]
mpeg2: reset quantization matrices on new sequence headers.

The MPEG-2 standard specifies (6.3.7) that all quantisation matrices
shall be reset to their default values when a Sequence_Header() is

Signed-off-by: Gwenole Beauchesne <>
5 years agompeg2: cope with latest codecparser changes.
Gwenole Beauchesne [Fri, 5 Jul 2013 13:49:34 +0000 (15:49 +0200)]
mpeg2: cope with latest codecparser changes.

Fix build with newer MPEG-2 codecparser where GstMpegVideoPacket are
used in individual header parsers. Also use the new slice parsing API.

5 years agocodecparsers: update to gst-vaapi-branch commit dddd182.
Gwenole Beauchesne [Fri, 5 Jul 2013 15:51:26 +0000 (17:51 +0200)]
codecparsers: update to gst-vaapi-branch commit dddd182.

dddd182 mpeg2: add slice header parsing API
94e6228 mpeg2: add sequence scalable extension parsing API
531134f mpeg2: add new API that takes GstMpegVideoPacket arguments
4b135d3 h264: fix the return value type for the SEI palyload parsing methods

5 years agovaapisink: expose the raw video formats in static caps template.
Sreerenj Balachandran [Thu, 27 Jun 2013 09:25:44 +0000 (12:25 +0300)]
vaapisink: expose the raw video formats in static caps template.

Expose all raw video formats in the static caps template since the
vaapisink is supporting raw data. We will get the exact set of formats
supported by the driver dynamically through the _get_caps() routine.

This also fixes an inconsistency wrt. GStreamer 0.10 builds.

Signed-off-by: Gwenole Beauchesne <>
5 years agovaapisink: add "use-glx" property for OpenGL rendering.
Gwenole Beauchesne [Thu, 27 Jun 2013 11:53:46 +0000 (13:53 +0200)]
vaapisink: add "use-glx" property for OpenGL rendering.

Now that VA/GLX capable buffers are generated by default on X11, thus
depending on a VA/GLX display, we stil want to use vaPutSurface() for
rendering since it is faster.

Anyway, OpenGL rendering in vaapisink was only meant for testing and
enabling "fancy" effects to play with. This has no real value. So,
disable OpenGL rendering by default.

5 years agoplugins: try to allocate a GLX display first over an X11 one.
Víctor Manuel Jáquez Leal [Thu, 6 Jun 2013 09:36:03 +0000 (05:36 -0400)]
plugins: try to allocate a GLX display first over an X11 one.

If the gstreamer-vaapi plug-in elements are built with GLX support, then
try to allocate a GstVaapiDisplayGLX first before resorting to a VA/X11
display next.

5 years agoconfigure: use GST_PLUGIN_PATH_1_0 instead of GST_PLUGIN_PATH for Gst 1.0.
Lionel Landwerlin [Thu, 25 Apr 2013 16:07:13 +0000 (17:07 +0100)]
configure: use GST_PLUGIN_PATH_1_0 instead of GST_PLUGIN_PATH for Gst 1.0.

jhbuild sets $GST_PLUGIN_PATH_1_0 which overrides $GST_PLUGIN_PATH.

Signed-off-by: Gwenole Beauchesne <>
5 years agoimage: fix wrong check for rect bounds in copy_image().
Wind Yuan [Sat, 27 Apr 2013 07:15:49 +0000 (15:15 +0800)]
image: fix wrong check for rect bounds in copy_image().

5 years agoBump version for development.
Gwenole Beauchesne [Fri, 14 Jun 2013 11:41:14 +0000 (13:41 +0200)]
Bump version for development.

5 years ago0.5.4. 0.5.4
Gwenole Beauchesne [Fri, 14 Jun 2013 09:47:50 +0000 (11:47 +0200)]

5 years agoNEWS: updates.
Gwenole Beauchesne [Fri, 14 Jun 2013 09:43:46 +0000 (11:43 +0200)]
NEWS: updates.

5 years agoconfigure: always build the MPEG-4 parser.
Gwenole Beauchesne [Fri, 14 Jun 2013 09:39:54 +0000 (11:39 +0200)]
configure: always build the MPEG-4 parser.

Always build the MPEG-4 parser for now as there are also core fixes
included in the parser that cannot be tested for with API checks.

5 years agoconfigure: add --enable-builtin-codecparsers [default="yes"] option.
Gwenole Beauchesne [Fri, 14 Jun 2013 09:32:36 +0000 (11:32 +0200)]
configure: add --enable-builtin-codecparsers [default="yes"] option.

Add flag to have all codecparsers built-in, thus ensuring that the
resulting binaries have all the necessary bug fixes and this is what
the QA has been testing anyway.

Of course, for a completely up-to-date Linux distribution, you could
also opt for --disable-builtin-codecparsers and use the system ones.
Though, some core fixes could be missing, and those cannot be tested
for with API checks.

5 years agocodecparsers: update to gst-vaapi-branch commit 843ce3e.
Gwenole Beauchesne [Fri, 14 Jun 2013 09:14:23 +0000 (11:14 +0200)]
codecparsers: update to gst-vaapi-branch commit 843ce3e.

843ce3e jpeg: fix default Huffman tables generation.
8655187 mpeg2: fix the pixel-aspect-ratio calculation
21099dc mpeg2: actually store video bitrate values
dd02087 mpeg2: fix picture packet extension size check
25948e9 mpeg2: increase min size for picture coding ext
f1f5a40 ensure the debug category is properly initialized

5 years agodebian: fix list of generated files for .deb packaging.
Gwenole Beauchesne [Wed, 12 Jun 2013 13:16:17 +0000 (14:16 +0100)]
debian: fix list of generated files for .deb packaging.

5 years agodebian: fix libgstvaapi -dev package name.
Gwenole Beauchesne [Wed, 12 Jun 2013 12:48:26 +0000 (13:48 +0100)]
debian: fix libgstvaapi -dev package name.

Fix libgstvaapi -dev package name so that to allow installation of both
GStreamer 0.10 and 1.0.x based packages.

5 years agoNEWS: updates.
Gwenole Beauchesne [Wed, 5 Jun 2013 15:42:00 +0000 (17:42 +0200)]
NEWS: updates.

5 years agowayland: fix memory leak of display resources.
Gwenole Beauchesne [Fri, 31 May 2013 09:09:40 +0000 (11:09 +0200)]
wayland: fix memory leak of display resources.

5 years agovaapisink: fix build without VA/GLX support.
Zhao Halley [Mon, 3 Jun 2013 23:14:22 +0000 (07:14 +0800)]
vaapisink: fix build without VA/GLX support.

5 years agoplugins: allow buffer mappings to GstVaapiSurfaceProxy.
Gwenole Beauchesne [Wed, 5 Jun 2013 09:01:51 +0000 (11:01 +0200)]
plugins: allow buffer mappings to GstVaapiSurfaceProxy.

Allow plain gst_buffer_map() interface to work with gstreamer-vaapi
video buffers, i.e. expose the underlying GstVaapiSurfaceProxy to the
caller. This is the only sensible enough thing to do in this mode as
the underlying surface pixels need to be extracted through an explicit
call to the gst_video_frame_map() function instead.

A possible use-case of this is to implement a "handoff" signal handler
to fakesink or identity element for further processing.

5 years agoplugins: silence check for direct-rendering mode in video memory.
Gwenole Beauchesne [Mon, 3 Jun 2013 08:22:44 +0000 (10:22 +0200)]
plugins: silence check for direct-rendering mode in video memory.

Fix gst_vaapi_video_allocator_new() to silently check for direct-rendering
mode support, and not trigger fatal-criticals if either test surface or
image could not be created. Typical case: pixel format mismatch, e.g. NV12
supported by most hardware vs. I420 supported by most software decoders.

5 years agoplugins: improve video memory flags safety checks.
Gwenole Beauchesne [Mon, 3 Jun 2013 08:06:29 +0000 (10:06 +0200)]
plugins: improve video memory flags safety checks.

On map, ensure we have GST_MAP_WRITE flags since this is only what we
support for now. Likewise, on unmap, make sure that the VA image is
unmapped for either read or write, while still committing it to the
VA surface if write was requested.

5 years agosurface: fix memory leak through unreleased parent context.
Gwenole Beauchesne [Thu, 30 May 2013 16:17:07 +0000 (18:17 +0200)]
surface: fix memory leak through unreleased parent context.

Break the circular references between GstVaapiContext and its children
GstVaapiSurfaces. Since the VA surfaces held an extra reference to the
context, which holds a reference to its VA surfaces, then none of those
were released.

How does this impact support for subpictures?

The only situation when the parent context needs to disappear is when
it is replaced with another one because of a resolution change in the
video stream for instance, or a normal destroy. In this case, it does
not really matter to apply subpictures to the peer surfaces since they
are either gone, or those that are left in the pipe can probably bear
a reinstantiation of the subpictures for it.

So, parent_context is set to NULL when the parent context is destroyed,
other VA surfaces can still get subpictures attached to them, individually
not as a whole. i.e. subpictures for surface S1 will be created from
active composition buffers and associated to S1, subpictures for S2 will
be created from the next active composition buffers, etc. We don't try
to cache the subpictures in those cases (pending surfaces until EOS
is reached, or pending surfaces until new surfaces matching new VA context
get to be used instead).

5 years agovaapisink: fix one-time initialization when display property is set.
Gwenole Beauchesne [Mon, 27 May 2013 12:01:48 +0000 (14:01 +0200)]
vaapisink: fix one-time initialization when display property is set.

Fix gst_vaapisink_ensure_display() to perform one-time initialization
tasks even if the `display' property was explicitly set.

5 years agowindow: fix GLX window initialization.
Gwenole Beauchesne [Mon, 27 May 2013 13:59:08 +0000 (15:59 +0200)]
window: fix GLX window initialization.

Make sure to create the GLX context once the window object has completed
its creation. Since gl_resize() relies on the newly created window size,
then we cannot simply overload the GstVaapiWindowClass::create() hook.
So, we just call into gst_vaapi_window_glx_ensure_context() once the
window object is created in the gst_vaapi_window_glx_new*() functions.

5 years agodisplay: validate display types.
Gwenole Beauchesne [Mon, 27 May 2013 15:18:40 +0000 (17:18 +0200)]
display: validate display types.

5 years agodisplay: drop internal NAME_PREFIX, store the real display name.
Gwenole Beauchesne [Mon, 27 May 2013 14:13:33 +0000 (16:13 +0200)]
display: drop internal NAME_PREFIX, store the real display name.

Always store a valid display name/device path, instead of adding a
particular prefix. i.e. make it simply a strdup(), or "" if it was
initially NULL.

5 years agodisplay: make it possible to lookup the display cache by type.
Gwenole Beauchesne [Mon, 27 May 2013 11:17:31 +0000 (13:17 +0200)]
display: make it possible to lookup the display cache by type.

Make it possible to add extra an extra filter to most of display cache
lookup functions so that the GstVaapiDisplay instance can really match
a compatible and existing display by type, instead of relying on extra
string tags (e.g. "X11:" prefix, etc.).

5 years agodisplay: cope with new display cache API.
Gwenole Beauchesne [Fri, 24 May 2013 14:19:23 +0000 (16:19 +0200)]
display: cope with new display cache API.

5 years agodisplay: rework display cache API.
Gwenole Beauchesne [Fri, 24 May 2013 14:12:01 +0000 (16:12 +0200)]
display: rework display cache API.

Simplify display cache API, while making it more flexible. We can now create
custom lookup functions with gst_vaapi_display_cache_lookup_custom().

5 years agotests: improve check for display cache.
Gwenole Beauchesne [Fri, 24 May 2013 13:05:45 +0000 (15:05 +0200)]
tests: improve check for display cache.

Improve check for display cache infrastructure. In particular, for X11 and
GLX backends, we need to make sure that we can create a GstVaapiDisplayX11
from another GstVaapiDisplayGLX, i.e. underlying X11 and VA displays can be
shared. Besides, allocating a GstVaapiDisplayGLX while a GstVaapiDisplayX11
already exists will have to generate different VA displays.

5 years agouploader: fix memory leak in GStreamer 0.10 builds.
Zhao Halley [Wed, 15 May 2013 02:33:16 +0000 (10:33 +0800)]
uploader: fix memory leak in GStreamer 0.10 builds.

In GStreamer 0.10 builds, gst_vaapi_uploader_get_buffer() was used
but it exhibited a memory leak because the surface generated for the
GstVaapiVideoMeta totally lost its parent video pool. So, it was not
possible to release that surface back to the parent pool when the meta
gets released, and the memory consumption kept growing.

Signed-off-by: Gwenole Beauchesne <>
5 years agoplugins: fix gst_vaapi_video_meta_new_from_pool().
Gwenole Beauchesne [Thu, 23 May 2013 16:56:43 +0000 (18:56 +0200)]
plugins: fix gst_vaapi_video_meta_new_from_pool().

Since GST_VAAPI_IS_xxx_VIDEO_POOL() was only testing for NULL and not
the underlying object type, the gst_vaapi_video_meta_new_from_pool()
was hereby totally broken. Fixed this regression by using the newly
provided gst_vaapi_video_pool_get_object_type() function.

5 years agoplugins: cope with GST_VAAPI_IS_xxx() macros removal.
Gwenole Beauchesne [Thu, 23 May 2013 16:22:50 +0000 (18:22 +0200)]
plugins: cope with GST_VAAPI_IS_xxx() macros removal.

5 years agotests: cope with GST_VAAPI_IS_xxx() macros removal.
Gwenole Beauchesne [Thu, 23 May 2013 16:19:24 +0000 (18:19 +0200)]
tests: cope with GST_VAAPI_IS_xxx() macros removal.

5 years agolibs: add query for GstVaapiVideoPool object types.
Gwenole Beauchesne [Thu, 23 May 2013 16:45:23 +0000 (18:45 +0200)]
libs: add query for GstVaapiVideoPool object types.

Add API to identify the underlying GstVaapiVideoPool object type.

5 years agolibs: drop GST_VAAPI_IS_xxx() helper macros.
Gwenole Beauchesne [Thu, 23 May 2013 16:15:48 +0000 (18:15 +0200)]
libs: drop GST_VAAPI_IS_xxx() helper macros.

Drop obsolete GST_VAAPI_IS_xxx() helper macros since we are no longer
deriving from GObject and so those were only checking for whether the
argument was NULL or not. This is now irrelevant, and even confusing
to some extent, because we no longer have type checking.

Note: this incurs more type checking (review) but the libgstvaapi is
rather small, so this is manageable.

5 years agoBump library major version.
Gwenole Beauchesne [Tue, 7 May 2013 16:52:28 +0000 (18:52 +0200)]
Bump library major version.

The whole libgstvaapi libraries got a major refresh to get rid of GObject.
This is a fundamental change that requires a new SONAME. More changes are
underway to streamline the core libraries.

So far, the net result is a reduction of .text size (code) by 32KB, i.e. -10%.
On one particular test (sintel HD trailer), the total number of executed
instruction was reduced by 8%.

5 years agodocs: cope with removed APIs.
Gwenole Beauchesne [Tue, 7 May 2013 16:37:24 +0000 (18:37 +0200)]
docs: cope with removed APIs.

Some APIs are dead because they are no longer based on GObject.

5 years agoplugins: cope with new GstVaapiMiniObject objects.
Gwenole Beauchesne [Mon, 6 May 2013 12:43:38 +0000 (14:43 +0200)]
plugins: cope with new GstVaapiMiniObject objects.

5 years agotests: cope with new GstVaapiMiniObject objects.
Gwenole Beauchesne [Tue, 7 May 2013 09:45:10 +0000 (11:45 +0200)]
tests: cope with new GstVaapiMiniObject objects.

5 years agodisplay: fix set_synchronous() to lock display.
Gwenole Beauchesne [Tue, 7 May 2013 13:38:51 +0000 (15:38 +0200)]
display: fix set_synchronous() to lock display.

5 years agovideopool: simplify creation of video objects pool.
Gwenole Beauchesne [Fri, 3 May 2013 17:02:23 +0000 (19:02 +0200)]
videopool: simplify creation of video objects pool.

5 years agolibs: simplify GstVaapiID definitions.
Gwenole Beauchesne [Tue, 7 May 2013 16:17:10 +0000 (18:17 +0200)]
libs: simplify GstVaapiID definitions.

Make GstVaapiID a gsize instead of guessing an underlying integer large
enough to hold all bits of a pointer. Also drop GST_VAAPI_ID_NONE since
this is plain zero and that it is no longer passed as varargs.

5 years agolibs: drop obsolete function helpers and objects.
Gwenole Beauchesne [Thu, 2 May 2013 14:11:53 +0000 (16:11 +0200)]
libs: drop obsolete function helpers and objects.

Drop obsolete GstVaapiID related function helpers for passing them as

5 years agolibs: use GstVaapiMiniObject for display objects.
Gwenole Beauchesne [Tue, 7 May 2013 09:39:34 +0000 (11:39 +0200)]
libs: use GstVaapiMiniObject for display objects.

5 years agolibs: use GstVaapiMiniObject for video decoders.
Gwenole Beauchesne [Mon, 6 May 2013 12:07:17 +0000 (14:07 +0200)]
libs: use GstVaapiMiniObject for video decoders.

Port GstVaapiDecoder and GstVaapiDecoder{MPEG2,MPEG4,JPEG,H264,VC1} to
GstVaapiMiniObject. Add gst_vaapi_decoder_set_codec_state_changed_func()
helper function to let the user add a callback to a function triggered
whenever the codec state (e.g. caps) changes.

5 years agolibs: use GstVaapiMiniObject for video object pools.
Gwenole Beauchesne [Fri, 3 May 2013 09:01:12 +0000 (11:01 +0200)]
libs: use GstVaapiMiniObject for video object pools.

Port GstVaapiVideoPool, GstVaapiSurfacePool and GstVaapiImagePool to
GstVaapiMiniObject. Drop gst_vaapi_video_pool_get_caps() since it was
no longer used for a long time. Make object allocators static, i.e.
local to the shared library.

5 years agolibs: use GstVaapiObject for texture objects.
Gwenole Beauchesne [Tue, 30 Apr 2013 15:22:00 +0000 (17:22 +0200)]
libs: use GstVaapiObject for texture objects.

5 years agolibs: use GstVaapiObject for window objects.
Gwenole Beauchesne [Tue, 30 Apr 2013 15:20:14 +0000 (17:20 +0200)]
libs: use GstVaapiObject for window objects.

5 years agolibs: use GstVaapiObject for VA objects.
Gwenole Beauchesne [Tue, 30 Apr 2013 15:22:15 +0000 (17:22 +0200)]
libs: use GstVaapiObject for VA objects.

5 years agoPort GstVaapiObject to GstVaapiMiniObject.
Gwenole Beauchesne [Tue, 30 Apr 2013 15:20:46 +0000 (17:20 +0200)]
Port GstVaapiObject to GstVaapiMiniObject.

5 years agolibs: refine GstVaapiMiniObject.
Gwenole Beauchesne [Tue, 30 Apr 2013 08:28:30 +0000 (10:28 +0200)]
libs: refine GstVaapiMiniObject.

Drop support for user-defined data since this capability was not used
so far and GstVaapiMiniObject represents the smallest reference counted
object type. Add missing GST_VAAPI_MINI_OBJECT_CLASS() helper macro.

Besides, since GstVaapiMiniObject is a libgstvaapi internal object, it
is also possible to further simplify the layout of the object. i.e. merge
GstVaapiMiniObjectBase into GstVaapiMiniObject.

5 years agodecoder: update picture size from the bitstream.
Gwenole Beauchesne [Tue, 7 May 2013 14:43:51 +0000 (16:43 +0200)]
decoder: update picture size from the bitstream.

Propagate the picture size from the bitstream to the GstVaapiDecoder,
and subsequent user who installed a signal on notify::caps. This fixes
decoding of TS streams when the demuxer failed to extract the required

5 years agodecoder: fix raw decoding mode.
Gwenole Beauchesne [Thu, 25 Apr 2013 12:16:01 +0000 (14:16 +0200)]
decoder: fix raw decoding mode.

Fix gst_vaapi_decoder_get_surface() to actually transfer ownership of the
surface proxy to the caller.

5 years agodecoder: add gst_vaapi_decoder_get_frame_with_timeout().
Gwenole Beauchesne [Thu, 25 Apr 2013 11:56:18 +0000 (13:56 +0200)]
decoder: add gst_vaapi_decoder_get_frame_with_timeout().

Add gst_vaapi_decoder_get_frame_with_timeout() helper function that will
wait for a frame to be decoded, until the specified timeout in microseconds,
prior to returning to the caller.

This is a fix to performance regression from 851cc0, whereby the vaapidecode
loop executed on the srcpad task was called to often, thus starving all CPU

5 years agoBump version for development.
Gwenole Beauchesne [Fri, 19 Apr 2013 12:38:59 +0000 (14:38 +0200)]
Bump version for development.

5 years ago0.5.3. 0.5.3
Gwenole Beauchesne [Thu, 18 Apr 2013 17:09:45 +0000 (19:09 +0200)]