Commit graph

857 commits

Author SHA1 Message Date
Gwenole Beauchesne
c171b007ff jpeg: fix calculation of MCU count.
Fix calculation of MCU count for image sizes that are not a multiple
of 8 pixels in either dimension, but also for non-common sampling
factors like 4:2:2 in non-interleaved mode.
2013-09-23 19:17:17 +02:00
Gwenole Beauchesne
5444ab44d2 jpeg: add support for multiscan images.
Add support for images with multiple scans per frame. The Huffman table
can be updated before SOS, and thus possibly requiring multiple uploads
of Huffman tables to the VA driver. So, the latter must be able to cope
with multiple VA buffers of type 'huffman-table' and with the correct
sequential order.
2013-09-23 17:38:07 +02:00
Gwenole Beauchesne
fd51db279a jpeg: 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 frame headers.
2013-09-23 17:25:51 +02:00
Gwenole Beauchesne
22fef09443 jpeg: minor clean-ups.
Improve debugging and error messages. Rename a few variables to fit the
existing naming conventions. Change some fatal asserts to non-fatal
error codes.
2013-09-20 18:32:12 +02:00
Gwenole Beauchesne
f52dfe5797 jpeg: rework and optimize parser.
Split the input buffer data into decoder units that represent a JPEG
segment. Handle scan decoder unit specifically so that it can include
both the scan header (SOS) but also any other ECS or RSTi segment.

That way, we parse the input buffer stream only once at the gst-vaapi
level instead of (i) in gst_vaapi_decoder_jpeg_parse() to split the
stream into frames SOI .. EOI and (ii) in decode_buffer() to further
determine segment boundaries and decode them.

In practice, this is a +15 to +25% performance improvement.
2013-09-20 18:32:12 +02:00
Junfeng Xu
a4aac6b89e jpeg: handle comment segments.
Fix decode_buffer() function to gracefully skip comment (COM) segments.
This fixes decoding of streams generated by certain cameras, e.g. like
the Logitech Pro C920.

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

Signed-off-by: Junfeng Xu <jun.feng.xu@intel.com>
2013-09-20 18:32:12 +02:00
Gwenole Beauchesne
77298beb15 jpeg: fix determination of image bounds.
Look for the exact image bounds characterised by the <SOI> and <EOI>
markers. Use the gst_jpeg_parse() codec parser utility function to
optimize the lookup for the next marker segment.

https://bugzilla.gnome.org/show_bug.cgi?id=707447
2013-09-20 18:32:12 +02:00
Junfeng Xu
9c29bbde58 jpeg: fix calculation of offset to next marker segment.
Fix calculation of the offset to the next marker segment since the
correction of the codecparser part to match the API specification.
i.e. the GstJpegMarkerSegment.size field represents the size in bytes
of the segment minus any marker prefix.

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

Signed-off-by: Junfeng Xu <jun.feng.xu@intel.com>
2013-09-20 18:32:12 +02:00
Wind Yuan
621d48a5b1 configure: fix detection of VA/JPEG decoding API.
Fix detection of VA/JPEG decoding API with non-standard libva packages.
More precisely, some packages were shipping with a <va/va.h> header that
did not include <va/va_dec_jpeg.h>.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-29 19:44:48 +02:00
Gwenole Beauchesne
1362352825 wayland: render the raw surface if VPP failed.
As a last resort, if video processing capabilities (VPP) are not available,
or they did not produce anything conclusive enough, then try to fallback to
the original rendering code path whereby the whole VA surface is rendered
as is, no matter of video cropping or deinterlacing requests.

Note: under those conditions, the visual outcome won't be correct but at
least, something gets displayed instead of bailing out.
2013-08-27 18:29:45 +02:00
Gwenole Beauchesne
7759acd2f0 wayland: add supporting for video processing.
Try to use VA/VPP processing capabilities to handle video cropping and
additional rendering flags that may not be directly supported by the
underlying hardware when exposing a suitable Wayland buffer for the
supplied VA surface. e.g. deinterlacing, different color primaries than
BT.601, etc.
2013-08-27 18:29:45 +02:00
Gwenole Beauchesne
5fdc9a0e95 wayland: add new frame redraw infrastructure.
Update the frame redraw infrastructure with a new FrameState stucture
holds all the necessary information used to display the next pending
surface.

While we are at it, delay the sync operation down to when it is actually
needed. That way, we keep performing additional tasks meanwhile.
2013-08-27 18:28:28 +02:00
Gwenole Beauchesne
71e5fd536f filter: allow specification of render target regions.
Add support for rendering the source surface to a particular region within
the supplied target surface. The default background color is black.
2013-08-27 18:28:10 +02:00
Gwenole Beauchesne
292b2f51b4 mpeg2: disable video cropping as picture_display_extension() is missing.
Disable video cropping in MPEG-2 codec because it is partially implemented
and actually because nobody implements it that way, and the standard spec
does not specify the display process either anyway.

Most notably, there are two possible use cases for sequence_display_extension()
horizontal_display_size & vertical_display_size: (i) guesstimating the
pixel-aspect-ratio, or (ii) implement some kind of span & scan process
in conjunction with picture_display_extension() information.

https://bugzilla.gnome.org/show_bug.cgi?id=704848
2013-08-26 16:19:01 +02:00
Gwenole Beauchesne
d16db58968 mpeg4: fix double definition of GstVaapiDecoderMpeg4Class.
This fixes the following issue:

  CC     libgstvaapi_0.10_la-gstvaapidecoder_mpeg4.lo
gstvaapidecoder_mpeg4.c:113: error: redefinition of typedef
'GstVaapiDecoderMpeg4Class'
gstvaapidecoder_mpeg4.c:44: note: previous declaration of
'GstVaapiDecoderMpeg4Class' was here
make[5]: *** [libgstvaapi_0.10_la-gstvaapidecoder_mpeg4.lo] Error 1
make[5]: Leaving directory
`/builddir/build/BUILD/gstreamer-vaapi-0.5.5.1/gst-libs/gst/vaapi'

https://bugzilla.gnome.org/show_bug.cgi?id=705148
2013-08-26 11:31: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
Zhao Halley
1d222d3b4a filter: add support for color balance adjustment.
Add ProcAmp (color balance) adjustments for hue, saturation, brightness
and contrast. The respective range for each filter shall be the same as
for the VA display attributes.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-23 19:00:38 +02:00
Zhao Halley
a854768a80 filter: add support for sharpening.
Sharpening is configured with a float value. The supported range is
-1.0 .. 1.0 with 0.0 being the default, and that means no sharpening
operation at all.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-23 19:00:38 +02:00
Zhao Halley
22f55bd513 filter: add support for denoising.
Noise reduction is configured with a float value. The supported range
is 0.0 .. 1.0 with 0.0 being the default, and that means no denoise
operation at all.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
81395418e9 filter: add support for frame cropping.
Frame cropping is defined with a GstVaapiRectangle value. The default
behaviour is to treat the source surface as a whole
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
87c8d28499 filter: add helper functions.
Add helper functions to ensure an operation VA buffer is allocated to
the right size; that filter caps get parsed and assigned to the right
operation too; and that float parameters are correctly scaled to fit
the reported range from the VA driver.
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
f09008a8d1 Add initial infrastructure for video processing.
Add initial API for video processing: only scaling and color format
conversion operations are supported.
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
f34b6ffc60 libs: add gst_vaapi_video_format_from_string() helper.
Add gst_vaapi_video_format_from_string() helper function to convert from
a video format string representation to a suitable GstVideoFormat. This
is just an alias to gst_video_format_from_string() for GStreamer 1.0.x
builds, and a proper iteration over all GstVideoFormat string representations
otherwise for earlier GStreamer 0.10.x builds.
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
8ffe11a9df libs: add gst_vaapi_video_format_from_va_fourcc() helper.
Add gst_vaapi_video_format_from_va_fourcc() helper that converts from a
VA fourcc value to a suitable GstVideoFormat.
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
53fc8bb4c7 libs: add type definitions for GstVaapiPoint and GstVaapiRectangle.
Add helper functions to describe GstVaapiPoint and GstVaapiRectangle
structures as a standard GType. This could be useful to have them
described as a GValue later on.
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
d8ffc2c150 libs: drop some public APIs.
Don't expose GstVaapiContext APIs and make them totally private to
libgstvaapi core library. That API would also tend to disappear in
a future revision. Likewise, don't expose GstVaapiDisplayCache API
but keep symbols visible so that the various render backends could
share a common display cache implementation in libgstvaapi.

Try to clean-up the documentation from any stale entry too.
2013-08-23 19:00:38 +02:00
Gwenole Beauchesne
2b0a4a0304 image: clean image API up.
Don't expose functions that reference a GstVaapiImageRaw, those are
meant to be internal only for implementing subpictures sync. Also add
a few private definitions to avoid functions calls for retrieving
image size and format information.
2013-07-26 13:16:52 +02:00
Gwenole Beauchesne
e183ea1290 image: add gst_vaapi_image_copy() helper.
Add gst_vaapi_image_copy() helper function to copy images of same format
and size.
2013-07-26 13:16:52 +02:00
Gwenole Beauchesne
0af0849a92 x11: implement pixmap rendering with RENDER extension.
Use hardware accelerated XRenderComposite() function, from the RENDER
extension, to blit a pixmap to screen. Besides, this can also support
cropping and scaling.
2013-07-22 15:45:10 +02:00
Gwenole Beauchesne
373329e6ff x11: implement pixmap API.
Implement the new render-to-pixmap API. The only supported pixmap format
that will work is xRGB, with native byte ordering. Others might work but
they were not tested.
2013-07-22 15:45:10 +02:00
Gwenole Beauchesne
5eb2cbb5ef x11: update x11_get_geometry() helper function with depth output.
Allow x11_get_geometry() utility function to also return the depth
assigned to the X drawable.
2013-07-22 15:45:10 +02:00
Gwenole Beauchesne
5cabf4e305 Add initial Pixmap API.
Add API to transfer VA urfaces to native pixmaps. Also add an API to
render a native pixmap, for completeness. In general, rendering to
pixmap would only be useful to certain VA drivers and use cases on
X11 display servers. e.g. GLX_EXT_texture_from_pixmap (TFP) handled
in an upper layer.
2013-07-22 15:43:28 +02:00
Gwenole Beauchesne
4a8a80061f libs: add and expose gst_vaapi_video_format_to_string() helper.
This is just a wrapper over gst_video_format_to_string() for older
GStreamer 0.10 builds.
2013-07-22 15:22:34 +02:00
Gwenole Beauchesne
f4097931a1 mpeg2: don't output dummy pictures.
Mark dummy pictures as output already so that we don't try to submit
them to the upper layer since this is purely internal / temporary
picture for helping the decoder.
2013-07-15 17:51:51 +02:00
Gwenole Beauchesne
b358651fb3 decoder: dispose GstVideoCodecFrame earlier.
Once the picture was output, it is no longer necessary to keep an extra
reference to the underlying GstVideoCodecFrame. So, we can release it
earlier, and maybe subsequently release the associate surface proxy
earlier.
2013-07-15 17:43:34 +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
1fff3a44dd decoder: fix memory leak when processing interlaced pictures.
Fix memory leak when processing interlaced pictures and that occurs
because the first field, represented as a GstVideoCodecFrame, never
gets released. i.e. when the picture is completed, this is generally
the case when the second field is successfully decoded, we need to
propagate the GstVideoCodecFrame of the first field to the original
GstVideoDecoder so that it could reclaim memory.

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

https://bugzilla.gnome.org/show_bug.cgi?id=701257
2013-07-15 14:01:06 +02:00
Gwenole Beauchesne
ac75755105 pool: fix deallocation of video pools.
The queue of free objects to used was deallocated with g_queue_free_full().
However, this convenience function shall only be used if the original queue
was allocated with g_queue_new(). This caused memory corruption, eventually
leading to a crash.

The correct solution is to pair the g_queue_init() with the corresponding
g_queue_clear(), while iterating over all free objects to deallocate them.
2013-07-12 15:01:01 +02:00
Wind Yuan
89321cd3c4 image: add support for raw YUY2/UYVY image copies.
Implement raw image copies for YUY2 format. Add support for UYVY format
too, with the same copy function as for YUY2. Even though components
ordering differs, copying line strides is essentially the same.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-11 19:09:53 +02:00
Gwenole Beauchesne
1c9ebecb77 surface: fix surface pool creation with an explicit pixel format.
Fix creation of surface pool objects to honour explicit pixel format
specification. If this operation is not supported, then fallback to
the older interface with chroma format.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
8663ad9492 surface: try to determine the underlying VA surface format.
If a VA surface was allocated with the chroma-format interface, try to
determine the underlying pixel format on gst_vaapi_surface_get_format(),
or return GST_VIDEO_FORMAT_ENCODED if this is not a supported operation.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
a1b27c920b surface: allow creation with explicit pixel format.
Make it possible to create VA surfaces with a specific pixel format.
This is a new capability brought in by VA-API >= 0.34.0. If that
capability is not built-in (e.g. using VA-API < 0.34.0), then
gst_vaapi_surface_new_with_format() will return NULL.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
e3da054e48 surface: add helper function to get chroma type from GstVideoFormat.
Add gst_video_format_get_chroma_type() helper function to determine
the GstVaapiChromaType from a standard GStreamer video format. It is
possible to reconstruct that from GstVideoFormatInfo but it is much
simpler (and faster?) to use the local GstVideoFormatMap table.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
d633e0d072 surface: add new chroma formats.
Add new chroma formats available with VA-API >= 0.34.0. In particular,
this includes "RGB" chroma formats, and more YUV subsampled formats.
Also add a new from_GstVaapiChromaType() helper function to convert
libgstvaapi chroma type to VA chroma format.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
60b003709f pool: fix image pool to check for the video format to use.
Make gst_vaapi_image_pool_new() succeed, and thus returning a valid
image pool object, only if the underlying VA display does support the
requested VA image format.
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
97c0316fe4 Add more video formats.
Add new video format mappings to VA image formats:
- YUV: packed YUV (YUY2, UYVY), grayscale (Y800) ;
- RGB: 32-bit RGB without alpha channel (XRGB, XBGR, RGBX, BGRX).
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
d469b7274c image: fix debug message with video format.
Fix debug message string with image format expressed with GstVideoFormat
instead of the obsolete format that turned out to be a fourcc.

This is a regression from git commit e61c5fc.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
40ac87b45e libs: use GstVideoInfo wherever possible.
In particular, use gst_video_info_from_caps() helper function in VA image
for implementating gst_vaapi_image_get_buffer() [vaapidownload] and
gst_vaapi_image_update_from_buffer() [subpictures] in GStreamer 0.10 builds.
2013-07-09 17:16:35 +02:00
Gwenole Beauchesne
cb808f91aa libs: drop GstVaapiImageFormat helpers.
Drop GstVaapiImageFormat helpers since everything was moved to the new
GstVideoFormat based API. Don't bother with backwards compatibility and
just bump the library major version afterwards.
2013-07-09 17:16:35 +02:00
Gwenole Beauchesne
e61c5fc3d1 libs: port to new video format API. 2013-07-09 17:16:35 +02:00
Gwenole Beauchesne
430598cf00 Add new video format API.
Leverage GstVideoFormat utilities from core GStreamer to provide an
adaptation layer to VA image formats.
2013-07-09 17:16:35 +02:00
Sreerenj Balachandran
0b1faa62d0 mpeg2: add support for video cropping.
If the stream has a sequence_display_extenion, then attach the
display_horizontal/display_vertical dimension as the cropping
rectangle width/height to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:54:15 +02:00
Sreerenj Balachandran
f9ae0c0de4 vc1: add support for video cropping.
If the Advanced profile has display_extension fields, then set the display
width/height dimension as cropping rectangle to the GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:54:15 +02:00
Sreerenj Balachandran
976d27841a h264: add support for video cropping.
If the encoded stream has the frame_cropping_flag set, then associate
the cropping rectangle to GstVaapiPicture.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:54:15 +02:00
Gwenole Beauchesne
eb00f6d101 surfaceproxy: allow for NULL cropping rectangle.
Make it possible associate an empty cropping rectangle to the surface
proxy, thus resetting any cropping rectangle that was previously set.
This allows for returning plain NULL when no cropping rectangle was
initially set up to the surface proxy, or if it was reset to defaults.
2013-07-08 18:52:56 +02:00
Gwenole Beauchesne
ad7202bb77 surfaceproxy: clean-up helper macros.
Always use the GST_VAAPI_SURFACE_PROXY() helper macro to cast from a
proxy macro argument to a GstVaapiSurfaceProxy pointer.
2013-07-08 18:52:56 +02:00
Gwenole Beauchesne
99dfd44f33 surface: add simple surface info accessors as helper macros.
Add helper macros to retrieve the VA surface information like size
(width, height) or chroma type. This is a micro-optimization to avoid
useless function calls and NULL pointer re-checks in internal routines.
2013-07-08 18:52:56 +02:00
Sreerenj Balachandran
e66e72e7e3 decoder: add support for video cropping.
Add gst_vaapi_picture_set_crop_rect() helper function to copy the video
cropping information from raw bitstreams to each picture being decoded.
Also add helper function to surface proxy to propagate that information
outside of libgstvaapi. e.g. plug-in elements or standalone applications.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-08 18:52:56 +02:00
Zhong Cong
c2ddf464e5 mpeg2: reset quantization matrices on new sequence headers.
The MPEG-2 standard specifies (6.3.7) that all quantisation matrices
shall be reset to their default values when a Sequence_Header() is
decoded.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-07-05 17:57:57 +02:00
Gwenole Beauchesne
800b66f071 mpeg2: cope with latest codecparser changes.
Fix build with newer MPEG-2 codecparser where GstMpegVideoPacket are
used in individual header parsers. Also use the new slice parsing API.
2013-07-05 17:57:47 +02:00
Wind Yuan
b3525c824a image: fix wrong check for rect bounds in copy_image(). 2013-06-14 13:50:47 +02:00
Gwenole Beauchesne
4559f691a1 configure: always build the MPEG-4 parser.
Always build the MPEG-4 parser for now as there are also core fixes
included in the parser that cannot be tested for with API checks.
2013-06-14 11:45:11 +02:00
Gwenole Beauchesne
7793250607 wayland: fix memory leak of display resources. 2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
18031dc6ff surface: fix memory leak through unreleased parent context.
Break the circular references between GstVaapiContext and its children
GstVaapiSurfaces. Since the VA surfaces held an extra reference to the
context, which holds a reference to its VA surfaces, then none of those
were released.

How does this impact support for subpictures?

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

So, parent_context is set to NULL when the parent context is destroyed,
other VA surfaces can still get subpictures attached to them, individually
not as a whole. i.e. subpictures for surface S1 will be created from
active composition buffers and associated to S1, subpictures for S2 will
be created from the next active composition buffers, etc. We don't try
to cache the subpictures in those cases (pending surfaces until EOS
is reached, or pending surfaces until new surfaces matching new VA context
get to be used instead).
2013-05-30 19:32:58 +02:00
Gwenole Beauchesne
382542c747 window: fix GLX window initialization.
Make sure to create the GLX context once the window object has completed
its creation. Since gl_resize() relies on the newly created window size,
then we cannot simply overload the GstVaapiWindowClass::create() hook.
So, we just call into gst_vaapi_window_glx_ensure_context() once the
window object is created in the gst_vaapi_window_glx_new*() functions.
2013-05-27 17:21:10 +02:00
Gwenole Beauchesne
b1e5dfab96 display: validate display types. 2013-05-27 17:20:35 +02:00
Gwenole Beauchesne
b40cd3b382 display: drop internal NAME_PREFIX, store the real display name.
Always store a valid display name/device path, instead of adding a
particular prefix. i.e. make it simply a strdup(), or "" if it was
initially NULL.
2013-05-27 16:21:08 +02:00
Gwenole Beauchesne
71ab07d9c6 display: make it possible to lookup the display cache by type.
Make it possible to add extra an extra filter to most of display cache
lookup functions so that the GstVaapiDisplay instance can really match
a compatible and existing display by type, instead of relying on extra
string tags (e.g. "X11:" prefix, etc.).
2013-05-27 16:07:15 +02:00
Gwenole Beauchesne
c957823e8a display: cope with new display cache API. 2013-05-27 16:07:15 +02:00
Gwenole Beauchesne
b59445b2ab display: rework display cache API.
Simplify display cache API, while making it more flexible. We can now create
custom lookup functions with gst_vaapi_display_cache_lookup_custom().
2013-05-27 16:07:15 +02:00
Gwenole Beauchesne
809c7e097b libs: add query for GstVaapiVideoPool object types.
Add API to identify the underlying GstVaapiVideoPool object type.
2013-05-23 19:01:34 +02:00
Gwenole Beauchesne
67eea92044 libs: drop GST_VAAPI_IS_xxx() helper macros.
Drop obsolete GST_VAAPI_IS_xxx() helper macros since we are no longer
deriving from GObject and so those were only checking for whether the
argument was NULL or not. This is now irrelevant, and even confusing
to some extent, because we no longer have type checking.

Note: this incurs more type checking (review) but the libgstvaapi is
rather small, so this is manageable.
2013-05-23 18:15:48 +02:00
Gwenole Beauchesne
98bee4240f display: fix set_synchronous() to lock display. 2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
4cf1213b04 videopool: simplify creation of video objects pool. 2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
c2abeb1290 libs: simplify GstVaapiID definitions.
Make GstVaapiID a gsize instead of guessing an underlying integer large
enough to hold all bits of a pointer. Also drop GST_VAAPI_ID_NONE since
this is plain zero and that it is no longer passed as varargs.
2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
4ffdc98ab4 libs: drop obsolete function helpers and objects.
Drop obsolete GstVaapiID related function helpers for passing them as
GValues.
2013-05-07 17:51:27 +02:00
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