Commit graph

551 commits

Author SHA1 Message Date
He Junyan 4c5d34648c va: h264enc: Fix the forgotten unlock() when getting device path property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2215>
2022-04-18 12:44:19 +08:00
Seungha Yang 23e280f05b qsvdecoder: Use system memory for non-d3d11 downstream
QSV's memory download implementation seems to be more faster
than our implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 22:59:48 +09:00
Seungha Yang 9543998aa3 qsv: Add H.265 decoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:31 +09:00
Seungha Yang d136c98770 qsv: Include single gstva.h
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:31 +09:00
Seungha Yang fba44e8a01 qsvh264dec: Don't register element if it's not supported by device
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:31 +09:00
Seungha Yang 0692a5dde9 qsvh264dec: Add support for packetized format
Handle avc/avc3 packetized formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 20:57:26 +09:00
Seungha Yang 3c3274a8da qsv: Move debug init into each source file
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 04:15:13 +09:00
Seungha Yang a9a49c235d qsvdecoder: Reset next_task_index per init_session()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2206>
2022-04-17 04:15:13 +09:00
Seungha Yang b5a8bef5a7 d3d11decoder: Copy HDR10 related caps field manually
If negotiate() is called from the set_format() chain, sinkpad may not
hold caps yet, so baseclass cannot copy it over to srcpad caps.
Copy them manually.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2203>
2022-04-16 18:36:41 +00:00
Seungha Yang 86cf307a6c qsvencoder: Rename property name i-frames to idr-interval
... and clarify the meaning of the value for each h264 and h265
encoder since the usage of mfxInfoMFX::IdrInterval is different
per codec.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2204>
2022-04-16 23:34:41 +09:00
Seungha Yang f848619ff4 qsvh265enc: Write HDR10 metadata SEI
If device supports HDR10 metadata API, write the information
into bitstream per IDR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2204>
2022-04-16 23:34:41 +09:00
Víctor Manuel Jáquez Leal a2a6ece487 vah264enc: Use GstVaFeature enum for enabling MBBRC.
GstVaFeature is a common enumeration for auto/disabled/enabled kind of
property setting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
2022-04-16 11:11:51 +00:00
Víctor Manuel Jáquez Leal 3a7c1ddb3c vah264enc: Move rate-control enum to encoder class helper.
Since it's a common enumeration used, as user setting property, for
most of codecs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
2022-04-16 11:11:51 +00:00
Víctor Manuel Jáquez Leal 81951c59ef vah264enc: Add device-path property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2169>
2022-04-16 11:11:51 +00:00
Corentin Damman c68c40a6bc cudautils: fix critical typo in gst_cuda_buffer_fallback_copy
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2194>
2022-04-16 02:16:22 +00:00
He Junyan c5546d476a va: h264enc: Correct the hierarchical level name for pyramid-b frames.
The current way names the level by the number of B frames it contains, the
less it contains, the higher level it is. So the non ref B frames are in the
lowest layer and the B frames in the highest level refer to I/P frames.
But the widely used way is just the opposite, the ref B frames are in the
lower level and non ref B frames are at the highest level.
The is just a terminology change, and does not have any effect for compression
result and quality.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2149>
2022-04-13 08:22:32 +00:00
Seungha Yang 83ba83924a amfh265enc: Handle preset option
Add missing preset option handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2165>
2022-04-13 01:46:34 +09:00
Seungha Yang 097919f79b amfencoder: Do shared resource copy only if texture belongs to other device
Staging texture from the same d3d11device can be copied without
shared resource handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2165>
2022-04-13 01:42:34 +09:00
Seungha Yang 2548014dfc win32: Enable high-resolution timer for MinGW build
timeapi.h is missing in our MinGW toolchain. Include mmsystem.h
header instead, which defines struct and APIs in case of our MinGW
toolchain. Note that in case of native Windows10 SDK (MSVC build),
mmsystem.h will include timeapi.h

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2153>
2022-04-12 15:09:16 +00:00
Andoni Morales Alastruey 2df32360b2 amfcodec: fix setting quality presets
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2159>
2022-04-12 12:14:04 +02:00
Seungha Yang ad9c435647 amfcodec: Fix for MinGW build
timeapi.h header might not be missing depending on toolchain.
Also do hard meson error if winmm dep is not available but
amfcodec is explicitly enabled.
And fixing various GCC build warning errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2155>
2022-04-11 18:44:40 +00:00
Seungha Yang ad434759a9 qsv: Add JPEG encoder
Note that YUY2 is not supported yet, since the format support is not
implemented now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2142>
2022-04-10 23:38:07 +09:00
Seungha Yang 89293656e4 amfcodec: Update plugin cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2143>
2022-04-10 03:15:02 +09:00
Seungha Yang a0d8133d60 nvencoder: Update property names and default values
Update properties of newly written D3D11/CUDA mode encoders
to be consistent with Intel QSV plugin. And rename "zerolatency"
to "zero-reorder-delay" because previous "zerolatency" may
misleading

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2140>
2022-04-09 14:00:35 +00:00
Seungha Yang 7b89cdbefe qsvencoder: Update property names and default values
Stop using MSDK plugins property naming, instead use unified names
and default values to be consistent with newly written NVIDIA encoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2140>
2022-04-09 14:00:35 +00:00
Seungha Yang f413449a28 amfcodec: Add support for h264/h265 encoding
New encoder implementations for AMD GPU using AMF API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2109>
2022-04-08 17:59:12 +00:00
Seungha Yang c41a72a1ff amfcodec: Import AMF SDK headers
SDK version v1.4.24 at the commit of
fbf12cd39f

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2109>
2022-04-08 17:59:12 +00:00
Seungha Yang 6e4ffaee1e msdk: Fix Windows build
Headers of gstva should not be included on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2141>
2022-04-09 02:13:57 +09:00
Seungha Yang 2291781087 d3d11window: Use ANSI version WIN32 API explicitly
We were using ANSI version APIs implicitly because UNICODE is not
defined by ourselves. But potentially it can be broken if user
defines UNICODE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2131>
2022-04-08 11:51:37 +00:00
Seungha Yang fb226f4733 d3d11: Run indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2131>
2022-04-08 11:51:37 +00:00
Seungha Yang 26fa35dcdf qsvencoder: Don't use USAGE_HINT_ENCODER and enable derived image support
Peformance issue by disabled derived image support was reported

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2111>
2022-04-04 21:18:13 +00:00
Seungha Yang b74da32b5c Revert "vah264enc: Disable derived image support"
This reverts commit 0011feb0d6.

The commit caused performance-wise regression for some platforms

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2111>
2022-04-04 21:18:13 +00:00
Tong Wu 4e97cc24a7 msdk: use mfxU32 instead of uint32_t
Msdk should use mfx variables defined in mfxdefs.h. Replace uint32_t
with mfxU32.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2091>
2022-04-04 20:28:25 +00:00
Seungha Yang 5ed8e416fe nvcodec: Fix typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2107>
2022-04-03 22:12:33 +09:00
Seungha Yang 9b5fe81d01 nvencoder: Fix operator overloading
GUID equality check was inverted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2107>
2022-04-03 22:09:19 +09:00
Seungha Yang 0011feb0d6 vah264enc: Disable derived image support
Behavior of derived image seems to be platform dependent and
it's buggy in some cases.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1110
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2086>
2022-04-02 07:04:03 +00:00
He Junyan 976356e159 va: h264enc: Do not use USAGE_HINT_ENCODER for input pool.
It seems that the VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER is used only
for the recon surfaces, if we set this flags for input raw surfaces,
the alignment is wrong and we get broken result.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2100>
2022-04-02 06:23:03 +00:00
Xavier Claessens b004464ac6 Remove glib and gobject dependencies everywhere
They are part of gst_dep already and we have to make sure to always have
gst_dep. The order in dependencies matters, because it is also the order
in which Meson will set -I args. We want gstreamer's config.h to take
precedence over glib's private config.h when it's a subproject.

While at it, remove useless fallback args for gmodule/gio dependencies,
only gstreamer core needs it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2031>
2022-04-01 16:32:17 +00:00
Seungha Yang b5ed0eb4b0 qsvencoder: Add support for VA memory
Use VA allocator and buffer pool implementation for zero-copy
encoding with upstream VA elements

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2030>
2022-03-31 20:48:24 +00:00
Seungha Yang 9c44b32c21 qsv: Use pipeline's VA context
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2030>
2022-03-31 20:48:24 +00:00
Víctor Manuel Jáquez Leal 6d2f57b6c7 libs: va: add VA allocator parameter for derived images usage.
Added GstVaFeature enum type, and new parameter for VA allocator's
set_format() and get_format(). Also added a new parameter in VA pool
gst_va_pool_new_with_config() and
gst_buffer_pool_config_set_va_allocation_params().

This new parameter will define if derived images will by used for
buffer mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2057>
2022-03-31 14:14:45 +00:00
Víctor Manuel Jáquez Leal 8759014f4c va: encoder: Remove unused allocation config.
Since it's also done inside of gst_va_pool_new_with_config().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2072>
2022-03-30 22:18:06 +00:00
Víctor Manuel Jáquez Leal 599257bf10 vapostproc: Build classification dynamically.
By default, the classification is
"Converter/Filter/Colorspace/Scaler/Video/Hardware", but if VA
post-processor driver supports either color balance, skin tone
enhancement, sharpening or noise reduction, "Effect" is added.

Thus, if vapostproc ranking is raised, it can be chosen by
autovideosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2066>
2022-03-30 04:24:35 +00:00
Víctor Manuel Jáquez Leal 400faf7361 va: Set <gst/va/gstva.h> as library single point entry header.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
He Junyan 990fbb3b52 va: Move allocators and pool objects into gstva library.
In order to other plugins use gstva objects, such as allocators and buffer
pools, this merge request move them from the va plugin to the gstva library.

This objects are not exposed in <gst/va/gstva.h> since they are not expected
to be used by users, only by plugin implementators.

Because of the surface copy design, which is used to implement allocator's
mem_copy() virtual function, depends on the vafilter, which is kept inside
the plugin, memory copy through VAPosproc is disabled and removed temporarly.

Also added some missing parameter validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
He Junyan 53783eab6c va: Move the video format functions into gstlibva.
Untabifying header file.

The logging category was moved from the plugin generic category to
the display category. It can argue that video formats hacks are
display dependant.

Added validations for input parameters.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
2022-03-29 19:48:30 +00:00
Seungha Yang 886cfecd36 qsvencoder: Add support for dynamic bitrate update
... and add more encoding options.

QSV API supports dynamic bitrate change without IDR insertion.
That's more efficient way of runtime encoding option update
than starting from new sequence with IDR per bitrate option change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2039>
2022-03-29 15:52:58 +00:00
Seungha Yang a8d7b10cc4 qsvh265enc: Add missing gop-size property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2039>
2022-03-29 15:52:58 +00:00
Seungha Yang 1a7b23dc02 qsv: Fix mfxFrameAllocator::Lock for encoder
Only read map is possible for encoder input system memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2039>
2022-03-29 15:52:58 +00:00
Matthew Waters b8a5e7a4e4 applemeida/texturecache: remove unused variable
Fixes:

../sys/applemedia/videotexturecache.m:71:20: error: variable 'features' set but not used [-Werror,-Wunused-but-set-variable]
  GstCapsFeatures *features;
                   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 3ffbb66593 applemedia/corevideobuffer: remove unused variable
Fixes:

../sys/applemedia/corevideobuffer.c:209:19: error: variable 'video_meta' set but not used [-Werror,-Wunused-but-set-variable]
    GstVideoMeta *video_meta;
                  ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters b8f83c9d14 applemedia/iosgl: remove unused variable
Fixes:

../sys/applemedia/iosurfaceglmemory.c:219:41: error: variable 'texfmt' set but not used [-Werror,-Wunused-but-set-variable]
    GLuint tex_id, tex_target, texifmt, texfmt;
                                        ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 49e452525d vtdec: remove unused variable
Fixes:

../sys/applemedia/vtdec.c:611:35: error: variable 'output_flags' set but not used [-Werror,-Wunused-but-set-variable]
  VTDecodeFrameFlags input_flags, output_flags;
                                  ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters edd9ec0456 avsamplevideosink: remove unused variable
Fixes

../sys/applemedia/avsamplevideosink.m:80:20: error: variable 'gstelement_class' set but not used [-Werror,-Wunused-but-set-variable]
  GstElementClass *gstelement_class;
                   ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Matthew Waters 651cd8e0bb avfassetsrc: fix unused-but-set warning
../sys/applemedia/avfassetsrc.m:1014:12: error: variable 'caps' set but not used [-Werror,-Wunused-but-set-variable]
  GstCaps *caps;
           ^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2046>
2022-03-28 10:30:23 +00:00
Andrew Pritchard 432354e6d4 Fix GstAmcSurfaceTexture segfault
Check that `self` and `self->callback` are defined. `self` can be set to
`NULL` in `remove_listener`, and `self->callback` can be set to `NULL`
inside `gst_amc_surface_texture_jni_set_on_frame_available_callback`.
This can cause a segfault since the Java object can outlive the C
object, and call the callback after `remove_listener` is called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2024>
2022-03-28 04:44:21 +00:00
Nicolas Dufresne c9d8b8a972 v4l2codecs: Detect missing M2M_HOLD_CAPTURE_BUF
Produce an error if we try to use the feature of holding capture buffer
but it is not supported by the driver. Ingoring this can lead to stalls
as the driver will run-out of capture buffer to decode into. This
affects slice decoders but also split-field interlaced decoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne efa360ce82 v4l2codecs: h264: Set other field poc if available
Whenever the other field POC is available, pass it back to the
driver. This should not be strictly required, but it makes things
easier to debug and more forgiven.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne dcd62c35f0 v4l2codecs: Trace request by it FD
This helps when crossing the debug logs with the kernel logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Nicolas Dufresne d24dc74170 v4l2codecs: h264: Fix dpb entry flag FLAG_FIELD
The logic to guess back this value was broken. Use the value
now saved into the picture instead. This was tested using
LibreELEC patched 5.15 kernel, and fixed the interlaced decode
issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2009>
2022-03-25 21:40:28 +00:00
Thibault Saunier 25819c41fb navigation: Add support for key Modifiers in all relevant events
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2010>
2022-03-25 15:16:03 +00:00
He Junyan b2a00dff07 va: h265dec: Fix a crash because of missing reference frame.
Some problematic H265 stream may miss the reference frame in the DPB,
and get some message like: "No short term reference picture for xxx".
So there may be empty entries in ref_pic_list0/1 when passing to
decode_slice() function of sub class. We need to check the NULL pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2018>
2022-03-25 13:12:46 +00:00
Seungha Yang 769800ad5f qsvencoder: Clear caps after debug print
Otherwise debug function will print (null) for alread cleared pointer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>
2022-03-24 02:55:49 +09:00
Seungha Yang 188382ca9a qsvh264enc: Fix profile and level setting in codec data
The profile field in SPS is located after header byte

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2012>
2022-03-24 02:55:31 +09:00
Seungha Yang 60735deded nvcodec: Add new Direct3D11/CUDA mode encoder implementation
Adding new encoder elements nvd3d11{h264,h265}enc for Direct3D11
input support and re-written nvcuda{h264,h265}enc elements.
Newly writeen elements have some differences compared with old
nv{h264,h265}enc including non-backward compatible changes.

* RGBA is not a supported input format any more:
  New elements will support only YUV formats to avoid implicit conversion
  done by hardware. Ideally it should be done by upstream element
  in order to have more control on it. Moreover, RGBA support can cause
  redundant RGBA -> YUV conversion if multiple encoders are
  used for the same RGBA input
* Subsampled planar format support is dropped:
  I420 and YV12 format are not supported formats for Direct3D11.
  Although it's supported in CUDA mode, it's not a hardware friendly
  memory layout and it will waste GPU memory since UV planes
  will have large padding due to the memory layout requirement of NVENC.
* GL support is dropped: Similar to the RGBA case,
  GL support in encoder would be suboptimal if GL input is
  used by multiple encoders, because each encoder will copy GL memory
  into CUDA memory.
  Upstream cudaupload element can be used for GL <-> CUDA
  interop instead.
* No more pre-allocation of encoder input surfaces. New implementation
  will use input CUDA memory without copy (zero-copy) or
  will copy into a NVENC's input buffer struct in case of
  system memory input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1997>
2022-03-23 13:48:53 +00:00
Vivienne Watermeier 6c2f6c3bd4 all: Use new navigation interface and API
Use and implement the new navigation interface in all relevant sink elements,
and use API functions everywhere instead of directy accessing the event structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1633>
2022-03-23 13:14:52 +00:00
Tong Wu 2a703678c0 msdkenc: add macro definitions to avoid the gst-inspect error
Since the strings are empty for GST_MSDK_CAPS_MAKE_WITH_DMABUF_FEATURE
and GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE, when excuting
gst-inspect-1.0.exe msdkh265enc, there will be convert static caps error
because of the extra semicolon between two empty strings. Now macro
definitions are added to avoid this issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2004>
2022-03-23 04:34:06 +00:00
Mengkejiergeli Ba d8ab85c3ef msdkdec: Check width and height of mfxVideoParam before allocation
DecodeHeader must be called to fill the mfxVideoParam before allocation,
and thus the check for width and height in mfxVideoParam is necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1817>
2022-03-22 05:22:09 +00:00
Benjamin Gaignard 98cb44ffc6 v4l2codecs: Fix memory leak
Free pending_requests array when releasing decoder to avoid memory leak

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2000>
2022-03-21 16:06:05 +00:00
Daniel Almeida 9a364464f0 av1decoder: Sync duplicate_picture with VP9 one
Pass the current frame to the duplicate_picture callback. This makes it easier
to set the frame's output_buffer if we already have one available. Also
documented that unlike VP9, it is not optional to implement this as the
picture will populate the DPB if it is a key-frame. To ensure this, remove the
default implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1992>
2022-03-21 15:10:01 +00:00
Seungha Yang 0c6125bad6 meson: va: Define GST_USE_UNSTABLE_API
Remove extra_c_args which is not defined in this meson file at all,
and define GST_USE_UNSTABLE_API to avoid build warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1999>
2022-03-21 22:17:00 +09:00
Jakub Adam 90eadae350 d3d11: Fix some typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1985>
2022-03-19 00:19:41 +00:00
Jakub Adam df55700f44 d3d11screencapturesrc: Allow capturing screen sub-area
Adds crop-x, crop-y, crop-width, crop-height properties specifying the
screen area to capture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1932>
2022-03-18 13:56:51 +01:00
Seungha Yang c08ce58753 nvcodec: Move CUDA <-> GL, D3D11, NVMM copy function to utils
This method can be used in other elements as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1945>
2022-03-15 21:51:50 +00:00
Seungha Yang b3df58add1 nvh265sldec: Add support for delayed output
Delay 4 frames in case of non-live to improve throughput

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1937>
2022-03-15 21:08:06 +00:00
Seungha Yang e270e2967f nvenc: Fix deadlock because of too strict buffer pool size
The pool size might need to be larger than encoding surface pool size.
Also, because we always copy input frame into internal CUDA memory,
there's no reason to restrict max size of buffer pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1939>
2022-03-12 16:44:44 +00:00
He Junyan 50a481939d va: Fix a regression because of "Invert video codec frame dependency".
1. Always set the according GstVaH264EncFrame pointer when GstVideoCodecFrame
   pointer is assigned, which can make the logic safe.
2. Fix the forgotten change in _sort_by_frame_num. Its input pointer now is
   GstVideoCodecFrame type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1935>
2022-03-12 15:20:19 +00:00
Seungha Yang aa476452fb codecs: Rename picture clear functions
Our convention for clear method is gst_clear_foo_bar().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1897>
2022-03-11 20:20:17 +00:00
Seungha Yang 423111480c nvh265sldec: Always fill SPS/PPS related parameters
Address compare was not a valid approach since it works
only if SPS/PPS id are changed. Otherwise it will always point to
the same address of member variables of h265parser.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1931>
2022-03-11 16:14:14 +00:00
Corentin Damman 1fb3e35708 cudamemorycopy: add D3D11 resource support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman 1568db2c3e cudacontext: find associated DXGI Adapter LUID
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman 895f11401d cudautils: add support of D3D11 resource as Cuda graphics resource type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Corentin Damman f76ecf1e63 cudaloader: add D3D11 API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1807>
2022-03-10 18:08:10 +00:00
Seungha Yang 5d298b98da nvh264dec,nvh265dec: Fix broken key-unit trick and reverse playback
On GstVideoDecoder::{drain,flush}, we send null packet with
CUVID_PKT_ENDOFSTREAM flag to drain out decoder. Which will
reset CUVID parser as well.
To continue decoding after the drain, the next input buffer
should include sequence headers otherwise CUVID parser will
not report any decodeable frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1911>
2022-03-10 12:40:05 +00:00
Víctor Manuel Jáquez Leal 838fe24e78 vah264enc: Invert video codec frame dependency.
Instead of using GstMiniObject to hold H264 frame, now it uses a plain
structure. Besides, instead of holding a reference to
GstVideoCodecFrame, the H264 frame structure is set as a
GstVideoCodecFrame user data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1856>
2022-03-09 12:57:30 +00:00
Seungha Yang 496b77e6aa cudamemorycopy: Fix GL resource leak
Clear GL resources on stop()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1896>
2022-03-08 18:02:25 +00:00
Seungha Yang 34c6063769 decklink: Update SDK version to 12.2.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1883>
2022-03-08 10:16:29 +00:00
Seungha Yang 4aa516f305 cudamemorycopy: Remove texture-target caps field
It's GL specific field, and we can remove it unconditionally

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1865>
2022-03-07 19:05:29 +00:00
Seungha Yang e5132a8508 cudaupload,cudadownload: Add support for dGPU NVMM
Implement NVMM <-> CUDA, GL, SYSTEM memory conversion. Jetson is
not supported yet. Note that NVMM <-> GL interop on Jetson platform
is supported by GstGL

Some example pipelines are:
- Convert NVMM to GstGL memory
  nvv4l2decoder ! "video/x-raw(memory:NVMM)" ! cudadownload ! "video/x-raw(memory:GLMemory)" ! glimagesink

- Upload system memory to NVMM and encode
  video/x-raw,format=NV12 ! cudaupload ! "video/x-raw(memory:NVMM)" ! nvv4l2h264enc

- Convert NVMM to GstCUDA memory and encode
  nvvideoconvert ! "video/x-raw(memory:NVMM)" ! cudaupload ! "video/x-raw(memory:CUDAMemory)" ! nvh264enc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1865>
2022-03-07 19:05:29 +00:00
Víctor Manuel Jáquez Leal 0c7fe80387 va: encoder: Don't preallocate reconstruct buffers.
It's not required by VA to register the reconstruct buffers at context
creation, just as in decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1857>
2022-03-07 16:31:41 +00:00
Seungha Yang a63d1cf4c4 cudamemorycopy: Fix build when gl is disabled
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1707
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1868>
2022-03-07 10:22:21 +00:00
Mengkejiergeli Ba c9aa529484 msdkdec: Fix to not trigger SFC scaling when vpp at downstream
When there is vpp scaling downstream, we need to make sure SFC is not
triggered because vpp may fall into passthrough mode which causes
the decoder negotiation to create src caps with vpp scaled width/height.

This patch includes bitstream's original size in first query with
downstream in gst_msdkdec_src_caps, which is the same for what we do for
color format in this query. This is to ensure SFC scaling starts to
work only when downstream directly asks for a different size instead of
through vpp.

Note that here SFC scaling follows the same behavior as msdkvpp:
if user only changes width or height, e.g. dec ! video/x-raw,width=xx !,
the height will be modified to the value which fits the original DAR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1838>
2022-03-07 07:26:40 +00:00
Seungha Yang 30ddb0cd97 nvcodec: Add missing null check in context sharing code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang c31bf2db4d nvcodec: Refactor cudaupload/download and add support for GL memory
* Implement new baseclass GstCudaMemoryCopy to remove duplicated
  cudaupload/download code
* Add support for CUDA <-> GL memory conversion via cudaupload/download

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 111b2c3f53 nvcodec: Refactor GstCudaMemory abstraction
* Hide GstCudaMemory member variables
* Make GstCudaAllocator object GstCudaContext independent
* Set offset/stride of memory correctly via video meta
* Drop GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT support.
  This implementation actually does not support custom alignment
  because we allocate device memory via cuMemAllocPitch
  of which alignment is almost uncontrollable

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang ad0e7fca14 nvcodec: Refactor basetransform subclasses
* cudaupload/download
  - Specify only formats actually we can deal with
    nvcodec elements, not all video formats
  - Supports CUDA output for download and input for upload in order
    to make passthrough possible, like other upload/download elements.
* cudabasetransform
  - Reset conversion element if upstream CUDA memory
    holds different CUDA context and the element can accept it.
    This is the same behavior as corresponding d3d11 filter elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 89bbcf0061 cudabufferpool: Move GstCudaContext object to public member
... so that plugins can understand assosicated cuda context with the
pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang c8a1c953d8 cudacontext: Require explicit gpu id instead of auto (-1)
Sync up with GstD3D11Device implementation. The auto stuff should
be handled in context sharing step, not device creation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang 1b9274307a nvcodec: Indent update
... to prevent gnu indent version dependent diffs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Seungha Yang cec7ac2a1b cudacontext: Remove unnecessary cuInit() call
It's already called at plugin init time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1834>
2022-03-06 15:39:04 +00:00
Víctor Manuel Jáquez Leal e42d10431d va: basetransform: Add device-path read-only property.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1844>
2022-03-04 14:34:32 +00:00
Víctor Manuel Jáquez Leal 47a95dfd65 va: basedec: Add device-path read-only property.
And elements will notify the used device-path if display is DRM.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1844>
2022-03-04 14:34:32 +00:00
Víctor Manuel Jáquez Leal 72c6a3b95a vah264enc: Remove GST_PARAM_CONDITIONALLY_AVAILABLE.
Since it's used only when the property is conditionally installed, and
these parameters are always installed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
He Junyan be24cdb150 va: encoder: Clean dead code.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 7aa597d6df va: encoder: Fix error code path when open.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 81c00664a2 vah264enc: Remove preferred_output_delay.
In the current state of the encoder it's just dead code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 1a19a835a9 vah264enc: Avoid mapping coded buffer twice.
Currently for copying the coded buffer onto a GStreamer buffer, the
coded buffer is mapped two times: one for getting the size, and later
for do the actual copy. We can avoid this by doing directly in the
element rather than in the general encoder object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 81b99c37d8 vah264enc: Single parameter array per picture.
There's no need, at least in H.264, to hold a global parameter array,
since there's no need to submit SPS, trellis, hdr or quality in every
buffer, but only on IDR ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Víctor Manuel Jáquez Leal 72b0f8ab17 va: Fix log message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1845>
2022-03-04 12:41:37 +00:00
Mengkejiergeli Ba 8a598deef2 msdkenc: Change default ref frames number as 0
When user does not set ref-frames in pipeline, we should let MediaSDK
decide the reference frame number via setting default value as 0 at
gstreamer side.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1839>
2022-03-04 01:05:30 +00:00
Seungha Yang 8e0ce6b125 meson: wic: Fix typo
Should check WIC build option, not MediaFoundation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1847>
2022-03-04 04:18:06 +09:00
Seungha Yang 00f773bd10 qsv: Remove strcpy for DRM device path
Simplify code. It's just one-time allocation, so don't need to worry
about leaking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1835>
2022-03-03 11:29:33 +00:00
Seungha Yang 799616aea9 msdk: Don't print error log for missing DRM device path
It's expected in case that such DRM device is unavailable for some reasons,
specifically non-Intel platform or so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1836>
2022-03-03 06:29:11 +00:00
Seungha Yang f8016687a4 wic: Add support for JPEG and PNG decoding
Adding Windows Imaging Component (WIC) plugin with JPEG/PNG decoding
support.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1605>
2022-03-03 00:00:54 +00:00
Seungha Yang df6624bf1c directshow: Fix for division by zero
The AvgTimePerFrame value may be unknown. Use arbitrary
value (30 fps) instead of crashing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1828>
2022-03-02 19:35:49 +00:00
Seungha Yang c4ac657364 qsv: Add H.264 decoder
Initial decoder implementation with baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1786>
2022-03-01 21:24:07 +00:00
He Junyan 1f2f135cdb va: enable the H264 encoder.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan f17357f759 va: Add H264 encoder.
This a new VA-API implementation of a H264 encoder.

It can control the GOP and parameter settings, while the MV searching,
VCL and the rate control algorithm are implemented by VA drivers and HW.
It supports most of the common usage options in H264, but still lacks
of look ahead, field, B frame weighted prediction, etc.

Co-authored-by: Victor Jaquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan 736a0ac9b0 va: Add a common encoder object.
As the counterpart of the va decoder, this class handles all the
common logic for the encoding routine and miscellaneous queries about
encoding.

Co-authored-by: Victor Jaquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan fb644e84fa va: Add vacompat.h to wrap glib functions.
The g_queue_clear_full() and g_array_copy() functions in the glib
may not be available for the current glib version check, so we add
helper functions to wrap it.
This should be deleted after the glib version bumps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan 57d50a941f va: Add the profile string name into the profile_map.
We also add a helper function of gst_va_profile_from_name to get
the VA profile value by its profile string name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan e0b6c6678b va: Change the H264 profile string order in the profile_map.
The first one should be the one that matches the VA profile's name
most precisely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
He Junyan 83408cfdc8 va: caps: Expose gst_va_create_coded_caps as helper function.
And allow free indentation for array declaration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1051>
2022-03-01 10:53:50 +01:00
jinsl00000 ef4cc9e637 ipcpipeline: fix crash and error on windows with SOCKET or _pipe()
The fd was in different meanings on windows:
POSIX read and write use the fd as a file descriptor.
The gst_poll use the fd as a WSASocket.

This patch use WSASocket as default on windows. This is a temporary measure, because IPC has many different implement. There may be a better way in the future.

See #1044

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1791>
2022-03-01 06:31:51 +00:00
Wu Tong c60ac7a04b MSDK: Add _context_query() and avoid compile error on Windows
To avoid compile error on Windows, macro definitions are added to suppress va
variables. In the meantime, add function _context_query() to query
context on Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1693>
2022-02-28 12:54:23 +00:00
Mengkejiergeli Ba b41c70aed5 msdkdec: Fix uninitialized variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1731>
2022-02-25 03:11:29 +00:00
Mengkejiergeli Ba e1090c152c msdk: Fix unchecked return values
There are several calls of gst_video_info_from_caps and gst_video_frame_copy
without checks for the returned values. This patch adds all necessary
function return checks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1738>
2022-02-25 02:04:20 +00:00
Seungha Yang ad73f73356 qsvencoder: Fix caps leak in Linux build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1769>
2022-02-22 12:55:26 +00:00
Seungha Yang 20328914dc qsv: Fix debug category name of qsvallocator
Remove gst prefix to make $env:GST_DEBUG="qsv*:6" work for qsvallocator
as well

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1769>
2022-02-22 12:55:26 +00:00
Dmitry Osipenko 248f143fa3 v4l2codecs: Support YUV420M format
YUV420M format of V4L essentially is I420 with separate memory planes.
It's used by NVIDIA Tegra V4L decoder. Support this format by v4l2codecs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1727>
2022-02-21 21:58:19 +03:00
Seungha Yang 8ff5f10a40 d3d11screencapturesrc: Use staging buffer pool for performance
By using staging pool/buffer, we can avoid per frame
staging texture -> system memory copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1756>
2022-02-20 23:43:18 +00:00
Nicolas Dufresne 8883809ef9 v4l2codecs: Enable MediaTek MM21 (NV12_16L32S)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>
2022-02-20 22:32:55 +00:00
Nicolas Dufresne 3005dbc55a v4l2codecs: Add support for multi planar buffers
V4L2 have some pixel formats that produces 2 dmabuf, this add
support for these format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>
2022-02-20 22:32:55 +00:00
Nicolas Dufresne bab9041c4b Port plugins to gst_video_format_info_extrapolate_stride()
This reduces code duplication and simplify addition of new
pixel formats into related plugins.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1567>
2022-02-20 22:32:55 +00:00
Seungha Yang d49454123e winscreencap: Remove dxgiscreencapsrc element
We have the d3d11screencapturesrc element in d3d11 plugin
which is obviously better than this element in terms of performance
and design, so we don't need to make people be confused by two separate elements.

Let's pick the better implementation and remove unnecessary one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1750>
2022-02-20 20:04:05 +00:00
Seungha Yang c19d0db454 directshow: Fix build warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1744>
2022-02-19 19:54:52 +00:00
Seungha Yang 7eedd52510 directshow: Merge plugins into single directshow plugin
... and lower rank of dshowvideosink and dshowdeviceprovider
to GST_RANK_MARGINAL since we don't prefer this plugin
by default

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1744>
2022-02-19 19:54:52 +00:00
Seungha Yang d94d338bd5 directshow: Remove white spaces
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1744>
2022-02-19 19:54:52 +00:00
Nicolas Dufresne cf3d64129b v4l2codecs: vp9: Fix reset_frame_context parameter
It was assumed that the kernel parameters would match with the bitstream value
but instead the author when with another set of value. Surprisingly, this
makes no difference with the resulting fluster score.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1748>
2022-02-18 23:55:59 +00:00
Nicolas Dufresne 5a9df9e850 v4l2codecs: vp9: Only fill compressed headers if needed
Fixes: 13944cf3ee ("v4l2codecs: vp9: Make compressed hdr control optional")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1748>
2022-02-18 23:55:59 +00:00
Tim Mooney 54a1f60077 v4l2: include <sys/ioccom.h> on Illumos
Needed for _IOR/_IORW

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1524>
2022-02-18 21:34:49 +00:00
Loic Le Page e1c0628bb9 Add build files and fix build for gst-plugins-bad dshowsinkwrapper plugin
dshowsinkwrapper plugin is the old dshowvideosink plugin that has been
renamed to be compliant with the actuel plugin name in the source code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loic Le Page b355345ef5 Add build files and fix build for gst-plugins-bad dshowsrcwrapper plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loic Le Page 587b2e6bcb Add build files and fix build for gst-plugins-bad dshowdecwrapper plugin
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loic Le Page 42bdeaf52c Add directshow strmbase library source code from Microsoft repo
Original repo is here:
https://github.com/microsoft/Windows-classic-samples

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:25 +01:00
Loïc Le Page 42c6a26aea Move all directshow plugins to the same sub-folder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1577>
2022-02-18 14:59:24 +01:00
Tim Mooney 97720dabe0 meson: check for libsocket and libnsl
If present, add '-lsocket' and '-lnsl' to network_deps.

ext/curl/meson.build: add network_deps to dependencies
gst/festival/meson.build: same
sys/shm/meson.build: same

Fixes linking issues on Illumos distros.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1525>
2022-02-17 18:44:49 +00:00
Seungha Yang 04b8dfa391 d3d11: Add support for AYUV, AYUV64, and RGBA64_LE formats
Note that AYUV and AYUV64 formats will be used to expand format
support, especially some packed YUV formats (e.g., Y410, YUY2)
are common DXGI formats used for hardware decoder/encoder on Windows
but those formats cannot be used as a render target. We need to handle
them differently without pixel shader help, using compute shader
for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang dd906f9610 d3d11: Store device format in struct
Holding pointer to struct was unsafe approach because
the pointer to d3d11 format will be invalidated once d3d11 device
object is released

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang e1f0687b09 meson: Do hard build error for some MSVC warnings
Handle various MSVC warnings as errors for development version.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1006>
2022-02-16 17:03:29 +00:00
Dmitry Osipenko b757d12cff v4l2codecs: h264: Correct scaling matrix ABI check
Scaling matrix V4L UAPI control not presents on NVIDIA Tegra, the default
matrix should be used in this case. Mark scaling matrix presence optional.

Fixes: 47bfa71530 ("v4l2codecs: h264: Improve ABI check ")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1726>
2022-02-16 13:16:17 +00:00
Mengkejiergeli Ba 586dfab9bd msdkdec: Enable SFC scaling for AVC and HEVC
Decoder SFC only supports down-scaling at most to 1/8.
For example, given a 4K bistream, SFC can scale it to 1080p via:
"msdkh265dec ! video/x-raw,width=1920,height=1080 ! glimagesink"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1444>
2022-02-16 08:26:46 +00:00
Mengkejiergeli Ba c5f0e075e2 msdkdec: Enable SFC csc for AVC and HEVC
Decoder SFC will be triggered when default output format is not accept at
downstream. One use case below can work without using msdkvpp:
"! msdkh265dec ! "video/x-raw,format=BGRA" ! glimagesink",

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1444>
2022-02-16 08:26:46 +00:00
Mengkejiergeli Ba eb742c8ed0 msdkdec: Add SFC codes
SFC refers to Scaler Format Converter, more details here:
https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-kbl-vol15-sfc.pdf
By attaching mfxExtDecVideoProcessing buffer to mfxVideoParam, decoder
can do SFC for csc and scaling.

MSDK will check if surface bitdepth equals to input when no SFC is
triggered, which means in the case of SFC, there is no need to update
surface bitdepth via gst_msdk_update_mfx_frame_info_from_mfx_video_param.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1444>
2022-02-16 08:26:46 +00:00
Seungha Yang dbda4cf409 d3d11converter: Fix for missing GRAY conversion
Add missing Y410 -> GRAY and GRAY -> semi-planar conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
2022-02-16 02:30:01 +09:00
Seungha Yang 98345a141a d3d11converter: Don't use FIXME_OBJECT for non-GstObject
... and print ERROR messages for unexpected input/output formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1724>
2022-02-16 02:27:53 +09:00
He Junyan 24c3e0fcfa va: Delete the display lock/unlock when we call VA-API.
According to the VA-API's description, they are MT-safe, we do not
need to care about that in our middleware layer. The lock/unlock
operations have overhead and make the performance lower.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1333>
2022-02-15 10:02:08 +00:00
Seungha Yang e3e23a2c84 d3d11converter: Fix RGB to GRAY conversion
Fix typo in shader code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1697>
2022-02-14 17:49:54 +00:00
Seungha Yang 27246ebeb0 d3d11download: Fix decide_allocation
Caps should be parsed in any cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1691>
2022-02-14 10:48:31 +00:00
He Junyan fa4dc3470f meson: va: Add va option check into plugin's build.
Because the liblibgstva is built unconditionally, we now move the
va option check into va plugin's build.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1685>
2022-02-14 06:30:56 +00:00
He Junyan 1eed9de0bb vavpp: Fix the caps leak in the transform_caps() function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1689>
2022-02-12 20:11:46 +08:00
Seungha Yang e96687d88d d3d11: Update build-time dependency
Remove all the d3d11 and dxgi header version dependent ifdef
and bump the minimum requirement to d3d11_4.h and dxgi1_6.h.
We are already failing support old Visual Studio (Windows SDK actually)
such as Visual Studio 2015. Note that our MinGW toolchain satisfies
the requirement.

From runtime point of view, this change should be fine since
we are checking OS version with IUnknown::QueryInterface()
everywhere in order to check API availability

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1684>
2022-02-11 20:01:52 +00:00
He Junyan 248baef400 MSDK: Import VA surface as encoder's input.
We make all MSDK encoders declare "memory:VAMemory" feature. Then
the pipeline such as:
  gst-launch-1.0 -vf filesrc location=xxx.h264 ! h264parse ! \
       vah264dec ! msdkh265enc ! fakesink
will choose VA memory caps between the VA decoder and MSDK encoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan ef5f6ab5d9 MSDK: Add helper function to peek VA surface of VA kind gstbuffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 26172123e5 MSDK: Handle context query into the encoder's query function.
The MSDK encoder's query function is not set and it just forwards
all query to its base class. We now need to answer the context
query correctly. Other VA plugins need to query the VA display.

By the way, the current query of "gst.msdk.Context" is also missing.
The other MSDK elements must depend on the bin's context message(
sent in context_propagate()) to set their MsdkContext correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 2928b14b69 MSDK: Handle context query into the VPP's query function.
The MSDK VPP's query function is not set and it just forwards
all query to its base class. We now need to answer the context
query correctly. Other VA plugins need to query the VA display.

By the way, the current query of "gst.msdk.Context" is also missing.
The other MSDK elements must depend on the bin's context message(
sent in context_propagate()) to set their MsdkContext correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan db5be289c7 MSDK: Handle context query into the decoder's query function.
The MSDK decoder's query function is not set and it just forwards
all query to its base class. We now need to answer the context
query correctly. Other VA plugins need to query the VA display.

By the way, the current query of "gst.msdk.Context" is also missing.
The other MSDK elements must depend on the bin's context message(
sent in context_propagate()) to set their MsdkContext correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 6635852c40 MSDK: Add a handle_context_query() helper function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan 85664b5af6 MSDK: Improve the GstContext setting logic.
We now can use the gst va lib's display to create our MSDK context,
and use its helper functions to simplify our code. The improved logic
is like this:
1. Every MSDK element should use gst_msdk_context_find() to find a MSDK
context from neighbour. If valid, reuse it.
2. Use gst_msdk_ensure_new_context(). It will first query neighbours
about the GstVaDisplay, if found(e.g. some VA element is connected),
use gst_msdk_context_from_external_display() to create a MSDK context.
3. Then, creating the MSDK context from scratch. It creates both the
display and MSDK context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan a905e7474b MSDK: Add new_with_va_display() helper function to create context.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan a9aa522e26 MSDK: Use the VA display object to replace the raw display handle.
The VA display object from VA lib is a common defined object. which
contain the whole display things. It is easier to use, and more important,
we can share it with the other VA plugins and keep all the VA related
plugins working on the same GPU device.
We also delete the useless gst_msdk_context_get_fd() API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
He Junyan c7e3c8e9f6 MSDK: Add the gst va lib into MSDK's dependency.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1087>
2022-02-11 07:13:45 +00:00
Seungha Yang 2c93afd8bb mediafoundation: Add support for MP3 decoding
See also
https://docs.microsoft.com/en-us/windows/win32/medfound/windows-media-mp3-decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:23 +09:00
Seungha Yang be957f6c61 mediafoundation: Add support for AAC decoding
See also
https://docs.microsoft.com/en-us/windows/win32/medfound/aac-decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:22 +09:00
Seungha Yang 0b26254a6a mediafoundation: Cosmetic changes
Rename baseclass to be consistent with other Windows plugins

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:22 +09:00
Seungha Yang ce4875ccde mediafoundation: Use & operator instead of GetAddressOf()
Use shorter expression

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:22 +09:00
Seungha Yang 36020c7549 mediafoundation: Port to C++
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1596>
2022-02-11 04:16:15 +09:00
Seungha Yang c7a9b5c458 d3d11decoder: Promote rank to primary except for mpeg2
Our D3D11/DXVA codecs implementation has been verified
during 1.18 and 1.20 development cycle and also via the Fluster
test framework. Similar to the case of nvdec and vtdec,
we can prefer hardware over software in most cases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1672>
2022-02-10 17:16:18 +00:00
Nicolas Dufresne 7a9e11ae1b v4l2codecs: vp9: Fix duplicating a duplicated picture
Duplicating a picture what was already a dup was leading to a crash. Rename
the custom picture flags as HOLDS_BUFFER to make its meaning clear. Then save
then ref and store the picture as userdata, so it can be obtained when
duplicating. Finally, mark the doplicated as HOLDS_BUFFER to avoid thinking it
holds a request.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1681>
2022-02-09 22:37:55 +00:00
Seungha Yang 090b50e549 mfaudioenc: Handle empty IMFMediaBuffer
IMFMediaBuffer may not hold encoded data, which seems to happen
while draining.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1679>
2022-02-10 01:49:55 +09:00
Víctor Manuel Jáquez Leal b3c71584e0 va: decoder: Log profile name.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1675>
2022-02-09 12:25:24 +01:00
Víctor Manuel Jáquez Leal df6c985474 va: filter: Log the added filter name.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1675>
2022-02-09 11:07:47 +00:00
Víctor Manuel Jáquez Leal 4be3413fec vapostproc: Process HDR caps
This patch adds a new parameter: hdr-tone-mapping (same as
vaapipostproc), if the HDR capabilites are availabe in driver, and
it's disabled by default.

If hdr-tone-mapping is enabled then HDR fields in sink caps are
processed in frames from HDR to SDR, removing those hdr fields in
source pad caps too.

hdr-tone-mapping is not enabled if a color conversion is also
requested, since it fails to process in the iHD driver, so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1258>
2022-02-09 10:26:02 +00:00
Víctor Manuel Jáquez Leal 0e7dade55a build: Add libva dependency fallback.
Then libva can be subproject and used by either gstreamer-vaapi,
va and msdk in gst-plugins-bad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1397>
2022-02-09 09:45:04 +00:00
Nicolas Dufresne 13944cf3ee v4l2codecs: vp9: Make compressed hdr control optional
This is to supported by Mediatek VP9 driver. Mediatek handles
the forward probabilities in hardware hence does not need and
does not implement support for
V4L2_CID_STATELESS_VP9_COMPRESSED_HDR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1600>
2022-02-08 16:46:09 -05:00
Víctor Manuel Jáquez Leal 5e4c152de4 va: Remove libgudev crumbs in library.
In commit e699aaeb we moved linking of libgudev to the plugin rather
the library, because it's only used in the plugin. But the dependency
check is still done in library.

This patch removes the dependency check in library, and updates the
dependency check in plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1650>
2022-02-08 16:22:42 +00:00
Seungha Yang 8773ba1104 msdk: Fix for MFXUnload symbol re-definition build error
Fix for libgstreamer-full build

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 278908ce96 qsv: Add support for HEVC encoding
main and main-10 profiles are supported for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 3a7e4635bb qsv: Add support for VP9 encoding and more video formats
Add VP9 encoder with 4:2:0 8 bits and 4:4:4 8/10 bits formats support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 64ed6075b7 qsv: Introduce H.264 Intel Quick Sync Video Encoder
A new implementation of Intel Quick Sync Video plugin.
This plugin supports both Windows and Linux but optimization for
VA/DMABuf is not implemented yet.

This new plugin has some notable differences compared with existing
MSDK plugin.

* Encoder will expose formats which can be natively supported
without internal conversion. This will make encoder
control/negotiation flow much simpler and cleaner than
that of MSDK plugin.

* This plugin includes QSV specific library loading helper,
called dispatcher, with QSV SDK headers as a part of this plugin.
So, there will be no more SDK version dependent #ifdef in the code
and also there will be no more build-time MSDK/oneVPL SDK
dependency.

* Memory allocator interop between GStreamer and QSV is re-designed
and decoupled. Instead of implementing QSV specific allocator/bufferpool,
this plugin will make use of generic GStreamer memory
allocator/bufferpool (e.g., GstD3D11Allocator and GstD3D11BufferPool).
Specifically, GstQsvAllocator object will help interop between
GstMemory and mfxFrameAllocator memory abstraction layers.

Note that because of the design decision, VA/DMABuf support is not made
as a part of this initial commit. We can add the optimization for Linux
later once GstVA library exposes allocator/bufferpool implementation as
an API like GstD3D11.

* Initial encoder implementation supports interop with GstD3D11
infrastructure, including zero-copy encoding with upstream D3D11 element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang c80132e4a3 qsv: Remove unnecessary pargma message
We know what we are doing, just remove noisy build warnings

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 81d63948d1 qsv: Import libmfx API and dispatch code from oneVPL project
Copied from oneVPL project (https://github.com/oneapi-src/oneVPL)
v2022.0.3 tag at the commit of efc259f8b7ee5c334bca1a904a503186038bbbdd

This is corresponding to MFX API version 2.6

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang a37da515f4 d3d11memory: Add support for ID3D11Buffer
Allow wrap ID3D11Buffer via GstD3D11Memory object
At the moment, only staging ID3D11Buffer is supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang 28eeba3e18 nvh265sldec: Fix for decoding 12bits stream
We've been exposing main-444-12 profile as a supported profile
in its sinkpad template but not actaully. Adding code to
covert 12 and 16 bits as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1612>
2022-02-07 18:27:48 +00:00
Seungha Yang 80bbc71ec0 nvdecoder: Fix for HEVC 4:4:4 format decoding
Map chroma_format_idc == 3 (which means 4:4:4 subsampling) correctly,
also pass coded bitdepth for decoder initialization instead of
inferring it from output format since they can be different.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/949
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1612>
2022-02-07 18:27:48 +00:00
He Junyan ea9b350240 va: Add a gstva.h to include all va lib header files.
And replacing all va lib headers with this new header files
when including.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1256>
2022-02-07 10:12:36 +00:00
He Junyan d5c535744b va: Move the vautils into the gst va lib.
The context query and handle are common logic for all va related
elements. So we move it from va plugins to the common gst va lib.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1256>
2022-02-07 10:12:36 +00:00
Seungha Yang 6434d69f8c codecs: Stop claiming constness for refcounted object
It's almost pointless and makes little sense as subclass might
want to modify refcount of the object or so. And all subclasses
are already casting them to non-const version as well.
In a general sense, we need to avoid passing refcounted object
with const qualifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1238>
2022-02-06 17:17:22 +00:00
Seungha Yang 499c89c729 d3d11videosink: Use staging buffer pool for non-d3d11 upstream
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1643>
2022-02-06 21:58:52 +09:00
Seungha Yang 9518f15309 d3d11upload,d3d11download: Use staging buffer pool
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1643>
2022-02-06 21:58:48 +09:00
Seungha Yang b22aa14e43 d3d11decoder: Use staging buffer pool for non-d3d11 downstream
In specific condition, this can show about 10% ~ 30%
performance gain with non-d3d11 downstream element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1643>
2022-02-06 21:57:17 +09:00
Seungha Yang 34b54ca665 nvdecoder: Fix for display resolution setup
Display resolution should be cropped rect, not coded resolution.
Otherwise decoded output from NVDEC might be wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1617>
2022-02-01 17:58:06 +00:00
Nirbheek Chauhan bb32532f60 applemedia: Disable 64RGBALE support on older macOS
The kCVPixelFormatType_64RGBALE enum is only available on macOS Big
Sur (11.3) and newer. We also cannot use that while configuring the
encoder or decoder on older macOS.

Define the symbol unconditionally, but only use it when we're running
on Big Sur with __builtin_available().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1613>
2022-02-01 16:57:04 +00:00
Nirbheek Chauhan 6ae4497c07 applemedia: Remove some unnecessary variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1613>
2022-02-01 16:57:04 +00:00
Nirbheek Chauhan 67656c5eeb docs: Add objc and objcpp files to hotdoc gst_c_sources
Hotdoc should be able to extract and parse comments out of these. Just
need to be careful to only add the glob in directories that actually
contain *.m (objc) and *.mm (objcpp) files.

Also fix some doc comments and remove redundant ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1614>
2022-02-01 05:25:42 +05:30
Nirbheek Chauhan f1449ac116 docs: Rename "OS X" to "macOS" in some documentation
No one uses the term "Mac OS X" anymore, it's "macOS". "OS X" is even
worse, because people will usually start the search with "mac".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1607>
2022-01-30 19:17:18 +05:30
Nirbheek Chauhan d05fcadf4e applemedia: Document vtenc / vtdec elements
Also preserve-alpha property should only be exposed on the
vtenc_prores element since h264 does not support transparency.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/94

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1601>
2022-01-30 02:17:24 +05:30
Nicolas Dufresne 47bfa71530 v4l2codecs: h264: Improve ABI check
This moves the ABI check to the registration, so we don't expose
decoders with the wrong ABI or that are just broken somehow. It
also makes few enhancement:

- Handle missing, but required controls
- Prints the controls macro name instead of id

This should fix RK3399 support with a currently release minor
regression in the Hantro driver that cause errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1599>
2022-01-29 15:33:49 +00:00
Seungha Yang ea06439c39 d3d11decoder: Fix typo in doc
s/elemenet/element/g

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1598>
2022-01-29 04:47:16 +09:00
Víctor Manuel Jáquez Leal d86288904f vapostproc: Make cb max values symmetrical to their min values.
Intel drivers expose some colorbalance's maximum values much more
bigger than their minimum values, given their middle values (default
value). This means, in practice, that the real middle point between
the maximum and minimum values implies a major change in the color
balance, which is not expected by the GStreamer color balance logic.

This patch makes the given maximum value symmetrical to the minimum
value, given the middle one (default value).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1580>
2022-01-27 22:33:21 +00:00
Nicolas Dufresne d7363bd838 v4l2codecs: Fix debug assertion in register functions
As now, we warn if the decoder have no support src pixel format, but that
warning is called before the type (hence the debug category) is initialized.
Fix this by moving the debug category init out of the type initialization,
into the register funcitons.

This will fix an assertion that occures in the register function and allow
relevant log to be seen by the users.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1588>
2022-01-27 18:53:41 +00:00
Seungha Yang 7b1683f6b2 d3d11av1dec: Fix typo in debug message
Fixing copy and paste mistake, It's AV1 decoder not VP8

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1576>
2022-01-27 03:11:33 +09:00
Víctor Manuel Jáquez Leal b8068c6fda va: basetransform: Pass component index not plane index.
This is an issue detected and fixed in commit 3897b24f for other
libraries and elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1566>
2022-01-25 14:15:12 +00:00
Víctor Manuel Jáquez Leal c7e52e869d va: filter & postproc: Match color with caps features.
When fixating color, there might be "other caps" with color spaces not
supported by the caps features exposed in the vapostproc's source pad
caps template (perhaps it's a bug somewhere else in GStreamer).

This solution checks if the proposed format exists in the filter
within the caps feature associated with the proposed format.

The check is done with the new filter's function
gst_va_filter_has_video_format().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1559>
2022-01-24 18:10:49 +00:00
Nicolas Dufresne 107088a658 v4l2codecs: Unify the src template caps format
Notably NV12_4L4 ended up being applied to only VP9 decoder. This fixes the
situation by using a central define for all static src pad templated formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/965>
2022-01-21 19:32:30 +00:00
Nicolas Dufresne a67e9fb05f v4l2codecs: Sync kernel headers against 5.16.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/965>
2022-01-21 19:32:30 +00:00
Víctor Manuel Jáquez Leal 08aa930fee msdk: Avoid noisy registry when no MSDK device.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1550>
2022-01-21 11:13:55 +01:00
Seungha Yang 77225c79f9 wasapi2: Fix for device open failure on old OS
To open automatic stream routing aware device,
at least Windows10 Anniversary Update is required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1545>
2022-01-20 23:04:46 +09:00
Seungha Yang 009bc15f33 wasapi2ringbuffer: Fix for desynced buffer-size and segsize
GstAudioRingBufferSpec::segsize has been configured by using
device period but GstWasapi2RingBuffer was referencing the
buffer size returned by IAudioClient::GetBufferSize()
which is most likely larger than device period.
Fixing to sync them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1533>
2022-01-18 03:23:17 +09:00
Seungha Yang f97ab9edf7 d3d11deinterlace: Do not restrict minimum resolution to 64x64
The value 64 was completely arbitrary one, and this element
will be able to support smaller resolutions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1528>
2022-01-16 02:23:55 +09:00
Seungha Yang e63a3a7f31 d3d11compositor: Don't try to read empty buffer
The queued buffer may not be readable buffer in case that
upstream sends GAP event or so.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1497>
2022-01-13 20:27:50 +00:00
Dmitry Osipenko 644969e0ba kmssink: Support auto-detection of NVIDIA Tegra driver
NVIDIA Tegra SoCs have a separate (from GPU) display controller. It's
the primary display device on all Tegra SoCs. Add Tegra to the list
of primary DRM drivers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1514>
2022-01-13 04:50:55 +00:00
Nirbheek Chauhan 1be6d6ccf5 meson: Add explicit check: kwarg to all run_command() calls
This is required since Meson 0.61.0, and causes a warning to be
emitted otherwise:

2c079d855e
https://github.com/mesonbuild/meson/issues/9300

This exposed a bunch of places where we had broken run_command()
calls, unnecessary run_command() calls, and places where check: true
should be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1507>
2022-01-09 18:12:47 +05:30
Nirbheek Chauhan 6b7d819c25 vtenc: Signal ignored alpha component with ProRes
When the image is opaque but the output ProRes format has an alpha
component (4 component, 32 bits per pixel), Apple requires that we
signal that it should be ignored by setting the depth to 24 bits per
pixel. Not doing so causes the encoded files to fail validation.

So we set that in the caps and qtmux sets the depth value in the
container, which will be read by demuxers so that decoders can skip
those bytes entirely. qtdemux does this, but vtdec does not use this
information at present.

The sister change was made in qtmux and qtdemux in:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1061

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1489>
2022-01-04 18:01:54 +00:00
Seungha Yang 5fefc689a0 d3d11decoder: Negotiate again on the first output buffer
... unconditionally. There may be updated field in sinkpad caps
after the new_sequence() call (HDR related ones for example),
then we should signal the information to downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1474>
2021-12-30 11:09:45 +00:00
He Junyan 85d2118a53 va: av1dec: Use named profiles to replace the numeric ones.
Use named AV1 profiles (i.e., main, high, and professional) to replace
the old 0, 1, 2 profiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1456>
2021-12-21 22:20:34 +09:00
Seungha Yang 91484ce2ac d3d11av1dec: Update sinkpad template for profile
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1456>
2021-12-21 22:20:34 +09:00
Seungha Yang 1564567c3e d3d11av1dec: Fix for Cdef param
av1parser will increase the sec_strength values by 1 if parsed
values were equal to 3 as defined in spec. But DXVA wants unmodified
ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1455>
2021-12-17 23:28:29 +09:00
Seungha Yang 146815bbb6 d3d11av1dec: Sync DXVA AV1 data structure with released header
Update AV1 data structure based on Windows 11 SDK header

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1455>
2021-12-17 23:27:24 +09:00
Seungha Yang f10867dfb5 d3d11videosink: Use only tested color space for swapchain
We are querying supported swapchain colorspace via
CheckColorSpaceSupport() but it doesn't seem to be reliable.
Use only tested full-range RGB formats which are:
- sRGB
- BT709 primaries with linear RGB
- BT2020 primaries with PQ gamma

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1433>
2021-12-12 11:00:24 +00:00
Nicolas Dufresne e0f8ce501b v4l2codecs: vp9: Add alpha decodebin wrapper
This will allow HW accelerated decoding of WebM alpha videos.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1439>
2021-12-10 21:37:14 +00:00
Nicolas Dufresne 31d49da237 v4l2codecs: plugin: Minor style fix
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1439>
2021-12-10 21:37:14 +00:00
Nicolas Dufresne 3f02515380 v4l2codecs: decoder: Improve logging of timed out request
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1439>
2021-12-10 21:37:14 +00:00
Nicolas Dufresne c4216a693c v4l2codecs: mpeg2: Check that the decoder output formats
This is to avoid exposing a decoder for which we don't support any
output format. This happens on platform using vendor formats or
not yet supported tiles formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1439>
2021-12-10 21:37:14 +00:00
Seungha Yang e8c923ebde d3d11window: Remove hack related to color space selection
Use input GstVideoColorPrimaries without any special case handling
otherwise rendered image color would be very wrong.

The hack was added to work around an issue that some Intel driver
couldn't handle wide color gamut image without HDR10 metadata, specifically PQ image.
But device capability can be checked via a method added in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1723
so there's no issue now.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1175
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1430>
2021-12-09 20:12:12 +09:00
Seungha Yang 1a12883993 d3d11window: Fix typo in debug message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1430>
2021-12-09 19:51:20 +09:00
Nicolas Dufresne 7e875ddb2c v4l2codecs: mpeg2: Fix selected sizeimage
Due to a copy paste bug, the bitdepth was never set and that was leading
to requesting sizeimage of 0. Previously that worked since the driver
would in that case pick a size for us. But now the we bumped the minimum
to 4KB, the driver happily allocate 4KB of bitstream which lead to
decoding error.

As MPEG2 have a fixed bitdeph of 8, use a define instead of the run-time
variable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1415>
2021-12-03 07:55:30 -05:00
Nicolas Dufresne 05458f05e0 v4l2codecs: vp9: Drop frames on non-keyframe format change
V4L2 does not yet support this feature, this will skip over the
transition portion up to the next keyframe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1404>
2021-12-02 15:52:03 -05:00
Nicolas Dufresne a6eb1e7782 v4l2codecs: Fix renegotiation
If we hold the last reference to the allocator, leaving the device
streaming will cause an EBUSY error when trying to free the allocate
buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1404>
2021-12-02 15:45:26 -05:00
Seungha Yang e87791592e d3d11vp9dec: Drop frames on non-keyframe format change
... in case of NVIDIA GPU

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1407>
2021-12-02 19:19:59 +00:00
Seungha Yang 2c834b5fc7 nvvp9sldec: Drop frames on non-keyframe format change
NVDEC doesn't seem to be able to handle the case

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1407>
2021-12-02 19:19:59 +00:00
Nicolas Dufresne d04fba93f8 v4l2codecs: vp9: Remove uneeded picture data
The GstV4l2Request now holds a reference on the picture buffer and is
recounted already. This effectively removes usage of GRefCount which is only
available in GLib 2.58, while we support 2.56.

Fixes #910

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1402>
2021-11-30 17:11:59 -05:00
Nicolas Dufresne 19d99dbcae v4l2codecs: decoder: Add method to get the pic_buf
This helper will be needed for VP9 frame duplication.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1402>
2021-11-30 17:11:59 -05:00
Nicolas Dufresne 8a1440b3f1 v4l2codecs: vp9: Add missing error checks in decide_allocation
This could otherwise lead to crash.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1402>
2021-11-30 17:11:56 -05:00
Nicolas Dufresne 4ca7f1e014 v4l2codecs: h264: Fix typo in comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1387>
2021-11-30 00:28:34 +00:00
Nicolas Dufresne 83933b7772 v4l2codecs: h264: Properly set pic_num/frame_num
The V4L2 uAPI uses pic_num for both PicNum and ShortTermPicNum. It also
doe the same for both FrameNum and LongTermFrameIdx. This change does
not change the fluster score, but fixed a visual corruption noticed
with some third party streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1387>
2021-11-30 00:28:34 +00:00
He Junyan b5c07e11ca va: Use a lock to protect the surface copy by using vpp.
If we use vpp to do the surface copy, its operation is not atomic.
 We need to maintain the filter's context unchanged during the whole
 copy progress.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1373>
2021-11-29 19:25:31 +00:00
He Junyan 954f7cf88c va: Use the GstVaSurfaceCopy of the allocator atomically.
The mem_copy() of the allocator can be called simultaneously from
different threads. We should use atomic pointer operations to create
and use the GstVaSurfaceCopy of the allocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1373>
2021-11-29 19:25:31 +00:00
He Junyan 7f31dcf084 va: DMA allocator: Set the copied memory properly when popped from pool.
The current code does not set the copied memory correctly when it is popped
from the surface cache pool.
1. We forget to ref the allocator, which causes the allocator to be freed
   unexpected, and we get a crash later because of the memory violation.
2. We forget to add ref_mems_count, which causes the surface leak because
   the surface can not be pushed back to the cache pool again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1373>
2021-11-29 19:25:31 +00:00
Daniel Almeida 285695ee52 v4l2codecs: gstv4l2decoder: set minimum sizeimage
Set minimum sizeimage such that there is enough space for any overhead
introduced by the codec.

Notably fix a vp9 issue in which a small image would not have a
bitstream buffer large enough to accomodate it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1012>
2021-11-29 17:41:19 +00:00