platform/upstream/gstreamer.git
9 years agovaapisink: Fix the conditional pad template creation.
Sreerenj Balachandran [Thu, 18 Jun 2015 11:55:12 +0000 (14:55 +0300)]
vaapisink: Fix the conditional pad template creation.

9 years agobuild: Don't build simple-encoder test program if there is no VA Encoding support
Sreerenj Balachandran [Thu, 18 Jun 2015 10:19:26 +0000 (13:19 +0300)]
build: Don't build simple-encoder test program if there is no VA Encoding support

This will fix the build error against older VA-APIs <= 0.32

9 years agoFix build error for older VA-API versions
Sreerenj Balachandran [Thu, 18 Jun 2015 09:20:37 +0000 (12:20 +0300)]
Fix build error for older VA-API versions

Provide guards for VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM and
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME which are only availble from
VA >= 0.36.

9 years agovaapisink: Fix the capsfeature advertisement in padtemplate
Sreerenj Balachandran [Wed, 17 Jun 2015 11:20:37 +0000 (14:20 +0300)]
vaapisink: Fix the capsfeature advertisement in padtemplate

This fixes the regression introduced in 64acc74.

If a pad supports multiple set of capsfeatures, it needs to add
multiple equal structures with different feature sets to the caps.
Because caps structures with the same name but with a non-equal
set of caps features are not compatible.

Without this patch, playbin will autoplug xvimagesink instead of vaapisink.

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

9 years agovaapisink: Expose the overlay capability for compatibility with dvbsuboverlay.
Adrian Cox [Wed, 17 Jun 2015 09:41:28 +0000 (12:41 +0300)]
vaapisink: Expose the overlay capability for compatibility with dvbsuboverlay.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agovaapipluginbase: Override downstream allocation reply if no pool
Olivier Crete [Wed, 17 Jun 2015 06:53:29 +0000 (09:53 +0300)]
vaapipluginbase: Override downstream allocation reply if no pool

If the downstream replied without a pool, then override it.

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

9 years agovaapipostproc: add color balance interface
Víctor Manuel Jáquez Leal [Tue, 9 Jun 2015 13:15:31 +0000 (15:15 +0200)]
vaapipostproc: add color balance interface

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

9 years agovaapipostproc: add skin tone enhancement
Víctor Manuel Jáquez Leal [Fri, 22 May 2015 16:13:25 +0000 (18:13 +0200)]
vaapipostproc: add skin tone enhancement

Added the 'skin-tone-enhancement' property to vaapostproc.

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

9 years agodoc: add VA-API reference in freedesktop
Víctor Manuel Jáquez Leal [Wed, 20 May 2015 16:02:37 +0000 (18:02 +0200)]
doc: add VA-API reference in freedesktop

9 years agopatches/videoparsers: rebase all the h264parse patches
Víctor Manuel Jáquez Leal [Thu, 4 Jun 2015 17:03:44 +0000 (19:03 +0200)]
patches/videoparsers: rebase all the h264parse patches

In order to avoid the creation of .orig files and break the distcheck target

9 years agobuild: don't build in parallel libvpx
Víctor Manuel Jáquez Leal [Thu, 4 Jun 2015 16:29:15 +0000 (18:29 +0200)]
build: don't build in parallel libvpx

This fixes the distcheck -j XX target.

9 years agoencoder: jpeg: Fix the packed header generation
Sreerenj Balachandran [Tue, 2 Jun 2015 05:52:53 +0000 (08:52 +0300)]
encoder: jpeg: Fix the packed header generation

This is a work-around to satisfy the va-intel-driver.
Normalize the quality factor and scale QM values (only for packed header
generation) similar to what VA-Intel driver is doing . Otherwise the
generated packed headers will be wrong, since the driver itself is
scaling the QM values using the normalized quality factor.

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agodecoder: h264: fix uninitialized variables in avcC mode.
Gwenole Beauchesne [Tue, 2 Jun 2015 09:46:00 +0000 (11:46 +0200)]
decoder: h264: fix uninitialized variables in avcC mode.

Fix uninitialized variables when decoding SPS and PPS NAL units from
"codec-data" buffers. This is particularly important when seeking ops
are involved, and the new persistent states are used more often.

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

9 years agovaapidecode: remove unneeded casting
Víctor Manuel Jáquez Leal [Mon, 1 Jun 2015 16:39:18 +0000 (18:39 +0200)]
vaapidecode: remove unneeded casting

And a code-style fix

9 years agovaapidecode: calculate decoding latency
Víctor Manuel Jáquez Leal [Thu, 21 May 2015 17:38:33 +0000 (19:38 +0200)]
vaapidecode: calculate decoding latency

This is a naïve approach to the calculation of the VA-API decoding latency. It
takes into consideration when the frame-rate has some insane value.

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

9 years agoconfigure: Compiling against libgstgl requires libgstvideo
Jan Schmidt [Thu, 21 May 2015 13:16:14 +0000 (23:16 +1000)]
configure: Compiling against libgstgl requires libgstvideo

Fix detection of the GstGL helper headers in uninstalled
builds.

9 years agoencoder: hevc: Fix the size over-flow for encoded buffer.
Sreerenj Balachandran [Thu, 28 May 2015 07:52:48 +0000 (10:52 +0300)]
encoder: hevc: Fix the size over-flow for encoded buffer.

The approximation of 6 times compression ratio migh not
work in all cases. Especially when enabling I frames.
Provide large enough size for coded-buffer creation.

9 years agoencoder: vp8: Fix the size over-flow for encoded buffer.
Sreerenj Balachandran [Thu, 28 May 2015 07:43:20 +0000 (10:43 +0300)]
encoder: vp8: Fix the size over-flow for encoded buffer.

The approximation of 4 times compression ratio will not
work in all cases. Especially when enabling I frames.
Provide large enough size for coded-buffer creation.

9 years agoencoder: hevc: fix bug in multi slice encoding.
Sreerenj Balachandran [Thu, 28 May 2015 02:43:49 +0000 (05:43 +0300)]
encoder: hevc:  fix bug in multi slice encoding.

This is a work-around for satisfying the VA-Intel driver.
The driver only support slices begin from CTU row start address.

Multi-Slice encoding also requires a fix in va-intel-driver:
http://lists.freedesktop.org/archives/libva/2015-May/003351.html

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agodecoder: h264: add initial support for loss of pictures.
Gwenole Beauchesne [Thu, 12 Mar 2015 21:57:22 +0000 (22:57 +0100)]
decoder: h264: add initial support for loss of pictures.

Implement decoding process for gaps in frame_num (8.5.2). This
also somewhat supports unintentional loss of pictures.

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

Original-patch-by: Wind Yuan <feng.yuan@intel.com>
[fixed derivation of POC, ensured clone is valid for reference,
 actually fixed detection of gaps in FrameNum by PrevRefFrameNum]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agodecoder: h264: add support for missing first field.
Gwenole Beauchesne [Fri, 22 May 2015 09:42:52 +0000 (11:42 +0200)]
decoder: h264: add support for missing first field.

Try to identify missing first fields too, thus disregarding any
intermediate gaps in frames. We also assume that we keep the same
field sequence, i.e. if previous frames were in top-field-first
(TFF) order, then so are subsequent frames.

Note that insertion of dummy first fields need to operate in two
steps: (i) create the original first field that the current field
will inherit from, and (ii) submit that field into the DPB prior
to initializing the current (other) field POC values but after any
reference flag was set. i.e. copy reference flags from the child
(other field) to the parent (first field).

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

9 years agodecoder: h264: add support for missing second field.
Gwenole Beauchesne [Thu, 7 May 2015 12:00:58 +0000 (14:00 +0200)]
decoder: h264: add support for missing second field.

Interlaced H.264 video frames always have two fields to decode and
display. However, in some cases, e.g. packet loss, one of the field
can be missing. This perturbs the reference picture marking process,
whereby the number of references available in DPB no longer matches
the expected value.

This patch adds initial support for missing field within a decoded
frame. The current strategy taken is to find out the nearest field,
by POC value, and with the same parity.

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

9 years agodecoder: h264: improve tracking of "top-field-first" flag.
Gwenole Beauchesne [Fri, 22 May 2015 15:06:11 +0000 (17:06 +0200)]
decoder: h264: improve tracking of "top-field-first" flag.

Try to maintain a "top-field-first" (TFF) flag, even if the H.264 standard
does not mandate it. This will be useful for tracking missing fields, and
also for more correct _split_fields() implementation for frames in the DPB.

9 years agodecoder: h264: skip all pictures prior the first I-frame.
Gwenole Beauchesne [Tue, 5 May 2015 09:56:11 +0000 (11:56 +0200)]
decoder: h264: skip all pictures prior the first I-frame.

Don't try to decode pictures until the first I-frame is received within
the currently active sequence. There is no point is decoding and then
displaying frames with artifacts.

9 years agodecoder: h264: fix processing of EOSEQ NAL.
Gwenole Beauchesne [Tue, 12 May 2015 13:36:10 +0000 (15:36 +0200)]
decoder: h264: fix processing of EOSEQ NAL.

Fix decoding of end_of_seq() NAL unit so that to not submit the current
picture for decoding again. This is pretty vintage code that dates back
before the existing of the whole decoder units machinery.

One issue that could be arising if that code was kept is that we could
have submitted a picture, and subsequently a GstVideoCodec frame, twice.
Once without the decode_only flag set, and once with that flag set. The
end result is that the GstVideoDecoder would release the codec frame
twice, thus releasing stale data.

In short, the piece of code that is removed by this patch is for once
completely obsolete for a while, and secondly error-prone in corner
cases.

9 years agodecoder: add utility function to clone picture objects.
Wind Yuan [Thu, 28 Feb 2013 07:26:36 +0000 (15:26 +0800)]
decoder: add utility function to clone picture objects.

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

Signed-off-by: Wind Yuan <feng.yuan@intel.com>
[added cosmetic changes, fixed propagation of "one-field" flag to
 children, fixed per-codec clone modes (h264)]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 years agobuild: don't compile HEVC encoder if not supported
Alban Browaeys [Wed, 27 May 2015 20:49:18 +0000 (23:49 +0300)]
build: don't compile HEVC encoder if not supported

Fix:
(gst-plugin-scanner:16681): GStreamer-WARNING **: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so': /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so: undefined symbol: gst_vaapi_encoder_h265_get_default_properties

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

Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: decode: add missing va_dec_hevc header
Alban Browaeys [Wed, 27 May 2015 20:43:16 +0000 (23:43 +0300)]
HEVC: decode: add missing va_dec_hevc header

Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=749953

9 years agompeg2: fix PTS cache for GOP start.
Gwenole Beauchesne [Tue, 26 May 2015 11:28:32 +0000 (13:28 +0200)]
mpeg2: fix PTS cache for GOP start.

If the GOP temporal sequence number (TSN) is interpolated from a valid
PTS, then we need to compensate that PTS corresponding to the start of
GOP with the next picture to be decoded, which shall be an I-frame,
based on its sequence number.

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

9 years agompeg2: avoid crash when seeking with debug logs
Víctor Manuel Jáquez Leal [Wed, 27 May 2015 08:49:56 +0000 (10:49 +0200)]
mpeg2: avoid crash when seeking with debug logs

Move down the debug message when the state of the decoder is verified
so the slice header is not NULL.

9 years agompeg2: Avoid crashes and warnings on re-opened decoder after a seek
Jan Schmidt [Tue, 16 Dec 2014 13:41:10 +0000 (00:41 +1100)]
mpeg2: Avoid crashes and warnings on re-opened decoder after a seek

Reset state and add some checks for safe state to avoid a crash and
a warning after the decoder is destroyed/recreated during a seek.

9 years agopatches/videoparsers: Rebase the patch on top of gst-vaapi-branch commit 20ee952
Sreerenj Balachandran [Tue, 26 May 2015 07:21:59 +0000 (10:21 +0300)]
patches/videoparsers: Rebase the patch on top of gst-vaapi-branch commit 20ee952

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agocodecparsers: Update to gst-vaapi-branch commit 20ee952
Sreerenj Balachandran [Tue, 26 May 2015 07:03:20 +0000 (10:03 +0300)]
codecparsers: Update to gst-vaapi-branch commit 20ee952

b7dded3: h264parse: don't consider unknown stream-format as avc
5110ad9: h264parse: fix up handling of input caps corner cases
e51db3e: h264parse: Remove dead code
3d739d0: codecparser: h265: Fix the number of tile rows/columns parsing
8482957: h265parse: Fix profile, tier and level setting in caps
4649acb: h265parse: Fix the memory freeing of stored VPS nals
f2beeb7: h265parse: Fix source caps to report cropped dimensions
6886a31: h264parse: Fix profile and level setting in caps
5286c1a: h264parse: Consider SEI NALU as "HEADER" packets
eb97854: videoparsers: h264: bit-exact sync with upstream, minor changes here and there
53074fc: build: Upgrade GStreamer dependency to 1.0

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: decode: Replace clip3 implementation with glib CLAMP macro
Sreerenj Balachandran [Tue, 26 May 2015 03:01:10 +0000 (06:01 +0300)]
HEVC: decode: Replace clip3 implementation with glib CLAMP macro

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: decode: Update Cropping Rectangle
Sreerenj Balachandran [Tue, 26 May 2015 02:33:33 +0000 (05:33 +0300)]
HEVC: decode: Update Cropping Rectangle

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC_Encode: Add HEVC(h265) Encoder plugin
Sreerenj Balachandran [Mon, 25 May 2015 08:58:20 +0000 (11:58 +0300)]
HEVC_Encode: Add HEVC(h265) Encoder plugin

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC_Encode: Add HEVC(h265) encoder to core libgstvaapi
Sreerenj Balachandran [Mon, 25 May 2015 08:38:34 +0000 (11:38 +0300)]
HEVC_Encode: Add HEVC(h265) encoder to core libgstvaapi

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC_Encode: build: Check availability of VA APIs for H265 encoding.
Sreerenj Balachandran [Mon, 25 May 2015 08:26:14 +0000 (11:26 +0300)]
HEVC_Encode: build: Check availability of VA APIs for H265 encoding.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=748874

9 years agogstvaapiutils_h265: Add H265 Tier specific utility functions
Sreerenj Balachandran [Mon, 25 May 2015 07:58:52 +0000 (10:58 +0300)]
gstvaapiutils_h265: Add H265 Tier specific utility functions

-- New API: gst_vaapi_utils_h265_get_tier_from_string()
-- New API: gst_vaapi_utils_h265_get_tier_string()

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

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agodoc: conditional linking for scanner
Víctor Manuel Jáquez Leal [Tue, 19 May 2015 08:57:42 +0000 (10:57 +0200)]
doc: conditional linking for scanner

Add x11 library only if it is enabled.

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

9 years agodoc: fix scanner compilation warning
Víctor Manuel Jáquez Leal [Tue, 19 May 2015 08:37:13 +0000 (10:37 +0200)]
doc: fix scanner compilation warning

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

9 years agodoc: update sections and symbols
Víctor Manuel Jáquez Leal [Wed, 6 May 2015 14:19:23 +0000 (16:19 +0200)]
doc: update sections and symbols

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

9 years agobuild: use git.mk
Víctor Manuel Jáquez Leal [Wed, 13 May 2015 08:38:24 +0000 (10:38 +0200)]
build: use git.mk

This patch handles dinamically the gitignore files with git.mk[1].

Removed the automake variable MAINTAINERCLANFILES in most of the
Makefile.am files since now it is handled by the top one.

1. https://github.com/behdad/git.mk/blob/master/git.mk

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

9 years agowayland: sync() when destroy()
Víctor Manuel Jáquez Leal [Thu, 7 May 2015 09:28:15 +0000 (11:28 +0200)]
wayland: sync() when destroy()

Before pushing a the new frame, the render() method calls sync() to flush the
pending frames. Nonetheless, the last pushed frame never gets rendered, leading
to a memory leak too.

This patch calls sync() in the destroy() to flush the pending frames before
destroying the window.

Also a is_cancelled flag is added. This flag tells to not flush the event
queue again since the method failed previously or were cancelled by the user.

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

9 years agovaapisink: implement unlock/unlock_stop for wayland
Michael Olbrich [Thu, 7 May 2015 13:55:40 +0000 (15:55 +0200)]
vaapisink: implement unlock/unlock_stop for wayland

Otherwise wl_display_dispatch_queue() might prevent the pipeline from
shutting down. This can happen e.g. if the wayland compositor exits while
the pipeline is running.

Changes:
* renamed unlock()/unlock_stop() to unblock()/unblock_cancel() in gstvaapiwindow
* splitted the patch removing wl_display_dispatch_queue()

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=747492

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

9 years agowayland: wl_display_dispatch_queue() can block forever.
Víctor Manuel Jáquez Leal [Thu, 7 May 2015 10:33:34 +0000 (12:33 +0200)]
wayland: wl_display_dispatch_queue() can block forever.

wl_display_dispatch_queue() might prevent the pipeline from shutting
down. This can happen e.g. if the wayland compositor exits while the
pipeline is running.

This patch replaces it with these steps:

- With wl_display_prepare_read() all threads announce their intention
  to read.
- wl_display_read_events() is thread save. On threads reads, the other
  wait for it to finish.
- With wl_display_dispatch_queue_pending() each thread dispatches its
  own events.

wl_display_dispatch_queue_pending() was defined since wayland 1.0.2

Original-patch-by: Michael Olbrich <m.olbrich@pengutronix.de>
* stripped out the unlock() unlock_stop() logic
* stripped out the poll handling

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=749078

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

9 years agowayland: rename frame for last_frame
Víctor Manuel Jáquez Leal [Thu, 7 May 2015 16:30:33 +0000 (18:30 +0200)]
wayland: rename frame for last_frame

Since frame in the private data means the last frame sent, it would
semantically better use last_frame.

Also, this patch makes use of g_atomic_pointer_{compare_and_exchange, set}()
functions.

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

9 years agowayland: use a counter as sync flag
Víctor Manuel Jáquez Leal [Thu, 7 May 2015 09:18:12 +0000 (11:18 +0200)]
wayland: use a counter as sync flag

Wayland window has a pointer to the last pushed frame and use it to set the
flag for stopping the queue dispatch loop. This may lead to memory leaks,
since we are not keeping track of all the queued frames structures.

This patch removes the last pushed frame pointer and change the binary flag
for an atomic counter, keeping track of number of queued frames and use it for
the queue dispatch loop.

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

9 years agowayland: decouple wl_buffer from frame
Víctor Manuel Jáquez Leal [Thu, 7 May 2015 08:36:17 +0000 (10:36 +0200)]
wayland: decouple wl_buffer from frame

This patch takes out the wayland's buffer from the the frame structure. The
buffer is queued to wayland and destroyed in the "release" callback. The
frame is freed in the surface's "done" callback.

In this way a buffer may be leaked but not the whole frame structure.

- surface 'done' callback is used to throttle the rendering operation and to
  unallocate the frame, but not the buffer.
- buffer 'release' callback is used to destroy wl_buffer.

Original-patch-by: Zhao Halley <halley.zhao@intel.com>
* code rebase
* kept the the event_queue for buffer's proxy

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=749078

9 years agovaapisink: fix indentation
Víctor Manuel Jáquez Leal [Thu, 14 May 2015 14:22:36 +0000 (16:22 +0200)]
vaapisink: fix indentation

9 years agobuild: fix make distcheck
Víctor Manuel Jáquez Leal [Wed, 13 May 2015 09:54:01 +0000 (11:54 +0200)]
build: fix make distcheck

This patch fixes several issues found when running the `make distcheck`
target:

- In commit c561b8da, the update of gstcompat.h in Makefile.am was
  forgotten.
- In commit c5756a91 add the simple_encoder_source_h in EXTRA_DIST was
  forgotten.
- vpx.build.stamp is not generated at all, only vpx.configure.stamp.
- The make target distcleancheck failed because some autogenerated files
  were not handled with the DISTCLEANFILES variable.

Note: `make distcheck -jXX` is not currently supported.

9 years agoh264parse: update patches with upstream
Víctor Manuel Jáquez Leal [Wed, 13 May 2015 11:28:17 +0000 (13:28 +0200)]
h264parse: update patches with upstream

These patches didn't applied cleanly, breaking the `make distcleancheck`
target. Re-sync'ed the patches against the current git's submodule.

9 years agotests: simple-encoder: fix build warnings on 64-bit platforms.
Gwenole Beauchesne [Tue, 12 May 2015 14:04:33 +0000 (16:04 +0200)]
tests: simple-encoder: fix build warnings on 64-bit platforms.

Add a cosmetic change to replace VAAPI buffer with VA buffer and most
importantly fix warnings spitted out during build on 64-bit platforms.

../../tests/simple-encoder.c:211:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘gssize’ [-Wformat=]
     g_warning ("Invalid VAAPI buffer size (%d)", size);
     ^
../../tests/simple-encoder.c:217:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘gssize’ [-Wformat=]
     g_warning ("Failed to create output buffer of size %d", size);
     ^

9 years agoplugins: remove gstreamer-0.10 crumbs
Víctor Manuel Jáquez Leal [Fri, 8 May 2015 13:54:09 +0000 (15:54 +0200)]
plugins: remove gstreamer-0.10 crumbs

GstVideoContext was used in gstreamer-0.10, which is not supported anymore.
Still, its definition was still in the code. This patch removes it.

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

9 years agotests: add simple-encoder program
Víctor Manuel Jáquez Leal [Tue, 5 May 2015 11:08:25 +0000 (13:08 +0200)]
tests: add simple-encoder program

This patch adds a simple-encoder test program that uses libgstvaapi for video
encoding to elementary (raw) streams. Input stream is raw YUV in the Y4M
format. That can be from a regular file or standard input when the input
filename is "-".

Usage: simple-encoder [options]* <source>

Options:
--output|-o     output file name
--codec|-c      codec to use for video encoding
--bitrate|-b    desired bitrate (kbps)

By default, and as an initial patch, the encoded stream shall conform to the
minimally supported profile. That is "Constrained Baseline Profile" for H.264
and "Simple Profile" for MPEG-2. Though, those are the defaults to be
generated by libgstvaapi.

You can find Y4M sample files here http://samples.mplayerhq.hu/yuv4mpeg2/

Original-patch-by: Changzhi Wei <changzhix.wei@intel.com>
* general code clean-up
* removed the yuv reader thread
* re-wrote the y4m file parser
* updated used API fixed some wrong usage
* fixed a lot of memory leaks
* added the bitrate setting
* keep fps' numerator and denominator
* simplified the thread control
* removed custom logging and use glib

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=719528

9 years agolibs: trivial documentation fix
Víctor Manuel Jáquez Leal [Tue, 5 May 2015 11:02:19 +0000 (13:02 +0200)]
libs: trivial documentation fix

GST_VAAPI_ENCODER_STATUS_NO_SURFACE and GST_VAAPI_ENCODER_STATUS_NO_BUFFER
are not errors, so they do not have the ERROR namespace.

This patch fixes this typo in documentation.

9 years agowindow: Correct prototype to match implementation
Simon Farnsworth [Sun, 15 Feb 2015 15:01:03 +0000 (15:01 +0000)]
window: Correct prototype to match implementation

On s390x, guintptr and GstVaapiID are not compatible types. The
implementation of gst_vaapi_window_new_internal() and all its callers
seem to assume that its third argument is a GstVaapiID, while the
header gives it guintptr type.

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

9 years agovaapidecode: add guards for disabled codecs.
Gwenole Beauchesne [Mon, 4 May 2015 12:24:43 +0000 (14:24 +0200)]
vaapidecode: add guards for disabled codecs.

Fix link when building plugin elements without HEVC support. e.g. don't
try to call into gst_vaapi_decoder_h265_set_alignment() if there is no
support HEVC enabled in libgstvaapi.

Also, drop disabled codecs from static template caps. Add the missing
HEVC static template caps into vaapidecodebin too.

9 years agobuild: upgrade glib dependency to 2.32
Víctor Manuel Jáquez Leal [Thu, 30 Apr 2015 11:29:48 +0000 (13:29 +0200)]
build: upgrade glib dependency to 2.32

Since bug #745728 was fixed the oldest supported version of GStreamer is
1.2. That GStreamer release requires glib 2.32, so we can upgrade our
requirement too.

This patch changes the required version of glib in configure.ac and removes
the hacks in glibcompat.h

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

9 years agoplugins: check if the pool config is already set
Víctor Manuel Jáquez Leal [Thu, 30 Apr 2015 11:21:08 +0000 (13:21 +0200)]
plugins: check if the pool config is already set

In commit 97b768, a regression for GStreamer 1.2 was introduced:

GStreamer 1.2 doesn't check, in gst_buffer_pool_set_config() if the
config option is already set. This patch adds an inline function to
first verify if the option is not in the pool config berfore add it.

9 years agovaapipostproc: tune up a couple of log messages
Víctor Manuel Jáquez Leal [Wed, 29 Apr 2015 10:39:50 +0000 (12:39 +0200)]
vaapipostproc: tune up a couple of log messages

In order to reduce the noise, the query type log was downgrade from INFO to
DEBUG, and the shared display address log message is assigned to the object.

9 years agoplugins: check gst_buffer_pool_set_config()
Víctor Manuel Jáquez Leal [Wed, 29 Apr 2015 10:27:43 +0000 (12:27 +0200)]
plugins: check gst_buffer_pool_set_config()

Check the return value of gst_buffer_pool_set_config(). If it fails an error
message is posted in the bus.

9 years agoplugins: more specific log message
Víctor Manuel Jáquez Leal [Wed, 29 Apr 2015 10:24:52 +0000 (12:24 +0200)]
plugins: more specific log message

Be more specific in the log message about the reason of creating a new pool.

9 years agoplugins: delete unused variable
Víctor Manuel Jáquez Leal [Wed, 29 Apr 2015 10:22:29 +0000 (12:22 +0200)]
plugins: delete unused variable

need_pool is a boolean variable extracted from the allocation query, but it is
not used afterwards.

9 years agovaapipluginbase: Update the pool if there was no pool in the downstream reply
Olivier Crete [Mon, 27 Apr 2015 23:21:12 +0000 (19:21 -0400)]
vaapipluginbase: Update the pool if there was no pool in the downstream reply

Fix regression introduced by bd866479, the query after decide_allocation()
always needs a pool in the first slot.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
https://bugzilla.gnome.org/show_bug.cgi?id=748559

9 years agovideopool: Free members before chaining up finalize
Olivier Crete [Tue, 28 Apr 2015 00:50:19 +0000 (20:50 -0400)]
videopool: Free members before chaining up finalize

The finalize function in GObject frees the object memory, so
everything else needs to have been freed before.

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

9 years agowayland: don't leak the registry proxy
Olivier Crete [Tue, 28 Apr 2015 00:31:50 +0000 (20:31 -0400)]
wayland: don't leak the registry proxy

Release the registry proxy when closing the display.

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

9 years agowayland: refactor _sync() method and rename callback
Víctor Manuel Jáquez Leal [Tue, 21 Apr 2015 15:17:06 +0000 (17:17 +0200)]
wayland: refactor _sync() method and rename callback

This patch only intends to improve readability: in the method
gst_vaapi_window_wayland_sync() the if/do instructions are squashed into a
single while loop.

Also renames the frame_redraw_callback() callback into frame_done_callback(),
which is a bit more aligned to Wayland API.

9 years agowayland: free frame in buffer release callback
Michael Olbrich [Tue, 3 Feb 2015 15:52:06 +0000 (16:52 +0100)]
wayland: free frame in buffer release callback

The Wayland compositor may still use the buffer when the frame done
callback is called.

This patch destroys the frame (which contains the buffer) until the
release callback is called. The draw termination callback only controls
the display queue dispatching.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
https://bugzilla.gnome.org/show_bug.cgi?id=747492

9 years agovaapidecode: refactor gst_vaapidecode_internal_flush()
Víctor Manuel Jáquez Leal [Tue, 21 Apr 2015 08:00:36 +0000 (10:00 +0200)]
vaapidecode: refactor gst_vaapidecode_internal_flush()

This a cosmetic refactor: gst_vaapidecode_internal_flush() removes its only
label; gst_vaapidecode_finish() is more readable and gst_vaapidecode_purge()
shares the same error message of gst_vaapidecode_internal_flush() when flush
fails.

9 years agovaapidecode: refactor gst_vaapidecode_destroy()
Víctor Manuel Jáquez Leal [Mon, 20 Apr 2015 11:27:27 +0000 (13:27 +0200)]
vaapidecode: refactor gst_vaapidecode_destroy()

Add the method gst_vaapidecode_purge(). This method releases the
flushed frames from the decoder.

This new method add more readablity to gst_vaapidecode_destroy()

9 years agovaapidecode: Tell the base class about released frames on close
Olivier Crete [Thu, 16 Apr 2015 16:53:18 +0000 (12:53 -0400)]
vaapidecode: Tell the base class about released frames on close

The base class needs to be informed about frames that were still queued
in the decoder on release, otherwise they are leaked.

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

9 years agovaapidecode: reduce logging noise
Víctor Manuel Jáquez Leal [Sun, 19 Apr 2015 09:19:03 +0000 (11:19 +0200)]
vaapidecode: reduce logging noise

When a frame is rejected by downstream, the message is logged twice. This
patch removes one of those logging messages.

Also, the reject of a frame doesn't mean an alarming error. This patch demotes
the log message from error to info.

9 years agovaapidecode: Use the GstVideoDecoder error reporting function
Olivier Crete [Fri, 17 Apr 2015 00:18:13 +0000 (20:18 -0400)]
vaapidecode: Use the GstVideoDecoder error reporting function

This way, the decoder won't stop on the first decoding error,
in most cases it can recover after some glitchiness.

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

9 years agovaapipluginbase: The allocation query can return without a pool
Olivier Crete [Fri, 17 Apr 2015 19:10:35 +0000 (19:10 +0000)]
vaapipluginbase: The allocation query can return without a pool

It is possible to return the min/max/size without actually providing
a pool. This way the source knows how many buffers downstream needs.

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

9 years agoplugins: Add h265 videoparser element "vaapiparse_h265"
Sreerenj Balachandran [Fri, 17 Apr 2015 13:45:22 +0000 (16:45 +0300)]
plugins: Add h265 videoparser element "vaapiparse_h265"

This is a mirror of h265parse element in upstream gst-plugins-bad.
There could be additional patches but all should go to upstream.
This is for making development faster.

Note: vaapiparse_h265 will get build only for GStreamer version >= 1.4

9 years agocodecparsers: Update to gst-vaapi-branch commit 43a0368
Sreerenj Balachandran [Fri, 17 Apr 2015 12:44:04 +0000 (15:44 +0300)]
codecparsers: Update to gst-vaapi-branch commit 43a0368

45f1c28: codecparser: h265: Fix nal unit size checking
f25987b: codecparser: h265: Calculate crop rectangle dimensions
639573a: codecparser: h265: Fix parsing multiple SEI messages in a single SEI Nal
4c8ec41: Add h265 videoparser plugin source files

9 years agoautogen: drop videoutils submodule.
Gwenole Beauchesne [Fri, 17 Apr 2015 08:10:10 +0000 (10:10 +0200)]
autogen: drop videoutils submodule.

9 years agodecoder: hevc: cosmetics.
Gwenole Beauchesne [Fri, 17 Apr 2015 08:36:25 +0000 (10:36 +0200)]
decoder: hevc: cosmetics.

Mostly coding style updates. Avoid integer signess inconsistencies.
Optimize dpb_find_lowest_poc() to align with original h264's decoder.

9 years agodecoder: hevc: Add Support for tiled video decoding
Sreerenj Balachandran [Thu, 16 Apr 2015 11:13:59 +0000 (14:13 +0300)]
decoder: hevc: Add Support for tiled video decoding

Based up on the value of uniform_spacing_flag in Picture Parameter Set,
the tile column width and tile row height should be calculated.
Equations: 6-1, 6-2
Tiled video Descriptions: 7.3.2.3, 7.4.3.3

9 years agodecoder: hevc: Fix decoding when there are RASL pictures present.
Sreerenj Balachandran [Thu, 16 Apr 2015 11:13:21 +0000 (14:13 +0300)]
decoder: hevc: Fix decoding when there are RASL pictures present.

-- Set NoRaslOutputFlag based on EOS and EOB Nal units
-- Fix PicOutputFlag setting for RASL picture
-- Fix prev_poc_lsb/prev_poc_msb calculation
-- Drop the RASL frames if NoRaslOutputFlag is TRUE for the associated IRAP picture
-- Fixed couple of crashes and added cosmetics

9 years agodisplay: drm: fix race condition setting device type
Martin Sherburn [Tue, 14 Apr 2015 09:54:54 +0000 (10:54 +0100)]
display: drm: fix race condition setting device type

There is a race condition where g_drm_device_type can be left set to
DRM_DEVICE_RENDERNODES when it shouldn't.

If thread 1 comes in and falls into the last else statement setting up both
RENDERNODES and LEGACY types. And begins to process the first type (RENDERNODES),
it sets g_drm_device_type = RENDERNODES.

Now when thread 2 comes in and sees g_drm_device_type is RENDERNODES, it queues
up that type to be tried but then encounters the lock and has to wait until the
first thread finishes. Once the lock is acquired it will then proceed to ONLY try
RENDERNODES and fail it. But it doesn't try LEGACY. And from then on, all future
attempts will only try RENDERNODES.

So to avoid this situation I have simply moved the acquisition of the lock higher
up in the attached patch.

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

9 years agovaapipostproc: Don't create filter on caps query
Olivier Crete [Wed, 15 Apr 2015 19:26:12 +0000 (15:26 -0400)]
vaapipostproc: Don't create filter on caps query

The problem with this is that creating the filter causes the display to
be selected, and the caps query happens while linking the element. So,
if the downstream or upstream element is using a specific display
object, it won't be propagated correctly to the postproc as it already
has a display at this point.

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

9 years agovideopool: Release lock while allocating new object
Olivier Crete [Wed, 15 Apr 2015 19:20:17 +0000 (15:20 -0400)]
videopool: Release lock while allocating new object

The video pool can be accessed with the display lock held, for example,
when releasing a buffer from inside vaapisink_render, but allocating
a new object can may also take the display lock. Which means a possible
deadlock.

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

9 years agovaapisink: use GstVideoSink vmethod show_frame()
Víctor Manuel Jáquez Leal [Wed, 15 Apr 2015 15:26:43 +0000 (17:26 +0200)]
vaapisink: use GstVideoSink vmethod show_frame()

vaapisink inherits from GstVideoSink, in order to use its functionality (such
as ::show-preroll-frame property), we should use its vmethod show_frame(),
rather than call ourselves render() and preroll().

9 years agovaapisink: add 'handoff' signal
Víctor Manuel Jáquez Leal [Wed, 15 Apr 2015 16:16:47 +0000 (18:16 +0200)]
vaapisink: add 'handoff' signal

This patch adds the signal ::handoff and the property signal-handoffs. If the
property is set TRUE, the signal ::handoff is emitted just after the buffer is
rendered.

Based on Zhao Halley <halley.zhao@intel.com>

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

9 years agoHEVC: silence the compiler
Víctor Manuel Jáquez Leal [Tue, 14 Apr 2015 08:17:16 +0000 (10:17 +0200)]
HEVC: silence the compiler

Fixed a couple of clang complains.

9 years agowayland: destroy vpp buffer pool on resize
Michael Olbrich [Mon, 2 Feb 2015 15:42:43 +0000 (16:42 +0100)]
wayland: destroy vpp buffer pool on resize

Otherwise the old buffers with the old size are used.

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

9 years agobuild: don't compile HEVC if not supported
Víctor Manuel Jáquez Leal [Tue, 14 Apr 2015 08:08:47 +0000 (10:08 +0200)]
build: don't compile HEVC if not supported

HEVC decoding was added recently libva-1.5.

This patch avoids HEVC decoding support in libgstvaapi if it is not available
in the installed libva.

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

9 years agovaapidecode: Update Author name in plugin metadata
Sreerenj Balachandran [Mon, 13 Apr 2015 13:04:59 +0000 (16:04 +0300)]
vaapidecode: Update Author name in plugin metadata

9 years agoplugins: Add HEVC decoder
Sreerenj Balachandran [Mon, 13 Apr 2015 12:43:30 +0000 (15:43 +0300)]
plugins: Add HEVC decoder

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: Add HEVC(h265) decoder to core libgstvaapi
Sreerenj Balachandran [Mon, 13 Apr 2015 12:41:45 +0000 (15:41 +0300)]
HEVC: Add HEVC(h265) decoder to core libgstvaapi

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: Add codec utility methods to core libgstvaapi
Sreerenj Balachandran [Mon, 13 Apr 2015 11:53:46 +0000 (14:53 +0300)]
HEVC: Add codec utility methods to core libgstvaapi

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: gstvaapiprofile: Add profile definitions
Sreerenj Balachandran [Mon, 13 Apr 2015 11:52:53 +0000 (14:52 +0300)]
HEVC: gstvaapiprofile: Add profile definitions

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: build: Check availability of h265 decoder APIs
Sreerenj Balachandran [Mon, 13 Apr 2015 11:52:14 +0000 (14:52 +0300)]
HEVC: build: Check availability of h265 decoder APIs

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoHEVC: Allow to build h265 codecparser internally
Sreerenj Balachandran [Mon, 13 Apr 2015 11:51:51 +0000 (14:51 +0300)]
HEVC: Allow to build h265 codecparser internally

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
9 years agoguard buffer export API if not available
Víctor Manuel Jáquez Leal [Wed, 8 Apr 2015 16:05:20 +0000 (18:05 +0200)]
guard buffer export API if not available

The support for buffer exports in VA-API was added in version 0.36. These
interfaces are for interop with EGL, OpenCL, etc.

GStreamer-VAAPI uses it for a dmabuf memory allocator. Though, gstreamer-vaapi
has to support VA-API versions ranging from 0.30.4, which doesn't support it.

This patch guards all the buffer exports handling (and dmabuf allocator) if
the detected VA-API version is below 0.36.

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

9 years agocodecparsers: Update to gst-vaapi-branch commit 9bc72b0
Sreerenj Balachandran [Mon, 13 Apr 2015 08:29:35 +0000 (11:29 +0300)]
codecparsers: Update to gst-vaapi-branch commit 9bc72b0

767bf22: codecparsers: h265: add helpers to convert quantization matrices
71c8e93: codecparser: h265: skip byte alignment bits while parsing slice header
3bf0355: codecparsre: h265: Fix the NumDeltaPocs calculation
10e2087: codecparser: h265: Fix the NumPocTotalCurr calculatio
2d753b8: codecparser: h265: Fix nal size calculation for EOS and EOB

9 years agovaapidecode: unref video codec frame twice
Michael Olbrich [Thu, 11 Dec 2014 11:02:38 +0000 (12:02 +0100)]
vaapidecode: unref video codec frame twice

We get one reference when the frame is passed to decode_handle_frame()
and create another one in gst_vaapi_decoder_push_frame().

Usually the frame is handled in gst_vaapidecode_push_decoded_frame().
Here the frame is always released twice:
gst_video_decoder_finish_frame() + gst_video_codec_frame_unref() or
gst_video_decoder_drop_frame() + gst_video_codec_frame_unref().

In gst_vaapidecode_reset_full() both references to the frame must be
released as well.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
https://bugzilla.gnome.org/show_bug.cgi?id=743226

9 years agolibs: remove unused variables
Víctor Manuel Jáquez Leal [Wed, 8 Apr 2015 16:20:34 +0000 (18:20 +0200)]
libs: remove unused variables

clang reports these unused variables. Let's get rid of them.

This patch is a missing part of commit c82e5173

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