Commit graph

759 commits

Author SHA1 Message Date
Gwenole Beauchesne
915cef5e01 libs: use GstVaapiMiniObject for display objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
3cc7b26961 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.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
2e6ff64a34 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.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
98c7068937 libs: use GstVaapiObject for texture objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
8402b04ac9 libs: use GstVaapiObject for window objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
6c46179709 libs: use GstVaapiObject for VA objects. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
1f15c28a1b Port GstVaapiObject to GstVaapiMiniObject. 2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
6439169db5 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.
2013-05-07 17:51:27 +02:00
Gwenole Beauchesne
da2493f731 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
information.
2013-05-07 16:43:51 +02:00
Gwenole Beauchesne
5ea1a675ab decoder: fix raw decoding mode.
Fix gst_vaapi_decoder_get_surface() to actually transfer ownership of the
surface proxy to the caller.
2013-04-25 14:20:55 +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
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
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
2909d0229d decoder: fix GstVideoCodecFrame flags for interlaced contents.
Fix support for interlaced contents with GStreamer 0.10. In particular,
propagate GstVaapiSurfaceProxy frame flags to GstVideoCodecFrame flags
correctly.

This is a regression from commit 87e5717.
2013-04-17 10:14:55 +02:00
Gwenole Beauchesne
a24e216466 decoder: rename GstVaapiDecoderFrame to GstVaapiParserFrame.
Rename GstVaapiDecoderFrame to GstVaapiParserFrame because this data
structure was only useful to parsing and a proper GstvaapiDecoderFrame
instance will be created instead.
2013-04-16 19:11:02 +02:00
Gwenole Beauchesne
2ac474b207 decoder: export presentation timestamp for raw decoding mode.
Fix regression from 0.4-branch whereby GstVaapiSurfaceProxy no longer
held any information about the expected presentation timestamp, frame
duration or additional flags like interlaced or top-field-first.
2013-04-16 19:11:02 +02:00
Gwenole Beauchesne
87e5717f66 decoder: use new GstVaapiSurfaceProxy utility functions.
Use new GstVaapiSurfaceProxy internal helper functions to propagate the
necessary GstVideoCodecFrame flags to vaapidecode (GStreamer 0.10).

Also make GstVaapiDecoder push_frame() operate similarly to drop_frame().
i.e. increase the GstVideoCodecFrame reference count in push_frame rather
than gst_vaapi_picture_output().
2013-04-16 19:07:24 +02:00
Gwenole Beauchesne
c7dff071c7 surfaceproxy: add more attributes for raw decoding modes.
Add more attributes for raw decoding modes, i.e. directly through the
libgstvaapi helper library. In particular, add presentation timestamp,
duration and a couple of flags (interlaced, TFF, RFF, one-field).
2013-04-16 19:07:24 +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
Víctor Manuel Jáquez Leal
2db47c0ade build: link libgstvaapi-glx-1.0.so against libdl.
Ensure libgstvaapi-glx*.so builds against libdl since dlsym() is used
to resolve glXGetProcAddress() from GLX libraries. This fix builds on
Fedora 17.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-15 15:04:29 +02:00
Gwenole Beauchesne
8cce65c6f1 decoder: fix gst_vaapi_decoder_get_codec_state().
Fix previous commit whereby gst_vaapi_decoder_get_codec_state() was
supposed to make GstVaapiDecoder own the return GstVideoCodecState
object. Only comment was updated, not the actual code.
2013-04-15 14:22:57 +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
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
788d337505 decoder: fix unpaired GstBuffer map/unmaps.
This possibly fixes a few memory leaks along the way.
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
Gwenole Beauchesne
13ca9f382c tests: add support for GStreamer 1.0. 2013-04-10 14:58:16 +02:00
Sreerenj Balachandran
51151e7aa1 Add initial support for GStreamer 1.0.
This integrates support for GStreamer API >= 1.0 only in the libgstvaapi
core decoding library. The changes are kept rather minimal here so that
the library retains as little dependency as possible on core GStreamer
functionality.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00
Gwenole Beauchesne
e65726de8d decoder: drop obsolete functions.
Drop the following functions that are now obsolete:
- gst_vaapi_context_get_surface()
- gst_vaapi_context_put_surface()
- gst_vaapi_context_find_surface_by_id()
- gst_vaapi_surface_proxy_new()
- gst_vaapi_surface_proxy_get_context()
- gst_vaapi_surface_proxy_set_context()
- gst_vaapi_surface_proxy_set_surface()

This is an API change.
2013-04-03 13:34:59 +02:00
Gwenole Beauchesne
6e82da1e93 decoder: delegate surface size check to VA context reset.
Now that the surface pool is reference counted in the surface proxy wrapper,
we can safely ignore surface size checks in gst_vaapi_decoder_ensure_context().
Besides, this check is already performed in gst_vaapi_context_reset_full().
2013-04-03 13:34:59 +02:00
Gwenole Beauchesne
e22a863084 decoder: simplify acquisition/release of spare surface.
Introduce gst_vaapi_surface_proxy_new_from_pool() to allocate a new surface
proxy from the context surface pool. This change also makes sure to retain
the parent surface pool in the proxy.

Besides, it was also totally useless to attach/detach parent context to
VA surface each time we acquire/release it. Since the whole context owns
all associated VA surfaces, we can mark this as such only once and for all.
2013-04-03 13:34:59 +02: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
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
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
2000d5d6e1 vc1: fix use of possibly uninitialized variable.
In decode_codec_data(), force initialization of format to zero so that
we can catch up cases where codec-data has neither "format" nor "wmvversion"
fields, thus making it possible to gracefully fail in this case.
2013-03-21 14:38:06 +01:00
Gwenole Beauchesne
2c6e235e4d jpeg: propagate buffer data as a const guchar * pointer (cosmetics). 2013-03-21 14:38:06 +01:00
Gwenole Beauchesne
4009430bec decoder: sanitize codec-data decoding.
Add a new GstVaapiDecoder::decode_codec_data() hook to actually decode
codec-data in the decoder sub-class. Provide a common shared helper
function to do the actual work and delegating further to the sub-class.
2013-03-21 14:38:06 +01:00
Gwenole Beauchesne
ba8a7ab6cd decoder: get rid of GstVaapiDecoderUnit::buffer field.
Drop GstVaapiDecoderUnit buffer field (GstBuffer) since it's totally
useless nowadays as creating sub-buffers doesn't bring any value. It
actually means more memory allocations. We can't do without that in
JPEG and MPEG-4:2 decoders.
2013-03-21 13:44:59 +01:00
Gwenole Beauchesne
57ed7e3f8b decoder: sanitize uses of codec frame input buffer (cosmetics).
Alias GST_VAAPI_DECODER_CODEC_FRAME(decoder)->input_buffer to a simple
"buffer" variable.
2013-03-21 13:28:05 +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
e539092f21 tests: modernize GstTypeFind functions.
Use the GstTypeFind hooks from GStreamer 1.0. They look safer and
exactly correspond to the expected behaviour.
2013-03-20 18:35:01 +01:00
Gwenole Beauchesne
0ad846e68d subpicture: use gst_video_overlay_rectangle_get_pixels_unscaled_raw().
Use newer gst_video_overlay_rectangle_get_pixels_unscaled_raw() helper
function with GStreamer 0.10 compatible semantics, or that tries to
approach the current meaning. Basically, this is also just about moving
the helper to gstcompat.h.
2013-03-20 18:30:09 +01:00
Gwenole Beauchesne
c756766805 image: add gst_vaapi_image_format_from_structure() helper.
Add helper function to convert video formats from a GstStructure to a
plain GstVaapiImageFormat.
2013-03-20 18:30:09 +01:00
Gwenole Beauchesne
833ebf9cae sysdeps: split out GStreamer API compatibility glue to "gstcompat.h". 2013-03-20 18:30:09 +01:00
Gwenole Beauchesne
87624fd6c8 sysdeps: add more standard includes by default. 2013-03-20 18:30:09 +01:00
Gwenole Beauchesne
4dd6035dac configure: rename GST_MAJORMINOR to GST_API_VERSION. 2013-03-20 11:44:10 +01:00
Gwenole Beauchesne
ddaaa42020 h264: set {luma,chroma}_log2_weight_denom to 0 if no pred_weight_table().
Force luma_log2_weight_denom and chroma_log2_weight_denom to zero if
there is no pred_weight_table() that was parsed.

This is a workaround for the VA intel-driver on Ivy Bridge.
2013-02-08 11:56:54 +01:00
Gwenole Beauchesne
0c3650e7e8 h264: use new profile definitions from codecparsers. 2013-02-07 15:42:55 +01:00
Gwenole Beauchesne
56bc1ce98c glibcompat: add replacement for g_async_queue_timeout_pop().
g_async_queue_timeout_pop() appeared in glib 2.31.18. Implement it as
g_async_queue_timed_pop() with a GTimeVal as the final time to wait for
new data to arrive in the queue.
2013-01-31 11:30:35 +01:00
Gwenole Beauchesne
20a81f5a70 glibcompat: add replacement for g_cond_wait(). 2013-01-31 11:25:18 +01:00
Gwenole Beauchesne
06725d651e mpeg2: fix decoding of 4K videos.
Account for slice_vertical_position_extension when vertical_size > 2800.
2013-01-30 19:19:47 +01:00
Gwenole Beauchesne
564ca5d221 mpeg2: fix decoding of sequence_end().
There shall be only one place to call decode_current_picture(), and this
is in the end_frame() hook. The EOS unit is processed after end_frame()
so this means we cannot have a valid picture to decode/output at this
point.
2013-01-30 19:19:47 +01:00
Gwenole Beauchesne
23b2386fd0 mpeg2: improve robustness when packets are missing.
Improve robustness when some expected packets where not received yet
or that were not correctly decoded. For example, don't try to decode
a picture if there was no valid sequence or picture headers.
2013-01-30 19:04:16 +01:00
Gwenole Beauchesne
4499f39274 decoder: handle decode-only frames in raw API mode.
Fix gst_vaapi_decoder_get_surface() to only return frames with a valid
surface proxy, i.e. with a valid VA surface. This means that any frame
marked as decode-only is simply skipped.
2013-01-30 19:04:16 +01:00
Gwenole Beauchesne
2305b0db46 decoder: allow frames to be dropped.
If the decoder was not able to decode a frame because insufficient
information was available, e.g. missing sequence or picture header,
then allow the frame to be gracefully dropped without generating
any error.

It is also possible that a frame is not meant to be displayed but
only used as a reference, so dropping that frame is also a valid
operation since GstVideoDecoder base class has extra references to
that GstVideoCodecFrame that needs to be released.
2013-01-30 16:38:48 +01:00
Sreerenj Balachandran
0d5e203e79 mpeg2: implement GstVaapiDecoder::flush() as a DPB flush. 2013-01-29 18:25:22 +01:00
Sreerenj Balachandran
3e4c7f564d decoder: fix documentation for GstVaapiDecoderFrame.
Drop superfluous reference to prev_slice member.
2013-01-29 18:24:46 +01:00
Gwenole Beauchesne
aee91a31ba decoder: assume current frame is complete at end-of-stream.
Assume we got a complete frame when the end-of-stream is reached and that
the current codec frame contains at least one slice data unit.
2013-01-29 16:18:13 +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
0f662a8913 legal: add Intel copyright on modified files. 2013-01-29 14:00:04 +01:00
Gwenole Beauchesne
1d16669aca wayland: use a local event queue to avoid lock contention.
This improves performance when rendering several surfaces from within
the same process. e.g. a tee of vaapidecode'd buffers to vaapisink.
2013-01-28 19:06:59 +01:00
Gwenole Beauchesne
96d12f9eb1 wayland: fix thread-safe issues.
The Wayland API is not fully thread-safe and client applications shall
perform locking themselves on key functions. Besides, make sure to
release the lock if the _render() function fails.
2013-01-28 19:06:59 +01:00
Gwenole Beauchesne
1fb25b0853 wayland: really wait until the pending redraw completed.
Introduce gst_vaapi_window_wayland_sync() helper function to wait for
the completion of the redraw request. Use it in _render() function to
actually block until the previous draw request is completed.
2013-01-28 18:57:21 +01:00
Gwenole Beauchesne
23c6053b94 wayland: fix frame_redraw callback.
The redraw callback needs to be attached to the surface prior to the
commit. Otherwise, the callback notifies the next surface repaint,
which is not the desired behaviour. i.e. we want to be notified for
the surface we have just filled.

Another isse was the redraw_pending was reset before the actual completion
of the frame redraw callback function, thus causing concurrency issues.
e.g. the callback could have been called again, but with a NULL buffer.
2013-01-28 18:24:37 +01:00
Gwenole Beauchesne
087bf30c23 wayland: fix display sharing.
When the Wayland display is shared, we still have to create our own local
shell and compositor objects, since they are not propagated from the cache.
Likewise, we also need to determine the display size or vaapisink would
fail to account for the display aspect ratio, and will try to create a 0x0
window.
2013-01-28 18:24:37 +01:00
Gwenole Beauchesne
efd90114bf vc1: handle frames with multiple slices. 2013-01-23 17:02:45 +01:00
Gwenole Beauchesne
3eeff1786a vc1: handle CLOSED_ENTRY.
When CLOSED_ENTRY == 0, and if the B pictures that follow an entry-point
lack a reference anchor picture, these B pictures shall be discarded.

https://bugs.freedesktop.org/show_bug.cgi?id=59505
2013-01-23 11:19:32 +01:00
Gwenole Beauchesne
ee181d1b85 vc1: cope with latest codecparser changes.
Fix build with newer VC-1 codecparser where dqsbedge was renamed to
dqbedge, and now represents either DQSBEDGE or DQDBEDGE depending on
the actual value of DQPROFILE.
2013-01-23 10:25:52 +01:00
Gwenole Beauchesne
df411e435f vc1: fix size of encapsulated BDU.
Fix size of encapsulated BDUs since GstVC1BDU.size actually represents
the size of the BDU data, starting from offset, i.e. after any start
code is parsed.

This fixes a buffer overflow during the unescaping process.
2013-01-22 16:59:40 +01:00
Wind Yuan
a68c218c8e vc1: fix decoding of WMV3 videos in AVI format.
The AVI demuxer (avidemux) does not set a proper "format" attribute
to the generated caps. So, try to recover the video codec format from
the "wmvversion" property instead.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-22 16:10:07 +01:00
Gwenole Beauchesne
d69cb4389f vc1: review and report errors accordingly.
Use GST_ERROR() to report real errors instead of hiding them into
GST_DEBUG().
2013-01-22 16:10:07 +01:00
Gwenole Beauchesne
b134a97d42 vc1: don't create GstBuffers for all decoder units.
Don't create temporary GstBuffers for all decoder units, even if they
are lightweight "sub-buffers", since it is not really necessary to keep
the buffer data around.
2013-01-22 16:10:07 +01:00
Gwenole Beauchesne
ec3c4576c0 vc1: implement flush() hook.
Make it a simple DPB flush.
2013-01-22 16:09:45 +01:00
Gwenole Beauchesne
1513f52fc1 vc1: implement {start,end}_frame() hooks.
Implement GstVaapiDecoder.start_frame() and end_frame() semantics so
that to create new VA context earlier and submit VA pictures to the
HW for decoding as soon as possible. i.e. don't wait for the next
frame to start decoding the previous one.
2013-01-22 16:08:25 +01:00
Gwenole Beauchesne
823f16d7ce vc1: fix next POC for new sequence layers.
Fix next POC when a new sequence layer is reached. At this point, we
need to reset any previous reference picture, i.e. non B-frame.
2013-01-22 09:30:04 +01:00
Sreerenj Balachandran
472f3473e0 vc1: port to common GstVaapiDpb interface.
Use GstVaapiDpb interface instead of maintaining our own prev and next
picture pointers. While doing so, try to derive a sensible POC value.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-21 19:08:00 +01:00
Gwenole Beauchesne
142e13f637 vc1: fix decode_sequence_end() to return success, not EOS. 2013-01-21 16:35:58 +01:00
Gwenole Beauchesne
b24752da4f decoder: simplify gst_vaapi_decoder_get_surface().
Avoid extraenous branches, i.e. immediately return with success once we
have a decoded frame available.
2013-01-18 17:00:18 +01:00
Gwenole Beauchesne
a811a5de3d decoder: optimize and clean decode_step() up.
Avoid usage of goto. Simplify decode_step() process to first accumulate all
pending buffers into the GstAdapter, and then parse and decode units from
that input adapter. Stop the process once a frame is fully decoded or an
error occurred.
2013-01-18 16:56:15 +01:00
Gwenole Beauchesne
cd52fa315a display: move "vaapi" debug init to libgstvaapi_init_once(). 2013-01-18 14:49:15 +01:00
Gwenole Beauchesne
655f400e1c display: dump gstreamer-vaapi version for debugging purposes. 2013-01-18 14:49:15 +01:00
Gwenole Beauchesne
319f87f142 h264: implement GstVaapiDecoder::flush() as a DPB flush. 2013-01-17 18:40:36 +01:00
Gwenole Beauchesne
34162f5001 h264: handle end-of-stream NALU.
Handle <end-of-stream> NAL unit to actually flush any pending picture
from the DPB.
2013-01-17 18:40:36 +01:00
Gwenole Beauchesne
60acedb56e decoder: add GstVaapiDecoder::flush() hook. 2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
e4e3a58bc0 decoder: fix check for end-of-stream in raw API mode.
Make sure to immediately return GST_VAAPI_DECODER_STATUS_END_OF_STREAM
if the end-of-stream was already reached at the previous iteration.
2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
cc347cb41e decoder: make decode_step() return once the frame is decoded.
Make sure we always have a free surface left to use for decoding the
current frame. This means that decode_step() has to return once a frame
gets decoded. If the current adapter contains more buffers with valid
frames, they will get parsed and decoded on subsequent iterations.
2013-01-17 18:39:22 +01:00
Gwenole Beauchesne
059e032103 docs: expose new interfaces. 2013-01-14 12:58:41 +01:00
Gwenole Beauchesne
9372f14f94 dpb: cosmetics (clean-ups). 2013-01-14 10:58:49 +01:00
Gwenole Beauchesne
e44d8ee6e3 dpb: port to GstVaapiMiniObject. 2013-01-14 10:46:50 +01:00
Gwenole Beauchesne
6f4e01258d dpb: drop GstVaapiDpb2 interface, keep only one class.
Keep only one DPB interface and rename gst_vaapi_dpb2_get_references()
to gst_vaapi_dpb_get_neighbours() so that to retrieve pictures in DPB
around the specified picture POC.
2013-01-14 10:21:53 +01:00
Sreerenj Balachandran
eafdd771ae dpb: rename GstVaapiDpbMpeg2 to GstVaapiDpb2.
Move GstVaapiDpbMpeg2 API to a more generic version that could also be
useful to other decoders that require 2 reference pictures, e.g. VC-1.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-14 10:11:21 +01:00
Holger Kaelberer
082a56599b overlay: fix build without advanced GstVideoOverlayFormatFlags.
Check for global-alpha support in GstVideoOverlayComposition API.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 15:47:46 +01:00
Gwenole Beauchesne
7e1a8eabfe overlay: fix ordering of composition layers.
Make sure to maintain the association order of composition layers when
GstVideoOverlayRectangle objects are kept around (cached).
2013-01-11 15:32:17 +01:00
Holger Kaelberer
2ecb955626 overlay: fix support for global-alpha.
Fix support for global-alpha subpictures. The previous changes brought
the ability to check for GstVideoOverlayRectangle changes by comparing
the underlying pixel buffer pointers. If sequence number and pixel data
did not change, then this is an indication that only the global-alpha
value changed. Now, try to update the underlying VA subpicture global-alpha
value.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 15:29:12 +01:00
Gwenole Beauchesne
e6390d6e5f overlay: detect render-rect changes.
Don't re-upload VA subpicture if only the render rectangle changed.
Rather deassociate the subpicture and re-associate it with the new
render rectangle.
2013-01-11 15:29:12 +01:00
Gwenole Beauchesne
e876d9a581 overlay: fix check for pixels buffer change.
A GstVideoOverlayRectangle is created whenever the underlying pixels data
change. However, when global-alpha is supported, it is possible to re-use
the same GstVideoOverlayRectangle but with a change to the global-alpha
value. This process causes a change of sequence number, so we can no longer
check for that.

Still, if sequence numbers did not change, then there was no change in
global-alpha either. So, we need a way to compare the underlying GstBuffer
pointers. There is no API to retrieve the original pixels buffer from
a GstVideoOverlayRectangle. So, we use the following heuristics:

1. Use gst_video_overlay_rectangle_get_pixels_unscaled_argb() with the same
   format flags from which the GstVideoOverlayRectangle was created. This
   will work if there was no prior consumer of the GstVideoOverlayRectangle
   with alternate (non-"native") format flags.

2. In overlay_rectangle_has_changed_pixels(), we have to use the same
   gst_video_overlay_rectangle_get_pixels_unscaled_argb() function but
   with flags that match the subpicture. This is needed to cope with
   platforms that don't support global-alpha in HW, so the gst-video
   layer takes care of that and fixes this up with a possibly new
   GstBuffer, and hence pixels data (or) in-place by caching the current
   global-alpha value applied. So we have to determine the rectangle
   was previously used, based on what previous flags were used to
   retrieve the ARGB pixels buffer.
2013-01-11 15:29:12 +01:00
Gwenole Beauchesne
a14d259060 overlay: optimize cache at the GstVideoOverlayRectangle level.
We previously assumed that an overlay composition changed if the number
of overlay rectangles in there actually changed, or that the rectangle
was updated, and thus its seqnum was also updated.

Now, we can cope with cases where the GstVideoOverlayComposition grew
by one or a few more overlay rectangles, and the initial overlay rectangles
are kept as is.
2013-01-11 15:29:11 +01:00
Gwenole Beauchesne
ad6cdc0b52 overlay: simplify caching of GstVideoOverlayComposition objects.
Create the GPtrArray once in the _init() function and destroy it only
in the _finalize() function. Then use overlay_clear() to remove all
subpicture associations for intermediate updates, don't recreate the
GPtrArray.

Make GstVaapiOverlayRectangle a reference counted object. Also make
sure that overlay_rectangle_new() actually creates and associates the
VA subpicture.
2013-01-11 15:28:25 +01:00
Holger Kaelberer
2d2334afed overlay: add support for global-alpha.
Handle global-alpha from GstVideoOverlayComposition API. Likewise,
the same code path could also work for premultiplied-alpha but this
was not tested.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-01-11 14:23:08 +01:00