Commit graph

3881 commits

Author SHA1 Message Date
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
Seungha Yang
afe941249e d3d11window: Add unprepare method to clear internal resource
GObject::dispose method can be called multiple times. As win32 d3d11window
has an internal thread and because GObject::dispose method could be called from the
thread, it might cause problems such as trying to join self-thread

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1299>
2020-05-27 04:59:50 +09:00
Seungha Yang
8ce4980273 mfsourceobject: Remove useless null check for string
We can pass null for the value of string type property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
2020-05-25 15:09:20 +00:00
Seungha Yang
50b36ce257 mediafoundation: Use G_BEGIN_DECLS/G_END_DECLS pair everywhere
... instead of extern "c" {} block.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
2020-05-25 15:09:20 +00:00
Seungha Yang
c4cb51c63d mediafoundation: Add support video capture on UWP app
New video capture implementation using WinRT Media APIs for UWP app.
Due to the strict permission policy of UWP, device enumeration and
open should be done via new WinRT APIs and to get permission from users,
it will invoke permission dialog on UI.
Strictly saying, this implementation is not a part of MediaFoundation
but structurally it's very similar to MediaFoundation API.
So we can avoid some code duplication by adding this implementation
into MediaFoundation plugin.

This implementation requires UniversalApiContract version >= 6.0
which is part of Windows 10 version 1803 (Redstone 4)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
2020-05-25 15:09:20 +00:00
Seungha Yang
e580676747 mfsourceobject: Move device name, path, and index to public struct
... so that subclass can access each value and update them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
2020-05-25 15:09:20 +00:00
Seungha Yang
6ae478946c mediafoundation: Fix typo in source object impl.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1241>
2020-05-25 15:09:20 +00:00
Seungha Yang
3efc8f5de9 mftransform: Clear unused output IMediaSample
If MFT doesn't produce encoded output, need to free allocated
output sample and buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1297>
2020-05-25 10:25:37 +00:00
Seungha Yang
b93fbdd3cd mfvideoenc: Fix huge memory leak
Subclass must unref passed GstVideoCodecFrame on GstVideoEncoder::handle_frame()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1294>
2020-05-24 19:12:28 +09:00
Seungha Yang
e75049eb84 nvh264sldec: Fix wrong scaling list matrix scan order
Quatization matrix of NVDEC should be raster scan order but
h264parser stores it in zig-zag scan order. We need to convert
the matrix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1290>
2020-05-23 01:06:28 +09:00
Nicolas Dufresne
d16367f046 v4l2codecs: h264: Add missing break
There was a missing break for the 4:4:4 case which would break the sizeimage
calculation. We don't currently have hardware that supports 4:4:4, so this
code wasn't tested. This was detected by Coverity.

CID 1463592 1463591

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1283>
2020-05-21 20:12:07 +00:00
Matthew Waters
8403d97587 amc/videodec: only retrieve the stride/slice-height for raw output
When outputting to a surface, these values may not exist.

As found on a Google Pixel 3.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1284>
2020-05-21 12:40:21 +00:00
Seungha Yang
dac36cb98f mediafoundation: Add device provider implementation
Only static device probing is supported for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1236>
2020-05-20 11:06:09 +00:00
Seungha Yang
ba45e3f82b mfsourceobject: Store selected device path, name and index
Update path, name and index with selected device so that checked by
get_property() after constructed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1236>
2020-05-20 11:06:09 +00:00
Nicolas Dufresne
2160239548 v4l2slh264dec: Request large enough bitstream buffer
The Cedrus driver would otherwise choose 1KB buffer, which is too small.
This follows what some drivers do, which is simply to use the size a
packed raw image would have. Specifications do not really guaranty any minimum
compression ratio.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1268>
2020-05-19 17:51:11 +00:00
Nicolas Dufresne
037730a787 v4l2slh264dec: Add slice based decoder support
This adds support for slice based decoder like the Allwinner/Cedrus driver. In
order to keep things efficient, we hold the sink buffer until we reach the end
of the picture. Note that as we don't know which one is last, we lazy queue the
slices. This effectively introduces one slice latency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1268>
2020-05-19 17:51:11 +00:00
Nicolas Dufresne
661f0c161e v4l2codecdec: Fix error handling
If none of the format the HW produce is supported, the fiter will be NULL,
which would lead to assertion when trying to release it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1268>
2020-05-19 17:51:11 +00:00
Nicolas Dufresne
26264163de v4l2decoder: Add legacy non-multiplanar support
The Cedrus driver uses the lagacy buffer type (non-mplane). This automatically
detect and use the right v4l2_buf_type. This also affect code using
v4l2_buffer and v4l2_format structures.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1268>
2020-05-19 17:51:11 +00:00
Nicolas Dufresne
14b0b68354 v4l2codecs: Update kernel headers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1268>
2020-05-19 17:51:11 +00:00
Seungha Yang
24f30b2e6e d3d11convert: Fix fallback texture setup when resolution is not even number
When texture format is semi-planar, resolution should be even number,
and add missing P016 format handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Seungha Yang
a966cc20bc d3d11convert: Fix fallback texture copy
Fix texture copy when input texture has non-zero subresource index

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Seungha Yang
a24d4e654d d3d11: Add support for video rescale and rename element to d3d11convert
GstD3D11ColorConverter implementation is able to rescale video as well.
By doing colorspace conversion and rescale at once, we can save
one cycle of shader pipeline which will can save GPU resource.

Since this element can support color space conversion and rescale,
it's renamed as d3d11convert

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Seungha Yang
0e842c74b6 d3d11: Move scoring util method for colorspace conversion to colorconvert element
It's used only by colorconvert element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Víctor Manuel Jáquez Leal
d2aae6bb96 codecs: h264decoder: ref pic lists as decode_slice parameters
Pass reference picture lists to decode_slice() vmethods

Change gstv4l2codech264dec and gstnvh264dec accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1238>
2020-05-19 16:57:09 +00:00
Arun Raghavan
d0776faf47 opensles: Remove hard-coded buffer-/latency-time values
These were originally required in early Android versions, but are no
longer needed.
2020-05-16 19:23:06 +00:00
Seungha Yang
8afc283b51 mediafoundation: Refactor GstMFSourceObject implementation
* Move CoInitializeEx/CoUninitialize pair into thread function in order to
  ensure MTA COM thread
* Move common code to baseclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1269>
2020-05-15 09:03:13 +00:00
Seungha Yang
c29c71ae9d mediafoundation: Remove COM thread constraints from GstMFTransform object
Move CoInitializeEx/CoUninitialize pair into our dedicated thread so that
we can ensure COM thread is MTA. This will remove thread constraints
around plugin init.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1269>
2020-05-15 09:03:13 +00:00
Matthew Waters
b3cbdb1d26 amcvideodec: fix sync meta copying not taking a reference
Fixup for
9b9e39be24: amc: Fix crash when a sync_meta survives its sink
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/603

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1272>
2020-05-15 13:54:56 +10:00
Ting-Wei Lan
d10e2381c7 v4l2codecs: Fix compilation error on FreeBSD
This commit does the following things to fix compilation on FreeBSD:

1. Add required typedefs to linux/types-compat.h.
2. Remove unnecessary include linux/ioctl.h and replace linux/types.h
   with linux/types-compat.h. Both files do not exist on FreeBSD.
3. Check the header including makedev macro. FreeBSD does not have
   sys/sysmacros.h, and including it unconditionally causes error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1259>
2020-05-11 15:17:31 +00:00
Haihao Xiang
98600942e4 msdkvpp: clear the parameters after closing the session
Otherwise the stale values are used for the new process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1159>
2020-05-11 02:16:44 +00:00
Xu Guangxin
cab1ddf48b msdk: bufferpool: set alignment to video meta
else gst_video_meta_validate_alignment will report error like
"videometa gstvideometa.c:416:gst_video_meta_validate_alignment: Stride of plane 0 defined in meta (384) is different from the one computed from the alignment (320)"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1224>
2020-05-07 05:45:36 +00:00
Nicolas Dufresne
5ece17ecbd v4l2slvp8dec: Flip the meaning of segment_feature_mode
In section 9.3.4 a), segment_feature_mode have 0 for absolute and 1 for delta,
while in 19.2, it says the opposite. But the reference code, which usually
rules over the text state that 1 means absolute:

 if (hdr->update_data)
 {
     hdr->abs = bool_get_bit(bool);

And uses it with that meaning to decide weither to override the existing value
or just add the detla. This fixes multiple decoding issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1245>
2020-05-05 17:57:08 +00:00
Nicolas Dufresne
11c62eb015 v4l2slvp8dec: Copy header version
This field was not copied.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1245>
2020-05-05 17:57:08 +00:00
Nicolas Dufresne
8c56822936 v4l2slvp8dec: Add debugging for reference frames
This simply trace the frame number of the references used for decoding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1245>
2020-05-05 17:57:08 +00:00
Nicolas Dufresne
a449815f95 v4l2slvp8dec: Ensure width/height is always set
Our parser strictly read the bitstream. As it's known from DXVA that always
having a valid width/height might be needed, use the cached width/height
instead of the value from the parser. This didn't impact Hantro driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1245>
2020-05-05 17:57:08 +00:00
Nicolas Dufresne
ffd74fb5ec v4l2slvp8dec: Fix debug category name
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1245>
2020-05-05 17:57:08 +00:00
Seungha Yang
d9c552802e d3d11vp8dec: Remove useless assign operation
It's already been done in the line just above.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1246>
2020-05-05 16:37:14 +00:00
Seungha Yang
a4fbb49ef3 d3d11window: Fix processor output view resource leak
Because this object holds reference to native d3d11 device handle internally,
related native d3d11 objects would be leaked as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1243>
2020-05-05 20:49:32 +09:00
Tim-Philipp Müller
9539eecf20 nvcodec: fix compiler warning in certain setups
Fixes gstnvh264dec.c:648:12: warning: unused variable ‘ret’
compiler warning on raspbian where HAVE_NVCODEC_GST_GL is
not defined.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1239>
2020-05-03 11:08:29 +01:00
Seungha Yang
ed147a3b48 d3d11h264dec: Rearrange the order of supported profiles in caps
constrained-baseline profile is much preferred than baseline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1229>
2020-04-29 18:13:42 +00:00
Seungha Yang
28dc4a1dd8 nvh264sldec: Allow constrained-baseline and baseline profiles
Like d3d11h264dec, we need to relax the condition for profiles of nvh264sldec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1228>
2020-04-30 02:36:34 +09:00