Commit graph

4610 commits

Author SHA1 Message Date
Fabian Orccon
71c4355b1c sys: shm: Define shm_enable and shm_deps before escape meson subdir
Fixes meson configure in tests if the shm plugin is disabled

Fixes #1664

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2534>
2021-09-18 22:13:55 +00:00
Seungha Yang
45409d4558 d3d11videosink: Display title of content if possible
Update title text of window (currently it's always "Direct3D11 renderer")
when we are rendering on internal HWND, not external HWND.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2529>
2021-09-18 16:02:15 +00:00
Seungha Yang
3817efb275 d3d11videosink: Remove unused enum value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2529>
2021-09-18 16:02:15 +00:00
Mengkejiergeli Ba
5628955624 msdkenc: Pass color properties to MediaSDK for encoding
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2523>
2021-09-18 14:40:24 +00:00
Mengkejiergeli Ba
788826b205 msdkh265enc: Add profile main10 still picture for hevc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2524>
2021-09-18 06:04:56 +00:00
Seungha Yang
7d1f6459a0 d3d11decoder: Refactor for more unified decoding flow
... and various code cleanup.

* Move spreaded decoding API calls into one method
Previously, decoding flow of most codecs are
- Call DecoderBeginFrame() on start_picture()
- Call {Get,Release}DecoderBuffer() on decode_slice()
- Call SubmitDecoderBuffers() and DecoderEndFrame() on end_picture()
Such spreaded API calls make it hard to keep track of status
of decoding. Now it will be done at once in a new method.

* Drop a code for non-zero wBadSliceChopping
When bitstream buffer provided by driver is not sufficient
to write compressed bitstream data, host decoder needs to make use
of wBadSliceChopping so that driver can understand there are
multiple bitstream buffer. But it's a bit unrealistic and
not tested. Since FFMpeg's DXVA implemetaion doesn't support it,
we might be able to ignore the case for now.

* Make code more portable
Consider common logic of GstCodecs -> DXVA translation for all D3D APIs
(i,e., D3D9, D3D11, and D3D12).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2525>
2021-09-17 20:03:28 +09:00
Seungha Yang
a77f793c8b d3d11decoder: Remove duplicated class_init and property related code
Move them into the decoder helper code to remove duplication

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2525>
2021-09-17 18:44:51 +09:00
Seungha Yang
4f45828641 d3d11: Get rid of "extern "C"" wrapping for GST_DEBUG_CATEGORY_EXTERN
Instead, change the file defining debug category to cpp

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2525>
2021-09-17 00:48:45 +09:00
He Junyan
364a2fe08e va: h264dec: Try to use ConstrainedBaseline or Main to decode BaseLine.
In the h264, the Baseline profile is widely misused. A lot of streams declare
that they are the Baseline, but in fact they just conform to ConstrainedBaseline.
The features such as FMO and ASO are not used at all.
If the decoder does not strictly conforms to the SPEC, we can just use Baseline
or Main profile to decode it to avoid lots of streams failure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2428>
2021-09-13 21:51:12 +08:00
Víctor Manuel Jáquez Leal
4f0b619023 va: Update vapostproc documentation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 17:48:23 +02:00
Víctor Manuel Jáquez Leal
d4d483856f va: Update todo lists, removing deinterlacing.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 17:48:23 +02:00
Víctor Manuel Jáquez Leal
4a39bf6680 Add vadeinterlace element.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 17:48:23 +02:00
Víctor Manuel Jáquez Leal
b13fd4f15b va: filter: Add past and future frames in GstVaSample.
And add them in the pipeline structure if they are provided.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 17:48:23 +02:00
Víctor Manuel Jáquez Leal
419ef31d1e va: filter: Add gst_va_filter_add_deinterlace_buffer()
This function decorates gst_va_filter_add_filter_buffer() to get the
number of past and future frames to hold, given the method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 17:48:22 +02:00
Víctor Manuel Jáquez Leal
101dcb55d9 va: filter: Add deinterlacing method parameter.
For exposing that gobject parameter a new helper function is added:

gst_va_filter_install_deinterlace_properties()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 17:48:22 +02:00
Víctor Manuel Jáquez Leal
51dcba7b1e va: filter: Protect filters array of overwrite.
It's possible to modify the filters array from another GStremer
thread, and the post-processing operation is not atomic, so the filter
array is reffed while the VA pipeline is processed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 14:45:00 +02:00
Víctor Manuel Jáquez Leal
cc91fd0956 va: filter: Add helper function to query pipeline caps.
This function is going to be shared for future deinterlace filter
processing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 14:45:00 +02:00
Víctor Manuel Jáquez Leal
7f2e1e2eb3 va: filter: Shuffle _destroy_filters_unlocked().
In order to put it near to its caller.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 14:45:00 +02:00
Víctor Manuel Jáquez Leal
0a7828e9ba vapostproc: Move up color balance detection to plugin.
In order to install the color balance interface, a GstVaFilter is
instantiated and queried to know if it supports color balance
filter. It was done just after the GObject was registered. Now, it's
done before.

The reason of this change is that deinterlace element has to be
registered only if deinterlace filter is available, using only one
instantiate of GstVaFilter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 14:45:00 +02:00
Víctor Manuel Jáquez Leal
ece5feeb8d va: basetransform: Update documentation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 14:41:27 +02:00
Víctor Manuel Jáquez Leal
1b30920464 va: basetransform: Add autoptr clean up function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 14:34:32 +02:00
Víctor Manuel Jáquez Leal
ef3f53428d va: basetransform: Use copy_metadata() at buffer import.
Instead of using only gst_buffer_copy_into() use copy_metadata()
vmethod to copy what's needed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 10:52:13 +02:00
Víctor Manuel Jáquez Leal
51e446345f vapostproc: don't chain up transform_meta()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2495>
2021-09-10 10:52:13 +02:00
Ung, Teng En
580ac55194 msdk: Adjust the plugin and factories description based on MFX_VERSION.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2485>
2021-09-09 13:06:06 +08:00
Nicolas Dufresne
52fff41aae Revert "kmssink: Fix fallback path for driver not able to scale scenario"
This reverts commit d2a7b763be.

After this change, non-scaled rendered were not centred as expected.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2496>
2021-08-27 19:54:52 +00:00
Seungha Yang
fe4ec03a4b d3d11bufferpool: Hide buffer_size field from header
User can get the required buffer size by using buffer pool config.
Since d3d11 implementation is a candidate for public library in the future,
we need to hide everything from header as much as possible.

Note that the total size of allocated d3d11 texture memory by GPU is not
controllable factor. It depends on hardware specific alignment/padding
requirement. So, GstD3D11 implementation updates actual buffer size
by allocating D3D11 texture, since there's no way to get CPU accessible
memory size without allocating real D3D11 texture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2482>
2021-08-22 00:46:19 +09:00
Seungha Yang
1874206abd nvcodec: Fix various typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2481>
2021-08-21 13:09:15 +00:00
Seungha Yang
4ed4a7ed7e nvcodec: Get rid of G_GNUC_INTERNAL
Our default symbol visibility is hidden, so G_GNUC_INTERNAL
is pointless

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2481>
2021-08-21 13:09:15 +00:00
Nicolas Dufresne
4eb22b7695 v4l2codecs: h264: Fix split field handling
Split fields ends up on multiple picture and requires accessing the
other_field to complete the information (POC).

This also cleanup the DPB from non-reference (was not useful) and skips
properly merge field instead of keeping them duplicated. This fixes most
of interlace decoding seen in fluster.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2474>
2021-08-20 19:29:53 +00:00
Nicolas Dufresne
ad5dcfb091 v4l2codec: h264: Implement support for split fields
When a frame is composed of two fields, the base class now split the
picture in two. In order to support this, we need to ensure that picture
buffer is held in VB2 queue so that the second field get decoded into
it. This also implements the new_field_picture() virtual and sets the
previous request on the new picture.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2474>
2021-08-20 19:29:53 +00:00
Nicolas Dufresne
0b05b9b3e6 v4l2codecs: h264: Fix filling weight factors
This was a typo, the wrong index was used to set l1 weight (b-frames).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2480>
2021-08-20 16:03:43 +00:00
Seungha Yang
75f6f79e57 mfvideosrc: Fix for negative MF stride
Negative stride value can be used in MediaFoundation to inform
whether memory layout is top-down or bottom-up manner. Note that
negative stride is allowed only for RGB, system memory.

See also
https://docs.microsoft.com/en-us/windows/win32/medfound/image-stride

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1646
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2473>
2021-08-19 22:01:50 +09:00
Nicolas Dufresne
0a6a8e3869 v4l2slh264dec: Fix slice header bit size calculation
The emulation bytes need to be removed as bytes, not bit. This fixes
decoding issues with files that have emulation bytes with the Cedrus
driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2471>
2021-08-18 18:02:00 +00:00
Víctor Manuel Jáquez Leal
dc825d6a52 vapostproc: Use vapostproc as debug category name.
Otherwise is difficult to remember the different name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2470>
2021-08-18 14:51:01 +02:00
Víctor Manuel Jáquez Leal
6853c3eea8 vapostproc: Disable cropping in pass-through mode.
Originally, if a buffer arrives with crop meta but downstream doesn't
handle crop allocation meta, vapostproc tried to reconfigure itself to
non pass-through mode automatically. Sadly, this behavior was based on
the wrong assumption that propose_allocation() vmethod would bring
downstream allocation query, but it is not.

Now, if vapostproc is in pass-through mode, the cropping is passed to
downstream.  Pass-through mode can be disabled via a parameter.

Finally, if pass-through mode isn't enabled, it's assumed the buffer
is going to be processed and, if cropping, downstream already
negotiated the cropped frame size, thus it's required to do the
cropping inside vapostproc to avoid artifacts because of the size of
downstream allocated buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2443>
2021-08-18 09:00:55 +00:00
Víctor Manuel Jáquez Leal
4784d107ed vapostproc: Update filters update_properties().
Right after instantiating the VA filter and changing the element
state, rebuild the image filters.

This will fix a regression from f20b3b815, where properties in a
gst-launch pipeline are not applied.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2443>
2021-08-18 09:00:55 +00:00
Sebastian Dröge
751f68740f decklinkvideosrc: Fix PAL/NTSC widescreen autodetection when switching back to non-widescreen
Previously it would only switch to widescreen but never back.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2469>
2021-08-18 09:13:45 +03:00
Mengkejiergeli Ba
86872b1b46 msdkvpp: Fix frc from lower fps to higher fps
There are three framerate conversion algorithms described in
<https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md>,
interpolation is not implemented so far and thus distributed timestamp algorihtm
is considered to be more practical which evenly distributes output timestamps
according to output framerate. In this case, newly generated frames are inserted
between current frame and previous one, timestamp is calculated by msdk API.

This implementation first pushes newly generated buffers(outbuf_new) forward and
the current buffer(outbuf) is handled at last round by base transform automatically.
A flag "create_new_surface" is used to indicate if new surfaces have been generated
and then push new outbuf forward accordingly.

Considering the upstream element may not be the msdk element, it is necessary to
always set the input surface timestamp as same as input buffer's timestamp and
convert it to msdk timestamp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2418>
2021-08-18 03:06:59 +00:00
He Junyan
fbf6bfd4d8 va: Use GST_CAPS_FEATURE_MEMORY_VA to replace "memory:VAMemory".
"memory:VAMemory" is a commonly used string which notates our VA-kind
memory type. We now used a definition in va lib to replace the simply
string usage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2466>
2021-08-16 16:25:15 +08:00
He Junyan
d14e8055ad va: Use MEMORY_DMABUF definition to replace "memory:DMABuf" strings.
GST_CAPS_FEATURE_MEMORY_DMABUF is already a common definition, we should
just use it rather than use the "memory:DMABuf" strings by ourselves.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2466>
2021-08-16 16:24:14 +08:00
Seungha Yang
b1dd20d57a wasapi2: Increase rank to primary + 1
wasapi2 plugin should be preferred than old wasapi plugin if available because:
* wasapi2 supports automatic stream routing, and it's highly recommended
  feature for application by MS. See also
  https://docs.microsoft.com/en-us/windows/win32/coreaudio/automatic-stream-routing
* This implementation must be various COM threading issue free by design
  since wasapi2 plugin spawns a new dedicated COM thread and all COM objects'
  life-cycles are managed correctly.
  There are unsolved COM issues around old wasapi plugin. Such issues are
  very tricky to be solved unless old wasapi plugin's threading model
  is re-designed.

Note that, in case of UWP, wasapi2 plugin's rank is primary + 1 already

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2314>
2021-08-13 12:35:11 +00:00
He Junyan
2505ab17e9 va: caps: Make the template raw video caps classified by features.
The current output of raw video caps is not good. When we have multi
profiles and each profile support different formats, the output of
gst-inspect may like:

 SRC template: 'src'
 Availability: Always
 Capabilities:
   video/x-raw(memory:VAMemory)
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: NV12
   video/x-raw
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: NV12
   video/x-raw(memory:VAMemory)
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P010_10LE
   video/x-raw
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P010_10LE
   video/x-raw(memory:VAMemory)
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P012_LE
   video/x-raw
         width: [ 1, 16384 ]
         height: [ 1, 16384 ]
         format: P012_LE

The gst_caps_simplify does not classify the caps by same features, but
just leave them interweaved. We need to handle them manually here, the
result should be:

  SRC template: 'src'
  Availability: Always
  Capabilities:
    video/x-raw
          width: [ 1, 16384 ]
          height: [ 1, 16384 ]
          format: { (string)P010_10LE, (string)P012_LE, (string)NV12 }
    video/x-raw(memory:VAMemory)
          width: [ 1, 16384 ]
          height: [ 1, 16384 ]
          format: { (string)P010_10LE, (string)P012_LE, (string)NV12 }

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2456>
2021-08-11 09:37:33 +00:00
Víctor Manuel Jáquez Leal
f20b3b8156 vapostproc: Inherit from GstVaBaseTransform.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>
2021-08-10 17:31:58 +00:00
Víctor Manuel Jáquez Leal
977a8f3b01 va: Add base transform class.
This base transform class is a derivable class for VA-based filters,
for example vapostproc right now, but it will be used also for
future elements such as vadeinterlace.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>
2021-08-10 17:31:58 +00:00
Víctor Manuel Jáquez Leal
2added54c3 va: pool: Add gst_va_pool_new_with_config().
It is a function helper.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2442>
2021-08-10 17:31:58 +00:00
Seungha Yang
1f6fd7550c d3d11window: Misc code cleanup
* Remove unnecessary upcasting. We are now dealing with C++ class objects
  and don't need explicit C-style casting in C++ world
* Use helper macro IID_PPV_ARGS() everywhere. It will make code
  a little short.
* Use ComPtr smart pointer instead of calling manual IUnknown::Release()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2461>
2021-08-10 16:20:37 +00:00
Seungha Yang
a1048ce110 d3d11compositor: Fix indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2461>
2021-08-10 16:20:37 +00:00
Tim-Philipp Müller
a561b1bd86 Use g_memdup2() where available and add fallback for older GLib versions
g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2280>
2021-08-05 20:51:00 +05:30
Haihao Xiang
c7be05cc38 msdk: make sure child context is destroyed first
The parent context shares some resources with child context, so the
child context should be destroyed first, otherwise the command below
will trigger a segmentation fault

$> gst-launch-1.0 videotestsrc num-buffers=100 ! msdkh264enc ! \
msdkh264dec ! fakesink videotestsrc num-buffers=50 ! \
msdkh264enc ! msdkh264dec ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2435>
2021-08-04 04:50:08 +00:00
Seungha Yang
a096207f85 d3d11videosink: Fix warning around GstVideoOverlay::expose()
When expose() is called, d3d11videosink needs to redraw using
cached buffer, so gst_d3d11_window_render() should allow null buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2450>
2021-08-02 18:27:46 +09:00