Commit graph

163 commits

Author SHA1 Message Date
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