Commit graph

459 commits

Author SHA1 Message Date
Gwenole Beauchesne
9d417815ab vaapipostproc: don't crash with dynamic framerate (0/1).
Avoid reaching an assert if dynamic framerates (0/1) are used. One
way to solve this problem is to just stick field_duration to zero.
However, this means that, in presence of interlaced streams, the
very first field will never be displayed if precise presentation
timestamps are honoured.

https://bugzilla.gnome.org/show_bug.cgi?id=729604
2014-06-19 14:51:01 +02:00
Simon Farnsworth
1a2c06a81c vaapipostproc: create filter surface pool if it does not exist yet.
ensure_srcpad_buffer_pool() tries to avoid unnecessarily deleting and
recreating filter_pool. Unfortunately, this also meant it didn't create
it if it did not exist.

Fix it to always create the buffer pool if it does not exist.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
2014-06-18 17:30:12 +02:00
Zhao, Halley
faefd62e9b vaapipostproc: reset deinterlacer state when there is a discontinuity.
Reset deinterlacer state, i.e. past reference frames used for advanced
deinterlacing, when there is some discontinuity detected in the course
of processing source buffers.

This fixes support for advanced deinterlacing when a seek occurred.

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

[fixed type of pts_diff variable, fetch previous buffer PTS from the
 history buffer, reduce heuristic for detecting discontinuity]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 17:24:48 +02:00
Gwenole Beauchesne
b3401dbb29 vaapipostproc: add support for crop regions in VPP mode.
Apply video cropping regions stored in GstVideoCropMeta, or in older
GstVaapiSurfaceProxy representation, to VPP pipelines. In non-VPP modes,
the crop meta are already propagated to the output buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=720730
2014-06-18 16:24:52 +02:00
Simon Farnsworth
927fd2e1a8 vaapipostproc: make deinterlace-mode behave as expected.
deinterlace-mode didn't behave in the way you'd expect if you have
past experience of the deinterlace element. There were two bugs:

 1. "auto" mode wouldn't deinterlace "interleaved" buffers, only "mixed".
 2. "force" mode wouldn't deinterlace "mixed" buffers flagged as progressive.

Fix these up, and add assertions and error messages to detect cases that
aren't handled.

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

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 16:24:23 +02:00
Matthieu Bouron
ead38a4d77 vaapidecode: do not discard video info props when the format changed.
gst_video_info_set_format() does not preserve video info properties. In
order to keep important information in the caps such as interlace mode,
framerate, pixel aspect ratio, ... we need to manually copy back those
properties after setting the new video format.

https://bugzilla.gnome.org/show_bug.cgi?id=722276
2014-06-18 13:59:09 +02:00
Matthew Waters
3fbef25e13 vaapidecode: plug a memory leak.
It can happen that there is a pool provided that does not advertise
the vappivideometa. We should unref that pool before using our own.

Discovered with vaapidecode ! {glimagesink,cluttersink}

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

[fixed compilation by adding the missing semi-colon]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-18 13:58:49 +02:00
Gwenole Beauchesne
abfb5dd06c vaapidecode: parse source data until a frame is obtained.
Parse any pending data until a complete frame is obtained. This is a
memory optimization to avoid expansion of video packets stuffed into
the GstAdapter, and a fix to EOS condition to detect there is actually
pending data that needs to be decoded, and subsequently output.

https://bugzilla.gnome.org/show_bug.cgi?id=731831
2014-06-18 13:47:36 +02:00
Gwenole Beauchesne
5e5d62cac7 vaapisink: fix initialization with "drm" display type.
Force early initializatin of the GstVaapiDisplay so that to make sure
that the sink element display object is presented first to upstream
elements, as it will be correctly featuring the requested display type
by the user.

Otherwise, we might end up in situations where a VA/X11 display is
initialized in vaapidecode, then we try VA/DRM display in vaapisink
(as requested by the "display" property), but this would cause a failure
because we cannot acquire a DRM display that was previously acquired
through another backend (e.g. VA/X11).
2014-06-13 17:42:35 +02:00
Gwenole Beauchesne
eef863f82f plugins: fix initialization with foreign context.
When a new display is settled through GstElement::set_context() (>= 1.2),
or GstVideoContext::set_context() (<= 1.0), then we shall also update the
associated display type.
2014-06-13 17:42:29 +02:00
Gwenole Beauchesne
3af6b0b8a0 plugins: add built-in video parsers as "vaapiparse" element.
The built-in video parsers elements are built into a single DSO named
libgstvaapi_parse.so. The various video parsers could be accessed as
vaapiparse_CODEC.

For now, this only includes a modified version of h264parse so that to
support H.264 MVC encoded streams.
2014-06-13 17:17:07 +02:00
Li Xiaowei
7bdf3fa177 encoder: h264: add initial support for H.264 Stereo High profile.
Add initial support for Subset SPS, Prefix NAL and Slice Extension NAL
for non-base-view streams encoding, and the usual SPS, PPS and Slice
NALs for base-view encoding.

The H.264 Stereo High profile encoding mode will be turned on when the
"num-views" parameter is set to 2. The source (raw) YUV frames will be
considered as Left/Right view, alternatively.

Each of the two views has its own frames reordering pool and reference
frames list management system. Inter-view references are not supported
yet, so the views are encoded independently from each other.

Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
[limited to Stereo High profile per the definition of MAX_NUM_VIEWS]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-06-02 18:25:13 +02:00
Sreerenj Balachandran
ee6d1b7bd1 build: fix conditional compilation of VP8 decoder.
https://bugzilla.gnome.org/show_bug.cgi?id=729170

[added check for VASliceParameterBufferBase fields]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-05-09 14:41:52 +02:00
Gwenole Beauchesne
de02a5c190 build: fix make dist with certain conditionals not met.
Fix generation of source tarballs when certain conditionals are not
met. e.g. always include all buildable codecparsers sources in the
distribution tarball, fix plug-in element sources set to include X11
and encoder bits.
2014-04-21 18:02:21 +02:00
Zhao, Halley
029bae0b6a Add initial VP8 decoder.
https://bugzilla.gnome.org/show_bug.cgi?id=722761

[complete overhaul, fixed support for resolution changes]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-04-18 20:03:44 +02:00
Gwenole Beauchesne
6bf3c1863c legal: update copyright notice dates. 2014-01-22 19:02:35 +01:00
Gwenole Beauchesne
1c95903b98 legal: add per-file authorship information. 2014-01-22 18:49:20 +01:00
Holger Kaelberer
b1d3f7d4c0 vaapisink: set csc render flags from sinkpad caps.
This maps GstVideoColorimetry information in vaapisink's sinkpad caps
to GST_VAAPI_COLOR_STANDARD_* flags, if per-buffer information was not
available.

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

[factored out code, added SMPTE240M, handle per-buffer flags]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 14:24:32 +01:00
Gwenole Beauchesne
751aa05937 surface: rework render flags.
Pack render flags per category and provide more flags into the color
standard category. In particular, cover for SMPTE-240M.
2014-01-15 13:53:42 +01:00
Zhao, Halley
467bf95c09 vaapipostproc: add support for colorbalance filters.
Add support for hue, saturation, brightness and constrat adjustments.
Also fix cap info local copy to match the really expected cap subtype
of interest.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 11:49:49 +01:00
Zhao, Halley
db5465c2d6 vaapipostproc: fix support for "sharpen" filter.
Fix copy/paste error when submitting the "sharpen" value to the
GstVaapiFilter instance.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 11:42:15 +01:00
Holger Kaelberer
f8666e2cae vaapisink: fix display initialization in GstVideoOverlay implementation.
When gst_vaapisink_video_overlay_set_window_handle() is called early,
before the pipeline has been set to PLAYING, the display has not yet
been initialized and _PLUGIN_BASE_DISPLAY_TYPE() is not yet
up-to-date. For this reason the foreign XID is not attached.

Now _ensure_display() is called earlier.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 11:07:05 +01:00
Sreerenj Balachandran
dd6751ed47 vaapisink: expose the raw video formats in static caps template.
Expose all raw video formats in the static caps template since the
vaapisink is supporting raw data. We will get the exact set of formats
supported by the driver dynamically through the _get_caps() routine.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-15 11:06:01 +01:00
Matthieu Bouron
a674d9eff2 vaapidecode: query downstream caps features like GLTextureUploadMeta.
Fix vaapidecode to correctly report caps features downstream, when
a custom pipeline is built manually.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-14 19:14:41 +01:00
Matthieu Bouron
cb81acd48c vaapidecode: add system memory caps to template caps.
Since vaapidecode provides buffer that can be mapped as regular memory,
those caps should be added to the template caps. That only applies to
GStreamer >= 1.2.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-14 19:14:41 +01:00
Wind Yuan
d2f6274f31 vaapidecode: fix hang on SIGINT.
vaapidecode hangs when pipeline is stopped without any EOS, e.g. when
<Ctrl>+C is pressed, thus causing the srcpad task to keep running and
locked. This fixes a deadlock on state change from PAUSED to READY.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-14 19:14:41 +01:00
Wind Yuan
830566c17e vaapiencode: fix possible hang on SIGINT.
vaapiencode might hang when the pipeline is stopped without any EOS,
e.g. when <Ctrl>+C is pressed, thus causing the srcpad task to keep
running and locked. This fixes a possible deadlock on state change
from PAUSED to READY.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-14 19:14:41 +01:00
Gwenole Beauchesne
d3b672411d vaapiencode: fix typo in error message.
Fix incomplete error message in gst_vaapiencode_push_frame().
2014-01-14 19:14:41 +01:00
Gwenole Beauchesne
ef9819ecf4 plugins: add helpers to create video caps with features.
Add gst_vaapi_video_format_new_template_caps_with_features() helper
function to add the supplied caps feature string on GStreamer >= 1.2.

Add gst_vaapi_find_preferred_caps_feature() helper function to discover
the "best" caps feature to use for the supplied pad. In practice, we
will always favor memory:VASurface first, then meta:GLTextureUploadMeta,
and finally the system memory caps.

https://bugzilla.gnome.org/show_bug.cgi?id=719372
2014-01-14 19:14:41 +01:00
Matthieu Bouron
b065ae7d7f plugins: don't apply overlay composition in GLTextureUpload function.
The GLTextureUpload function is not in charge of doing the overlay
composition if any.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-14 19:14:41 +01:00
Gwenole Beauchesne
bdf91aa765 encoder: h264: allow target decoder constraints.
Allow user to precise the largest profile to use for encoding due
to target decoder constraints. For instance, if CABAC entropy coding
mode is requested by "constrained-baseline" profile only is desired,
then an error is returned during codec configuration.

Also make sure that the suitable profile we derived actually matches
what the HW can cope with.

https://bugzilla.gnome.org/show_bug.cgi?id=719694
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
45732dcc83 encoder: h264: clean-ups.
Various clean-ups to improve consistency and readability: rename some
variables, drop unused macro definitions, drop initialization of vars
that are zero-initialized from the base class, drop un-necessary casts.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
5394c75461 encoder: add video codec-state API.
Add interface to communicate the encoder resolution and related info
like framerate, interlaced vs. progressive, etc. This new interface
supersedes gst_vaapi_encoder_set_format() and doesn't use any GstCaps
but rather use GstVideoCodecState.

Note that gst_vaapi_encoder_set_codec_state() is also a synchronization
point for codec config. This means that the encoder is reconfigured
there to match the latest properties.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
2c4fde0eae vaapiencode: don't crash on NULL encoder on _finish().
Don't try to destroy an encoder, in GstVideoEncoder::finish() handler,
if it was not created in the first place. Return "not-negotiated" error
since this means we did not even reach GstVideoEncoder::set_format(),
where the encoder could have been created.

This fixes a crash when the vaapiencode_* plug-in elements get deallocated
and that we failed to negotiate either pad.

https://bugzilla.gnome.org/show_bug.cgi?id=719704
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
ea7c1d87c5 vaapiencode: use more GstVaapiPluginBase facilities.
Avoid duplication of pad references or query functions since they are
provided through the GstVaapiPluginBase object.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
449ac54348 vaapiencode: fix negotiation process of output caps.
The specified caps in gst_video_encoder_set_output_state() function
arguments should not contain any resolution, pixel-aspect-ratio,
framerate, codec-data et al. Those rather should be set through the
returned GstVideoCodecState. This means that output caps creation
could be delayed until before gst_video_encoder_finish_frame() is
called.

This greatly simplifies the GstVideoEncoder::set_format() callback
by the way.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
37fa6a8a3d vaapiencode: make GstVaapiEncode an abstract type.
Make base GstVaapiEncode class an abstract type so that we cannot
create an instance from it without going through any of the codec
specific derived class.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
85ce893faa vaapiencode: rename a few member functions.
Rename a few member functions to make them more consistent:
- alloc_encoder(): now reduced to allocate the encoder object only;
- alloc_buffer(): allocate buffer from srcpad, and copy bitstream.
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
a43d06dcf5 vaapiencode: update for new properties API.
Update MPEG-2 and H.264 encode elements to cope with the new core
libgstvaapi properties API. i.e. all configurable properties are now
directly handled at the GstVaapiEncoder level.

Besides, this also makes sure to not use or modify the GstVaapiEncoder
private definitions directly. Private data need to remain private.

https://bugzilla.gnome.org/show_bug.cgi?id=719529
2014-01-13 17:31:55 +01:00
Gwenole Beauchesne
70b3600f11 encoder: add bitrate API.
Add gst_vaapi_encoder_set_bitrate() interface to allow the user control
the bitrate for encoding. Currently, changing this parameter is only
valid before the first frame is encoded. Should the value be modified
afterwards, then GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED is
returned.

https://bugzilla.gnome.org/show_bug.cgi?id=719529
2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
a24c52e4d0 encoder: add rate control API.
Add gst_vaapi_encoder_set_rate_control() interface to request a new
rate control mode for encoding. Changing the rate control mode is
only valid prior to encoding the very first frame. Afterwards, an
error ("operation-failed") is issued.

https://bugzilla.gnome.org/show_bug.cgi?id=719529
2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
076d75aeb8 vaapiencode: fix indentation. 2014-01-13 17:31:54 +01:00
Gwenole Beauchesne
01af353116 encoder: fix indentation. 2014-01-13 17:31:54 +01:00
Matthieu Bouron
231a067cdd plugins: do not free debug category in finalize method.
Fixes a crash when multiple vaapidecode elements are finalized since
the debug category is created once in the class init method.

This is a regression from git commit 7e58d60.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2014-01-06 10:11:54 +01:00
Gwenole Beauchesne
33bb859228 Fix printf()-like formats.
Fix formts for various GST_DEBUG et al. invocations. More precisely,
make size_t arguments use the %zu format specifier accordingly; force
XID formats to be a 32-bit unsigned integer; and fix the format used
for gst_vaapi_create_surface_with_format() error cases since we have
been using strings nowadays.
2014-01-06 10:04:05 +01:00
Gwenole Beauchesne
7f88fdcc03 download: use GstVideoInfo facilities to build output caps.
Use standard GstVideoInfo related functions to build the output caps,
thus directly preserving additional fields as needed, instead of
manually copying them over through gst_vaapi_append_surface_caps().

Also ensure that the input caps are fixated first.
2013-12-21 12:35:24 +01:00
Gwenole Beauchesne
113bd3a5f2 plugins: factor out construction of template caps.
Add new helper functions to build video template caps.
- gst_vaapi_video_format_new_template_caps():
  create GstCaps with size, frame rate and PAR to full range
- gst_vaapi_video_format_new_template_caps_from_list():
  try to create a "simplified" list from the supplied formats
2013-12-21 12:35:24 +01:00
Gwenole Beauchesne
528b5adc5a plugins: factor out construction of GValue from GstVideoFormat.
Add new helper functions to build GValues from GstVideoFormat:
- gst_vaapi_value_set_format():
  build a GValue from the supplied video format
- gst_vaapi_value_set_format_list():
  build a GValue list from the supplied array of video formats
2013-12-21 12:35:24 +01:00
Gwenole Beauchesne
b80257389d plugins: re-indent common and video context creation utils. 2013-12-21 12:35:23 +01:00
Gwenole Beauchesne
c5581298fb display: don't use GstCaps for decode or encode profiles list.
Replace gst_vaapi_display_get_{decode,encode}_caps() APIs with more
more convenient APIs that return an array of GstVaapiProfile instead
of GstCaps: gst_vaapi_display_get_{decode,encode}_profiles().
2013-12-20 17:16:58 +01:00
Gwenole Beauchesne
c4ca08a8d6 display: don't use GstCaps for image or subpicture formats list.
Replace gst_vaapi_display_get_{image,subpicture}_caps() APIs, that
returned GstCaps, with more convenient APIs that return an array of
GstVideoFormat: gst_vaapi_display_get_{image,subpicture}_formats().
2013-12-20 17:16:58 +01:00
Gwenole Beauchesne
690e85ff8e plugins: fix permissions for certain files.
Drop the execute bit for gstvaapiuploader.c and gstvaapipostproc.[ch]
files.
2013-12-20 17:16:12 +01:00
Matthieu Bouron
bf8f244de3 plugins: implement GLTextureUploadMeta user data copy.
Makes the copies of a buffer reference their own GLTextureUploadMeta
user data and prevent the original buffer accessing already freed
memory if its copies has been released and freed.

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

[Propagate the original meta texture to the copy too]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-12-18 18:34:10 +01:00
Gwenole Beauchesne
e3dcd33114 plugins: factor out support for raw YUV buffers on sink pads.
Factor out propose_allocation() hooks, creation of video buffer pool
for the sink pad, conversion from raw YUV buffers to VA surface backed
buffers. Update vaapidecode, vaapiencode and vaapipostproc to cope
with the new GstVaapiPluginBase abilities.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
b324fc6add plugins: factor out pad caps. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
01a3fc44c0 plugins: factor out video context sharing code. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
e5f066b719 plugins: factor out GstImplementsInterface. 2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
fad3f538bc plugins: check type of display obtained from neighbours.
Fix display creation code to check that any display obtained from a
neighbour actually has the type we expect. Note: if display type is
set to "any", we can then accept any VA display type.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
6f2dfb71e6 plugins: factor out display creation process.
Move common VA display creation code to GstVaapiPluginBase, with the
default display type remaining "any". Also add a "display-changed"
hook so that subclasses could perform additional tasks when/if the
VA display changed, due to a new display type request for instance.

All plug-ins are updated to cope with the new internal APIs.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
7e58d60854 plugins: add new base object, store display in there.
Introduce a new GstVaapiPluginBase object that will contain all common
data structures and perform all common tasks. First step is to have a
single place to hold VA displays.

While we are at it, also make sure to store and subsequently release
the appropriate debug category for the subclasses.
2013-12-18 16:38:57 +01:00
Gwenole Beauchesne
61f6cbffc6 plugins: fix GLTextureUploadMeta to work with different texture ids.
The GLTextureUploadMeta implementation assumed that for each upload()
sequence, the supplied texture id is always the same as the one that
was previously cached into the underlying GstVaapiTexture. Cope with
any texture id change the expense to recreate the underlying VA/GLX
resources.

https://bugzilla.gnome.org/show_bug.cgi?id=719643
2013-12-11 15:30:51 +01:00
Gwenole Beauchesne
c2eabc17dd plugins: allow builds without GLX enabled for GStreamer 1.2.
Don't try to build GLTextureUploadMeta related code if GLX is not
enabled during GStreamer >= 1.2 builds.
2013-12-11 15:30:51 +01:00
Matthieu Bouron
6b6c10d94d plugins: request GLTextureUpload meta on buffers in the buffer pool.
Requesting the GLTextureUpload meta on buffers in the bufferpool
prevents such metas from being de-allocated when buffers are released
in the sink.

This is particulary useful in terms of performance when using the
GLTextureUploadMeta API since the GstVaapiTexture associated with
the target texture is stored in the meta.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-12-11 15:30:51 +01:00
Gwenole Beauchesne
c7673f1cd6 plugins: robustify GstVideoGLTextureUploadMeta implementation.
Make GstVideoGLTextureUploadMeta::upload() implementation more robust
when the GstVaapiTexture associated with the supplied texture id could
not be created.
2013-12-11 15:30:51 +01:00
Gwenole Beauchesne
2f5e5f0784 encoder: clean-ups and document public APIs.
Clean public APIs up so that to better align with the decoder APIs.
Most importantly, gst_vaapi_encoder_get_buffer() is changed to only
return the VA coded buffer proxy. Also provide useful documentation
for the public APIs.
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
038149b69b encoder: refactor status codes.
Drop obsolete or unused status codes. Align some status codes with the
decoder counterparts.
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
0fb7c60508 encoder: rework GstVaapiCodedBuffer and related proxy.
Refactor the GstVaapiCodedBuffer APIs so that to more clearly separate
public and private interfaces. Besides, the map/unmap APIs should not
be exposed as is but appropriate accessors should be provided instead.

* GstVaapiCodedBuffer: VA coded buffer abstraction
- gst_vaapi_coded_buffer_get_size(): get coded buffer size.
- gst_vaapi_coded_buffer_copy_into(): copy coded buffer into GstBuffer

* GstVaapiCodedBufferPool: pool of VA coded buffer objects
- gst_vaapi_coded_buffer_pool_new(): create a pool of coded buffers of
  the specified max size, and bound to the supplied encoder

* GstVaapiCodedBufferProxy: pool-allocated VA coded buffer object proxy
- gst_vaapi_coded_buffer_proxy_new_from_pool(): create coded buf from pool
- gst_vaapi_coded_buffer_proxy_get_buffer(): get underlying coded buffer
- gst_vaapi_coded_buffer_proxy_get_buffer_size(): get coded buffer size

Rationale: more optimized transfer functions might be provided in the
future, thus rendering the map/unmap mechanism obsolete or sub-optimal.

https://bugzilla.gnome.org/show_bug.cgi?id=719775
2013-12-04 19:14:38 +01:00
Gwenole Beauchesne
7a33165436 plugins: fix reference leaks of VA display objects.
Fix GstElement::set_context() implementation for all plug-in elements
to avoid leaking an extra reference to the VA display, thus preventing
correct cleanup of VA resources in GStreamer 1.2 builds.
2013-11-29 14:02:52 +01:00
Gwenole Beauchesne
16751205a2 plugins: simplify gst_vaapi_ensure_display().
Return earlier if the creation of a VA display failed. Likewise, simplify
gst_vaapi_video_context_propagate() now that we are guaranteed to have a
valid VA display.
2013-11-29 13:56:12 +01:00
Gwenole Beauchesne
84b3f84925 plugins: fix memory leaks through GstVideoMeta maps.
When GstVideoMeta maps were used, the supporting functions incorrectly
used gst_buffer_get_memory() instead of gst_buffer_peek_memory(), thus
always increasing the associated GstMemory reference count and giving
zero chance to actually release that, and subsequently the VA display.
2013-11-28 19:08:28 +01:00
Gwenole Beauchesne
9ab6037847 plugins: use G_PARAM_STATIC_STRINGS.
This avoids a few string copies during initialization.
2013-11-28 17:35:44 +01:00
Gwenole Beauchesne
3324cdfb61 plugins: simplify VA video meta to only reference surface proxies.
Simplify GstVaapiVideoMeta to only hold a surface proxy, which is
now allocated from a surface pool. This also means that the local
reference to the VA surface is also gone, as it could be extracted
from the associated surface proxy.
2013-11-28 17:32:18 +01:00
Gwenole Beauchesne
d45658ba5a plugins: drop obsolete functions.
Drop the following functions that are not longer used:
- gst_vaapi_video_buffer_new_with_surface()
- gst_vaapi_video_meta_new_with_surface()
- gst_vaapi_video_meta_set_surface()
- gst_vaapi_video_meta_set_surface_from_pool()
2013-11-28 17:32:18 +01:00
Gwenole Beauchesne
b04c75848a plugins: allow VA video meta to be allocated from surface proxy pools.
Fix gst_vaapi_video_meta_new_from_pool() to allocate VA surface proxies
from surface pools instead of plain VA surfaces. This is to simplify
allocations now that surface proxies are created from a surface pool.
2013-11-28 17:32:18 +01:00
Gwenole Beauchesne
30f382fcdf vaapiencode: optimize _handle_frame() to avoid extra allocation.
Optimize gst_vaapiencode_handle_frame() to avoid extra memory allocation,
and in particular the GstVaapiEncObjUserData object. i.e. directly use
the VA surface proxy from the source buffer. This also makes the user
data attached to the GstVideoCodecFrame more consistent between both
the decoder and encoder plug-in elements.
2013-11-28 17:32:18 +01:00
Gwenole Beauchesne
081ff63f9a vaapiencode: fix memory leaks in _push_frame() on error.
Simplify gst_vaapiencode_push_frame(), while also removing the call
to gst_video_encoder_negotiate() since this is implicit in _finish()
if caps changed. Also fixed memory leaks that occured on error.
2013-11-28 17:32:17 +01:00
Gwenole Beauchesne
8116d8a50e vaapiencode: additional clean-ups.
Constify pointers wherever possible. Drop unused variables, and use
consistent variable names. Fix gst_vaapiencode_h264_allocate_buffer()
to correctly report errors, especially when in-place conversion from
bytestream to avcC format failed.
2013-11-28 15:17:42 +01:00
Gwenole Beauchesne
d759fe34e6 vaapiencode: move common properties to base class.
Move "rate-control" mode and "bitrate" properties to the GstVaapiEncode
base class. The actual range of supported rate control modes is currently
implemented as a plug-in element hook. This ought to be determined from
the GstVaapiEncoder object instead, i.e. from libgstvaapi.
2013-11-28 14:05:33 +01:00
Gwenole Beauchesne
1a4b3c3b22 vaapiencode: fix plugin description and debug name.
Align the plug-in debug category to its actual name. i.e. enable debug
logs through vaapiencode_<CODEC> where <CODEC> is mpeg2, h264, etc. Fix
the plug-in element description to make it more consistent with other
VA-API plug-ins.
2013-11-28 10:54:36 +01:00
Gwenole Beauchesne
bc020c05f9 vaapiencode: add initial support for GStreamer 0.10. 2013-11-27 17:23:56 +01:00
Gwenole Beauchesne
207264abc4 vaapiencode: fix error handling while allocating output buffers.
Fix default GstVideoEncoder::allocate_buffer() implementation to properly
unmap the coded buffer prior to returning an error.
2013-11-26 17:26:44 +01:00
Gwenole Beauchesne
a6b8f94470 vaapiencode: fix error handling in _finish() hook.
Fix GstVideoEncoder::finish() implementation to really return possible
errors instead of GST_FLOW_OK. That is, fix check for timeout status.
2013-11-26 17:11:22 +01:00
Gwenole Beauchesne
e01d48feba vaapiencode: minor clean-ups.
Add a GST_VAAPIENCODE_CAST() helper to avoid run-time checks against
the GObject type system. We are guaranteed to only deal with the same
plug-in element object.
2013-11-26 17:08:31 +01:00
Gwenole Beauchesne
84af151796 vaapiencode: fix support for raw YUV sink buffers.
Allow vaapiencode plug-in elements to encode from raw YUV buffers.
The most efficient way to do so is to let the vaapiencode elements
allocate a buffer pool, and subsequently buffers from it. This means
that upstream elements are expected to honour downstream pools.

If upstream elements insist on providing their own allocated buffers
to the vaapiencode elements, then it possibly would be more efficient
to insert a vaapipostproc element before the vaapiencode element.
This is because vaapipostproc currently has better support than other
elements for "foreign" raw YUV buffers.
2013-11-26 15:55:09 +01:00
Gwenole Beauchesne
139c99bb77 vaapiencode: fix support for GStreamer 1.2. 2013-11-26 15:12:59 +01:00
Wind Yuan
3e96f10cf2 vaapiencode: initial port to GStreamer 1.2.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-26 14:32:21 +01:00
XuGuangxin
2e356b0f7e plugins: add mpeg2 encoder element.
Add GstVaapiEncodeMPEG2 element object. The actual plug-in element
is called "vaapiencode_mpeg2".

Valid properties:
- rate-control: rate control mode (default: cqp - constant QP)
- bitrate: desired bitrate in kbps (default: auto-calculated)
- key-period: maximal distance between two key frames (default: 30)
- max-bframes: number of B-frames between I and P (default: 2)
- quantizer: constant quantizer (default: 8)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
f1c33feef9 plugins: add h264 encoder element.
Add GstVaapiEncodeH264 element object. The actual plug-in element
is called "vaapiencode_h264".

Valid properties:
- rate-control: rate control mode (default: none)
- bitrate: desired bitrate in kbps (default: auto-calculated)
- key-period: maximal distance between two key frames (default: 30)
- num-slices: number of slices per frame (default: 1)
- max-bframes: number of B-frames between I and P (default: 0)
- min-qp: minimal quantizer (default: 1)
- init-qp: initial quantizer (default: 26)

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Wind Yuan
06ea8ba92b plugins: add base encoder element.
vaapiencode element is based on GstVideoEncoder APIs.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-24 16:52:05 +01:00
Gwenole Beauchesne
e713d43379 build: fix for Wayland headers not in standard include dirs.
Fix build when Wayland headers don't live in plain system include dirs
like /usr/include but rather in /usr/include/wayland for instance.

Original patch written by Dominique Leuenberger <dimstar@opensuse.org>

https://bugzilla.gnome.org/show_bug.cgi?id=712282
2013-11-22 11:28:09 +01:00
Gwenole Beauchesne
922a04b734 vaapostproc: fix memory leaks.
Destroy VPP output surface pool on exit. Also avoid a possible crash
in double-free situation caused by insufficiently reference counted
array of formats returned during initialization.
2013-11-22 11:15:57 +01:00
Gwenole Beauchesne
7a464ba015 vaapipostproc: fix and optimize advanced deinterlacing mode.
Fix advanced deinterlacing modes with VPP to track only up to 2 past
reference buffers. This used to be 3 past reference buffers but this
doesn't fit with the existing decode pipeline that only has 4 extra
scratch surfaces.

Also optimize references tracking to be only enabled when needed, i.e.
when advanced deinterlacing mode is used. This means that we don't
need to track past references for basic bob or weave deinterlacing.
2013-11-22 10:27:19 +01:00
Gwenole Beauchesne
1d1f18bcbe vaapipostproc: fix "mixed" mode deinterlacing.
In "mixed" interlaced streams, the buffer contains additional flags that
specify whether the frame contained herein is interlaced or not. This means
that we can alternatively get progressive or interlaced frames. Make sure
to disable deinterlacing at the VPP level when the source buffer is no longer
interlaced.
2013-11-22 10:04:45 +01:00
Gwenole Beauchesne
98ac557e87 vaapipostproc: fix memory leaks with advanced deinterlacing.
Fix memory leaks with advanced deinterlacing, i.e. when we keep track
of past buffers. Completely reset the deinterlace state, thus destroying
any buffer currently held, on _start(), _stop() and _destroy().
2013-11-22 09:49:30 +01:00
Gwenole Beauchesne
c516311a1a legal: update copyright notice dates. 2013-11-22 06:39:20 +01:00
Gwenole Beauchesne
15519ebe3d legal: add per-file authorship information.
Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.
2013-11-22 06:39:15 +01:00
Gwenole Beauchesne
9968661ffd vaapipostproc: add initial support for GStreamer 1.2.
Port vaapipostproc element to GStreamer 1.2. Support is quite minimal
right now so that to cope with auto-plugging issues/regressions. e.g.
this happens when the correct set of expected caps are being exposed.
This means that, currently, the proposed caps are not fully accurate.
2013-11-21 23:08:02 +01:00
Halley Zhao
ef8f5defd2 vaapipostproc: add support for denoise and sharpen filters.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
c8bea66d33 vaapipostproc: add support for advanced deinterlacing.
Add initial support for advanced deinterlacing. The history buffer
size is arbitrarily set to 3 references for now.
2013-11-21 23:08:02 +01:00
Gwenole Beauchesne
49e2d040fa vaapipostproc: fix deinterlacing with VPP.
Fix basic deinterlacing flags provided to gst_vaapi_set_deinterlacing()
for the first field. Render flags were supplied instead of the actual
deinterlacing flags (deint_flags).
2013-11-21 23:08:02 +01:00