Commit graph

1322 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal 0815899121 vaapivideobufferpool: validate returned meta
Validate if the meta returned by gst_buffer_get_vaapi_video_meta() in
the acquired buffer is not null.

This situation should be very "pathological", but still it is better
be safe since that meta might be used later to create a new dma
buffer.
2020-01-24 11:55:22 +01:00
Philipp Zabel 89f202ea2e vaapivideobufferpool: always update/release the underlying surface proxy
gst_vaapi_video_buffer_pool_reset_buffer() is called when the sink
releases the last reference on an exported DMA buffer. This should
release the underlying surface proxy. To avoid releasing the wrong
surface due to a stale surface proxy reference in the buffer's
GstVaapiVideoMeta, always update the reference to the correct surface
in gst_vaapi_video_buffer_pool_acquire_buffer().
2020-01-24 09:10:44 +00:00
Víctor Manuel Jáquez Leal e25ef7dfc2 vaapiencode: promote info to warning
Let's notify user about using constrained-baseline instead on
requested basline profile.
2020-01-21 14:12:29 +01:00
Nicolas Dufresne 866a9f069d vaapih264dec: Add a property to assume constrained-baseline
When baseline-as-constrained is set, the decoder will expose support
for baseline decoding and assume that the baseline content is
constrained-baseline. This can be handy to decode streams in hardware
that would otherwise not be possible to decode. A lot of baseline
content is in fact constrained.
2020-01-19 15:55:47 +00:00
Víctor Manuel Jáquez Leal 73159cdc5d vaapih264enc: accept baseline as constrained baseline compatible 2020-01-19 15:14:14 +00:00
Víctor Manuel Jáquez Leal 9f627ef234 vaapih264enc: update level in src caps
And, if downstream requests a specific level, the caps are not
negotiated, because there is no mechanism right now to specify a
custom level in the internal encoder.
2020-01-19 14:26:18 +00:00
Víctor Manuel Jáquez Leal 5e26efbcf2 vaapih264enc: force byte-stream if avc isn't supported
Removing the validation in gst_vaapiencode_h264_get_caps() since that
ought be handled in gst_vaapiencode_h264_set_config()
2020-01-19 14:57:04 +01:00
Philipp Zabel d576963979 vaaph264enc: suppress avc if the driver does not support packed headers
Do not negotiate AVC output if the driver does not support it.
2020-01-19 14:57:04 +01:00
Víctor Manuel Jáquez Leal 38d7297bb6 vaapih264enc: intersect the new proposed caps
Instead of just leave to keep the proposed caps, with the best profile
in the allowed caps, is its intersected again.
2020-01-19 12:54:02 +00:00
Víctor Manuel Jáquez Leal 8b4d18da0a vaapih264enc: propose new profile caps and fixate it
When the available caps doesn't intersect with the allowed caps in the
pipeline, a new caps is proposed rather than just expecting to
iterate.

Later, the intersected caps (profile_caps) is fixated in order to
extract the configuration.
2020-01-19 12:54:02 +00:00
Víctor Manuel Jáquez Leal a56ac3bffe vaapih264enc: common fail for gst_vaapiencode_h264_set_config()
Add a common fail code path for gst_vaapiencode_h264_set_config().
2020-01-19 12:54:02 +00:00
Víctor Manuel Jáquez Leal 6eafebc804 vaapih264enc: fix log message
Before the log wasn't processed because wrong instance pointer.
2020-01-19 10:46:13 +01:00
He Junyan 25422b6766 plugin: encode: Add H265 main-444 profile.
Expose the main-444 profile to h265enc caps, when the upstream
chooses to use VUYA as input, we choose main 4:4:4 profile to encode
the frames.
2020-01-17 11:02:44 +00:00
Víctor Manuel Jáquez Leal 1db3ce56a0 vaapiencode: DMABuf only if PRIME is available
Add DMABuf capsfeature in encoders' allowed sinkcaps only if PRIME
memory type is available in the VA surface attributes of codec
context.
2020-01-17 11:31:57 +01:00
Víctor Manuel Jáquez Leal 9da5196b5a Remove all FEI related
FEI encoders are not actively mantained neither tested, and it is
using infrastructure that is changing and FEI is stopping this
effort.

Also it is required to rethink how FEI can be used in GStreamer.
2020-01-15 07:30:15 +00:00
U. Artie Eoff 1364070eca vaapioverlay: ensure sinkpad has current buffer
Use the gst_video_aggregator_pad_has_current_buffer API
to check if the current sinkpad has a queued buffer before
attempting to obtain a input buffer from the base plugin.
If the sinkpad does not have a current buffer, then it is
either not producing them yet (e.g. current time < sinkpad
start time) or it has reached EOS.

Previously, we only handled EOS case.

Example:

 gst-launch-1.0 videotestsrc num-buffers=100 \
  ! vaapipostproc ! vaapioverlay name=overlay \
  ! vaapisink videotestsrc timestamp-offset=1000000000 \
  num-buffers=100 ! video/x-raw,width=160,height=120 \
  ! overlay.
2020-01-14 11:37:22 -08:00
Víctor Manuel Jáquez Leal 889fac3823 vaapioverlay: unroll the recursive call
Recursive functions are elegant but dangerous since they might
overflow the stack. It is better to turn them into a list tranversal
if possible, as this case.
2020-01-14 19:52:18 +01:00
Víctor Manuel Jáquez Leal d0e14ec308 vaapioverlay: add minimal documentation 2020-01-14 19:52:18 +01:00
Víctor Manuel Jáquez Leal 81f3a7f02b libs: blend: simplify generator API
Instead of using a parent structure that has to be derived by API
consumers, this change propse a simplification by using the common
pattern of GTK of passing a function pointer and user data which will
be passed as its parameter. That user data contains the state and the
function will be called to update that state.
2020-01-14 19:52:18 +01:00
U. Artie Eoff edca6efede vaapioverlay: use blend surface generator API
See #219
2020-01-14 19:01:41 +01:00
He Junyan 36fd4d5d8a plugin: encode: List all possible profiles to detect input formats.
The current get_profile just return one possible profile for the encode,
which is not enough.  For example, if we want to support HEVC 4:4:4
profile, the input of encode should be VYUA rather than NV12 in HEVC
main profile. So the command line:

gst-launch-1.0 videotestsrc num-buffers=200 ! capsfilter \
caps=video/x-raw,format=VUYA,width=800,height=600 ! vaapih265enc \
tune=low-power init-qp=30 ! fakesink

can not work because vaapih265enc just report NV12 in sink caps, we need
to specify the profile obviously like:

gst-launch-1.0 videotestsrc num-buffers=200 ! capsfilter \
caps=video/x-raw,format=VUYA,width=800,height=600 ! vaapih265enc \
tune=low-power init-qp=30 ! capsfilter caps=video/x-h265, \
profile=main-444 ! fakesink

The encode should have the ability to choose the profile based on input
format automatically. If the input video format is VUYA, the main-444
profile should be auto choosed.

We modify to let get_allowed_profiles of each encode sub class to return
an array of all supported profiles based on downstream's allowed caps, or
return NULL if no valid profiles specified by downstream.
If no allowed profiles found, all profiles which belong to the current
encoder's codec will be the candidates.
The function gst_vaapi_encoder_get_surface_attributes collects the surface's
attributes for that profile list we just get.

So for this case, both NV12 and VUYA should be returned.

TODO: some codec like VP9, need to implement the get_profile() function.
2020-01-14 11:36:18 +00:00
He Junyan 67e7e15408 plugin: util: add helper function to detect profiles in caps. 2020-01-14 11:36:18 +00:00
U. Artie Eoff ad31d5bb81 plugins: overlay: use proper NULL check on double pointer
Check the address of the variable is not NULL,
not the address of the pointer.
2020-01-10 17:40:56 +00:00
Víctor Manuel Jáquez Leal 11a8175fff plugins: add iHD driver in whitelist 2020-01-08 12:07:57 +00:00
U. Artie Eoff d28ffd73c3 plugins: add vaapioverlay plugin
A plugin similar to the base compositor element but
uses VA-API VPP blend functions to accelerate the
overlay/compositing.

Simple example:

 gst-launch-1.0 -vf videotestsrc ! vaapipostproc \
  ! tee name=testsrc ! queue \
  ! vaapioverlay sink_1::xpos=300 sink_1::alpha=0.75 \
  name=overlay ! vaapisink testsrc. ! queue ! overlay.
2020-01-06 19:56:10 +00:00
U. Artie Eoff 894c1da6c7 plugins: base: add GstVideoAggregator subclass support 2020-01-06 19:56:10 +00:00
Stéphane Cerveau 3cde7db1d3 doc: fix pipeline typo in vaapipostproc 2020-01-06 17:41:53 +01:00
He Junyan a6cf75e8c6 libs: encoder: get surfaces resolution the same time with formats.
We can get all the information about the video format at one shot
when we create the test context for getting the supported formats.

The current way to get the width and height ranges are inefficient,
since it calls the function gst_vaapi_profile_caps_append_encoder()
and it creates another temporal context to detect the resolution
information.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2020-01-02 18:01:45 +01:00
He Junyan 3355cd4691 plugin: encode: set allowed_sinkpad_caps to empty.
We now set encode->allowed_sinkpad_caps to NULL if we fail to get
surfaces formats. This causes two problem:
1. gst_video_encoder_proxy_getcaps use NULL as its caps parameter,
which changes its behavior. It will use encode's sinkpad template
rather than empty caps to do the clip job. So even if we fail to set
allowed_sinkpad_caps, gst_video_encoder_proxy_getcaps can still return
valid caps.
2. We should just set the allowed_sinkpad_caps once. The NULL point
make the ensure_allowed_sinkpad_caps function works again and again.
2019-12-23 01:28:56 +08:00
U. Artie Eoff 18d1c75d1a plugins: base: do not reset can_dmabuf
Don't reset the can_dmabuf field.  This restores the
close/reset logic that existed prior to commit
ca2942176b in regards to
dmabuf support.

Plugins only call gst_vaapi_plugin_base_set_srcpad_can_dmabuf
once during startup, but may need to reset the other private
fields multiple times during negotiation.  Thus, can_dmabuf
should be exempt from the resets.

Fixes #208
2019-12-20 06:38:42 -08:00
He Junyan 7ce44bc372 plugin: encode: Refine encode's sink caps.
The old manner to get the encode's sink caps is not correct.
Such as 264 encode, it gets:

video/x-raw(memory:VASurface),
format=(string){ ENCODED, NV12, I420, YV12, YUY2, UYVY, Y210,
P010_10LE, AYUV, Y410, Y444 }, width=(int)[ 32, 4096 ],
height=(int)[ 32, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
video/x-raw(memory:DMABuf), format=(string){ I420, YV12, RGBA },
width=(int)[ 32, 4096 ], height=(int)[ 32, 4096 ],
framerate=(fraction)[ 0/1, 2147483647/1 ];
video/x-raw, format=(string){ NV12 }, width=(int)[ 32, 4096 ],
height=(int)[ 32, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

where the formats for memory:VASurface and memory:DMABuf are superfluous.
All the "I420, YV12, YUY2, UYVY, Y210, RGBA" can not be really used as
input format for encoder.

We should get:
video/x-raw, format=(string){ NV12 }, width=(int)[ 32, 4096 ],
height=(int)[ 32, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ];
video/x-raw(memory:VASurface), format=(string){ NV12 },
width=(int)[ 32, 4096 ], height=(int)[ 32, 4096 ],
framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw(memory:DMABuf),
format=(string){ NV12 }, width=(int)[ 32, 4096 ],
height=(int)[ 32, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

as the correct result.
2019-12-20 10:02:03 +00:00
He Junyan 608ce681e5 libs: surface: port to GstMiniObject
GstVaapiMiniObject and GstVaapiObject are deprecated.

This is the first step to remove them by porting GstVaapiSurface as
a GstMiniBuffer descendant.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-20 05:01:08 +00:00
He Junyan d56824c05c libs: image: port to GstMiniObject base class
GstVaapiMiniObject and GstVaapiObject are deprecrated. This is the
first step to remove them, by porting GstVaapiImage as a
GstMiniObject.

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2019-12-20 05:01:07 +00:00
He Junyan 61de88e580 plugin: encode: change the dmabuf caps to all supported formats.
The encode's dmabuf caps definition is obsolete, it can support
more formats now. Re-define it to include all supported formats
in video format map.
2019-12-18 20:34:27 +08:00
He Junyan 2cad0e5629 plugin: encode: set sink's raw caps to GST_VAAPI_FORMATS_ALL.
Then encode plugin just supports raw formats declared in vaapi video
format map. This modification makes the template caps more precise.
2019-12-16 16:32:39 +08:00
U. Artie Eoff b1bab9a317 plugins: base: add GstPad param to internal helper functions
The base plugin public API function implementations determine
which pad should be passed to the internal helper functions.
Currently, only the base plugin static sinkpad and static
srcpad are supported/used.  However, this change enables future
API functions to be added that can accept a pad (i.e. request pad)
from an element subclass (e.g. a GstVideoAggregator subclass).
2019-12-11 21:27:48 +00:00
U. Artie Eoff ca2942176b plugins: base: manage pad-specific data in a single struct
Define a struct (GstVaapiPadPrivate) to encapsulate the
pad-specific data (i.e. buffer pool, allocator, info,
caps, etc.).

Add an interface to retrieve the data struct for a given
pad.

Finally, update the base plugin to use the data struct
throughout the implementation.

This will enable us to easily extend the base plugin in the
future to allow for N-to-1 pad subclasses (e.g. overlay/
composite).
2019-12-11 21:27:48 +00:00
U. Artie Eoff b384593d3d plugins: use plugin base macros to access pad specific data
Don't access base struct fields directly since the underlying
definition can change.  Instead, use the accessor macros.
2019-12-11 21:27:48 +00:00
He Junyan f4fc37ccc5 libs: decoder: Modify decode src's template raw formats
We do not need to maintain a standalone list of decoder's output
template for raw formats and that is easy to make mistake(for
example, the AYVU is wrong in that list, should be VUYA).
Just use GST_VAAPI_FORMATS_ALL to replace the raw formats list for
src template.
2019-12-11 19:44:24 +00:00
He Junyan 9d8467dc60 libs: postproc: Modify src/sink template raw formats
We need to provide more precise template caps for postproc's src
and sink pads. The GST_VIDEO_FORMATS_ALL make all video formats
available which are really superfluous.
2019-12-11 16:39:23 +00:00
He Junyan f16c93a187 libs: video-format: add GST_VAAPI_FORMATS_ALL
GST_VAAPI_FORMATS_ALL collects all declared formats in video-format
as a caps template string, and make them available in caps with
memory:VASurface feature.

Fixes: #199
2019-11-27 01:44:49 +01:00
Tim-Philipp Müller 8af5ef8a0b Remove autotools build 2019-10-14 01:01:27 +01:00
U. Artie Eoff 40bcefcb3b vaapipostproc: fix off-by-one coord translations
When translating navigation x,y coordinates for
video-direction, it is necessary to subtract 1
when using the video dimensions to compute the
new x,y coordinates.  That is, a 100x200 image
should map coordinates in x=[0-99],y=[0-199].

This issue was found with unit tests provided
in !182.
2019-10-11 16:37:31 +00:00
Yan Wang 4c87644914 vaapipostproc: Use level value for skin-tone-enhancement filter.
Currently the parameter of skin-tone-enhancement filter is forced
to zero. In fact it could be set different value by the user.
So create a new property named as "skin-tone-enhancement-level"
for accepting the used defined parameter value.
At the same time, skin-tone-enhancement is marked as deprecated.
When skin-tone-enhancement-level is set, skin-tone-enhancement
will be ignored.
2019-09-30 18:14:53 +00:00
U. Artie Eoff 73ac0c4e50 gst: encode: h264_fei: remove useless comparison
The expression "len >= 0" is always true since "len"
is an unsigned type.  And it is clear that the writers
intention was not to write "len > 0" since we handle
len == 0 in the ensuing "if (len < 3)" conditional
block.
2019-09-19 12:09:35 -07:00
Víctor Manuel Jáquez Leal f0d6263318 libs: encoders: use GST_PARAM_USER_SHIFT to define internal params
This patch makes use of GST_PARAM_USER_SHIFT to define the internal
param in encoders to decide which parameters to expose. Thus
gstreamer-vaapi will not interfere with any change in GStreamer in the
future.

Also, the internal symbol was change to
GST_VAAPI_PARAM_ENCODER_EXPOSURE to keep the namespacing.
2019-09-11 14:32:22 +02:00
Philippe Normand a90daabb84 pluginutil: Remove Mesa from drivers white list
The Mesa Gallium driver is poorly tested currently, leading to bad user
experience for AMD users. The driver can be added back to the white list at
runtime using the GST_VAAPI_ALL_DRIVERS environment variable.
2019-09-06 16:10:54 +00:00
U. Artie Eoff 2f0f5e1ef9 vaapipostproc: allow cropping via properties
Add crop-left, crop-right, crop-top and crop-bottom
properties to vaapipostproc.
2019-09-05 10:42:28 -07:00
U. Artie Eoff 55654f2915 vaapipostproc: rotate outbuf and crop meta if forwarding
When forwarding crop meta to downstream, the output
buffer and crop meta need to be rotated, too.

Test:
 for i in 90r 180 90l vert horiz ul-lr ur-ll
 do
  gst-launch-1.0 -vf videotestsrc num-buffers=500 \
   ! videocrop top=100 bottom=30 left=40 right=20 \
   ! vaapipostproc video-direction=$i \
   ! vaapisink & \
  gst-launch-1.0 -vf videotestsrc num-buffers=500 \
   ! videocrop top=100 bottom=30 left=40 right=20 \
   ! vaapipostproc video-direction=$i \
   ! identity drop-allocation=true \
   ! vaapisink
 done
2019-09-05 11:03:34 +00:00
U. Artie Eoff c6ee20fab3 vaapipostproc: fix output buffer WxH for crop meta forwarding
Adding crop meta x,y to w,h only compensates for left,top
cropping.  But we also need to compensate for right,bottom
cropping.

The video meta contains the appropriate w,h (uncropped)
values, so use it instead.

Test:

 gst-launch-1.0 -vf videotestsrc num-buffers=500 \
  ! videocrop top=50 bottom=30 left=40 right=20 \
  ! vaapipostproc ! vaapisink & \
 gst-launch-1.0 -vf videotestsrc num-buffers=500 \
  ! videocrop top=50 bottom=30 left=40 right=20 \
  ! vaapipostproc ! identity drop-allocation=1 \
  ! vaapisink
2019-09-05 11:03:34 +00:00
U. Artie Eoff 9fd020a117 vaapipostproc: handle size and direction together in src events
Mapping a pointer event needs to consider both size and
video-direction operations together, not just one or the other.

This fixes an issue where x,y were not being mapped correctly
for 90r, 90l, ur-ll and ul-lr video-direction. In these directions,
the WxH are swapped and GST_VAAPI_POSTPROC_FLAG_SIZE is set.  Thus,
the first condition in the pointer event handling was entered and
x,y scale factor were incorrectly computed due to srcpad WxH
swap.

This also fixes all cases where both video-direction and scaling
are enabled at the same time.

Test that all pointer events map appropriately:

for i in `seq 0 7`
do
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} width=300 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} width=300 height=200 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} height=200 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} \
  ! vaapisink
done
2019-09-04 16:03:24 -07:00
U. Artie Eoff 6700f642fc vaapipostproc: advertise crop meta is handled
Advertise to upstream that vaapipostproc can handle
crop meta.

When used in conjunction with videocrop plugin, the
videocrop plugin will only do in-place transform on the
crop meta when vaapipostproc advertises the ability to
handle it.  This allows vaapipostproc to apply the crop
meta on the output buffer using vaapi acceleration.
Without this advertisement, the videocrop plugin will
crop the output buffer directly via software methods,
which is not what we desire.

vaapipostproc will not apply the crop meta if downstream
advertises crop meta handling; vaapipostproc will just
forward the crop meta to downstream.  If crop meta is
not advertised by downstream, then vaapipostproc will
apply the crop meta.

Examples:

1. vaapipostproc will forward crop meta to vaapisink
 gst-launch-1.0 videotestsrc \
  ! videocrop left=10 \
  ! vaapipostproc \
  ! vaapisink

2. vaapipostproc will do the cropping
 gst-launch-1.0 videotestsrc \
  ! videocrop left=10 \
  ! vaapipostproc \
  ! identity drop-allocation=1 \
  ! vaapisink
2019-08-30 17:01:55 +00:00
He Junyan 258719e0ed plugin: encode: delete useless init_properties.
Also delete the get_properties function in encode class. We now
use g_object_class_list_properties to get all properties for
internal encoder class.
2019-08-30 21:21:04 +08:00
He Junyan 2ab5e0ef46 plugin: encode: delete set/get_property func in encode class
Use standard gobject's property functions to replace the old way.
2019-08-30 21:21:04 +08:00
He Junyan 46ce4e3054 plugin: encode: delete gst_vaapiencode_init_properties
No need to init the properties got by get_default_properties func
now. The properties are inited correctly in internal encoder class.
2019-08-30 21:21:04 +08:00
He Junyan 1256680486 gst: encode: enable new type of property mechanism. 2019-08-30 21:19:14 +08:00
He Junyan 05643dadb5 gst: encode: add property help functions for encoder properties.
The encoder is a true gstobject now and all the properties are using
gobject's properties mechanism. Add help functions to handle the properties
between encode and encoder class.
The basic idea is mapping the same property between encoder and encode. All
the encoder's properties will have the same name, the same type in encode.
The set/get property function just forward the property setting/getting to
the encoder using the same property name and value. Because the encoder is
created on needed, we need to cache the property setting in encode.
2019-08-30 21:06:47 +08:00
Víctor Manuel Jáquez Leal d671197684 vaapipostproc: check for filter before appending caps
While ensuring the allowed sink pad caps, the filter attributes set
the frame size restriction, but it is not ensured, at that moment,
that the filter is already instantiaded.

In order to silence the glib logs, this patch add only calls
gst_vaapi_filter_append_caps() if the filter is instantiated.
2019-08-29 11:03:30 +00:00
Thibault Saunier 9fe6b621a2 Classify vaapidecodebin as a hardware decoder 2019-08-28 12:49:03 -04:00
He Junyan 70cefdd272 libs: postproc: fix a memory leak point.
filter_ops and filter_formats should already have valid value when
the function gst_vaapipostproc_ensure_filter_caps re-enter
2019-08-27 16:33:34 +00:00
Wangfei 6f8ea02b61 vaapidecode: support transform ROI meta
This will benefit the use case like:

src --->   encode    ---> decode ---> circle ROI ---> sink
     |                |
     --> analyse to -->
         get ROI
2019-08-26 09:36:54 +00:00
Mathieu Duponchelle 0592731715 docstrings: port ulinks to markdown links 2019-08-23 19:10:15 +02:00
Víctor Manuel Jáquez Leal dae057588b libs: remove surface's parent context
In commit 18031dc6 surface's parent context is not assigned because of
circular references. Since then (2013), there's has no issue with
subpictures attached to a context, the current only users of this API.

This patch cleans up all of related code with the unused surface's
parent context.
2019-08-20 17:11:23 +02:00
Víctor Manuel Jáquez Leal e8b52f59f5 vaapidecode: guard if no structure is available in caps 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal f88d18bebe vaapipostproc: append frame size restrictions in caps 2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal 6f61252f9d vaapiencode: set frame size restrictions in caps
Fixes: #12
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal 3ba3966fc3 vaapiencode: enhance how the profile is defined
This code doesn't define the profile used by the internal encoder, but
it used to "predict" which is going to be used and to get the caps
restrictions.

Before the profile was predicted by checking the donwstream caps, but
sometimes they are not defined, setting an unknown profile. In order
to enhances this situation, the encoder asks to internal encoder if it
has one. If so, it is used.

To ask the internal encoder's profile a new accessor function was
added: gst_vaapi_encoder_get_profile()
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal f7c1ac036d libs: profilecaps: move caps config into a new file
Implement all the appending of frame size restrictions in caps, for
encoders and decoders, in a new source file.
2019-08-19 17:26:55 +00:00
Víctor Manuel Jáquez Leal 6cb3e741fd vaapipostproc: handle navigation downstream event
When navigation events contains coordiantes those have to be mapped
to the new size and/or orientation.
2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal bcb29e8399 vaapipostproc: handle image-orientation upstream event
Now that vaapipostproc can possible handle video-direction, it
should also handle the image-orientation event from upstream if
video-direction property is set to auto.
2019-08-19 16:48:50 +00:00
Víctor Manuel Jáquez Leal b8a333e0c3 vaapipostproc: add missing locks when adding flags 2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal bd175f9956 vaapipostproc: update filter before fixate caps
It is requiered to know if postproc is capable to change the video
direction before fixating the source caps.

In order to do it, it'ss required to know if there's a functional VPP,
but that's checked at create() vmethod, which occurs after caps
fixating.

This patch checks for a functional VPP at fixate caps and, if so,
checks for the enabled filtes and later do the caps fixations.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal c06b587819 vaapipostproc: element warning if video direction is unsupported
If the video direction is unsupported by the driver, an element
warning is posted in the bus to notify the application.

gst_vaapi_enum_type_get_nick() was added in the library thus it can
be used elsewhere. It retrives the nick from an enum gtype.
2019-08-19 16:48:49 +00:00
Víctor Manuel Jáquez Leal e48b0a90f1 vaapivideomemory: demote error message to info
The main reason to demote the message's level is because it is not an
error, it's a possible output of the trial and there's a code path
that handles it.

Secondly, it's very annoying when using gallium driver for radeon.
2019-08-15 12:58:44 +02:00
Víctor Manuel Jáquez Leal 14ea838512 vaapidecodebin: set queue's max size buffers to 1
Otherwise the queue will swallow all the available decoder's surfaces
reaching a dead-lock.

This setting might impact the bin's peformance, but it's a trade-off.
2019-07-26 12:43:17 +02:00
Víctor Manuel Jáquez Leal 1fa172f032 vaapidecodebin: set properties default values 2019-07-26 12:40:01 +02:00
Víctor Manuel Jáquez Leal ec9a2a4b4e vaapidecode: don't error if can't push buffers downtream
When the code path goes to push buffers downstream when no surface
available in decoder context, and it fails the code bails out with a
fatal error.

That behavior is wrong, since it shouldn't be fatal. The use case is
when the video stream is disabled.

This patch just ignores the errors in this situation and demotes the
level of a log message.
2019-07-26 12:40:01 +02:00
U. Artie Eoff 4e4ca03bc1 vaapipostproc: update PAR when rotating
When rotating, swap pixel-aspect-ratio during
negotiation.

Fixes #181
2019-07-15 15:33:15 -07:00
U. Artie Eoff f1aa0cc5e0 vaapipostproc: add rotation support
Adds vpp rotation support to vaapipostproc.  Uses
property video-direction. Default is identity (no
rotation).

Closes #104
2019-07-09 12:26:46 -07:00
Wangfei e4bec306b6 vaapidecode: set initial decode format according surface chroma type
For surfaces with different chroma type, it is prefer to initialize
a format which chroma type should be same with surface chroma type
instead of using fixed NV12.
2019-06-26 10:36:56 +00:00
Wangfei 67ed67515b libs: decoder: jpeg: add support 400/411/422/444 chroma type
When create vaapi surface, it is better to use the chroma type get
from jpeg file instead of using fixed 420 format. And the correct
chroma type can be determined by horizontal_factor/vertical_factor
flags that get from jpegparse.
2019-06-26 10:36:56 +00:00
U. Artie Eoff a6dfb6e5be plugins: remove last negotiated video info if caps are same
If the allocation caps and negotiated caps are the same,
then ensure any previously negotiated video info is also
removed.  This can occur when multi-resolution video
decoding returns to it's original resolution.

Fixes #170
2019-06-10 21:28:13 -07:00
U. Artie Eoff 5f41422215 vaapivideomemory: allow negotiated info to be removed
Allow NULL negotiated_vinfo to be passed into
gst_allocator_set_vaapi_negotiated_video_info to allow
any previously set info to be removed.
2019-06-10 20:39:28 -07:00
Freyr666 53d86ff519 vaapiencode: Fixes deadlock in gst_vaapiencode_change_state function
This fixes a deadlock in gst_vaapiencode_change_state, which was due to
srcpad's chain function was locked waiting for available buffers. Since the
coded buffers in codedbuf_queue become available after sinkpad consume the
encoded frames, Paused -> Ready state change leads to deadlock. Coded buffers
are never consumed and marked free, hence gst_vaapiencode_handle_frame waits for
available buffers and holds the stream_lock of the srcpad.
2019-05-30 07:08:35 +00:00
Mathieu Duponchelle df3989865e doc: remove xml from comments 2019-05-29 23:08:22 +02:00
U. Artie Eoff 3ccf3f3334 vaapipostproc: add mirror support
Adds vpp mirroring support to vaapipostproc.  Use
property video-direction.  Valid values are identity,
horiz or vert.  Default is identity (no mirror).

Closes #89

v2: Use GstVideoOrientationMethod enum
v3: Don't warn for VA_MIRROR_NONE.
    Use GST_TYPE_VIDEO_ORIENTATION_METHOD type.
v4: Query VAAPI caps when setting mirror value
    instead of during per-frame processing.
v5: Return TRUE in warning cases when setting mirror value.
2019-05-29 09:06:27 +00:00
Mathieu Duponchelle 38d25c65c3 doc: fix some incorrect gtk-doc links 2019-05-29 01:41:37 +02:00
Thibault Saunier b0f5a59760 docs: Port to hotdoc 2019-05-13 17:00:00 -04:00
Wangfei 2ee518a988 vaapiencode: handle DMABuf caps feature in sink pad
Add DMABuff caps features in all encoders' sink pad.
2019-05-06 16:54:00 +02:00
Víctor Manuel Jáquez Leal 838045b9e2 vaapipostproc: don't do any color conversion when GL_TEXTURE_UPLOAD
https://bugzilla.gnome.org/show_bug.cgi?id=748184 has resurrected
with commit 3e992d8a

Since gst_vaapi_find_preferred_caps_feature() returns a color format
from caps negotiation, different from the default one (NV12), the
postproc enables the color transformation. But when GL_TEXTURE_UPLOAD
feature is negotiated, no color transformation shall be done.

Nonetheless, with commit 3e992d8a the requested format changes
firstly, because there's no video sink yet, so ANY caps are
negotiated; but later, when there's a video sink and a caps
renegotiation, the GL_TEXTURE_UPLOAD is negotiated though the color
format conversion still ongoing. It is required to reset that
conversion.

This patch force default color format when GL_TEXTURE_UPLOAD is
selected as preferred, thus avoiding the color conversion.

Fixes: #157
2019-05-02 16:47:28 +02:00
Wangfei e88f349c6f plugins: find the preferred format from right caps.
When the downstream has any caps, then raw video feature will
be used. At this situation, the preferred format should be chose
from caps which contains "vide/x-raw" feature instead of from
the fist allowed caps.

Fixes #142
2019-04-11 08:40:38 +00:00
Danilo Spinella f91046bad3 vaapipluginutil: Fix #endif for USE_X11 2019-03-30 18:29:31 +01:00
He Junyan acf10ce164 vaapiencode: gobject's prop_id differ from vaapi encoder
The vaapi internal encoder's property id are negative, thus they are
different from GObject's property ids.

gst_vaapi_encoder_set_property() should map to the internal encoder
property id, assigned in gst_vaapiencode_default_set_property().
2019-03-25 19:15:38 +01:00
Víctor Manuel Jáquez Leal 3e992d8adb plugin: if any caps in downstream, negotiate raw video
When downstream has any caps, vaapi should not shovel vaapi featured
buffers, but rather plain raw video, assuming always the worst case
scenario (downstream cannot handle featured video memory but raw
system memory buffers).

This patch query the peer caps without any filter, to know if
donwstream just ask for any caps, if so jump to the color space
checking, otherwise do the caps intersection and continue with the
feature selection algorithm.

Fixes: #139
2019-02-27 13:13:14 +01:00
He Junyan ee21fd9053 vaapivideomemory: Prefer same format for surface and image
We prefer to use the same format between image and surface for gst
vaapi allocator. The old way may choose different formats between
image and surface. For example, the RGBA image may have a NV12 surface.

So we need to do format conversion when we put/get image to surface.

Some drivers such as iHD can not support such conversion and always
cause a data flow error. There may also have some performance cost
for format conversion when put/get images.

So we prefer to use the same format for image and surface in the
allocator. If the surface can not support that format, we then
fallback to find a best one as the surface format.

Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
2019-02-21 13:41:46 +01:00
Niels De Graef f84394fa49 libs: wayland: add support for XDG-shell protocol
[wl_shell] is officially [deprecated], so provide support for the
XDG-shell protocol should be provided by all desktop-like compositors.
(In case they don't, we can of course fall back to wl_shell).

Note that the XML file is directly provided by the `wayland-protocols`
dependency and generates the protocol marshalling code.

[wl_shell]: https://people.freedesktop.org/~whot/wayland-doxygen/wayland/Client/group__iface__wl__shell.html
[deprecated]: 698dde1958
2019-02-16 23:55:42 +01:00
Víctor Manuel Jáquez Leal 7afe5311cc vaapisink: x11: trap WM_DELETE_WINDOW message
Register the WM_DELETE_WINDOW message from window manager and
trap it to stop the pipeline cleanly.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/130
2019-01-24 21:11:54 +01:00
Wangfei 98c32df830 vaapipostproc: before set surface proxy, check if it already been created and exist.
Fix the deinterlace black frame when playing with glimagesink:
gst-launch-1.0 filesrc location=test.264 ! h264parse ! vaapih264dec \
! vaapipostproc deinterlace-mode=1 deinterlace-method=1 ! glimagesink
2019-01-15 14:48:19 +08:00
Haihao Xiang 5b447753da meson: build h264 fei encoder if possible 2019-01-07 17:46:42 +00:00
Haihao Xiang 920b1ec7a8 vaapi: bump the minimum vaapi version requirement to 0.39.0
And reduce unnecessary API version and structures check as well.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/108
2019-01-07 17:46:42 +00:00
He Junyan 7663fa263c plugins: Add more check for allowed raw caps.
The gst_vaapi_plugin_base_get_allowed_raw_caps is used for both sink
pad and src pad, which cause some bugs. For sink pad, we need to verify
vaPutImage() while for the src pad we need to verify vaGetImage().
For vaapidecoderXXX kind of plugins, the case is more complex. We need
to verify whether the decoded result(in some surface, NV12 format most
of the time) can be vaGetImage to some raw image format. Add more check
to fix all these problems.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/123

Signed-off-by: He Junyan <junyan.he@hotmail.com>
2018-12-24 10:46:23 +00:00
Wangfei 63ea81a983 vaapipostproc: fix csc fail when only change width or height. 2018-12-18 10:47:15 +08:00
Wangfei 1513cf774d libs: enc: h264: set max profile idc with correct profile.
Use the highest rank of available profile as the max profile to
set max idc value.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/124
2018-12-15 14:48:03 +08:00
Wangfei 5e7988b2d8 libs: dec: h265: support decode for main-444 10bit streams.
Add 444 10bit yuv format Y410, which can be used to decode
main-444 10bit streams. Currently, this feature is only
supported by media-driver in Icelake.
2018-12-04 13:25:59 +08:00
Jordan Petridis d8b3c0495f
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:56:44 +02:00
He Junyan 176bbce975 plugins: modify image check of extract_allowed_surface_formats.
The extract_allowed_surface_formats function just check whether
we can support some kind of surface/image format pair. We just
need to create a surface, create an image with the same video-format
and putImage from image to surface. All these operations success,
that kind of video-format is supported.
The old manner do not work for some kind of video-format. For example,
the RGBA kind of format will create a NV12 surface and RGBA image,
and the putImage will fail because the format is not same. And so
the RGBA format is not supported but actually it is supported.
2018-11-27 15:11:51 +00:00
Michael Olbrich c1de41b841 vaapipostproc: add some missing locking
gst_vaapi_plugin_base_close() removed the raw caps that are used indirectly
in gst_vaapipostproc_transform_caps(). The usage is already protected by
the mutex.
This is needed when the pipeline is stopped during startup.
2018-11-27 07:13:20 +01:00
Xiang, Haihao c728fb4ff6 Close dmabuf_fd
Otherwise it will result in resource leak when failed to create
dmabuf memory
2018-11-20 16:18:58 +08:00
Michael Olbrich 072f49cdcf vaapiencode: don't start src pad task in set_format
Otherwise the task may be restarted during shutdown. Start the task in
gst_vaapiencode_handle_frame() instead.
2018-11-14 12:55:49 +01:00
Wangfei 5d0878b48a libs: dec: h265: support decode for main-444 8bit streams.
Add 444 8bit yuv format AYUV, which can be used to decode
main-444 8bit streams. Currently, this feature is only
supported by media-driver in Icelake.

https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/119
2018-11-14 02:29:54 +00:00
Junyan He f25a80bf05 plugins: Fix build error when GL is enabled while EGL is disabled.
gl_platform_type in gst_vaapi_get_display_type_from_gl_env generate
unused-variable warning and may block build when Werror enabled.
Several functions like gst_vaapi_display_egl_new_with_native_display
have no prototype warning and link error when GL is enabled but EGL
is disabled. Fix all these warning and link error.

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

Signed-off-by: Junyan He <junyan.he@intel.com>
2018-11-05 14:28:01 +01:00
Wangfei 638004875b libs: dec: h265: support decode for main-10-422 10bit streams.
Add 422 10bit yuv format Y210, which can be used to decode
main-10-422 10bit streams. Currently, this feature is only
supported by media-driver in Icelake.

https://bugzilla.gnome.org/show_bug.cgi?id=797264
2018-11-01 14:03:23 +01:00
Víctor Manuel Jáquez Leal ce96f2d1fa vaapipostproc: fix classification string
The classification string is splitted by '/' and then looks for the
components.

This patch removes the ';' by unifying all the components.
2018-10-15 17:55:24 +02:00
Philippe Normand 8914ace06a vaapipostproc: Add Hardware classifier to metadata 2018-10-15 16:06:31 +01:00
Philippe Normand 70726aef00 gst: Advertise elements interacting with hardware devices 2018-10-12 15:39:53 +01:00
Soon, Thean Siew ee27377cb3 vaapipostproc: change the way of handling deinterlace
The current vaapipostproc calls driver's video processing
pipeline for deinterlacing only if it is Advance deinterlacing.
Modify in the way that it always tries with driver's video
processing pipeline for deinterlacing, and falls back to software
method of appending picture structure meta data only if it fails
with driver's method.

https://bugzilla.gnome.org/show_bug.cgi?id=797095
2018-10-09 16:19:52 +02:00
Wangfei 619abbdeb4 libs: dec: h265: add 422 chroma format support.
Add main-422-10 profile which support 422 chroma format stream.
Currently, this feature is only supported by media-driver in Icelake.

https://bugzilla.gnome.org/show_bug.cgi?id=797143
2018-09-27 11:55:04 +02:00
Víctor Manuel Jáquez Leal 0152410c97 libs: object: separation of internal API and plugins
Removed exposed macros GST_VAAPI_OBJECT_DISPLAY() and
GST_VAAPI_OBJECT_ID() to plugins, keeping them only for internal
library usage.

The purpose is readability.

https://bugzilla.gnome.org/show_bug.cgi?id=797139
2018-09-25 17:41:55 +02:00
Matteo Valdina 7872d12695 vaapidecode: Requests upstream a key unit at parse or decode error.
This is done to resume decoding after a parse error or decode error.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=797006
2018-09-03 16:11:13 +02:00
Matteo Valdina 2cb795fc77 vaapidecode: sets return value in failure case.
In gst_vaapidecode_handle_frame, when there is a decode error
there is a code path the returns an uninitialized value.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=797006
2018-09-03 15:38:33 +02:00
Nicolas Dufresne 06aa82f989 vaapidecode: Skip unparsable units from adapter
If the unit could not be parsed, just skip this nal and keep parsing
what is left in the adapter. We need to flush the broken unit in the
decoder specific parser because the generic code does not know about
units boundary. This increases error resilliance.

Before this, the broken unit would stay in the adapter and EOS would be
returned. Which stopped the streaming. Just removing the EOS would have
lead to the adapter size growing indefinitely.

https://bugzilla.gnome.org/show_bug.cgi?id=796863
2018-07-25 15:52:54 -04:00
Nicolas Dufresne d07bffb578 vaapidecoder: Don't error out on decode errors
This is problematic on live pipeline where loosing network can
cause an important amount of errors.

https://bugzilla.gnome.org/show_bug.cgi?id=796832
2018-07-25 15:52:54 -04:00
Mathieu Duponchelle b4d6a3b113 pluginutil: downgrade unsupported driver logging
On systems with an Nvidia card, this error is output each time
the registry is rebuilt, which happens pretty often when
using gst-build as a development environment.

https://bugzilla.gnome.org/show_bug.cgi?id=796663
2018-06-26 14:45:10 +02:00
Tim-Philipp Müller 4f32a72675 Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 13:07:20 +02:00
Víctor Manuel Jáquez Leal 6ccd5d6fb2 libs: display: remove gst_vaapi_display_ref()
Replace it with gst_object_ref()

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal fb1c4c52cc libs: display: remove gst_vaapi_display_unref()
Use gst_object_unref() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal b1d8c68921 vaapibufferpool: declare parameter display as object
We have neglected to update this code since GstVaapiDisplay turned
into a GstObject descendant.

https://bugzilla.gnome.org/show_bug.cgi?id=796470
2018-06-14 16:41:00 +02:00
Víctor Manuel Jáquez Leal 19e4769501 plugins: fix compilation
gstvaapipluginutil.c:171:1: error: old-style function definition [-Werror=old-style-definition]
2018-06-12 15:45:44 +02:00
Víctor Manuel Jáquez Leal 94709d49c6 plugins: refactor gst_vaapi_create_display_from_gl_context()
gst_vaapi_create_display_from_gl_context() was a spaghetti mess.

This path refactors it, in order to make the code readable and
easy to follow.

https://bugzilla.gnome.org/show_bug.cgi?id=796564
2018-06-12 12:55:15 +02:00
Víctor Manuel Jáquez Leal e62f3d75cf plugins: handle EGL when creating VAAPI display from gl
If GstGL reports a EGL platform force to create a EGL display using
the native EGL display.

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:42:11 +02:00
Hyunjun Ko 50470ae89f display: egl: create VaapiDisplayEGL with native EGL display
gst_vaapi_display_egl_new_with_native_display() has been broken since
it wasn't used.

Currently it's needed to call this API to create a display providing
the EGL display, so it could avoid duplicated calls to the native
display (eg. eglTerminate).

Signed-off-by: Victor Jaquez <vjaquez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795391
2018-06-12 12:35:04 +02:00
Michael Olbrich d79bda3153 vaapipostproc: don't copy the GstParentBufferMeta if use_vpp
Otherwise a reference to a DMABuf input buffer is kept until the output
buffer is deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=796399
2018-06-07 11:55:06 +02:00
Víctor Manuel Jáquez Leal 28952f534b vaapiencode: h264: log output caps 2018-06-06 11:04:02 +02:00
Víctor Manuel Jáquez Leal af3e6a8d16 vaapiencode: h264: find profile in available and allowed caps
The commit 67e33d3de2 ("vaapiencode: h264:
find best profile in those available") changed the code to pick a profile
that is actually supported by the hardware. Unfortunately it dropped the
downstream constraints. This can cause negotiation failures under certain
circumstances.

The fix is split in two cases:

1\ the available VA-API caps doesn't intersect with pipeline's allowed
caps:
 * The best allowed profile (pipeline's caps) is set as the encoding
   target profile (it will be adjusted later by the available profiles
   and properties)

2\ the available VA-API caps does intersect with pipeline's allowed
caps:
 * The intersected caps are fixed, and its profile is set as the
   encoding target profile. In this case the is not the best profile,
   but the minimal one (if VA-API reports the profiles in order).
   Setting the minimal profile of the intersected caps is better for
   compatibility.

This patch fixes other tests related with caps negotiation, for
example, it handles baseline profile, even when VA only supports
constrained-baseline.

Original-patch-by: Michael Olbrich <m.olbrich@pengutronix.de>

https://bugzilla.gnome.org/show_bug.cgi?id=794306
2018-06-06 11:04:02 +02:00
Víctor Manuel Jáquez Leal 705b37844e plugins: guard GstGL code 2018-05-21 13:57:08 +02:00
Wang,Fei 2d95089a8d vaapih264dec: add constrained and progressive profiles
Those profiles have been added in the version 2012-01
and 2011-06 of the AVC spec (A.2.4.1 and A.2.4.2).

Both are supported by VAProfileH264High

https://bugzilla.gnome.org/show_bug.cgi?id=795624
2018-04-30 12:48:26 +02:00
Víctor Manuel Jáquez Leal 59579a9cb3 plugin: remove custom GstGL context handling
Instead of using our own context handling for looking for GstGL
parameters (display, context and other context), this patch changes
the logic to use the utility function offered by GstGL.

https://bugzilla.gnome.org/show_bug.cgi?id=793643
2018-04-26 19:37:54 +02:00
Víctor Manuel Jáquez Leal 86bf89d16d plugins: GstGL API must use the member variables
This commit basically is a revert of commits 8092537 and fc1c415

https://bugzilla.gnome.org/show_bug.cgi?id=793643
2018-04-26 19:37:54 +02:00
Hyunjun Ko b9c38a295b plugins: pass members as parameters of gst_gl_ensure_element_data()
The parameters of gst_gl_ensure_element_data() have to be not
local variable since they are going to be used to see if they're
set in gst_element_set_context() inside the API.

This is basically a revert of commit 3d56306c

https://bugzilla.gnome.org/show_bug.cgi?id=793643
2018-04-26 19:35:49 +02:00
Hyunjun Ko bfac678e9a videocontext: support wl-display in "gst.vaapi.app.Display"
Through "gst.vaapi.app.Display" context, users can set their own
VADisplay and native display of their backend.

So far we support only X11 display, from now we also support Wayland
display.

Attributes:
- wl-display : pointer of struct wl_display .

https://bugzilla.gnome.org/show_bug.cgi?id=705821
2018-04-18 18:01:06 +02:00
Víctor Manuel Jáquez Leal fa77b2bf60 vaapiencode: h264: find best profile in those available
Instead to look for the best profile in the allowed profiles by
downstream, the encoder should look for the base profile in the
available profile in VA-API.

https://bugzilla.gnome.org/show_bug.cgi?id=794306
2018-03-30 20:44:25 +02:00
Víctor Manuel Jáquez Leal 940afd2900 vaapipostproc: change how the metadata is copied
Instead of copying the metada in prepare_output_buffer() vmethod,
it is done in append_output_buffer_metadata() thus deinterlaced
buffers could also have the proper metas.

GstVideoCropMeta now it is copied internally and it is decided via
transform_meta() vmethod.

A new internal method, copy_metadata() was added to handle VPP
transformation where non-GstVideoVaapiMeta metas were lost.
2018-03-01 09:48:38 -06:00
Nicolas Dufresne fde55003ca postproc: Copy meta data from input to output
This will ensure that meta data without memory tags will be copied. This
was noticed when testing ROI.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 17:51:02 -05:00
Víctor Manuel Jáquez Leal 25c2a0d353 Revert "vaapiencode: handle custom event GstVaapiEncoderRegionOfInterest"
This reverts commit 8f1b88dac0.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 17:51:02 -05:00
Víctor Manuel Jáquez Leal ba28c6cff2 plugins: copy input buffer metas
When importing buffers to a VA-base buffer, it is required to copy
the metas in the original buffer, otherwise information will be
lost, such as GstVideoRegionOfInterestMeta.

https://bugzilla.gnome.org/show_bug.cgi?id=768248
2018-02-27 10:02:14 -06:00
Víctor Manuel Jáquez Leal 9827ab0f3f vaapidecode: generate system allocated buffers
Generate system allocated output buffers when downstream doesn't
support GstVideoMeta.

The VA buffer content is copied to the new output buffer, and it
replaces the VA buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:58:08 -06:00
Víctor Manuel Jáquez Leal 188434f251 vaapipostproc: handle system allocated buffers when required
When downstream can't handle GstVideoMeta it is required to send
system allocated buffers.

The system allocated buffers are produced in prepare_output_buffer()
vmethod if downstream can't handl GstVideoMeta.

At transform() vmethod if the buffer is a system allocated buffer,
a VA buffer is instanciated and replaces the out buffer. Later
the VA buffer is copied to the system allocate buffer and it
replaces the output buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:58:08 -06:00
Víctor Manuel Jáquez Leal 2c36610748 plugins: add gst_vaapi_copy_va_buffer()
This helper function aims to copy buffers with VA memory to dumb
buffers, when GstVideoMeta is not available dowstream.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal 5842e9cf87 plugins: add COPY_OUTPUT_FRAME flag
This patch add the member copy_output_frame and set it TRUE when
when downstream didn't request GstVideoMeta API, the caps are raw
and the internal allocator is the VA-API one.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00
Víctor Manuel Jáquez Leal f0fd2aeb04 plugins: store the first downstream allocator if available
The allocator will be required if we need to allocate a buffer
to store the frame with the expected strides.

https://bugzilla.gnome.org/show_bug.cgi?id=785054
2018-02-20 10:57:12 -06:00