Commit graph

484 commits

Author SHA1 Message Date
Gwenole Beauchesne
f0d50cfbc2 vaapipostproc: add support for "mixed" interlace mode.
Add support for "mixed" interlace-mode, whereby the video frame buffer
shall be deinterlaced only if its flags mention that's actually an
interlaced frame buffer.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
f6f24bfc55 vaapipostproc: rework plug-in element.
Rewrite the vaapipostproc plug-in element so that it derives from
GstBaseTransform, thus simplifying the caps negotiation process.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
399e887c4f plugins: fix and optimize check for buffer pool allocator params.
Reset the buffer pool allocator only if the config caps changed in a
sensible way: format or resolution change. i.e. don't bother with
other caps like colorimetry et al. as this doesn't affect the way to
allocate VA surfaces or images.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
77b2d88452 plugins: enable memory maps for read & write with direct-rendering.
Enable read and write mappings only if direct-rendering is supported.
Otherwise, this means that we may need to download data from the VA
surface first for correctness, even if the VA surface doesn't need to
be read at all. i.e. sometimes, READWRITE mappings are meant for
surfaces that are written to first, and read afterwards for further
processing.

https://bugzilla.gnome.org/show_bug.cgi?id=704078
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
847e3efb4d plugins: fix check for direct-rendering support.
Fix check for direct-rendering if the creation of VA surfaces with
an explicit pixel format is not support, e.g. VA-API < 0.34.0, and
that we tried to allocate a VA surface based on the corresponding
chroma type. i.e. in that particular case, we have to make sure that
the derived image has actually the expected format.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
f361d4a23d plugins: fix buffer pool reset_buffer() to reset memory resources.
Fix GstVaapiVideoBufferPool::reset_buffer() to reset the underlying
memory resources, and more particularly the VA surface proxy. Most
importantly, the GstVaapiVideoMeta is retained. Cached surface in
memory are released, thus triggering a new allocation the next time
we need to map the buffer.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
4df68163dc plugins: fix GstVaapiVideoMemory to allocate VA surface proxies.
Make sure GstVaapiVideoMemory allocates VA surface proxies from a
pool stored in the parent VA memory allocator.

This fixes the following scenario:
- VA video buffer 1 is allocated from a buffer pool
- Another video buffer is created, and inherits info from buffer 1
- Buffer 1 is released, thus pushing it back to the buffer pool
- New buffer alloc request comes it, this yields buffer 1 back
- At this stage, buffers 1 and 2 still share the same underlying VA
  surface, but buffer 2 was already submitted downstream for further
  processing, thus conflicting with additional processing we were
  about to perform on buffer 1.

Maybe the core GstBufferPool implementation should have been fixed
instead to actually make sure that the returned GstBuffer memory we
found from the pool is writable?
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
cc9afca3ed plugins: create a proxy for GstVaapiUploader allocated buffers.
Always make sure to allocate a VA surface proxy for GstVaapiUploader
allocated buffers, i.e. make gst_vaapi_uploader_get_buffer() allocate
a proxy surface.

This fixes cases where we want to retain the underlying surface longer,
instead of releasing it back to the surface pool right away.
2013-10-04 19:34:32 +02:00
Gwenole Beauchesne
393e86e3d0 plugins: add helper function to disable deinterlacing in caps.
Add gst_caps_set_interlaced() helper function that would reset the
interlace-mode field to "progressive" for GStreamer >= 1.0, or the
interlaced field to "false" for GStreamer 0.10.
2013-10-04 19:30:36 +02:00
Víctor Manuel Jáquez Leal
395260f24b plugins: hanle the context query in any pad.
Also this patch simplifies the code, since now the query is common for the
decoder and the sink.

https://bugzilla.gnome.org/show_bug.cgi?id=709200
2013-10-01 18:41:16 +02:00
Víctor Manuel Jáquez Leal
b56144e924 plugins: query upstream element for a GstContext.
Fix gst_vaapi_video_context_prepare() to also query upstream elements
for a valid GstContext. Improve comments regarding the steps used to
lookup or build that context, thus conforming to the GstContext API
recommendations.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-10-01 17:55:43 +02:00
Víctor Manuel Jáquez Leal
41c4da5571 plugins: add support for GstVideoGLTextureUploadMeta.
If the allocation meta GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE is
requested, and more specifically under a GLX configuration, then add
the GstVideoGLTextureUploadMeta to the output buffer.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:17:20 +02:00
Sreerenj Balachandran
8fe3bb0b14 plugins: add support for GstCaps features.
Move VA video buffer memory from "video/x-surface,type=vaapi" format,
as expressed in caps, to the more standard use of caps features. i.e.
add "memory:VASurface" feature attribute to the associated caps.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:17:16 +02:00
Víctor Manuel Jáquez Leal
21aa850eb4 plugins: improve ::query() debugging messages.
Fix gst_vaapidecode_query() to correctly display the query type name,
instead of randomly displaying that we shared the underlying display.
Also add debug info for the GstVaapiSink::query() handler, i.e. the
supplied query type name actually.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:17:12 +02:00
Víctor Manuel Jáquez Leal
9e3d24c669 plugins: add support for GstContext API.
Add support for the new GstContext API from GStreamer 1.2.x.
- implement the GstElement::set_context() hook ;
- reply to the `context' query from downstream elements.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:17:07 +02:00
Víctor Manuel Jáquez Leal
c67b783275 plugins: add compat layer for GstVideoContext.
Add thin compatibility layer for the deprecated GstVideoContext API.
For GStreamer API >= 1.2, this involves the following two functions:
- gst_vaapi_video_context_prepare(): queries if a context is already
  set in the pipeline ;
- gst_vaapi_video_context_propagate(): propagates the newly-created
  context to the rest of the pipeline.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:16:52 +02:00
Víctor Manuel Jáquez Leal
f75762d910 plugins: initial port to GStreamer 1.2.
Port vaapidecode and vaapisink plugins to GStreamer API >= 1.2. This
is rather minimalistic so that to test the basic functionality.

Disable vaapipostproc plugin for now as further polishing is needed.
Also disable GstVideoContext interface support since this API is now
gone in 1.2.x. This is preparatory work for GstContext support.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-09-27 14:15:51 +02:00
Zhao Halley
45b4ba7df7 vaapisink: ensure the uploader is setup for upstream allocated buffers.
In GStreamer 0.10 builds, make sure that the GstVaapiUploader helper
is setup in case upstream elements allocate buffers themselves without
honouring our GstVaapiSink::bufer_alloc() hook.

In particular, this fixes support for OGG video streams with WebKit.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-29 19:36:06 +02:00
Gwenole Beauchesne
6d7b5eef7d vaapisink: simplify get_render_buffer() for GStreamer 0.10 builds.
Implement and use gst_vaapisink_get_render_buffer() for GStreamer 0.10
builds as well.
2013-08-29 19:36:06 +02:00
Gwenole Beauchesne
d2648afa32 vaapisink: handle raw buffers not created from VA video buffer pool.
Handle raw video buffers that were not created from a VA video buffer
pool. Use the generic GstVideo API to copy buffers in GStreamer 1.0.x
builds instead of the GstVaapiUploader.

https://bugs.freedesktop.org/show_bug.cgi?id=55818
2013-08-29 19:36:06 +02:00
Gwenole Beauchesne
1be80e791c vaapidecode: remove extraneous size information from allowed caps.
Fix _getcaps() implementation to not report codecs with size information
filled in the returned caps. That's totally useless nowadays. Ideally,
this is a hint to insert a video parser element, thus allowing future
optimizations, but this is not a strict requirement for gstreamer-vaapi,
which is able to parse the elementary bitstreams itself.

https://bugzilla.gnome.org/show_bug.cgi?id=704734
2013-08-29 19:36:06 +02:00
Guangxin.Xu
111d7d4fa4 vaapidecode: submit the last frame from output adapter to decoder.
If there is no frame delimiter at the end of the stream, e.g. no
end-of-stream or end-of-sequence marker, and that the current frame
was fully parsed correctly, then assume that last frame is complete
and submit it to the decoder.

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

Signed-off-by: Guangxin.Xu <Guangxin.Xu@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-29 14:47:40 +02:00
Gwenole Beauchesne
91736b3a60 vaapidecode: push all decoded frames from within the task.
Make sure to push all decoded frames from the task so that the unlying
VA surfaces could all be rendered from the same thread.
2013-08-29 11:55:05 +02:00
Gwenole Beauchesne
771071a4e5 decode: fix creation of GLX video buffers for GStreamer 0.10.
Fix creation of GstVaapiVideoBuffer objects (i) to have that type for real;
and (ii) to correctly extract the GstSurfaceConverter from the video buffer
object meta.

This fixes support for cluttersink with GStreamer 0.10 builds.
2013-08-26 17:14:33 +02:00
Simon Farnsworth
0ef5979d77 vaapisink: allow scaling to ignore aspect ratio.
Other GStreamer sinks, like xvimagesink, have a force-aspect-ratio property,
which allows you to say that you don't want the sink to respect aspect
ratio. Add the same property to vaapisink.

http://lists.freedesktop.org/archives/libva/2012-September/001298.html

Signed-off-by: Simon Farnsworth <simon.farnsworth at onelan.co.uk>
2013-08-26 13:10:33 +02:00
Wind Yuan
e5a50af2ae vaapisink: fix memory leak of GstVaapiUploader instance.
Make sure gst_vaapisink_ensure_uploader() checks for the existence
of a former GstVaapiUploader instance prior to forcibly creating a
new one.

https://bugzilla.gnome.org/show_bug.cgi?id=703980
2013-08-26 13:01:26 +02:00
Guangxin.Xu
92a124f306 vaapisink: fix get_caps() implementation for GStreamer 1.0.
Fix GstBaseSink::get_caps() implementation for GStreamer 1.0.X builds
by honouring the filter caps argument. More precisely, this fixes the
following pipeline: gst-launch-1.0 videotestsrc ! vaapisink

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

Signed-off-by: Guangxin.Xu <Guangxin.Xu@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-26 12:56:06 +02:00
Zhao Halley
944a7bd077 filter: add initial support for deinterlacing.
Add basic deinterlacing support, i.e. bob-deinterlacing whereby only
the selected field from the input surface is kept for the target surface.
Setting gst_vaapi_filter_set_deinterlacing() method argument to
GST_VAAPI_DEINTERLACE_METHOD_NONE means to disable deinterlacing.

Also move GstVaapiDeinterlaceMethod definition from vaapipostproc plug-in
to libgstvaapi core library.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
0b1a97cbf9 plugins: handle video cropping in X11 pixmap converter.
Use GstVideoCropMeta in GStreamer 1.0 or any other render rectangle
we could decode from the stream.
2013-07-22 15:45:10 +02:00
Gwenole Beauchesne
6f04a52905 plugins: add support for "x11-pixmap" video converter type.
Install a new video converter that supports X11 pixmap targets for X11
backends only, or make the GLX converter creation function chain up to
the X11 converter whenever requested.
2013-07-22 15:45:10 +02:00
Emilio López
b868c6d888 plugins: fix display type comparison in gst_vaapi_create_display().
After the code got moved to create the gst_vaapi_create_display() helper,
this comparison was not updated to dereference the newly-created
pointer, so the code was comparing the pointer itself to the type, and
therefore failing to retrieve the VA display.

This fixes the following error (and gets gst-vaapi decoding again):

    ERROR vaapidecode gstvaapidecode.c:807:gst_vaapidecode_ensure_allowed_caps: failed to retrieve VA display

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

Signed-off-by: Emilio López <emilio@elopez.com.ar>
2013-07-18 08:41:28 +02:00
Gwenole Beauchesne
7fa4973f8a Fix new video format API.
Fix new internal video format API, based on GstVideoFormat, to not
clobber with system symbols. So replace the gst_video_format_* prefix
with gst_vaapi_video_format_ prefix, even if the format type remains
GstVideoFormat.
2013-07-15 14:42:33 +02:00
Gwenole Beauchesne
cee9101dd8 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.
2013-07-15 11:58:31 +02:00
Víctor Manuel Jáquez Leal
3d290a162c plugins: add gst_vaapi_create_display() helper.
https://bugzilla.gnome.org/show_bug.cgi?id=703235

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-15 11:54:44 +02:00
Gwenole Beauchesne
5e18a5b1bd 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.
2013-07-12 17:55:37 +02:00
Gwenole Beauchesne
c82a1bc0ff 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.
2013-07-12 17:14:49 +02:00
Gwenole Beauchesne
d79d561819 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.
2013-07-12 15:15:07 +02:00
Wind Yuan
9b3ad4daad 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.

http://bugzilla.gnome.org/show_bug.cgi?id=703937

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-11 19:09:53 +02:00
Gwenole Beauchesne
4668e59bf6 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.
2013-07-11 19:09:53 +02:00
Gwenole Beauchesne
ed1bec1e43 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.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
419af50009 plugins: use GstVideoInfo in video uploader helper. 2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
1cfe03ee52 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.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
4ca7922f4b 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.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
09397fa0d8 plugins: port to new video format API. 2013-07-09 17:16:35 +02:00
Gwenole Beauchesne
40b6832b82 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.
2013-07-08 18:54:15 +02:00
Gwenole Beauchesne
5bbab30859 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.
2013-07-08 18:52:56 +02:00
Sreerenj Balachandran
dbb58f4152 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 <sreerenj.balachandran@intel.com>
signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:52:56 +02:00
Sreerenj Balachandran
769f33cab2 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.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-06-27 14:01:26 +02:00
Gwenole Beauchesne
ece5cb2d83 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.
2013-06-27 13:53:46 +02:00
Víctor Manuel Jáquez Leal
2fafbd7b64 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.

https://bugzilla.gnome.org/show_bug.cgi?id=701742
2013-06-27 10:19:37 +02:00
Zhao Halley
bbd7a130e2 vaapisink: fix build without VA/GLX support. 2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
e712abba11 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.
2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
eb9dd361f8 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.
2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
33f6415696 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.
2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
c12dc19b8b 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.
2013-05-27 17:21:11 +02:00
Zhao Halley
dadf0ef978 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 <gwenole.beauchesne@intel.com>
2013-05-23 19:22:48 +02:00
Gwenole Beauchesne
35eaa9e763 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.
2013-05-23 19:01:34 +02:00
Gwenole Beauchesne
e52ea35b11 plugins: cope with GST_VAAPI_IS_xxx() macros removal. 2013-05-23 19:01:34 +02:00
Gwenole Beauchesne
9535bb9950 plugins: cope with new GstVaapiMiniObject objects. 2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
c43a2d497a 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
resources.
2013-04-25 14:18:00 +02:00
Gwenole Beauchesne
d2bf4ffd97 vaapidecode: rework heuristics to detect decode timeout.
Rework heuristics to detect when downstream element ran into errors,
and thus failing to release any VA surface in due time for the current
frame to get decoded. In particular, recalibrate the render time base
when the first frame gets submitted downstream, or when there is no
timestamp that could be inferred.
2013-04-18 18:54:40 +02:00
Gwenole Beauchesne
851cc000c2 vaapidecode: rework GstVideoDecoder::handle_frame() with a task.
Rework GstVideoDecoder::handle_frame() to decode the current frame,
while possibly waiting for a free surface, and separately submit all
decoded frames from a task. This makes it possible to pop and render
decoded frames as soon as possible.
2013-04-18 18:46:01 +02:00
Gwenole Beauchesne
9d8bac313f plugins: use gst_object_unref() wherever applicable.
Use gst_object_unref() wherever applicable, e.g. objects derived from
GstElement, GstVideoPool, etc.
2013-04-18 17:16:43 +02:00
Gwenole Beauchesne
a0e587667a vaapipostproc: minor clean-ups.
Use g_clear_object() wherever appropriate and remove dead-code.
2013-04-17 10:58:04 +02:00
Gwenole Beauchesne
6b259abc02 vaapipostproc: fix reference counting buf for passthrough mode.
Fix reference counting bug for passthrough mode, whereby the input buffer
was propagated as is downstream through gst_pad_push() without increasing
its reference count before. The was a problem when gst_pad_push() returns
an error and we further decrease the reference count of the input buffer.
2013-04-17 10:53:03 +02:00
Gwenole Beauchesne
945516c9c7 vaapipostproc: port to GStreamer 1.0.
Add support for interlaced streams with GStreamer 1.0 too. Basically,
this enables vaapipostproc, though it is not auto-plugged yet. We also
make sure to reply to CAPS queries, and happily handle CAPS events.
2013-04-17 10:18:45 +02:00
Gwenole Beauchesne
0bd929dfa2 surfaceproxy: drop user-data support from GstVaapiSurfaceProxy.
Drop user-data support from GstVaapiSurfaceProxy. Rather make it explicit
to call some user-provided function when the surface proxy is released.
2013-04-16 18:54:37 +02:00
Gwenole Beauchesne
1790823ed4 decoder: make gst_vaapi_decoder_get_codec_state() return the original state.
Make gst_vaapi_decoder_get_codec_state() return the original codec state,
i.e. make the GstVaapiDecoder object own the return state so that callers
that want an extra reference to it would just gst_video_codec_state_ref()
it before usage. This aligns the behaviour with what we had before with
gst_vaapi_decoder_get_caps().

This is an ABI incompatible change, library major version was bumped from
previous release (0.5.2).
2013-04-15 13:58:58 +02:00
Gwenole Beauchesne
55b3053b88 plugins: mark a few more functions as internal.
Mark the following functions are internal, i.e. private to the vaapi plug-in:
- gst_vaapi_video_buffer_pool_get_type()
- gst_vaapi_video_converter_glx_get_type()
- gst_vaapi_video_converter_glx_new()
2013-04-15 13:52:19 +02:00
Gwenole Beauchesne
132d78ad3e plugins: implement GstSurfaceMeta API.
Implement GstSurfaceMeta API for GStreamer 1.0.x. Even though this is
an unstable/deprecated API, this makes it possible to support Clutter
sink with minimal changes. Tested against clutter-gst 1.9.92.
2013-04-15 13:48:43 +02:00
Gwenole Beauchesne
ad56d80c9e vaapisink: optimize GstVideoOverlayInterface::expose().
When render-mode is "overlay", then it is not really useful to peek into
the GstBaseSink::last_buffer, since we have our own video_buffer already
recorded and maintained into GstVaapiSink.
2013-04-12 17:12:43 +02:00
Gwenole Beauchesne
ca0e77756b vaapisink: fix memory leak of GstSample objects.
Fix memory leak of GstSample objects in GstVideoOverlayInterface::expose().
This also fixes extra unreferencing of the underlying GstBuffer in the common
path afterwards (for both 0.10 or 1.0).
2013-04-12 17:05:06 +02:00
Gwenole Beauchesne
9b981dd244 plugins: fix description for gst-inspect.
Fix the name of the plug-in element reported to gst-inspect-1.0. i.e. we
need an explicit definition for GStreamer >= 1.0 because the GST_PLUGIN_DEFINE
incorrectly uses #name for creating the plug-in name, instead of using macro
expansion (and let further expansion of macros) through e.g. G_STRINGIFY().
2013-04-12 13:44:52 +02:00
Gwenole Beauchesne
aedef381b2 Fix make dist to include all source files, in any case.
Fix make dist to allow build for either GStreamer 0.10 or 1.0. i.e. make
sure to include all source files in either case while generating source
tarballs.
2013-04-10 15:43:28 +02:00
Gwenole Beauchesne
3f15a682ea plugins: implement direct-rendering mode for raw YUV buffer uploads.
Allow direct-rendering (writes) into target VA surfaces.
2013-04-10 14:58:17 +02:00
Gwenole Beauchesne
c698a015a3 plugins: implement uploads from raw YUV buffers for GStreamer 1.0.
Implement GstVideoMeta::{,un}map() to support raw YUV buffer upload when
the last component is unmapped. Downloads are not supported yet. The aim
was to first support SW decoding + HW accelerated rendering (vaapisink).
e.g. for Wayland.
2013-04-10 14:58:17 +02:00
Gwenole Beauchesne
1ed3df201e vaapidecode: submit all decoded frames before decoding a new one.
Make sure to purge all pending frames that were already decoded prior
to decoding a new one. This helps release VA surfaces as early as
possible.
2013-04-10 14:58:17 +02:00
Gwenole Beauchesne
ead7ec2f43 vaapidecode: reply to CAPS queries.
Handle GST_QUERY_CAPS, which is the GStreamer 1.0 mechanism to retrieve
the set of allowed caps, i.e. it works similar to GstPad::get_caps().

This fixes fallback to SW decoding if no HW decoder is available.
2013-04-10 14:58:17 +02:00
Gwenole Beauchesne
1b500dee54 Allow build against either GStreamer API (0.10 or 1.0).
Introduce a new configure option --with-gstreamer-api that determines
the desired GStreamer API to use. By default, GStreamer 1.0 is selected.
Also integrate more compatibility glue into gstcompat.h and plugins.
2013-04-10 14:58:17 +02:00
Sreerenj Balachandran
551ac4c5b3 plugins: use new video buffer pools.
Use new GstVaapiVideoBufferPool to maintain video buffers. Implement
GstBaseSink::propose_allocation() to expose that pool to upstream
elements; and also implement GstVideoDecoder::decide_allocation() to
actually use that pool (from downstream), if any, or create one.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00
Sreerenj Balachandran
5b11b83321 plugins: add GstVaapiVideoMemory and GstVaapiVideoBufferPool objects.
Add initial support for GstVaapiVideoMemory backed buffer pool. The memory
object currently holds a reference to GstVaapiVideoMeta.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00
Gwenole Beauchesne
c8db926547 plugins: allow copies of GstVaapiVideoMeta objects.
Make it possible to copy GstVaapiVideoMeta objects, unless they contain VA
objects created from GstVaapiVideoPool. This is mostly useful to clone a
GstVaapiVideoMeta object containing a VA surface proxy so that to alter its
rendering flags.
2013-04-10 14:58:16 +02:00
Gwenole Beauchesne
8fe0011450 plugins: make it possible to clear VA objects from GstVaapiVideoMeta.
Fix GstVaapiVideoMeta to allow VA objects to be destroyed when they are
reset to NULL. i.e. make gst_vaapi_video_meta_set_{image,surface}() and
gst_vaapi_video_meta_set_surface_proxy() actually clear VA objects when
argument is NULL.
2013-04-10 14:58:16 +02:00
Sreerenj Balachandran
38d84d968e plugins: initial port to GStreamer 1.0.
Port vaapidecode and vaapisink plugins to GStreamer API >= 1.0. This
is rather minimalistic so that to test the basic functionality.

Disable vaapiupload, vaapidownload and vaapipostproc plugins. The latter
needs polishing wrt. to GStreamer 1.x functionality and the former are
totally phased out in favor of GstVaapiVideoMemory map/unmap facilities,
which are yet to be implemented.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00
Gwenole Beauchesne
6136ebe5e2 vaapisink: improve check for raw YUV format mode.
Improve check for raw YUV format modes by avoiding checks against strings
("video/x-raw-yuv") for each new GstBuffer allocation. In the usual case,
GstBaseSink::set_caps() is called first and if VA surface format mode is
used, then GstBaseSink::buffer_alloc() is not called. If the latter is
called before set_caps(), then we just make a full check. This one is
pretty rare though, e.g. it usually happens once for custom pipelines.
2013-04-03 15:58:57 +02:00
Gwenole Beauchesne
378ea2e237 plugins: don't fail if there is no overlay composition to apply.
Fix gst_vaapi_apply_composition() to not fail if no overlay composition
was found. i.e. return success (TRUE). This was harmless though extra
debug messages are not nice.

This is a regression introduced by commit 95b8659.
2013-04-03 15:11:01 +02:00
Gwenole Beauchesne
cadc42eafe vaapidecode: expose the exact set of supported HW decoders.
Don't return static caps that don't mean anything for the underlying codecs
that are actually supported for decoding. i.e. always allocate a VA display
and retrieve the exact set of HW decoders available. That VA display may be
re-used later on during negotiation through GstVideoContext "prepare-context".

This fixes fallback to SW decoding if no HW decoder is available.
2013-04-03 15:10:19 +02:00
Gwenole Beauchesne
578f788650 plugins: fix usage of gst_vaapi_reply_to_query().
Make gst_vaapi_reply_to_query() first check whether the query argument
is actually a video-context query, i.e. with type GST_QUERY_TYPE_CUSTOM.
Then, make sure vaapisink propagates the query to the parent class if
it is not a video-context query.
2013-03-26 18:57:00 +01:00
Gwenole Beauchesne
e6f0cbadd3 plugins: streamline video buffers.
Add new gst_vaapi_video_buffer_new() helper function that allocates a video
buffer from a GstVaapiVideoMeta. Also remove obsolete and useless function
gst_vaapi_video_buffer_get_meta().
2013-03-26 18:52:49 +01:00
Gwenole Beauchesne
140fa66be3 plugins: integrate GstVaapiVideoMeta from libgstvaapi.
Move GstVaapiVideoMeta from core libgstvaapi decoding library to the
actual plugin elements. That's only useful there. Also inline reference
counting code from GstVaapiMiniObject.
2013-03-26 10:33:27 +01:00
Gwenole Beauchesne
63fedf6767 plugins: drop gstvaapipluginbuffer.[ch] helper files.
Move all gst_vaapi_video_buffer_new*() helpers from gstvaapipluginbuffer.[ch]
to gstvaapivideobuffer.[ch], and drop the obsolete files.
2013-03-21 18:16:14 +01:00
Gwenole Beauchesne
4cf44e3ad2 plugins: integrate GstVaapiVideoBuffer from libgstvaapi.
Move GstVaapiVideoBuffer from core libgstvaapi decoding library to the
actual plugin elements. That's only useful there.
2013-03-21 18:16:14 +01:00
Gwenole Beauchesne
95b865968c plugins: use common helper function to apply compositions.
Use common gst_vaapi_apply_composition() helper function to apply compositions
attached to a buffer in vaapisink or GstVaapiVideoConverterGLX.
2013-03-21 18:16:14 +01:00
Gwenole Beauchesne
17e7e67c1f plugins: integrate GstVaapiVideoConverterGLX from libgstvaapi.
Make sure libgstvaapi core decoding library doesn't include un-needed
dependencies. So, move out GstVaapiVideoConverterGLX to plugins instead.
Besides, even if the vaapisink element is not used, we are bound to have
a correctly populated GstSurfaceBuffer from vaapidecode.

Also clean-up the file along the way.
2013-03-21 18:16:14 +01:00
Gwenole Beauchesne
9e1da76971 vaapisink: add helper function to apply a composition buffer.
Simplify application of a composition buffer to a GstVaapiSurface, and
all its peers, until that function is eventually promoted to libgstvaapi.
2013-03-20 19:22:24 +01:00
Gwenole Beauchesne
6ce6712ed5 vaapisink: fix support for raw YUV buffers.
If the raw YUV buffer was created from vaapisink, through the buffer_alloc()
hook, then it will have a valid GstVaapiVideoMeta object attached to it.
However, we previously assumed in that case that it was a "native" VA buffer,
thus not calling into GstVaapiUploader::process().
2013-03-20 19:21:02 +01:00
Gwenole Beauchesne
2dcc9f19da plugins: use modern GstElement metadata information.
Use gst_element_class_set_static_metadata() from GStreamer 1.0, which
basically is the same as gst_element_class_set_details_simple() in
GStreamer 0.10 context.
2013-03-20 18:43:35 +01:00
Gwenole Beauchesne
7fd648b8b0 plugins: move up interfaces (cosmetics).
Move GstImplementsInterface and GstVideoContext support functions up
so that to keep a clear separation between the plugin element and its
interface hooks.
2013-03-20 18:35:01 +01:00
Gwenole Beauchesne
13c5d3244b plugins: upgrade to newer APIs (GstVideoInfo based helpers).
Use GstVideoInfo and gst_video_info_from_caps() helper wherever possible.
Also use the newly added gst_vaapi_image_format_from_structure() helper
in GstVaapiUploader::ensure_allowed_caps().
2013-03-20 18:35:01 +01:00
Gwenole Beauchesne
4fa2315557 plugins: fix creation of video buffer from another source buffer.
gst_vaapi_video_buffer_new_from_buffer() needs to reference the source
buffer video meta since it would be unreference'd from the get_buffer()
helper function. For other cases, we still use (steal) the newly created
video meta.
2013-03-20 18:35:01 +01:00
Gwenole Beauchesne
7bb5750266 plugins: include "sysdeps.h" header instead of "config.h". 2013-03-20 18:35:01 +01:00
Gwenole Beauchesne
4dd6035dac configure: rename GST_MAJORMINOR to GST_API_VERSION. 2013-03-20 11:44:10 +01:00
Holger Kaelberer
9bf1ae04cc vaapiupload: fix illegal write in ensure_image().
Fix ensure_image() to only zero-initialize the first line of each plane.
Properly initializing each plane to their full vertical resolution would
require to actually compute it based on the image format.

In particular, for NV12 images, the UV plane has half vertical resolution
vs. the Y plane. So using the full image height to initialize the UV plane
will obviously lead to a buffer overflow. Likewise for other YUV format.

Since ensure_image() is only a helper function to initialize something,
and not necessarily the whole thing, it is fine to initializ the first
line only. Besides, the target surface is not rendered either.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-02-26 11:27:07 +01:00
Gwenole Beauchesne
41dcd82e2f vaapidecode: handle decode-only frames.
Decode-only frames may not have a valid surface proxy. So, simply discard
them gracefully, i.e. don't create meta data information. GstVideoDecoder
base class will properly handle this case and won't try to push any buffer
to downstream elements.
2013-01-30 16:38:48 +01:00
Sreerenj Balachandran
0847b3888d vaapidecode: add support for post-seek semantics reset.
Implement GstVideoDecoder::reset() as a destruction of the VA decoder
and the creation of a new VA decoder.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-30 11:00:19 +01:00
Gwenole Beauchesne
0c99f351fc legal: fix year for some copyright notices (2013). 2013-01-29 14:37:02 +01:00
Gwenole Beauchesne
22094ed053 legal: fix year for some copyright notices (2012). 2013-01-29 14:37:02 +01:00
Gwenole Beauchesne
236e8833d1 vaapidecode: handle EOS events.
Flush all decoded frames to downstream when EOS is received. This is
performed by implementing GstVideoDecoder::finish() hook.
2013-01-17 18:40:36 +01:00
Gwenole Beauchesne
cbcdc3bfae vaapidecode: split gvd_handle_frame() into decode/push frames.
Split GstVideoDecoder::handle_frame() implementation into two functions:
(i) one for decoding the provided GstVideoCodecFrame and (ii) another one
for purging all decoded frames and submit them downstream.
2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
a00ae0918a plugins: cope with new GstVaapiVideoMeta API.
Update plugin elements with the new GstVaapiVideoMeta API.

This also fixes support for subpictures/overlay because GstVideoDecoder
generates a sub-buffer from the GstVaapiVideoBuffer. So, that sub-buffer
is marked as read-only. However, when comes in the textoverlay element
for example, it checks whether the input buffer is writable. Since that
buffer read-only, then a new GstBuffer is created. Since gst_buffer_copy()
does not preserve the parent field, the generated buffer in textoverlay
is not exploitable because we lost all VA specific information.

Now, with GstVaapiVideoMeta information attached to a standard GstBuffer,
all information are preserved through gst_buffer_copy() since the latter
does copy metadata (qdata in this case).
2013-01-05 18:02:31 +01:00
Gwenole Beauchesne
5788d8ae45 vaapidecode: fix calculation of the time-out value.
Fix calculation of the time-out value for cases where no VA surface is
available for decoding. In this case, we need to wait until downstream
sink consumed at least one surface. The time-out was miscalculated as
it was always set to <current-time> + one second, which is not suitable
for streams with larger gaps.
2013-01-03 13:10:33 +01:00
Gwenole Beauchesne
3d3f37c558 vaapidecode: use GST_ERROR to print error messages. 2013-01-02 13:13:45 +01:00
Gwenole Beauchesne
0ff8556f65 vaapidecode: avoid double release of frame on error.
Don't call gst_video_decoder_drop_frame() if gst_video_decoder_finish_frame()
was already called before and it returned an error. In that case, we were
releasing the frame again, thus leading to a "double-free" condition.
2013-01-02 13:13:42 +01:00
Gwenole Beauchesne
9e643a6147 Add videoutils submodule for GstVideoDecoder APIs. 2012-12-21 16:01:16 +01:00
Gwenole Beauchesne
8c2d9bcd24 decoder: maintain decoded frames as GstVideoCodecFrame objects.
Maintain decoded surfaces as GstVideoCodecFrame objects instead of
GstVaapiSurfaceProxy objects. The latter will tend to be reduced to
the strict minimum: a context and a surface.
2012-12-18 15:31:52 +01:00
Gwenole Beauchesne
039eb3bb6c vaapidecode: output all decoded frames as soon as possible.
Make sure to push all decoded frames downstream as soon as possible.
This makes sure we don't need to wait for a new frame to be ready to
be decoded before receiving new decoded frames.

This also separates the decode process and the output process. The latter
could be moved to a specific GstTask later on.
2012-12-18 15:31:52 +01:00
Gwenole Beauchesne
c21d76cff2 vaapipostproc: use GstBuffer flags for TFF.
Determine whether the buffer represents the top-field only by checking for
the GST_VIDEO_BUFFER_TFF flag instead of relying on the GstVaapiSurfaceProxy
flag. Also trust "interlaced" caps to determine whether the input frame
is interleaved or not.
2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
936d8b8fc6 vaapipostproc: handle video sub-buffers.
Intermediate elements may produce a sub-buffer from a valid GstVaapiVideoBuffer
for non raw YUV cases. Make sure vaapipostproc now understands those buffers.
2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
d19c59ba31 vaapisink: handle sub video-buffers.
Intermediate elements may produce a sub-buffer from a valid GstVaapiVideoBuffer
for non raw YUV cases. Make sure vaapisink now understands those buffers.
2012-12-18 15:31:51 +01:00
Sreerenj Balachandran
cb3c0a3e8f vaapidecode: use gst_vaapi_decoder_get_codec_state().
Directly use the GstVideoCodecState associated with the VA decoder
instead of parsing caps again.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
cfdc5c5b43 vaapidecode: use more standard helpers.
Use g_clear_object() [glib >= 2.28] and gst_caps_replace() helper functions
in more places.
2012-12-18 15:31:51 +01:00
Sreerenj Balachandran
9127f17d81 vaapidecode: move to GstVideoDecoder base class.
Make vaapidecode derive from the standard GstVideoDecoder base element
class. This simplifies the code to the strict minimum for the decoder
element and makes it easier to port to GStreamer 1.x API.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-12-18 15:31:51 +01:00
Gwenole Beauchesne
1130a46837 surfaceproxy: port to GstVaapiMiniObject.
GstVaapiSurfaceProxy does not use any particular functionality from
GObject. Actually, it only needs a basic object type with reference
counting.

This is an API and ABI change.
2012-12-18 15:31:50 +01:00
Gwenole Beauchesne
48f4f0564e libs: fix compatibility with glib 2.28.
Always prefer non deprecated APIs by default and provide compatibility
glue for older glib versions when necessary.
2012-12-17 14:33:52 +01:00
Gwenole Beauchesne
df1eb6e01e vaapiupload: reset direct-rendering to zero when changing caps.
Make sure to reset direct-rendering flag to zero when caps are changed,
and only derive it to one when the next checks succeed.
2012-11-20 18:21:41 +01:00
Gwenole Beauchesne
237a4adb0c vaapiupload: fix sink caps to report the supported set of YUV caps.
Try to allocate the GstVaapiUploader helper object prior to listing the
supported image formats. Otherwise, only a single generic caps is output
with no particular pixel format referenced in there.
2012-11-20 16:04:51 +01:00
Zhao Halley
c2a610735f vaapiupload: use new GstVaapiUploader helper.
Use GstVaapiUploader helper that automatically handles direct rendering
mode, thus making the "direct-rendering" property obsolete and hence it
is now removed.

The "direct-rendering" level 2, i.e. exposing VA surface buffers, was never
really well supported and it could actually trigger degraded performance.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-11-20 16:04:51 +01:00
Gwenole Beauchesne
d4a4a49168 vaapisink: compute and expose the supported set of YUV caps.
Make vaapisink expose only the set of supported caps for raw YUV buffers.

Add gst_vaapi_uploader_get_caps() helper function to determine the set
of supported YUV caps as source (for images). This function actually
tries to zero and upload each image to a 64x64 test surface. Of course,
this relies on VA drivers to not claim success if vaPutImage() is not
correctly supported.
2012-11-20 16:04:51 +01:00
Gwenole Beauchesne
499e0dd981 vaapisink: add support for raw YUV buffers.
Add new GstVaapiUploader helper to upload raw YUV buffers to VA surfaces.
It is up to the caller to negotiate source caps (for images) and output
caps (for surfaces). gst_vaapi_uploader_has_direct_rendering() is available
to help decide between the creation of a GstVaapiVideoBuffer or a regular
GstBuffer on sink pads.

Signed-off-by: Zhao Halley <halley.zhao@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-11-20 16:04:51 +01:00
Rob Bradford
4bcfa3fe0a vaapidecode: adopt non-deprecrated glib locking primitive pattern.
The use of heap allocated GMutex/GCond is deprecated. Instead place them
inside the structure they are locking.

These changes switch to use g_mutex_init/g_cond_init rather than the heap
allocation functions.

Because we cannot test for a NULL pointer for the GMutex/GCond we must
initialise inside the GObject _init function and clear inside the _finalize
which is guaranteed to only be called once and after the object is no longer
in use.
2012-10-17 15:21:00 +02:00
Gwenole Beauchesne
7d1b583d91 vaapidecode: fix compiler warnings.
Don't care of the return value for gst_vaapi_decoder_put_buffer()
during destruction of the element. Don't print out (uninitialised)
error code when allocation of video buffer failed.
2012-10-17 14:52:35 +02:00
Wind Yuan
da1e4e3918 vaapidecode: flush buffers when receiving EOS.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-10-09 14:01:15 +02:00
Gwenole Beauchesne
e6047734b3 plugins: include "sysdeps.h" instead of "config.h". 2012-09-12 13:41:47 +02:00
Gwenole Beauchesne
5549dbc3c0 vaapidecode: don't reset decoder if codec type is the same.
Reset, i.e. destroy then create, the decoder in _setcaps() handler only
if the underlying codec type actually changed. This makes it possible
to be more tolerant with certain MPEG-2 streams that get parsed to
form caps that are compatible with the previous state but minor changes
to "codec-data".
2012-09-11 17:08:47 +02:00
Gwenole Beauchesne
2b71db3059 vaapidecode: simplify codec lookup from caps.
Add new gst_vaapi_codec_from_caps() helper to determine codec type from
the specified caps. Don't globally expose this function since this is
really trivial and only used in the vaapidecode element.
2012-09-11 17:08:47 +02:00
Gwenole Beauchesne
9afe700005 vaapidecode: improve "no free surface" conditions.
Previously, vaapidecode would wait up to one second until a free surface
is available, or it aborts decoding. Now, vaapidecode waits until the
last decoded surface was to be presented, plus one second. Besides, end
times are now expressed relative to the monotonic clock.
2012-09-11 17:08:47 +02:00
Gwenole Beauchesne
6c19849cd2 decoder: propagate buffer duration downstream. 2012-09-11 17:08:47 +02:00
Gwenole Beauchesne
d895e17db8 vaapipostproc: fix deinterlace-{mode,method} types definition. 2012-09-07 16:41:16 +02:00
Gwenole Beauchesne
a8624d6a79 plugins: fix build in strict ISO C mode. 2012-09-07 16:11:12 +02:00
Philip Lorenz
8bcfeb5a1c vaapidecode: acquire lock only if the mutex exists.
When playback stops the GstVaapiDecode object is reset into a clean
state. However, surfaces may still be referenced by library users and
unreferencing them after the reset triggers an access to an unset mutex.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-09-07 13:54:30 +02:00
Philip Lorenz
79b45a43d1 Do not forward declare enums.
Forward declaring enums is not allowed by the C standard and aborts
compilation if the header file is included in a C++ project.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-09-07 11:54:09 +02:00
Gwenole Beauchesne
de2a18012d vaapisink: fix calculation of window size.
If either dimension is out-of-bounds, then scale window to fit the
display size, even if the output is to be rotated. Use the standard
gst_video_sink_center_rect() function to center and scale the window
wrt. the outer (display) bounds.
2012-09-06 13:44:42 +02:00
Wind Yuan
c8f2358479 vaapisink: add video rotation support.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-09-06 13:44:42 +02:00
Gwenole Beauchesne
bd397a536b pluginutils: add G_PRIMITIVE_SWAP() helper macro.
This macro helps swapping variables while maintaining the correct underlying
and primitive type.
2012-09-06 13:39:50 +02:00
Gwenole Beauchesne
4a1127dd7c vaapisink: drop obsolete GstVaapiVideoSink interface.
This interface was deprecated since 0.3.x series when the GstVideoContext
interface was added to the main GStreamer APIs.
2012-08-29 13:20:17 +02:00
Gwenole Beauchesne
0ef393c6af vaapisink: automatically detect overlay rendering mode.
Retain the VA surface until another surface is to be displayed only
if VA display rendering mode is determined to be "overlay" mode.
2012-08-29 12:05:03 +02:00
Gwenole Beauchesne
e36fb69ef9 vaapisink: retain VA surface until another one is displayed.
Keep VA surface proxy associated with the surface that is currently
being displayed. This makes sure that surface is not released back
to the pool of surfaces free to use for decoding. This is necessary
with VA driver implementations that support rendering to an overlay
pipe. Otherwise, there could be cases where we are decoding into a
surface that is being displayed, hence some flickering.
2012-08-29 12:05:00 +02:00
Gwenole Beauchesne
ab8b0359e1 vaapisink: fix build with older toolchains.
Don't re-declare GstVaapiTexture if USE_GLX mode is set.
2012-08-29 12:04:55 +02:00
Gwenole Beauchesne
dfff02689c vaapisink: handle VA/DRM API.
This is not useful in practice but for raw performance evaluation when
the sink is invoked with display=drm sync=false. fakesink could also be
used though.
2012-08-01 16:40:17 +02:00
Gwenole Beauchesne
6118e76b62 plugins: add support for headless pipelines. 2012-08-01 16:40:17 +02:00
Gwenole Beauchesne
4401ada22a wayland: implement display ::get_size*() hooks. 2012-07-27 14:35:48 +02:00
Gwenole Beauchesne
511cc95a44 plugins: prefer X11 rendering over GLX.
Prefer X11 display over GLX so that "vaapisink" uses X11, i.e. vaPutSurface(),
for rendering instead of texturing.
2012-07-27 10:45:41 +02:00
Gwenole Beauchesne
0bf1e761f9 Fix build without X11. 2012-07-25 15:31:42 +02:00
Gwenole Beauchesne
9e00c87367 plugins: add support for Wayland. 2012-07-25 15:31:42 +02:00
Gwenole Beauchesne
5a1293a27e plugins: fix creation of video buffer from surface proxy.
Fix a regression introduced with commit 8ef490a.
2012-07-25 15:11:51 +02:00
Gwenole Beauchesne
efe623c253 plugins: use new display types more.
In particular, simplify gst_vaapi_reply_to_query() with display types.
Likewise for creating new video buffers.
2012-07-25 15:03:48 +02:00
Gwenole Beauchesne
cff117b54d plugins: fix display type selection and propagation.
If vaapisink is in the GStreamer pipeline, then we shall allocate a
unique GstVaapiDisplay and propagate it upstream. i.e. subsequent
queries from vaapidecode shall get a valid answer from vaapisink.
2012-07-25 14:52:05 +02:00
Gwenole Beauchesne
437bc925f6 display: add display types.
Move display types from gstvaapipluginutil.* to gstvaapidisplay.* so that
we could simplify characterization of a GstVaapiDisplay. Also rename "auto"
type to "any", and add a "display-type" attribute.
2012-07-25 14:37:11 +02:00
Gwenole Beauchesne
6b4ff307b3 plugins: declare helper functions as internal. 2012-07-24 16:14:51 +02:00
Gwenole Beauchesne
8ef490a3de videobuffer: drop deprecated functions.
Move video buffer creation routines to plugin elements. That exclusively
uses *_typed_new*() variants.
2012-07-24 16:13:31 +02:00
Gwenole Beauchesne
753a56e9a1 pluginutils: improve automatic display type selection. 2012-07-24 15:57:57 +02:00
Gwenole Beauchesne
aa64ce0bed pluginutils: cosmetics (indentation fixes). 2012-07-24 15:57:57 +02:00
Gwenole Beauchesne
8f132b7936 configure: drop check for --enable-vaapisink-glx.
vaapisink is now built with support for multiple display types, whenever
they are enabled. The new "display" attribute is used to select a particular
renderer.
2012-07-24 15:57:57 +02:00
Gwenole Beauchesne
7a0382130f configure: drop check for --enable-vaapi-glx.
This flag is obsolete. It was meant to explicitly enable/disable VA/GLX API
support, or fallback to TFP+FBO if this API is not found. Now, we check for
the VA/GLX API by default if --enable-glx is set. If this API is not found,
we now default to use TFP+FBO.

Note: TFP+FBO, i.e. using vaPutSurface() is now also a deprecated usage and
will be removed in the future. If GLX rendering is requested, then the VA/GLX
API shall be used as it covers most usages. e.g. AMD driver can't render to
an X pixmap yet.
2012-07-24 15:57:57 +02:00
Gwenole Beauchesne
bcae632c32 vaapisink: drop checks for new APIs used by default.
GStreamer -base plugins >= 0.10.31 are now required, so the checks for
new APIs like GstXOverlay::set_window_handle() and ::set_render_rectangle()
are no longer necessary.
2012-07-20 14:11:42 +02:00
Gwenole Beauchesne
9d440fafb3 Drop all references to USE_CODEC_PARSERS. 2012-07-19 17:30:36 +02:00
Gwenole Beauchesne
7f47ac3bea Drop FFmpeg-based decoders.
GStreamer codecparsers-based decoders are the only supported decoders now.
Though, FFmpeg decoders are still available in gstreamer-vaapi 0.3.x series.
2012-07-19 17:30:36 +02:00
Javier Jardón
ba3ae60613 plugins: declare _get_type() functions as const.
Declaring a function as const enables better optimization of calls to
the function.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 15:19:17 +02:00
Javier Jardón
5ff0837b32 plugins: use g_clear_object() wherever applicable.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 15:19:17 +02:00
Gwenole Beauchesne
50e40a4c87 plugins: add support for GstImplementsInterface. 2012-07-19 11:45:19 +02:00
Javier Jardón
2594aadb0e plugins: use G_DEFINE_TYPE_* instead of deprecated GST_BOILERPLATE_*.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 11:25:15 +02:00
Javier Jardón
187c503870 plugins: do not use deprecated GStreamer -base symbols.
Bump GStreamer plugins -base required version to 0.10.31, needed for
gst_x_overlay_got_window_handle().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 11:25:15 +02:00
Javier Jardón
90d82ab7e1 plugins: do not use deprecated core GStreamer symbols.
Bump GStreamer required version to 0.10.14, needed for
gst_element_class_set_details_simple().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-07-19 10:56:56 +02:00
Yan Yin
e0fac751f6 vaapiplugin: fix build when compiling without GLX.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-06-26 11:07:44 +02:00
Wind Yuan
75e8a7d6f8 Add initial JPEG decoder.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-11 19:38:12 +02:00
Wind Yuan
5d75cc4c6f vaapidecode: fix VA display type.
Fix typo whereby plain VADisplay type was used instead of the GstVaapiDisplay
wrapper.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-10 15:19:56 +02:00
Gwenole Beauchesne
68d1b7e525 vaapidecode: fix includes when compiling for a single API. 2012-04-10 15:19:56 +02:00
Gwenole Beauchesne
84b5fc5e58 vaapidecode: report unsupported codec profiles.
Try to gracefully abort when the HW does not support the requested
profile. There is no fallback unless profiles are correctly parsed
and matched through caps beforehand.
2012-04-02 16:11:22 +02:00
Holger Kaelberer
bd08610e07 vaapisink: don't resize a 'foreign' X-window.
Don't forcibly resize foreign X windows. The user is responsible for
their size and vaapisink shall not change this.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-02 13:33:55 +02:00
Holger Kaelberer
c37c9ca6cf vaapisink: recalculate render rect only if caps are negotiated.
Fix gst_vaapisink_xoverlay_set_window_handle() when it is called before
caps got negotiated. Besides, when a foreign window is provided by the
user, so should the render rect.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-04-02 13:33:13 +02:00
Gwenole Beauchesne
d9c57a236d Fix a few documentation issues. 2012-04-02 13:06:15 +02:00
Gwenole Beauchesne
b98d334dce vaapipostproc: get "interlaced" attribute from surface proxy.
Add new "interlaced" attribute to GstVaapiSurfaceProxy. Use this in
vaapipostproc so that to handles cases where bitstream is interlaced
but almost only frame pictures are generated. In this case, we should
not be alternating between top/bottom fields.
2012-03-28 17:59:19 +02:00
Gwenole Beauchesne
894d65b81a vaapipostproc: add new element for video postprocessing.
Add vaapipostproc element for video postprocessing. So far, only basic
bob deinterlacing is implemented. Interlaced mode is automatically
detected based on sink caps ("interlaced" field).
2012-03-26 14:37:24 +02:00
Gwenole Beauchesne
a5144358d1 videobuffer: add surface render flags.
Allow rendering flags, as a combination of GstVaapiSurfaceRenderFlags,
to be set to the video buffer. In particular, this is mostly useful for
basic deinterlacing.
2012-03-26 12:01:36 +02:00
Wind Yuan
d43f3dc50a decode: delay NEWSEGMENT event if vaapidecode element was not linked.
Rationale: playbin2 links all elements at run-time. Once vaapidecode
is created and a NEWSEGMENT event arrives, downstream element may not
be ready yet. So, delay this event until next element is chained in,
otherwise basesink could output "Received buffer without a new-segment.
Assuming timestamps start from 0".

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-22 14:33:17 +01:00
Holger Kaelberer
0d0cff695f vaapidecode: propagate interlaced and TFF properties downstream.
Propagate "interlaced" caps downstream and set "tff" buffer flag
appropriately to output buffers for interlaced pictures.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-03-19 18:43:06 +01:00
Gwenole Beauchesne
6c8b052bd3 Revert "vaapidecode: fix another pad template ref leak" (Holger Kaelberer)
This reverts commit 2f127d6af4.

For gst_element_class_get_pad_template(), no unreferencing is necessary
according to the GStreamer documentation.
2012-03-02 15:03:57 +01:00
Gwenole Beauchesne
2f127d6af4 vaapidecode: fix another pad template ref leak. 2012-02-06 16:11:38 +01:00
Gwenole Beauchesne
843f528f95 vaapiupload: use g_object_unref() for GstVaapiImage. 2012-02-05 18:28:51 +01:00
Gwenole Beauchesne
f64bafea59 plugins: fix pad template ref leaks. 2012-02-05 18:24:08 +01:00
Gwenole Beauchesne
c071f80f40 Add initial H.264 decoder. 2012-01-29 15:27:59 +01:00
Gwenole Beauchesne
990fe81fe2 vaapisink: cap window size to the maximum display size. 2012-01-24 10:15:47 +01:00
Gwenole Beauchesne
92f11799d1 legal: fix year for some copyright notices. 2012-01-16 11:40:51 +01:00
Gwenole Beauchesne
1594d99d55 legal: add Intel copyright on modified files. 2012-01-16 11:40:51 +01:00
Gwenole Beauchesne
14cc1cf061 legal: fix copyright notices to include "Copyright" term. 2012-01-16 11:40:51 +01:00
Zhao Halley
6502783474 Add initial MPEG-4 decoder.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-16 11:40:51 +01:00
Gwenole Beauchesne
b865d4a740 Add initial VC-1 decoder. 2012-01-16 11:40:51 +01:00
Gwenole Beauchesne
49b4702fb6 Add initial MPEG-2 decoder. 2012-01-16 11:40:50 +01:00
Gwenole Beauchesne
8f0eda8964 Allow conditional build of GStreamer/FFmpeg bitstream parsers. 2012-01-16 11:40:50 +01:00
Gwenole Beauchesne
6b03d30162 vaapiplugin: fix gst_vaapi_ensure_display() to use system defaults.
This ensures the display name provided to gst_vaapi_display_*_new()
maps to the system defaults, instead of forcing "" that could be different
from the current DISPLAY name.
2012-01-12 16:09:08 +01:00
Nicolas Dufresne
b7e5a48e5e vaapiupload: only set caps on newly created buffers.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-12 16:09:08 +01:00
Gwenole Beauchesne
0385750fa7 vaapisink: ensure VA display in GstBaseSink::start() hook.
This ensures a VA display is ready by the time upstream elements request
for it.
2012-01-12 16:09:08 +01:00
Nicolas Dufresne
c432e82e44 vaapisink: don't leak GL texture.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2012-01-12 16:09:08 +01:00
Gwenole Beauchesne
8866a7c223 vaapisink: fix calculation of render region. 2012-01-11 09:38:57 +01:00
Gwenole Beauchesne
b1aee91aa0 vaapisink: automatically fit video to window. 2012-01-11 09:38:56 +01:00
Gwenole Beauchesne
3ca1d0820c vaapisink: implement GstXOverlay::set_render_rectangle(). 2012-01-11 09:38:56 +01:00
Gwenole Beauchesne
48cefaf9ce vaapidecode: fix deinitialization order. 2012-01-05 16:26:49 +01:00
Gwenole Beauchesne
f0486c5716 vaapiupload: use new gst_vaapi_append_surface_caps() helper.
This also fixes extra structures, beyond the one at index 0, to hold
the right additional values.
2012-01-05 11:04:29 +01:00
Gwenole Beauchesne
0de8b8cce1 vaapiupload: fix sink (YUV) caps to not report type and opengl fields. 2012-01-05 11:04:29 +01:00
Gwenole Beauchesne
6ca190b4c5 vaapidownload: add new plugin to download pixels from VA surfaces. 2012-01-05 11:04:29 +01:00
Gwenole Beauchesne
872694fda5 vaapipluingutils: add helper to append surface caps to YUV caps. 2012-01-05 11:04:29 +01:00
Gwenole Beauchesne
12c85f69ff vaapiupload: fix memory leak in _init() function. 2012-01-03 18:16:35 +01:00
Gwenole Beauchesne
42fa974391 Rename vaapiconvert element to vaapiupload. 2012-01-03 14:34:09 +01:00
Gwenole Beauchesne
ac7c4cfe78 surface: apply composition to the parent context, if requested. 2011-12-14 14:40:37 +01:00
Gwenole Beauchesne
9c8c33857f Fix warnings. 2011-12-13 15:59:02 +01:00
Gwenole Beauchesne
a4244820af Rename gst_vaapi_surface_update_composition() to
gst_vaapi_surface_set_subpictures_from_composition().
2011-12-13 15:51:58 +01:00
Thibault Saunier
e4d7e90568 vaapisink: handle GstVideoOverlayComposition planes.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-12 18:38:51 +01:00
Gwenole Beauchesne
55738da35b image: add gst_vaapi_image_format_from_video() helper. 2011-12-12 18:32:29 +01:00
Gwenole Beauchesne
9337fb9a74 image: allow partial updates. 2011-12-12 18:32:29 +01:00
Nicolas Dufresne
cbf81d7d51 Add missing video context queries.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-12 15:02:15 +01:00
Gwenole Beauchesne
0df67b5e89 vaapiplugin: include local build dir to CFLAGS for generated files. 2011-12-09 10:45:20 +01:00
Sreerenj Balachandran
809e087cca vaapidecode: return sink caps template if decoder is in NULL state.
Otherwise, the decoder would always create its own X display instead
of probing it from the downstream element, which is not reliable.
e.g. DISPLAY is not :0 or when running on Wayland.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-08 15:48:42 +01:00
Gwenole Beauchesne
dc08d1eae0 vaapiplugin: properly set surface type to "vaapi" in caps. 2011-12-08 15:44:09 +01:00
Nicolas Dufresne
36e0f582a8 vaapiplugin: properly set opengl support in caps.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-08 15:13:42 +01:00
Nicolas Dufresne
bb22317e39 vaapiplugin: allocate GLX buffers when supported.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-08 15:13:42 +01:00
Nicolas Dufresne
b170d1a982 Don't use downstream buffer allocation.
With the new video/x-surface abstraction, we can't rely on having a VA
specific sink downstream. Also, there was no particular reason to do that.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-08 14:58:58 +01:00
Nicolas Dufresne
075374cda3 Change caps to use new video/x-surface generic type.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-08 14:58:58 +01:00
Nicolas Dufresne
99c5d18f41 Port to GstVideoContext interface.
This new interface allows for upstream and downstream display sharing
that works in both static and dynamic pipelines.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-08 14:58:58 +01:00
Gwenole Beauchesne
2df43791d4 vaapisink: use GST_ERROR to print error messages. 2011-12-08 14:57:36 +01:00
Gwenole Beauchesne
f3d89f8bc0 vaapiplugin: link against VA/GLX when enabled. 2011-12-08 13:30:51 +01:00
Gwenole Beauchesne
04d4c9f225 Add Intel copyright information. 2011-12-07 19:09:55 +01:00
Gwenole Beauchesne
513b9c700b vaapisink: allow compatibility with gst-plugins-base < 0.10.31. 2011-12-07 19:05:50 +01:00
Sreerenj Balachandran
820c52f953 vaapisink: replace the deprecated xoverlay API with the new one.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-07 18:02:22 +01:00
Nicolas Dufresne
48b3d02143 Group all plugins into the same bundle
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2011-12-07 14:33:59 +01:00