Commit graph

4421 commits

Author SHA1 Message Date
Sebastian Dröge
f71493a57c decklink: Remove \n from debug output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1721>
2020-10-30 16:23:31 +02:00
Sebastian Dröge
60b7bd23a8 decklink: Correctly indent everything
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1721>
2020-10-30 16:23:31 +02:00
Sebastian Dröge
56b2130300 decklink: Add a default profile id
This causes no changes to the profile but keeps the existing settings.
The profile can also be changed from e.g. the card's configuration
application and in that case probably should be left alone.

The default is the new value as it keeps the profile setting as it is,
which is consistent with the previous behaviour in 1.18.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1721>
2020-10-30 16:23:31 +02:00
Sebastian Dröge
d1df412d70 decklink: Mark internal function as static
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1721>
2020-10-30 13:47:51 +00:00
Sebastian Dröge
1ea2796cfc decklink: Remove some dead code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1721>
2020-10-30 13:47:51 +00:00
Sebastian Dröge
c6aca271a1 decklink: Update enum value bounds check in gst_decklink_get_mode()
The widescreen modes moved after GST_DECKLINK_MODE_2160p60 and using
them now would cause an assertion. This is a regression from
309f6187fe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1737>
2020-10-30 10:02:32 +02:00
Xavier Claessens
dd7b672830 amc: Fix crash when encoding AVC
gstamcvideoenc.c calls gst_amc_avc_profile_to_string() with alternatives
set to NULL which causes a crash.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1732>
2020-10-29 17:51:57 +00:00
Seungha Yang
b62867ecc8 d3d11videoprocessor: Fix wrong input/output supportability check
The flag argument of ID3D11VideoProcessorEnumerator::CheckVideoProcessorFormat
method is output value, not input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1726>
2020-10-28 15:53:54 +00:00
Seungha Yang
8f96361c81 nvcodec: nvsldec: Add support for CUDA memory
Add CUDA memory support. Note that zero copying is not supported yet

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1720>
2020-10-27 18:31:42 +00:00
Seungha Yang
fab234f2f1 d3d11memory: Adjust log level for some spammy debug messages
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
Seungha Yang
10f622aa5d d3d11convert: Use ID3D11VideoProcessor only if device supports colorspace
Check whether conversion with given combination of input/output
format and dxgi colorspace is supported or not by driver.
If not, we should use shader.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
Seungha Yang
6b992f291b d3d11videoprocessor: Add a method for device's conversion caps check
Add a wrapper method for
ID3D11VideoProcessorEnumerator1::CheckVideoProcessorFormatConversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
Seungha Yang
1e038ce322 d3d11format: Map more colorimetry with dxgi colorspace
Map more logically identical set of GstVideoColorimetry formats
with dxgi color space.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723>
2020-10-27 16:20:49 +00:00
He Junyan
d76204d14f va: pool: Set the video_alignment after we get image info.
The set_format() of the allocator may change the stride of the
alloc_info. We should update the video_align.stride_align based
on it. Or, we get a warning in gst_video_meta_validate_alignment().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1698>
2020-10-27 14:18:07 +00:00
He Junyan
caf28d8f12 va: h264dec: Set the padding to VideoAlignment's right.
In our va implemenation, we just use image's info to map the buffer.
The padding info just plays a role as a place holder to expand the
allocation size in caps when decoding size is bigger than display
size. So the padding_right or padding_left does not change the result.
But we find if using padding_left, it is hard to meet the requirement
of gst_video_meta_validate_alignment(), when the video meta's stride
is different from the allocation width.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1698>
2020-10-27 14:18:07 +00:00
He Junyan
6e72f45a8f va: basedec: No need to call base class' decide_allocation().
We have already done the jobs in gst_va_base_dec_decide_allocation()
and no need to call base class' decide_allocation() again. The base
class' decide_allocation() will set_format() again and let use do the
image/surface testing again, which is low performance and no needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1698>
2020-10-27 14:18:07 +00:00
He Junyan
32133c85d3 va: allocator: use _update_image_info() to set allocator parameters.
Use this standalone function to update the allocator info and make
all ensure_image() and mem_alloc() API clean.
We also change the default way of using image. We now set the non
derive manner as the default manner, and if it fails, then fallback
to the derived image manner.
On a lot of platforms, the derived image does not have caches, so the
read and write operations have very low performance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1698>
2020-10-27 14:18:07 +00:00
He Junyan
e577ca140f va: allocator: Add a helper function to update the image info.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1698>
2020-10-27 14:18:06 +00:00
He Junyan
16ff523575 va: allocator: Decide the allocator's parameters when set_format().
Moving the parameters testing and setting from the allocator_alloc_full()
to the allocator_try(). The allocator_alloc_full() will be called every
time when we need to allocate a new memory. But all these parameters such
as the surface and the image format, rt_format, etc, are unchanged during
the whole allocator lifetime. Just setting them in set_format() is enough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1698>
2020-10-27 14:18:06 +00:00
Sebastian Dröge
8a923af42f decklink: Reset skip counters when starting the sources
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/378>
2020-10-25 11:46:29 +02:00
Vivia Nikolaidou
675d8b347b decklink*src: Post a warning message on the bus about dropped frames
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/378>
2020-10-25 11:39:09 +02:00
Georg Lippitsch
a45b0c8f1a decklink*src: Aggregate dropped frame/packet logging
decklink*src currently prints a log entry for every dropped frame and
audio packet. That completely spams the logs.

This change aggregates information about dropped packets and only prints
a message once when dropping starts, and a summary when dropping ends.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/705

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/378>
2020-10-25 11:39:05 +02:00
Seungha Yang
9d810bbd81 d3d11memory: Protect view object with lock
Make resource allocation more thread-safe

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
2020-10-25 00:38:52 +09:00
Seungha Yang
969ab3e664 d3d11convert: Add support for conversion using ID3D11VideoProcessor
Output texture of d3d11 decoder cannot have the bind flag
D3D11_BIND_SHADER_RESOURCE (meaning that it cannot be used for shader
input resource). So d3d11convert (and it's subclasses) was copying
texture into another internal texture to use d3d11 shader.
It's obviously overhead and we can avoid texture copy for
colorspace conversion or resizing via ID3D11VideoProcessor
as it supports decoder output texture.
This commit would be a visible optimization for d3d11 decoder with
d3d11compositor use case because we can avoid texture copy per frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
2020-10-25 00:38:44 +09:00
Seungha Yang
484d510558 d3d11memory: Store ID3D11VideoProcessorOutputView object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1718>
2020-10-25 00:38:39 +09:00
Seungha Yang
35ed7c7811 d3d11window: Reuse ID3D11VideoProcessorInputView if possible
GstMemory object could be disposed if GstBuffer is not allocated
by GstD3D11BufferPool such as via gst_buffer_copy() and/or
gst_buffer_make_writable(). So attaching qdata on GstMemory
object would cause unnecessary view alloc/free.
By using view pool which is implemented in GstD3D11Allocator,
we can avoid redundant view alloc/free.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1716>
2020-10-23 15:44:10 +00:00
Seungha Yang
6c09cdd32b d3d11memory: Implement ID3D11VideoProcessorInputView pool
Similar to ID3D11VideoDecoderOutputView pool implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1716>
2020-10-23 15:44:10 +00:00
Nicolas Dufresne
f22fc190e7 h265decoder: Add support for l0/l1
Add support for reference list needed for VA-API and some V4L2 decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1713>
2020-10-21 09:05:57 -04:00
Nicolas Dufresne
f330b5ae62 h265decoder: Sync with the H264 implementation
This ensures that we get the last reference to picture being outputed,
avoiding GstBuffer structure copies and simplifying the buffer management.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1713>
2020-10-21 09:05:57 -04:00
Seungha Yang
f615677051 d3d11decoder: Directly access ID3D11VideoDecoderOutputView for decoding
Decoder output view is stored in GstD3D11Memory object instead of
wrapper struct now. So qdata is no more required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1712>
2020-10-20 17:56:57 +09:00
Seungha Yang
a4f324d668 d3d11memory: Implement ID3D11VideoDecoderOutputView pool
Similar to texture-array pool, we can reuse decoder output view
since the life time of output view is identical to that of texture-array.
In this way, we can avoid frequent output view alloc/free.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1712>
2020-10-20 17:56:52 +09:00
Seungha Yang
04376397eb d3d11memory: Move to GArray to store texture-array status
The size D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION is 2048
which is too large in practice especially for a texture
of dpb

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1712>
2020-10-20 01:14:27 +09:00
Víctor Manuel Jáquez Leal
bcd43acd42 va: Add VP9 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1702>
2020-10-19 13:15:06 +02:00
Víctor Manuel Jáquez Leal
5e3c7f2092 codecs: vp9decoder: Pass parser as new_sequence() parameter.
In order to know the chroma format, besides profile, subsampling_x and
subsampling_y are needed (Spec 7.2.2 Color config semantics). These values are
in GstVp9Parser but not in  GstVp9Framehdr.

Also, bit_depth is available in parser but not frame header. Evenmore, those
values are copied to picture structure later.

In case of VA-API, to configure the pipeline, it is require to know the chroma
format and depth.

It is possible to know chroma and depth through caps coming from vp9parser, but
it requires string parsing. It would be less error prone to get these values
through the parser structure at new_sequence() virtual method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1700>
2020-10-16 17:50:42 +00:00
Seungha Yang
6e30cbb3fc d3d11: Introduce d3d11compositor element
Add new video composition element which is equivalent to compositor
and glvideomixer elements. When d3d11 decoder elements are used,
d3d11compositor can do efficient graphics memory handling
(zero copying or at least copying memory on GPU memory space).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
36f7966a5e d3d11shader: Allow drawing without shader resource view
... for the case that we are rendering on target without input texture.
For example, we might want to draw arbitrary shape on render target view
without shader resource view.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
eecb130bd9 d3d11convert: Add new subclasses for only color convert or resize
New d3d11colorconvert and d3d11scale elements will perform only
colorspace conversion and rescale, respectively. Those new elements
would be useful when only colorspace conversion or rescale is required
and the other part should be done by another elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
4c19962997 d3d11colorconverter: Allow setting alpha value to use
... used for reordering case for now. In other words, non-alpha formats
such as NV12 is not supported case yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
ca87289e56 d3d11colorconverter: Add support conversion with blending
This is pre-work for d3d11compositor support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
94ac3cc94d d3d11colorconverter: Add method to support updating destination rect
It's equivalent to GST_VIDEO_CONVERTER_OPT_DEST_* options of GstVideoConverter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Seungha Yang
5c7caf70e1 d3d11: Clarify target rect to be updated
Rename internal methods to clarify which rect (i.e., input or output)
should be updated

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1323>
2020-10-16 17:02:15 +00:00
Julian Bouzas
32b0afb608 nvcodec: Report latency in decoder based on max-display-delay
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
1d4b6299dc nvcodec: Add max-display-delay decoder property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
8cf1b7a154 nvcodec: Fix compiler error if OpenGL is not enabled
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
36030158c4 nvcodec: Add missing CUDAMemory src caps in h264 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
45cc831efd nvcodec: Add missing CUDAMemory sink caps in h264 and h265 encoders
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Julian Bouzas
07c349768a nvcodec: Fix description of cudadownload element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
6e1c1178c2 nvcodec: Add CUDA video scale element
Add new element for video resizing using CUDA

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
fe83a12b10 nvcodec: Add CUDA video convert element
Add new element for colorspace conversion using CUDA.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
592a8d5400 nvcodec: Add generic CUDA video convert object
Introducing generic video convert object similar to video-converter
but using CUDA.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
4cc73ff9d6 nvcodec: Add support runtime CUDA kernel source compilation
Add util functions for runtime CUDA kernel source compilation
using NVRTC library. Like other nvcodec dependent libraries,
NVRTC library will be loaded via g_module_open.

Note that the NVRTC library naming is not g_module_open friendly
on Windows.
(i.e., nvrtc64_{CUDA major version}{CUDA minor version}.dll).
So users can specify the dll name using GST_NVCODEC_NVRTC_LIBNAME
environment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
dd995bd9d4 nvcodec: Add CUDA upload/download elements with base class for CUDA filters
Similar to glupload/gldownload elements but for CUDA memory.
It will help transfer memory between system and nvidia GPU

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
b1ac8bafc9 nvcodec: Peer direct access support
If support direct access each other, use device to device memory copy
without staging host memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
d16a9237c3 cudacontext: Enable direct CUDA memory access over multiple GPUs
If each device context can access each other, enable peer access
for better interoperability.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
a8e9d616d6 nvenc: Support CUDA buffer pool
When upstream support CUDA memory (only nvdec for now), we will create
CUDA buffer pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
8635d12929 nvdec: Support CUDA buffer pool
If downstream can accept CUDA memory caps feature (currently nvenc only),
always CUDA memory is preferred.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
Seungha Yang
cf5ef5635f nvcodec: Add CUDA specific memory and bufferpool
Introducing CUDA buffer pool with generic CUDA memory support.
Likewise GL memory, any elements which are able to access CUDA device
memory directly can map this CUDA memory without upload/download
overhead via the "GST_MAP_CUDA" map flag.
Also usual GstMemory map/unmap is also possible with internal staging memory.

For staging, CUDA Host allocated memory is used (see CuMemAllocHost API).
The memory is allowing system access but has lower overhead
during GPU upload/download than normal system memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1633>
2020-10-16 15:56:49 +00:00
He Junyan
edc6e0fa1d d3d11: vp8dec: No need to check show_frame flag when output_picture.
The VP8 base class has already handled it for us.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670>
2020-10-15 19:01:54 +00:00
Seungha Yang
a31a6608fe codecs: vp9decoder: handle the show_frame check in base class
Same as vp8 decoder update https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1670

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1697>
2020-10-15 18:36:54 +00:00
Nicolas Dufresne
0f5fc9646e v4l2codecs: vp8: Allow baseclass from skipping frames
In preparation for !1670, this will allow the base class from skipping frames
that should not be displayed. Previously it would complain about unordered
decoding taking place in the driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1696>
2020-10-15 13:15:02 -04:00
Nicolas Dufresne
a3e6d9fc24 v4l2codecs: decoder: Unmark previously pending request
requests are executed in order, so while dequeuing sink buffers for previous
request, also mark these request as no longer pending. This will allow reusing
the request later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1696>
2020-10-15 13:15:02 -04:00
Nicolas Dufresne
2e3bc60422 v4l2codecs: decoder: Properly remove pending requests
Pass the pointer instead of NULL in order to find and remove properly any
pending request from the queue. This coding error was leading to use after
free in error and early exit cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1696>
2020-10-15 13:14:57 -04:00
He Junyan
4af33eda76 va: basedec: Create the other pool anyway.
Fix a bug in _create_other_pool(). The old way of checking the
base->other_pool make that other_pool never be changed until the
gst_va_base_dec_stop() to stop the current decoding context.
But in some stream, the resolution may change during the decoding
process, and we need to re-negotiate the buffer pool. Then, the
old other_pool can not be clean correctly and the new correct one
can not be created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1692>
2020-10-15 13:22:33 +00:00
He Junyan
ee739003e8 va: basedec: Should unmap src frame when dst frame map failing.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1692>
2020-10-15 13:22:33 +00:00
He Junyan
21f4c31a52 va: bufferpool: use release_buffer to clean the mem.
The current bufferpool wastes all pre-allocate buffers when the
buffer pool is actived.
The pool->priv->size is 0 for va buffer pool. And every time, the
reset_buffer() will clean all mem and make the buffer size 0, that
can cache the gst_buffer in the buffer pool.
But when the buffer pool is activing, the default_start() just
allocate the buffer and release_buffer() immediately, all the pre
allocated buffers and surfaces are destroyed because of
gst_buffer_get_size (buffer) != pool->priv->size.
We need to use release_buffer() to do the clean job at the pool
start time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1686>
2020-10-15 12:02:29 +08:00
Víctor Manuel Jáquez Leal
18444fd993 va: basedec: copy frames logic to decide_allocation()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
2020-10-10 17:18:04 +00:00
Víctor Manuel Jáquez Leal
5658c4182a va: basedec: refactor the other video pool instantiation
Just a code clean up

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
2020-10-10 17:18:04 +00:00
Víctor Manuel Jáquez Leal
a6398eca17 va: basedec: add gstvabasedec helper
This is a helper for all decoders.

It is not an abstract subclass, just merely a helper that avoids code
duplication among the decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
2020-10-10 17:18:04 +00:00
Víctor Manuel Jáquez Leal
a5dcb35ad6 va: vp8dec: add element documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
2020-10-10 17:18:04 +00:00
Víctor Manuel Jáquez Leal
a0ba72ed50 va: h264dec: set video alignment definition earlier
This patch renames need_cropping variable to need_videoalign which is clearer
with its function. And now GstVideoAlignment is part of GstVaH264Dec structure,
so it can be set earlier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1673>
2020-10-10 17:18:04 +00:00
Víctor Manuel Jáquez Leal
fbbf9c629a va: allocator: add _set_format() and _get_format()
Since allocators keep an available memory queue to reuse, video format and usage
hint are now persistant while allocator's memories are around.

This patch adds _set_format() and _get_format() for both VA allocators.

_set_format() validates if given format can be used or reused. If no allocated
surface previously it creates a dummy one to fetch its offsets and
strides. Updated info is returned to callee.

GstVaPool uses _set_format() at config to verify the allocator capacity and to
get the surfaces offsets and strides, which are going to be used by the video
meta.

Allocator extracted caps are compared with caps from config and if they have
different strides or offsets, force_videometa is set.

A new bufferpool method gst_va_pool_requires_video_meta() is added return the
value of force_videometa. This value is checked in order to know if decoders
need to copy the surface if downstream doesn't announce video meta support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:57 +02:00
Víctor Manuel Jáquez Leal
482e93b4d8 va: caps: added gst_caps_is_raw()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:57 +02:00
Víctor Manuel Jáquez Leal
6a8fa67f42 va: pool: call parent's start() method
Without preallocating buffers and memories a deadlock in pool allocator is
highly probably since it might hit the case were buffer is returned to the pool
but their memories are still hold by a copy downstream, without other
preallocated buffers available.

This kind of a hack, where buffer_reset() follow the normal path if it's called
from start().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:57 +02:00
Víctor Manuel Jáquez Leal
8f936baffe va: pool: fix log's object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:57 +02:00
Víctor Manuel Jáquez Leal
26ee5b1e4e va: allocator: remove noisy log message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:57 +02:00
Víctor Manuel Jáquez Leal
9254045b3e va: allocator: add a todo for dmabuf_memories_setup()
It would be nice to add a surface pool for this type of surface allocation in
order to have a better control of them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Víctor Manuel Jáquez Leal
a299dff9d4 va: allocator: add a surface counter
Every time a new surface is created the counter increases by one, and when it is
destroyed (or will be destroyed in case of GstVaAllocator), the counter is
decreased. Then, at allocator dispose, it is warning if the counter is not zero.

This counter will be also used to check if the allocator can change its
configuration if the counter is zero or can not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Víctor Manuel Jáquez Leal
30281af83f va: allocator: remove GstVideoInfo from GstVaBufferSurface
Don't store it them anymore since it is related with the negotiated stream and
not the concrete buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Víctor Manuel Jáquez Leal
67eb0a9440 va: remove GstVideoInfo parameter from _get_surface() functions
There shouldn't be need to retrieve GstVideoInfo per buffer or memory since it
is the same for all the negotiated stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Víctor Manuel Jáquez Leal
895fe44154 va: vpp: don't fetch video info from buffer
Instead of fetching video info from the buffer, use the already set ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Víctor Manuel Jáquez Leal
64eb0f0ed2 va: dec, vpp: don't get buffer size from allocators
Since buffer size is now ignored by bufferpool there's no need to get tha value
from the allocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Víctor Manuel Jáquez Leal
e73b866fe0 va: pool: ignore size in config
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1667>
2020-10-09 16:34:56 +02:00
Seungha Yang
20d9283e3d mfvideosrc: Use only the first video stream per device
Non-first video stream might not be working with current
implementation. It could be non-video (e.g., photo source) and then
ReadSample() might be blocked forever.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1661>
2020-10-08 20:43:58 +00:00
Seungha Yang
9279326d8a decklink: Update doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1665>
2020-10-08 20:05:03 +00:00
Seungha Yang
b86e77e3a3 decklink: Update Windows headers with SDK 11.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1665>
2020-10-08 20:05:03 +00:00
Seungha Yang
94a9a8f836 decklink: Update OSX headers with SDK 11.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1665>
2020-10-08 20:05:03 +00:00
Tim
c6151f635f decklink: Updated DeckLink SDK to 11.2 to support DeckLink 8K Pro
Updated Decklink SDK to version 11.2 in order to support newer cards like the Decklink 8K Pro.
This required to replace the duplex property by a profile property.

Profile values can be the following:
-  bmdProfileOneSubDeviceFullDuplex
-  bmdProfileOneSubDeviceHalfDuplex
-  bmdProfileTwoSubDevicesFullDuplex
-  bmdProfileTwoSubDevicesHalfDuplex
-  bmdProfileFourSubDevicesHalfDuplex

Fixes #987

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1665>
2020-10-08 20:05:03 +00:00
Seungha Yang
9ecdfea7da mfvideosrc: Fix invalid memory access when outputting jpeg
Don't access unknown-dangerous-nonsense address

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1662>
2020-10-08 16:28:16 +00:00
Seungha Yang
0a454191c0 d3d11upload: Allow passthrough for system memory
... like how d3d11download and gl{upload,download} do.
This should've been part of the commit 9b72b04dad
but I missed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1645>
2020-10-05 15:54:37 +00:00
Víctor Manuel Jáquez Leal
dcc4557dd6 va: allocator: refactor flush methods for both allocators
Since the logic is the same, it can be generalized in a single common
function.

Also the methods run the common function with a lock and signal the
buffers' conditional.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
37fa6df57d va: allocator: refactor GstVaDmabufAllocator
Move code down to group it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
9c56c1b3e8 va: allocator: refactor GstVaBuffersurface
Move code up and add namespace to methods, and renaming
_creating_buffer_surface() to the canonical
gst_va_buffer_surface_new()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
734e2a74c4 va: implement pooled allocators
1. Allocators don't implement memory free() methods since all the memories will
   implement dispose() returning FALSE
2. Memory/miniobject dispose() will act as memory release, enqueueing the
   release memory
3. A new allocator's method prepare_buffer() which queries the released memory
   queue and will add the requiered memories to the buffer.
4. Allocators added a GCond to synchronize dispose() and prepare_buffer()
5. A new allocator's method flush() which will free for real the memories.

While the bufferpool will

1. Remove all the memories at reset_buffer()
2. Implement acquire_buffer() calling allocator's prepare_buffer()
3. Implement flush_start() calling allocator's flush()
4. start() is disabled since it pre-allocs buffers but also calls
   our reset_buffer() which will drop the memories and later the
   buffers are ditched, something we don't want. This approach avoids
   buffer pre-allocation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
d6f9cfc159 va: allocator: user gst_clear_object() for _buffer_surface_unref()
Event if this function is only used by gst_va_dmabuf_memories_setup(), it might
get reused later by GstVaDmabufAllocator's functions. This change makes the
function less fragile.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
10b3250175 va: allocator: renamed gst_va_dmabuf_memory_release()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
1617dcbe9e va: allocator: renamed available_mems queue
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
303b1ea350 va: allocator: rename gst_va_dmabuf_allocator_setup_buffer()
Since it's related with GstVaDmabufAllocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
bb586b227f va: allocator: calculated surface frame internally
Instead of using gst_buffer_get_size() just add the memory sizes reported by
exported fd.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
864f0c2ede va: allocator: make GstVaMemory shareable
Renamed the first variable member of GstVaMemory from parent to mem in
order to avoid confusion with GstMemory's parent.

When freeing the structure, memory's parent is check in order to
decide if surfaces has to be destroyed or not, since only the parent
class have to destroy it.

Removed GST_MEMORY_FLAG_NO_SHARE in memory initialization, since it is
deprecated.

Implemented allocator's share virtual method which creates a new
shallow GstVaMemory structure based on the passed one which will be
it's parent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
0b6d8e73ec va: allocator: remove copy method for GstVaMemory
Since the memory has to be shareable. That will be address in the next
commits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Víctor Manuel Jáquez Leal
43b950b252 va: allocator: remove va allocator mem_is_span() vmethod
Since it is the default by base class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1626>
2020-10-04 18:42:51 +00:00
Seungha Yang
a9314b4554 d3d11upload/d3d11download: Make use of staging buffer
... instead of direct cpu map for d3d11memory object. In this way,
we don't need per GstD3D11Memory staging texture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1627>
2020-10-04 15:44:03 +00:00
Seungha Yang
f35eeaa02b d3d11: Don't hold staging texture
Staging texture is used for memory transfer between system and
gpu memory. Apart from d3d11{upload,download} elements, however,
it should happen very rarely.

Before this commit, d3d11bufferpool was allocating at least one
staging texture in order to calculate cpu accessible memory size,
and it wasn't freed for later use of the texture unconditionally.
But it will increase system memory usage. Although GstD3D11memory
object is implemented so that support CPU access, most memory
transfer will happen in d3d11{upload,download} elements.

By this commit, the initial staging texture will be freed immediately
once cpu accessible memory size is calculated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1627>
2020-10-04 15:44:03 +00:00
Seungha Yang
899f9978f5 d3d11: Move to G_DECLARE_FINAL_TYPE
... and remove unnecessary forward declaration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1627>
2020-10-04 15:44:03 +00:00
Víctor Manuel Jáquez Leal
666eedc215 va: caps: centralize caps feature discovering
These function were repeated in the different implemented
elements. This patch centralize them.

The side effect is dmabuf memory type is no longer checked with the
current VAContext, but assuming that dmabuf is a consequence of caps
negotiation from dynamic generated caps templates, where the context's
memory types are validated, there's no need to validate them twice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1644>
2020-10-04 15:22:04 +00:00
Víctor Manuel Jáquez Leal
3653c19de3 va: filter: fix counter variable reuse
There was a bug reusing the counter variable i in nested loops. Also
the patch makes the code cleaner.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1643>
2020-10-04 16:05:03 +02:00
Sebastian Dröge
97e648a738 decklink: Correctly order the different dependent mode tables
One was forgotten in 309f6187fe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1617>
2020-10-01 06:29:19 +00:00
Seungha Yang
a668de747f wasapisrc: Make sure that wasapisrc produces data in loopback mode
An oddness of wasapi loopback feature is that capture client will not
produce any data if there's no outputting sound to corresponding
render client. In other words, if there's no sound to render,
capture task will stall. As an option to solve such issue, we can
add timeout to wake up from capture thread if there's no incoming data
within given time interval. But it seems to be glitch prone.
Another approach is that we can keep pushing silence data into
render client so that capture client can keep capturing data
(even if it's just silence).

This patch will choose the latter one because it's more straightforward
way and it's likely produce glitchless sound than former approach.

A bonus point of this approach is that loopback capture on Windows7/8
will work with this patch. Note that there's an OS bug prior to Windows10
when loopback capture client is running with event-driven mode.
To work around the bug, event signalling should be handled manually
for read thread to wake up.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1588>
2020-09-30 12:57:34 +00:00
Víctor Manuel Jáquez Leal
cd618f19b9 va: simplify VPP detection
Also the previous code failed if VPP was not present blacklisting the
plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1619>
2020-09-30 10:49:39 +02:00
Haihao Xiang
df49114275 msdk: call vaExportSurfaceHandle() to get DMABuf FD
Compared to vaAcquireBufferHandle(), vaExportSurfaceHandle() may
provide the handle details, so we needn't call vaDeriveImage().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1353>
2020-09-29 02:06:02 +00:00
He Junyan
709bec8f07 va: Implement the VA vp8 decoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587>
2020-09-25 17:07:30 +08:00
He Junyan
ae8f97ae34 va: codestyle: Clear all tabs in header files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587>
2020-09-25 17:07:10 +08:00
He Junyan
410938a069 va: util: make the _format_changed a common decoder function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587>
2020-09-25 17:07:05 +08:00
Víctor Manuel Jáquez Leal
00b73cfddd va: h264dec: allocate output buffers according DPB size
Instead of allocating the maximal number of references for output
buffers, this patch reduces the memory foot print in many cases by
just allocating the output buffers required for the DPB.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1595>
2020-09-24 20:35:49 +02:00
Víctor Manuel Jáquez Leal
755d769045 va: decoder: store output buffer rather than surface
GstVaDecodePicture stored the processed VASurfaceID, under the
assumption that the bufferpool with keep the referenced buffers, but
this approach is fragil.

This patch changes GstVaDecodePicture to store the output buffer,
which already contains its VASurfaceID, and provides a new method to
retrieve the VASurfaceID directly from picture.

Based on He Junyan <junyan.he@intel.com> patches for
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1587

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1594>
2020-09-24 15:36:06 +02:00
Matthew Waters
6c26d0e1a0 vtdec/vulkan: use Shared storage mode for IOSurface textures
Fixes a debug assertion with i(Pad)OS 14:

'IOSurface textures must use MTLStorageModeShared'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1592>
2020-09-23 23:21:50 +00:00
Víctor Manuel Jáquez Leal
990d1bfbce va: vpp: global lock to handle shared buffers
Add a global mutex to exclusive access to shared stream buffers, such
as DMABufs or VASurfaces after a tee:

LIBVA_DRIVER_NAME=iHD \
gst-launch-1.0 v4l2src ! tee name=t t. ! queue ! \
  vapostproc skin-tone=9 ! xvimagesink \
  t. ! queue ! vapostproc ! xvimagesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
9845ec68dc va: add vapostproc element
Video postprocessor for VA-API

Funcionalities: resize frames, change format, import buffers, apply
filters (such as denoise, sharpen, orientation, if driver offers them).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
117453b947 va: allocator: export composed layer for YUY2 and UYVY
This is a result of an error reported by i965 driver which only can
export composed layer for these formats. This seems to work too with
iHD. These formats are not exposed as native surfaces in Gallium.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
a4e535d5c1 va: allocator: add gst_va_dmabuf_buffer_setup()
This function will take an array of DMABuf GstMemory and an array of
fd, and create a VASurfaceID with those fds. Later that VASurfaceID is
attached to each DMABuf through GstVaBufferSurface.

In order to free the surface GstVaBufferSurface now have GstVaDisplay
member, and _buffer_surface_unref() were added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
6ac4e79b21 va: allocator: try to get VASurfaceID from every DMABuf allocator
Relax the check of the allocator type, because now the qdata can be
attached for other DMABuf allocators.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
20e493981b va: allocator: try to create surface without fourcc but chroma only
There are, in VPP, surfaces that doesn't support 4:2:2 fourccs but it
supports the chroma. So this patch gives that opportunity to the
driver.

This patch also simplifiies
gst_va_video_surface_format_from_image_format() to just an iterator
for surfaces available formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
482a7d7d7e va: allocator: create surfaces with VASurfaceAttribExternalBuffers
Add a new parameter to _create_surfaces(): a pointer to
VASurfaceAttribExternalBuffers.

If it's defined the memory type is changed to DRM_PRIME, also a new item is
added to the VASurfaceAttrib array with
VASurfaceAttribExternalBufferDescriptor.

Also, the VASurfaceAttrib for pixel format is not mandatory anymore. If fourcc
parameter is 0, is not added in the array, relying on the chroma. This is
useful when creating surfaces for uploading or downloading images.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
f306b1e0fe va: pool: use gst_object_replace() for allocator
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
f6a623d565 va: device: use gst_clear_object()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
6af7ec3c0f va: caps: expose gst_caps_set_format_array()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
2020-09-23 18:19:22 +02:00
Víctor Manuel Jáquez Leal
b1a1e2d841 va: vah264dec: fix documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1591>
2020-09-23 15:14:21 +00:00
Haihao Xiang
912fa7ce99 msdk: add support for AV1 decoding
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1448>
2020-09-22 06:54:27 +00:00
Víctor Manuel Jáquez Leal
9ed141734e va: utils: use GstObject for GstVaDisplay in context
Thus application could fetch the GstVaDisplay through the sync bus
without knowning the specific implementation, and sharing it or
extract properties.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1586>
2020-09-21 17:07:51 +00:00
Víctor Manuel Jáquez Leal
ed80aa5d6b va: utils: fix code style and wrong log message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1586>
2020-09-21 17:07:51 +00:00
Víctor Manuel Jáquez Leal
9e9e5c72d5 va: h264dec: add documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1585>
2020-09-20 09:21:08 +02:00
Haihao Xiang
9443bf7a22 msdk: enable GPUCopy
Note it works for system memory only

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/910>
2020-09-20 01:40:08 +00:00
Haihao Xiang
1d082baf18 msdk: call MFXInitEx instead of MFXInit
MFXInitEx has more control than MFXInit. The current setting in this
commit is identical to MFXInit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/910>
2020-09-20 01:40:08 +00:00
Víctor Manuel Jáquez Leal
467618f8ac va: decoder: render picture only if data
Call vaRenderPicture() only if buffer or slice data is available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1584>
2020-09-19 14:32:13 +02:00
Víctor Manuel Jáquez Leal
ad019a1d01 va: decoder: warn if decode fails on a surface
Instead of logging error if a step fails, it logs a warning message
reducing the noise and obeying the rule for errors since the program
doesn't end

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1584>
2020-09-19 14:32:13 +02:00
Víctor Manuel Jáquez Leal
ad839ada5b va: h264dec: check is pad has fixed caps at caps query
Otherwise it will always reply with the possible driver caps, which
generates problems with Web MSE players.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1583>
2020-09-19 13:00:49 +02:00
Seungha Yang
2fe1afeafa va: h264dec: Don't need to set pts/dts/duration on outputting frame
It will be handled by videodecoder baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1582>
2020-09-18 23:50:54 +00:00
Nicolas Dufresne
671d9fed3a kmssink: Do not source using padded width/height
The width/height from the video meta can be padded width, height. But when
sourcing from padded buffer, we only want to use the valid pixels. This
rectangle is from the crop meta, orther it is deduces from the caps. The width
and height from the caps is save in the parent class, use these instead of the
GstVideoInfo when settting the src rectangle.

This fixes an issue with 1080p video displaying repeated or green at the
padded bottom 8 lines (seen with v4l2codecs).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1580>
2020-09-18 16:26:23 +00:00
Seungha Yang
ea24a2e527 d3d11: Add support for packed 8bits 4:2:2 YUV formats
Note that newly added formats (YUY2, UYVY, and VYUY) are not supported
render target view formats. So such formats can be only input of d3d11convert
or d3d11videosink. Another note is that YUY2 format is a very common
format for hardware en/decoders on Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1581>
2020-09-18 14:47:21 +00:00
Randy Li (ayaka)
2f5904c20d msdk: vpp: fixup passthrough checking for DMA
I think it is just a typo from e1a90f1ec9
msdkvpp: Disable passthrough if memory capsfeature changes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1559>
2020-09-16 03:02:31 +00:00
Seungha Yang
08119ea515 d3d11vp9dec: Don't need to consider output_picture() call without GstVideoCodecFrame
Baseclass will be updated in order to ensure GstVideoCodecFrame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1567>
2020-09-15 15:54:53 +00:00
Seungha Yang
b73a223dc5 d3d11vp9dec: Specify profile and alignment on sink template
Set supported profile(s) on sink template caps, so that decodebin
can filter out this element if profile of given vp9 stream is not
supported by hardware decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1567>
2020-09-15 15:54:53 +00:00
Seungha Yang
bb5ef4fd5b d3d11decoder: Cleanup code
* Don't need to set pts/dts/duration on output buffer of frame.
  it's handled by baseclass
* Remove meaningless debug output

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1567>
2020-09-15 15:54:53 +00:00
Víctor Manuel Jáquez Leal
261d6e463a Revert "va: h264dec: set latency"
This reverts commit 3aedef4c86.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1531>
2020-09-14 16:48:31 +00:00
Nicolas Dufresne
20785e775e v4l2slh264dec: Minor cleanup
Move few variables in their respective scope.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1563>
2020-09-10 15:21:57 +00:00
Nicolas Dufresne
cc8e1ca2ac v4l2slh264dec: Fix B-Frame weight table
We where not setting the luma l1 weight table.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1563>
2020-09-10 15:21:57 +00:00
Seungha Yang
47bbc997f8 mfvideosrc: Set timestamp on buffer when it's captured
Capture the timestamp immediately when new frame is arrived,
instead of doing that on ::create() method. There would be
time gap between captured time and outputting time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1351>
2020-09-10 10:21:00 +00:00
Seungha Yang
d1d2acead1 mfvideoenc: Add support for zero-copy encoding
Add custom IMFMediaBuffer and IMF2DBuffer implementation in order to
keep track of lifecycle of Media Foundation memory object.
By this new implementation, we can pass raw memory of upstream buffer
to Media Foundation without copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1518>
2020-09-09 07:25:52 +00:00
Sebastian Dröge
64039cdf84 gst: Update for gst_video_transfer_function_*() function renaming
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1557>
2020-09-07 12:14:47 +03:00
Haihao Xiang
cc3057e4ea msdkvp9dec: change the include header order
This fixes the compiler error when MFX_VERSION_USE_LATEST is defined in
the SDK.

/usr/include/mfx/mfxvp9.h:48:5: error: unknown type name ‘mfxExtBuffer’
     mfxExtBuffer Header;

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1549>
2020-09-01 13:57:13 +08:00
Jérôme Laheurte
ccfb799d83 dshowsrcwrapper: Update build instructions. Add _builddir to include search path.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1537>
2020-08-28 23:00:53 +00:00
Jérôme Laheurte
02666d929f dshowsrcwrapper: fix typo in variable name
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1538>
2020-08-25 10:49:11 +02:00
Seungha Yang
95e007ac49 d3d11videosink: Fix crash caused by missing null termination
gst_caps_features_new() must be null terminated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1524>
2020-08-24 20:03:05 +00:00
Víctor Manuel Jáquez Leal
7c696b67be va: allocator: remove parameter from _create_buffer_surface()
Don't the allocator to _create_buffer_surface() since it's not used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516>
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
80de32b017 va: utils: free allocated string
and fix a memleak

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516>
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
69a00541dd va: utils: fix log category initialization
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516>
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
c905f6131d va: h264dec: check va allocator at decide allocation
And some code cleanups

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516>
2020-08-24 19:35:57 +00:00
Víctor Manuel Jáquez Leal
f755730b20 va: decoder: improve locks for member variable access
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1516>
2020-08-24 19:35:57 +00:00
Seungha Yang
5d4ab18ced mediafoundation: Correct wrong raw video format mapping
Was a shameful mistake

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1517>
2020-08-17 21:39:13 +09:00
Víctor Manuel Jáquez Leal
3aedef4c86 va: h264dec: set latency
The min latency is calculated with the maximum number of frames that
precede any frame, if available, and it is lower than the maximum
number of frames in DBP.

The max latency is calculated with the maxium size of frames in DBP.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1500>
2020-08-17 09:32:41 +00:00
Seungha Yang
5ffd2c64a0 mediafoundation: Call MFShutdown when destroying plugin
MFStartup and MFShutdown should be paired as documented in
https://docs.microsoft.com/en-us/windows/win32/api/mfapi/nf-mfapi-mfstartup#remarks
Otherwise valgrind-like tools would report false positive memory leak.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1512>
2020-08-13 07:05:36 +00:00
Xu Guangxin
9123b9ba39 msdkvpp: do not hold too many input buffers in locked list
If the surface is locked before vpp, upstream takes the reference.
We do not need to take a reference for msdk in vpp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1490>
2020-08-13 01:43:19 +00:00
Xu Guangxin
ea0aac4c19 msdkvpp: refact, put input and output surface in diffrent list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1490>
2020-08-13 01:43:19 +00:00
Seungha Yang
185d2f56a3 d3d11: Handle newly added GST_VIDEO_TRANSFER_BT601
Use the value for mapping between DXGI_COLOR_SPACE_TYPE and GstVideoColorimetry.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1410>
2020-08-12 15:18:56 +00:00
Seungha Yang
205ad89802 d3d11: Store more device information in context structure
It would be more informative for debugging

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1507>
2020-08-12 14:04:55 +00:00
Seungha Yang
ff9157eef4 d3d11: Selected adapter index should be unsigned integer
If d3d11device was created successfully, the index of adapter
must not be negative value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1507>
2020-08-12 14:04:55 +00:00
Víctor Manuel Jáquez Leal
122a3cc40c va: h264dec: remove spurious comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1499>
2020-08-10 15:36:47 +00:00
Víctor Manuel Jáquez Leal
159562faf7 va: h264dec: check return value of gst_va_handle_set_context()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1499>
2020-08-10 15:36:47 +00:00
Matthew Waters
d1667da0c3 build: update for gl pkg-config file split
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1462>
2020-08-07 20:22:41 +10:00
Sebastian Dröge
309f6187fe decklink: Re-order modes enum for backwards compatibility with 1.16
The PAL/NTSC widescreen modes were added after 1.16 but inserted before
the HD modes, which changed the integer values of the enums.

Move them to the very end instead to keep backwards compatibility.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1048

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1492>
2020-08-06 12:22:04 +03:00
Andrew Branson
8a51fdbc2c androidmedia: ignore additional camera effects if not present
Fixes https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/283

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1470>
2020-08-04 11:07:33 +00:00
Víctor Manuel Jáquez Leal
6cf03b21f6 va: h264dec: log if upstream pool is kept
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1489>
2020-08-04 10:39:05 +02:00
Víctor Manuel Jáquez Leal
f332c35ec0 va: utils: fix precondition check for handle_context_query()
display paramater can be NULL, but if it's not, it has to be a
GstVaDisplay.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1489>
2020-08-04 10:39:05 +02:00
Víctor Manuel Jáquez Leal
62dacfd89a va: allocator: support for GST_MAP_VA map flag
This flag will return the VASurface value at mapping
2020-08-03 19:33:01 +02:00
Víctor Manuel Jáquez Leal
f7cfb422f1 va: context: instanciate VA display through GstContext
Add all the machinery to instanciate VA display through GstContext,
thus all va elements can share the same display and the user can set
a custom one.
2020-08-03 19:33:01 +02:00
Víctor Manuel Jáquez Leal
0cc1dccd84 va: h264dec: don't copy frames if VAMemory capsfeature is negotiated
Otherwise the VASurfaceID is lost.
2020-08-03 19:33:01 +02:00
Víctor Manuel Jáquez Leal
aa664a4eca va: h264dec: copy render_device_path in klass
It it's not copied both cdata and klass, the string is lost. Thus
also it's freed from cdata when freeing it.
2020-08-03 19:33:01 +02:00
Víctor Manuel Jáquez Leal
040c799cd8 va: display: wrapped: Fix property name 2020-08-03 19:33:01 +02:00
Víctor Manuel Jáquez Leal
585295e82b va: decoder: remove unused argument
And that changes function's namespace
2020-08-03 19:33:01 +02:00
Víctor Manuel Jáquez Leal
5154ee7f4c va: caps: bail raw caps if driver doesn't report surface formats
This is a bug in Gallium RadeonSI driver for Polaris10, which doesn't
report sufrace formats for reported chroma.

If one chroma doesn't report surface formats, skip the generated caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1483>
2020-08-03 15:54:45 +00:00
Víctor Manuel Jáquez Leal
d3ef3d562a va: allocator: get a surface format from a image format
For the allocator to create surfaces with the correct chroma an
fourcc, it should use a surface format, not necessarily the negotiated
format.

Instead of the previous arbitrary extra formats list, the decoder
extracts the valid pixel formats from the given VA config, and pass
that list to the allocator which stores it (full transfer).

Then, when the allocator allocates a new surface, it looks for a
surface color format chroma-compatible with the negotiated image color
format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1483>
2020-08-03 15:54:45 +00:00
Víctor Manuel Jáquez Leal
2327ac4a13 va: caps: add raw caps image formats with same chroma of surfaces
Instead of adding a list of ad-hoc formats for raw caps (I420 and
YV12), the display queries the available image formats and we assume
that driver can download frames in that available format with same
chroma of the config surfaces chroma.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1483>
2020-08-03 15:54:45 +00:00
Víctor Manuel Jáquez Leal
9db747e4d0 va: display: add gst_va_display_get_image_formats()
For this it was also added gst_va_video_format_from_va_image_format()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1483>
2020-08-03 15:54:45 +00:00
Víctor Manuel Jáquez Leal
39e55129d5 va: decoder: initialize rt_formas to zero
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1483>
2020-08-03 15:54:45 +00:00
Seungha Yang
9b72b04dad d3d11download: Allow linking with downstream d3d11 elements
It will make pipeline configuration easier since d3d11download
element can be placed unconditionally. This behavior is similar
to that of gldownload element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1485>
2020-08-03 13:10:07 +00:00
Seungha Yang
4986b0dd34 mfvideosrc: Select common formats if both VideoPreview and VideoRecord are available
Some devices (e.g., Surface Book 2, Surface Pro X) will expose
both MediaStreamType_VideoPreview and MediaStreamType_VideoRecord types
for a logical device. And for some reason, MediaStreamType_VideoPreview
seems to be selected between them while initiailzing device.
But I cannot find any documentation for the decision rule.
To be safe, we will select common formats between them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1478>
2020-08-01 15:17:05 +00:00
Seungha Yang
479a67c1b7 mfvideosrc: Check framerate for target IMediaFrameFormat selection
Not only resolution and format, but framerate needs to be checked
for proper target IMediaFrameFormat selection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1478>
2020-08-01 15:17:05 +00:00
Seungha Yang
3fb8caf635 mfvideosrc: Handle I420/IYUV subtypes for UWP cases
Microsoft defines two I420 formats, one is I420, and the other is
IYUV (but both are same, just names are different).
Since both will be converted to GST_VIDEO_FORMAT_I420,
we should check both I420 and IYUV subtypes during
GstVideoFormat to Microsoft's format conversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1478>
2020-08-01 15:17:05 +00:00
Seungha Yang
2303ad7bf4 mfvideosrc: Add more debug log
It would be useful for finding the error reason.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1478>
2020-08-01 15:17:05 +00:00
Seungha Yang
fc49886c61 wasapi2, mfvideosrc: Update "dispatcher" property to be only writable
Disallow getting dispatcher pointer, since it doesn't seem to be useful
and might not be safe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1480>
2020-07-31 21:50:16 +09:00
Seungha Yang
ed14e0d5a6 wasapi2device: Allow empty caps for UWP use case
If the device has not been activated yet, caps might not be available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1466>
2020-07-26 12:52:15 +00:00
Seungha Yang
9e56d20279 wasapi2: Activate device asynchronously if required
In case of UWP, documentation from MS is saying that
ActivateAudioInterfaceAsync() method should be called from UI thread.
And the resulting callback might not happen until user interaction
has been made.
So we cannot wait the activation result on constructed() method.
and therefore we should return gst_wasapi2_client_new()
immediately without waiting the result if wasapi2 elements are
running on UWP application.
In addition to async operation fix, this commit includes COM object
reference counting issue around ActivateAudioInterfaceAsync() call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1466>
2020-07-26 12:52:15 +00:00
Seungha Yang
b10afc574e wasapi2: Add a new property for ICoreDispatcher setting
... so that ensure device activation on UI thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1466>
2020-07-26 12:52:15 +00:00
Seungha Yang
6d960781fc mfvideosrc: Only device activation needs to be running on UI thread
... and the other operations does not have the thread constraint.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1466>
2020-07-26 12:52:15 +00:00
Seungha Yang
502aea3969 mfvideosrc: Add a new property for ICoreDispatcher setting
Since the commit c29c71ae9d,
device activation method will be called from an internal thread.

A problem is that, CoreApplication::GetCurrentView()
method will return nullptr if it was called from non-UI thread,
and as a result, currently implemented method for accessing ICoreDispatcher
will not work in any case. There seems to be no robust way for
accessing ICoreDispatcher other then setting it by user.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1466>
2020-07-26 12:52:15 +00:00
Seungha Yang
42de98fd42 mfvideosrc: Suppress more spammy debug messages
The failure on compressed format (e.g., MJPG, H264 subtypes) is expected.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1468>
2020-07-26 05:48:48 +09:00
Seungha Yang
d03e959f54 d3d11window: Remove timeout and wait a task if possible
If the run_async() method is expected to be called from streaming
thread and not from application thread, use INFINITE as timeout value
so that d3d11window can wait UI dispatcher thread in any case.

There is no way to get a robust timeout value from library side.
So the fixed timeout value might not be optimal and therefore
we should avoid it as much as possible.

Rule whether a timeout value can be INFINITE or not is,
* If the waiting can be cancelled by GstBaseSink:unlock(), use INFINITE.
  GstD3D11Window:on_resize() is one case for example.
* Otherwise, use timeout value
  Some details are, GstBaseSink:start() and GstBaseSink:stop() will be called
  when NULL to READY or READY to NULL state change, so there will be no
  chance for GstBaseSink:unlock() and GstBaseSink:unlock_stop()
  to be called around them. So there is no other way then timeout way.
  GstD3D11Window:consturcted() and GstD3D11Window:unprepare() are the case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1461>
2020-07-24 04:53:44 +00:00
Seungha Yang
6ede4a99a7 d3d11window: Increase timeout to 10 sec for WinRT window implementations
No strong reason for this number, but we can follow other well known
UWP implementation ANGLE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1461>
2020-07-24 04:53:44 +00:00
Seungha Yang
deaa29bd96 codecs: vp8decoder: Sync up with h264decoder implementation
Pass GstVideoCodecFrame with GstVp8Picture to new_picture() and
output_picture() methods for subclass to be able to reference
it directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1458>
2020-07-23 15:48:05 -04:00
Seungha Yang
c78fe6bfb0 v4l2codecs: vp8dec: Remove white space
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1458>
2020-07-23 18:57:02 +00:00
Seungha Yang
e754d5a5b2 codecs: vp9decoder: Sync up with h264decoder implementation
* Pass GstVideoCodecFrame to new_picture() and output_picture()
* Pass the last reference of GstVp9Picture to subclass if possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1455>
2020-07-23 15:41:39 +00:00
Seungha Yang
8821165648 wasapi2: Fix broken debug log
I hope that MSVC is smart enought to warn this at build time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1459>
2020-07-23 14:37:52 +00:00
Seungha Yang
87b150c42a v4l2codecs: h264dec: Remove outdated comment
... and unnecessary user data clear on GstVideoCodecFrame

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1457>
2020-07-23 18:07:58 +09:00
Seungha Yang
96b9000289 v4l2codecs: h264dec: Fix leak on decoding failure
Given GstVideoCodecFrame and GstH264Picture should be cleared,
and the return must be GST_FLOW_ERROR, not boolean value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1457>
2020-07-23 18:07:11 +09:00
Seungha Yang
128e533a6e d3d11decoder: Disable array-of-texture
Some 4K VP9 + super frame enabled streams would be broken with
array-of-texture configuration (i.e., allowing runtime texture registration
for DPB).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1456>
2020-07-22 16:06:47 +00:00
Seungha Yang
3422868c59 mfutils: Suppress spammy debug print
Remove FIXME debug print. It seems to be spammy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1452>
2020-07-22 18:11:18 +09:00
Seungha Yang
6c52008413 mfvideosrc: Expose sorted caps
Sort the list of supported caps for downstream to be able to select
the best image in terms of quality (resolution and framerate) by default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1452>
2020-07-22 18:11:18 +09:00
Seungha Yang
c3ecea0aa4 mfvideosrc: Don't expose unsupported formats
Some UVC cameras support H.264 stream but we don't support it yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1452>
2020-07-22 18:10:57 +09:00
Víctor Manuel Jáquez Leal
820bbc1bce va: documentation since tag
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1387>
2020-07-21 16:15:47 +00:00
Víctor Manuel Jáquez Leal
1ca39b571d vah264dec: add documentation caps for pad templates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1387>
2020-07-21 16:15:47 +00:00
Seungha Yang
2a0de96015 d3d11window: Disable d3d11 video processor for HDR10 stream.
d3d11 video processor is showing buggy behaviors in various cases.
And this HDR10 is one case of them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1454>
2020-07-21 15:41:20 +00:00
Nicolas Dufresne
bb9fbf0626 v4l2codecs: h264dec: Use the new picture lookup
This will avoid having to create a reference chain from CodecFrame
to GstH264Picture to GstV4l2Request.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1449>
2020-07-21 17:18:42 +09:00
Seungha Yang
e921a07715 codecs: h264decoder: Pass GstVideoCodecFrame to output_picture()
All subclasses are retrieving list to get target output frame, which
can be done by baseclass. And pass the ownership of the GstH264Picture
to subclass so that subclass can clear implementation dependent resources
before finishing the frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1449>
2020-07-21 17:18:42 +09:00
Seungha Yang
7a024a740f codecs: h264decoder: Don't attach extra ref of GstH264Picture to GstVideoCodecFrame
The lifecycle of GstH264Picture is being managed by our DPB
implementation. If it's still required, subclass can do that
by itself in the new_picture() method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1449>
2020-07-21 17:18:42 +09:00
Seungha Yang
37aeb91d54 mfvideosrc: Don't error out when if we've found supported format
While retrieving supported formats by device, the last return might
not be S_OK in case that it's not supported one by us (e.g., H264, JPEG or so).
But if we've found at least one supported raw video format,
we can keep going on.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1451>
2020-07-20 16:13:37 +00:00
Seungha Yang
c1093e3481 plugins: Use g_win32_error_message for HRESULT to string conversion
We don't need to duplicate a method for HRESULT error code to string
conversion. This patch is intended to
* Remove duplicated code
* Ensure FormatMessageW (Unicode version) and avoid FormatMessageA
  (ANSI version), as the ANSI format is not portable at all.
  Note that if "UNICODE" is not defined, FormatMessageA will be aliased
  as FormatMessage by default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1442>
2020-07-18 11:05:52 +09:00
Seungha Yang
f68c8d853b wasapi2util: Fix wrong use of debug category
Haven't noticed so far since there is no debug statement in the source file.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1445>
2020-07-17 15:58:16 +09:00
Silvio Lazzeretti
3803fa29b2 wasapi: added missing lock release in case of error in gst_wasapi_xxx_reset
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1440>
2020-07-15 20:11:48 +00:00
Nicolas Dufresne
7b3c101ced v4l2codecs: Enable 32x32 tiled NV12 support
This is used by Cedrus driver to support Allwinner VPU, also known as the
sunxi platforms.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1437>
2020-07-15 13:24:13 +00:00
Haihao Xiang
e7160a97cf msdkh265enc: add the missing comma
Otherwise main-444 and main-444-10 are concatenated

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1436>
2020-07-15 08:38:07 +08:00
Seungha Yang
a43d6f6cd9 mfvideosrc: Enable WinRT capture impl. for desktop target
... if target OS version was specified as Windows 10.
When enabled, desktop application can select target capture
implementation between WinRT and Win32
via GST_USE_MF_WINRT_CAPTURE environment
(e,g., GST_USE_MF_WINRT_CAPTURE=1 for WinRT impl.).
Default is Win32 implementation in case of desktop target.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1434>
2020-07-14 16:59:06 +00:00
Seungha Yang
495ed45d05 d3d11decoder: Disable zero-copy for Qualcomm devices
Qualcomm driver looks buggy in zero-copy scenario. Even if we disable
zero-copy, device-to-device memory copy will be used with d3d11videosink
which should be fast enough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1432>
2020-07-12 01:40:45 +09:00
Haihao Xiang
c0e809d6b8 msdkh265enc: add support for screen content coding extension
Because the valid input formats for screen content coding extension is
a subset of input formats for range extension, user must specify the
profile for screen content coding extension in the caps filter

Example:
gst-launch-1.0 videotestsrc ! video/x-raw,format=NV12 ! msdkh265enc
low-power=1 ! video/x-h265,profile=screen-extended-main ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1389>
2020-07-11 23:42:52 +08:00
Haihao Xiang
e1d1cb07a6 msdkh265enc: allow user to choose profile
Example:
gst-launch-1.0 videotestsrc ! video/x-raw,format=NV12 ! msdkh265enc !
video/x-h265,profile=main-444 ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1389>
2020-07-11 23:42:52 +08:00
Haihao Xiang
55f3590317 msdkenc: support tune property in msdkh264enc and msdkh265enc
Introduce a new property for encoding mode selection, the default value
for this new property allows the SDK to decide what to do. In addition,
low-power is marked as deprecated since this fix

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1426>
2020-07-11 13:57:52 +00:00
Haihao Xiang
3ecb2a82be Revert "msdkh265enc: let MSDK select the encoding mode by default"
This reverts commit 9e977832c1.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1426>
2020-07-11 13:57:52 +00:00
Seungha Yang
ad8529caf7 d3d11: Disable D3D11Debug and DXGIDebug layer for UWP build
WACK (Windows App Certification Kit) doesn't seem to be happy with
the DXGIGetDebugInterface1 symbol.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1421>
2020-07-08 21:11:31 +00:00
Haihao Xiang
9e977832c1 msdkh265enc: let MSDK select the encoding mode by default
MSDK may support lowpower and non-lowpower modes, some features are
available only under one of the two modes, which is hard to know for
user, so let MSDK select the mode by default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1405>
2020-07-06 14:43:31 +00:00
Matthew Waters
c94675f1d4 decklinkvideosink: write the cdp timecode data correctly
We were mixing up the tens part with the unit parts all over the place.

e.g. 12 seconds would be encoded as 0x21 instead of the correct 0x12

Aligns the code with the same change applied to ccconverter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1400>
2020-07-03 06:54:46 +00:00
Nicolas Dufresne
1bef43f9d4 v4l2decoder: Track pending request
With the asynchronous slice decoding, we only queue up to 2 slices
per frames. That side effect is that now we are dequeuing bitstream
buffers in both decoding and presentation order. This would lead to
a bitstream buffer from a previous frame being dequeued instead of
the expected last slice buffer and lead to us trying to queue an
already queued bitstream buffer.

We now fix this by tracking pending requests. As request are executed
in decoding order, we marking a request done, we can effectively
dequeue bitstream buffer from all previous request, as they have been
executed already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
a88e63dd2f v4l2decoder: Improve debug tracing
Add some missing traces and move per-slice operation to TRACE level to
reduce the noise level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
d5a205cff4 v4l2decoder: Convert request pool to GstQueueArray
The decoder is not being access from multiple threads, instead it is
always protected by the streaming lock. For this reason, a
GstAtomicQueue for the request pool is overkill and may even introduce
unneeded overhead. Use a GstQueueArray in replacement, the
GstQueueArray is a good fit since the number of item is predictable and
unlikely to vary at run-time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
a2eb1b57ff v4l2slh264dec: Wait on previous pending request in slice mode
In slice mode, we'll do one request per slice. In order to recycle
bitstream buffer, and not run-out, wait for the last pending
request to complete and mark it done.

We only wait after having queued the current slice in order to reduce
that potential driver starvation and maintain performance (using dual
buffering).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
b20c6fe6c4 v4l2slh264dec: Renew bitstream buffer after submitting slice
Submitting a slice actually clears the bitstream buffer. Ensure we
have a newly allocated bitstream buffer for the next slice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
bc1a0323a9 v4l2slh264dec: Factor out bitstream allocation
No functional changes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
779f331bd4 v4l2slh264dec: Add a helper to ensure output buffer
In preparation of multi-slice decoding, we will decode multiple
slices into the same buffer. This will ensure we have a buffer to
decode to, queued into the driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
d65f7de650 v4l2slh264dec: Factor out request wait
This will be reused to wait for previous slices to be complete
when dealing with following slices (in slice decoding mode).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
176a860169 v4l2slh264dec: Remove double return in submit_bitstream()
This is code cleanup, no functional changes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Nicolas Dufresne
1f48e60bde v4l2slh264dec: Fix typo in debug trace
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1395>
2020-07-02 12:21:51 -04:00
Mathieu Duponchelle
b33f10e7e2 docs: remove gst prefix from plugin titles 2020-07-02 18:10:21 +02:00
Seungha Yang
8d0dc4fdd2 plugins: Update for documentation of Windows plugins
* Add Since marks
* Make use of GST_PARAM_CONDITIONALLY_AVAILABLE flag
2020-07-02 17:21:29 +02:00
Seungha Yang
76793ffabc nvcodec: Update for documentation
* Add Since marks
* Make use of GST_PARAM_CONDITIONALLY_AVAILABLE flag
* Add documentation template caps
2020-07-02 17:21:24 +02:00
Seungha Yang
73ddf27898 dxgiscreencapsrc: Add missing debug category init
This should've been addressed in the commit 9042062072
but I was missed it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1383>
2020-06-30 02:51:14 +09:00
Víctor Manuel Jáquez Leal
79d11c2022 va: VA-API H.264 decoder and infrastructure
New plugin with an element for H.264 decoding with VA-API. This novel
approach, different from gstreamer-vaapi, uses gstcodecs library for
state handling.

The code is expected to looks cleaner because it uses VA-API without
further layers or wrappers.

* It uses the first supported DRM device as default VA display (other
  displays will be supported through user's GstContext)
* Requires libva >= 1.6
* No multiview/stereo profiles neither interlaced streams because
  gstcodecs doesn't handle them yet
* It is incompatible with gstreamer-vaapi
* Even if memory:VAMemory is exposed, it is not handled yet by any
  other element
* Caps templates are generated dynamically querying VAAPI, but YV12
  and I420 are added for system memory caps because they seem to be
  supported for all the drivers when downloading frames onto main
  memory, as they are used by xvimagesink and others, avoiding color
  conversion.
* Surfaces aren't bounded to context, so they can grow beyond the DBP
  size, allowing smooth reverse playback.
* There isn't yet error handling and recovery.
* 10-bit H.264 streams aren't supported by libva.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1379>
2020-06-28 11:47:35 +02:00
Seungha Yang
117f593cff d3d11h265dec: Fix possible invalid memory access
The number of element to copy should be num_tile_columns_minus1
and num_tile_rows_minus1.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1374>
2020-06-25 13:58:57 +00:00
Seungha Yang
48ca7c7e93 nvh265sldec: Fix possible invalid memory access
Fix Coverity issues.

CID 1464959, 1464960, 1464961, 1464962

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1374>
2020-06-25 13:58:57 +00:00
Seungha Yang
82189d6859 d3d11videosink: Disable d3d11videosink depending on supported feature level
Current shader code is not compatible with HLSL profile "ps_4_0_level_9_3"
or lower. So d3dcompiler cannot compile our shader code in that case.
Note that VirtualBox is one known driver which doesn't support currently
implemented shader code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1343>
2020-06-25 07:55:47 +00:00
Kevin King
eebfed0726 avfvideosrc: wait for permissions request dialog callback
otherwise gstreamer gives up on transitioning the pipeline before the
user has accepted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1370>
2020-06-24 18:56:53 +00:00
Seungha Yang
133b902044 nvh264sldec: Remove useless double space
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1357>
2020-06-24 16:25:58 +00:00
Seungha Yang
711e964572 nvcodec: Add H265 stateless codec implementation
Add a new GstCodecs based H265 decoder element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1357>
2020-06-24 16:25:58 +00:00
Seungha Yang
1e544f741a nvcodec: Move common methods to nvdecoder
... and remove all #ifdef from nvh264sldec implementation.
New helper methods will take care of OpenGL specific ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1357>
2020-06-24 16:25:58 +00:00
Seungha Yang
1f452c0577 nvh264sldec: Declare OpenGL related objects unconditionally
GstGLDisplay and GstGLContext are subclass of GstObject so we can
remove #ifdef for such object. This is prework for nvh265sldec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1357>
2020-06-24 16:25:58 +00:00
Seungha Yang
82ddb0600b nvh264sldec: Fix for possible wrong device selction
decoder should select assigned CUDA device id

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1357>
2020-06-24 16:25:58 +00:00
Mathieu Duponchelle
ad49ae42f7 docs: mark more types as plugin API 2020-06-23 12:10:19 -04:00
Seungha Yang
863c663b1d d3d11window_win32: Chain up mouse event to parent window
Unlike key event, mouse event will not be chained up to parent window
by DefWindowProc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1361>
2020-06-22 15:09:22 +00:00
Seungha Yang
9042062072 dxgiscreencapsrc: Load HLSL compiler library using g_module_open
Depending on OS version, available d3dcompiler library name is different.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
96a5760751 dxgiscreencapsrc: Reorganize debug category usage
Use the same debug category in all dxgiscreencap related source code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
4aa7d3d589 winscreencap: Remove trailing whitespaces
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
3dd2b6f20b d3d11device: Print supported DXGI format for debugging
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
8fe1aae96c d3d11: Load HLSL compiler library using g_module_open
Depending on OS version, available d3dcompiler library name is different.
But for UWP, we can still use the current way

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
9b8eec39b6 d3d11shader: Add missing config.h include
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
4997cde699 mediafoundation: Add VP9 encoder element
Some Intel GPUs support hardware accelerated VP9 encoding and
Microsoft provides software VP9 encoding implementation as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1295>
2020-06-22 07:58:03 +00:00
Seungha Yang
1a68da54b6 mfvideosrc: Add support for jpeg on Win32 application
Enable reading jpeg data from webcam if it's supported.
Note that this would be enabled only for Win32.
For UWP, we need to research more about how to support jpeg.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1342>
2020-06-17 17:45:32 +09:00
Seungha Yang
f508c8b988 mfvideosrc: Fix wrong casting
Don't cast ISoftwareBitmap to IMFMediaBuffer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1342>
2020-06-17 17:37:05 +09:00
Seungha Yang
86e3df9493 mfvideosrc: Add support YUY2 format for UWP
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1342>
2020-06-17 17:37:05 +09:00
Seungha Yang
8d7f537782 mediafoundation: Drop IMFCaptureEngine implementation
It was introduced for later use of its enhanced feature over IMFSourceReader
such as taking photo with video preview, audio/video capturing at
the same time, etc. But currently it's not our use case, and it would
be maintenance burden.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1342>
2020-06-17 17:37:05 +09:00
Seungha Yang
f899728dd4 d3d11: Don't assume response of context query has valid d3d11 device context
Peer elements should return FALSE if d3d11 device context is unavailable
but it might happen for some reason (e.g., wrong implementation or so)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1347>
2020-06-16 11:23:34 +00:00
Seungha Yang
bc99ea1e30 d3d11decoder: Disable zero-copy for blacklisted device
Should enable it for verified devices. For now, Xbox is blacklisted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
1144cdc63a d3d11decoder: Adjust alignment constraint for Xbox device
XBox doesn't seem to support 128 bytes alignment for 4K HEVC

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
fe361ecc25 d3d11window: Do not configure video processor for Xbox device
Disable video processor for Xbox until it's verified

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
d12c0c4c7b d3d11utils: Add a helper method for checking Xbox device
Required for some cases to work around device specific issue

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
b5c8889d4f d3d11videosink: Use GPU memory copy if possible
Even if fallback buffer is required (e.g., shader resource view is unavailable),
use direct GPU memory copy if possible. It must be much faster than
system memory copy approach.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
73b39407a6 d3d11videosink: Ensure shader resource view of fallback buffer
SRV must be configured for color conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
4471788e4a d3d11window: Fix typo "configureed"
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Jun-ichi OKADA
d43c5b6485 winscreencap: Add dxgiscreencapsrc element.
This element uses the Desktop Duplication API to capture the desktop screen at high speed.
It supports Windows 8 or later.

It has the following features compared to other elements:
 * Runs faster.
 * It works in High DPI environment.
 * Draws an accurate mouse cursor.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/863>
2020-06-16 10:30:13 +09:00
Xu Guangxin
610e477565 msdkdec: hold a reference for the surfaces locked by msdk
previous code releases GstBuffer too earlier. so we will see

ERROR                default gstmsdkvideomemory.c:77:gst_msdk_video_allocator_get_surface: failed to get surface available
ERROR         msdkbufferpool gstmsdkbufferpool.c:270:gst_msdk_buffer_pool_alloc_buffer:<msdkbufferpool0> failed to create new MSDK memory

We need to hold GstBuffer reference for msdk if the surfaced locked by msdk.

step to reproduce.
1. ffmpeg -f lavfi -i testsrc=duration=10:size=320x240:rate=30 -pix_fmt yuv420p -c:v libx265 test.265
2. GST_GL_PLATFORM=egl  gst-launch-1.0 -v filesrc location=test.265  ! h265parse ! msdkh265dec  ! queue ! glimagesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1277>
2020-06-15 02:46:53 +00:00
Seungha Yang
2e1bec7ff6 wasapi2: Fallback to IAudioClient interface if IAudioClient3 API is unavailable
When default device is selected, IAudioClient3 API doesn't look like
available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1332>
2020-06-11 12:40:44 +00:00
Seungha Yang
7ab51e85ab wasapi: Fix possible deadlock while downwards state change
IAudioClient::Stop() doesn't seem to wake up the event handle,
then read() or write() could be blocked forever by WaitForSingleObject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1329>
2020-06-11 11:40:26 +00:00
Nicolas Dufresne
483539f45c v4l2slh264dec: Fix reading mode and start code type
These two controls are not pointer based, so we don't need to pass any size or
pointer and need to copy the values afterward. This fixes H264 decoding
regression with Hantro and RKVDEC drivers.

Fixes 037730a787

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1330>
2020-06-09 10:52:44 -04:00
Seungha Yang
52a82f5b84 mftransform: Fix deadlock when MFT requests processing output twice
This sequence of event/data flow might happen

1) Initially we have one pending output event
  1-1) Then, process the pending output data
2) No pending input event, then we should wait new pending input event
  2-1) Wakeup by new pending event (but it's pending output event)

In above case, MFT will not report new pending input event
if pending output is not processed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1325>
2020-06-08 23:46:43 +09:00
Seungha Yang
309c679c43 mftransform: Add some debug log
Add some trace level log for debugging

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1325>
2020-06-08 23:42:22 +09:00
Seungha Yang
a6a4267c7b wasapi2: Add device provider implementation
Similar to device provider implementation of wasapi plugin,
this implementation supports only static probing.
But we can implement runtime device add/remove/update
monitoring using DeviceWatcher interface later.

See https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.devicewatcher

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1264>
2020-06-08 03:10:05 +00:00
Seungha Yang
2778457678 wasapi2: Introduce new WASAPI plugin
Add a new wasapi implementation mainly to support UWP application.
Basically the core logic of this plugin is almost identical to
existing wasapi plugin, but main target is Windows 10 (+ UWP).
Since this plugin uses WinRT APIs, this plugin most likely might not
work Windows 8 or lower.

Compared with existing wasapi plugin, additional features of this plugin are
* Fully compatible with both Windows 10 desktop and UWP application
* Supports automatic stream routing (auto fallback when device was removed)
* Support device level mute/volume control

But some features of existing wasapi plugin are not implemented
in this plugin yet
* Exclusive streaming mode is not supported
* Loopback feature is not implemented
* Cross-compile is not possible with current mingw toolchain
  (meaning that MSVC and Windows 10 SDK are required to build this plugin)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1264>
2020-06-08 03:10:05 +00:00
Seungha Yang
0f74785b8e mfvideoenc: Set PAR to output IMFMediaType
We've set it to input IMFMediaType but not for output.
So, if PAR is not 1:1, the input IMFMediaType will be accepted
by MFT (default is 1:1).
The PAR of input/output IMFMediaType must be identical

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1322>
2020-06-06 21:19:48 +09:00
Seungha Yang
cec6858401 mftransform: Don't try to drain if MFT is not running
Otherwise MFT will be blocked forever as no event can be generated by
IMFMediaEventGenerator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1322>
2020-06-06 21:03:05 +09:00
Mathieu Duponchelle
a048ce81d4 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
Seungha Yang
a38ac7a865 d3d11overlaycompositor: Fix wrong Y position calculation
The Y coordinate of vertex and screen/image are opposite

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1319>
2020-06-05 13:47:49 +00:00
Sebastian Dröge
74f2f733be plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 13:33:16 -04:00
Seungha Yang
c4a2fd7683 d3dvideosink: Use secondary rank
d3dvideosink will be replaced by d3d11videosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1311>
2020-06-03 17:57:40 +09:00
Seungha Yang
116d7453cb d3d11videosink: Assign primary rank
d3d11videosink has an advantage over d3dvideosink, such as
* Zero-copy playback with d3d11 decoders
* HDR rendering with 10-bit format/swapchain support
* UWP support
* Any system memory alignment/padding can be supported
* User can select target GPU device
And old d3dvideosink's functionality (e.g., navigation event, overlaycomposition)
can be covered by d3d11videosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1311>
2020-06-03 17:57:41 +09:00
Haihao Xiang
f685893ed2 msdkh265enc: add support 12-bit 420 encoding
P016 is used for 12-bit encoding in MediaSDK, so the Shift flag is set
in the mfx parameters

Sample pipeline:
gst-launch-1.0 videotestsrc ! video/x-raw,format=P012_LE ! msdkh265enc ! \
fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1174>
2020-06-01 05:04:30 +00:00
Xu Guangxin
52be289847 msdkvpp: fix "failed to create new MSDK memory"
all msdk output surfaces come from out_alloc_resp, so the buffer count is not resizable.
we need set min_buffers, max_buffers to same size.

steps to reproduce
1. ffmpeg -f lavfi -i testsrc=duration=10:size=320x240:rate=30:decimals=3 -pix_fmt yuv420p -c:v libx265 ~/bits/hevc/test.265
2. GST_GL_PLATFORM=egl gst-launch-1.0 -v filesrc location=~/bits/hevc/test.265  ! h265parse ! msdkh265dec  ! msdkvpp ! queue ! glimagesink
you will see error like this:
ERROR                default gstmsdkvideomemory.c:77:gst_msdk_video_allocator_get_surface: failed to get surface available
ERROR         msdkbufferpool gstmsdkbufferpool.c:270:gst_msdk_buffer_pool_alloc_buffer:<msdkbufferpool2> failed to create new MSDK memory
ERROR                msdkvpp gstmsdkvpp.c:297:create_output_buffer:<msdkvpp0> failed to create output video buffer
ERROR                msdkdec gstmsdkdec.c:699:gst_msdkdec_finish_task:<msdkh265dec0> Failed to finish frame
ERROR                msdkdec gstmsdkdec.c:1085:gst_msdkdec_handle_frame:<msdkh265dec0> Failed to finish a task

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1278>
2020-06-01 02:09:04 +00:00
Xu Guangxin
275518f661 msdkvpp: hold GstBuffer ref count for locked surfaces
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1278>
2020-06-01 02:09:04 +00:00
Seungha Yang
12532cc8bb mediafoundation: Use core dispatcher of current view instead of main view
Main view might be hidden depending on application's view tree.
In that case, ICoreApplication object doesn't return get_MainView() method

Note that nothing about this behavior was documented by Microsoft
https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication.mainview

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1310>
2020-05-29 23:01:08 +09:00
Seungha Yang
2dc689c2c8 mediafoundation: Fix undeclared identifier error on UWP build
Some symbols are not available in case of UWP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1306>
2020-05-28 12:04:43 +00:00
Seungha Yang
7b5f99b47a mediafoundation: Add support MP3 audio encoding
Add MediaFoundation MP3 encoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1280>
2020-05-27 10:34:47 +00:00
Seungha Yang
cee619486a mediafoundation: Add support for AAC encoding
Add MediaFoundation AAC encoder element.

Before Windows 10, mono and stereo channels were supported audio channels
configuration by AAC encoder MFT. However, on Windows 10,
5.1 channels support was introduced.

To expose correct range of support format by this element
whatever the OS version is, this element will enumerate
all the supported format by the AAC encoder MFT
and then will configure sink/src templates while plugin init.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1280>
2020-05-27 10:34:47 +00:00
Seungha Yang
18f5bdee16 mfutils: Move IMediaType release function to common utility
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1280>
2020-05-27 10:34:47 +00:00
Seungha Yang
c8469644dd mediafoundation: Add util function to dump IMFAttributes values
It would be useful for debugging.

Reference: https://docs.microsoft.com/en-us/windows/win32/medfound/media-type-debugging-code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1280>
2020-05-27 10:34:47 +00:00
Seungha Yang
bd8a415747 d3d11window_win32: Create internal window on parent window's thread
If parent and child windows are running on different thread,
there is always a chance to cause deadlock as DefWindowProc() call
from child window thread might be blocked until the message
is handled by parent's window procedure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1299>
2020-05-27 05:08:48 +09:00