Commit graph

376 commits

Author SHA1 Message Date
He Junyan 122ffa56ed glupload: make directviv upload manner only consider system memory
The current _directviv_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

And in _directviv_upload_accept(), we should only accept the system
memory as input caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan b9c97ba76d glupload: make gl memory upload manner only consider memory:GLMemory feature
The current _gl_memory_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

And in _gl_memory_upload_propose_allocation(), we should only allocate
the allocator and buffer pool for the caps with "memory:GLMemory"
feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 414f91d0fa glupload: make meta upload manner only consider TextureUploadMeta feature
The current _upload_meta_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan fe07763fd8 glupload: make raw manner only consider system memory
The current _raw_data_upload_transform_caps() only simply apply
"memory:GLMemory" to all input caps to transform the output caps.
This is not precise and may cause problem. For example, if the
input caps include:

  video/x-raw(memory:DMABuf), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

it will be changed as

  video/x-raw(memory:GLMemory), width=(int)1920, height=(int)1080, \
  interlace-mode=(string)progressive, multiview-mode=(string)mono, \
  framerate=(fraction)30/1, drm-format=(string)NV12:0x0100000000000002

For GLMemory kind caps, no drm-format should appear.

So we should let it only transforms which it can recognize.
We also should recognize the system memory caps in _accept() early, if
the input is not system memory, we just return early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan cae46d36b5 glupload: change the accept function to import dmabuf with modifier
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 21faad5eca glupload: enable drm kind caps in glupload plugin for DMA buf
Most of the time, the RGB kind formats are OpenGL native supported
format which has only one plane. They can be imported at one shot
using no matter DIRECT or INDIRECT mode.
While YUV kind formats which have multi planes have two ways to import.
They can be DIRECT imported, which requires GL_OES_EGL_image_external
extension. The output format should be RGBA and TARGET should be set
as OES after imported. The other way, they can be INDIRECT imported,
which makes each plane as a texture. In this mode, the imported textures
have different fourcc from the original format. For example, the NV12
format can be imported as a R8 texture for the first plane and RG88
texture for the second plane. The output TARGET should be sets as 2D
in this mode.

When converting sink caps to src caps, we first filter the feature of
"video/x-raw(memory:DMABuf)" and system memory. Then Based on the
external_only flag (INDIRECT mode does not care while DIRECT mode cares),
we transform the drm-format into the gst video format.

When converting src caps into sink caps, we first filter the correct
TARGET(INDIRECT mode contains 2D only while DIRECT mode contains 2D,
OES or both of them) gstructure. Then Based on the include_external flag
(INDIRECT mode always true while DIRECT mode depends on TARGET), we
transform the gst video format into drm-format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 96ea1b8da9 glupload: Add a helper function of _filter_caps_with_features()
We sometimes need to filter some special feature for the next step.
This helper function can help us to filter out un-needed features
in a caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 95707bb80d glupload: add a helper function to convert drm formats into gst formats
Co-authored-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 6dd3d6f1c1 glupload: add a helper function to convert gst formats into drm formats
Co-authored-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
He Junyan 22bb3107d7 gl: add a method to check whether DMA modifier is supported in EGL
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3524>
2023-08-03 20:58:23 +00:00
Nirbheek Chauhan eb9be6de78 glcolorconvert: Fix syntax for GLSL shaders
Shader compilation was failing on macOS:

gstglslstage.c:519:_compile_shader:<glslstage1> fragment shader compilation failed:
ERROR: 0:10: 'input_swizzle' : syntax error: Array size must appear after variable name

Co-authored-by: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5123>
2023-07-31 17:33:20 +05:30
Matthew Waters 7fcef3818e glcolorconvert: expose the swizzle glsl functions
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters bff5d6d725 glcolorconvert: expose the YUV->RGB glsl function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters b32e2cd9dd gl: expose calculating swizzle indices to/from RGBA/YUVA
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters a90f6d5d67 gl/format: add helper for returning the number of components in a GL format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:09 +00:00
Matthew Waters 5bf85e7588 gl/colorconvert: use swizzle indices instead of chars
Allows using a uniform to control which value goes where and not rewrite
the shader for every format combination.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5109>
2023-07-28 03:29:08 +00:00
Matthew Waters 00316db5e5 gl/eagl: ignore OpenGLES deprecation on ios
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5111>
2023-07-27 13:05:37 +00:00
He Junyan 9e863976c9 video: dma: let gst_video_info_dma_drm_to_caps() return caps with DMABuf feature
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5107>
2023-07-26 20:49:02 +00:00
He Junyan 5299c34452 video: Add GST_VIDEO_FORMATS_STR to declare all video formats as a string
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5094>
2023-07-25 19:34:58 +00:00
Víctor Manuel Jáquez Leal 8b38614173 video: add GST_VIDEO_DMA_DRM_CAPS_MAKE
It is requried this macro because it doesn't define format field, neither
drm-format which is suppossed to be generated in run-time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
He Junyan bc48588818 video: dma: Set DMA caps' format field to DMA_DRM
The current way of dma caps uses the drm-format to replace the orginal
format field. The absence of format field means it can accept all formats.
It causes problems when clipping with other old DMA or video/x-raw(ANY)
caps, the result will contain both format field and drm-format field,
which is not valid DMA caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
He Junyan 94c94d34dc video: Add new GST_VIDEO_FORMAT_DMA_DRM video format
This GST_VIDEO_FORMAT_DMA_DRM is introduced for DMABuf kind feature
usage. It represent the DMA DRM kind memory. And like the ENCODED
format, it should not be interpreted and mapped as normal video format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4981>
2023-07-19 09:57:50 +00:00
Ruslan Khamidullin 53582b7430 video: accept timecode of 119.88 (120/1.001) FPS
The drop-frame rules are specified in “SMPTE ST 12-3:2016” and are
consistent with the traditional ones:

“

To minimize fractional time deviation from real time, the first two
super-frame numbers (00 and 01) shall be omitted from the count at the
start of each minute except minutes 00, 10, 20, 30, 40, and 50. Thus the
first eight frame numbers (0 through 7) are omitted from the count at
the start of each minute except minutes 00, 10, 20, 30, 40, and 50.
”

Where “super-frame” is a group of 4 frames for 120 FPS.

Fixes #2797

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5028>
2023-07-18 13:46:57 +00:00
Andoni Morales Alastruey fcf2d8c350 videodecoder: fix segfault copying buffer metas
The current implementation copies metas without checking if the buffer
is writable.

The operation that needs to be done, replacing the input buffer and
copying the metas, is only part of that process. We create a new function
that does both.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4912>
2023-07-18 07:39:02 +00:00
Hou Qi 4f5e881e2a riff: add more h265 fourcc formats
Regards hevc/HEVC/hev1/HEV1 fourcc as video/x-h265 format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5031>
2023-07-17 13:17:20 +00:00
Mathieu Duponchelle 6305db1279 base/video-converter: downgrade log level
We don't need to know about routine operation of video conversion
at GST_DEBUG=5 level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4993>
2023-07-17 07:39:46 +00:00
Matthew Waters a2d9584b27 gl: provide a pkg-config/gir file for the viv-fb backend
Required to be able to generate coherent bindings for window system
specific APIs due to limitations in gobject-introspection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5020>
2023-07-12 21:35:55 +10:00
Matthew Waters ffb2e87fd4 gl: don't install the viv-fb window header file
It is not needed at all by any external implementations and should not
be exposed to the outside world.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5020>
2023-07-12 21:31:45 +10:00
Maksym Khomenko 831737124f appsink: add missing make_writable call
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4991>
2023-07-11 07:08:38 +00:00
Edward Hervey 654609ef15 dsd: Fix documentation parameters
There were some inconsistencies between documentation and function signatures

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5002>
2023-07-11 05:17:55 +00:00
Tim-Philipp Müller 15957bcdc9 Revert "base: videosink: Avoid positing message on the bus before being constructed"
This reverts commit 893e4ed0dd.

This caused regressions in existing elements which override/set things
like QoS and such in their own init functions. If the base class does
this in ::constructed() now it will override the subclass settings
again with its own, which can have unintended side-effects.

Case in point is gdkpixbufsink which disabled QoS there, and this
patch would reliably make the unit test fail in valgrind because
now frames are dropped because of QoS (when QoS should really be
disabled).

Fixes #2794

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5006>
2023-07-10 21:54:51 +00:00
Thibault Saunier 893e4ed0dd base: videosink: Avoid positing message on the bus before being constructed
`gst_base_sink_set_processing_deadline` can post messages on the bus
which triggers traces for not constructed objects which fails in rust
tracers as object should have names in all traces.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4975>
2023-07-06 05:48:31 +00:00
Thibault Saunier 8d603b3e1d bad: audioaggregator: Do not post message before being constructed
`gst_aggregator_set_latency` will post a message on the bus which
triggers traces for not constructed objects which fails in rust tracers
as object should have names in all traces.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4975>
2023-07-06 05:48:31 +00:00
Sebastian Dröge e63548906c video: Move NV12_10LE40_4L4 before the BE variant on LE platforms
This keeps the sorting rules for the format list intact.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4974>
2023-07-06 00:11:45 +01:00
Sebastian Dröge 44ffb80a32 audio: Extend guards in functions to also cover negative/unknown out of bounds DSD formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4966>
2023-07-05 12:08:33 +00:00
Sebastian Dröge 6b47a37ed8 audio: Change value of GST_DSD_FORMAT_UNKNOWN to 0
GObject and calloc() etc are initializing memory to 0, so using 0 as the
unknown variant makes it more likely that mistakingly zero-initialized
memory does not end up with a wrong DSD format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4966>
2023-07-05 12:08:33 +00:00
Sebastian Dröge 030bf5e560 audio: Make GST_DSD_FORMAT_UNKNOWN -1 instead of 0xffffffff
0xffffffff is mapped to 2**32 - 1 but GLib enums are signed ints so this
value is out of range and causes problems with bindings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4966>
2023-07-05 12:08:33 +00:00
Carlos Rafael Giani d5a9ca8ef6 gl: Separate viv direct texture checks from viv-fb winsys check
Vivante direct textures do not depend on the viv-fb windowing system.
Decouple these two to be able to use direct textures even when viv-fb
is not enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4950>
2023-07-03 05:25:13 +00:00
Jan Schmidt 2e5908d33f appsrc: Release priv->lock before pushing segment
Don't hold the private appsrc lock while pushing out a segment
event, which may block indefinitely.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4951>
2023-06-30 16:05:57 +00:00
Jonas Kvinge fa46905aea discoverer: Only call handle_current_async if still processing
When gst_element_set_state is called in _setup_locked and errors, the
callback is already processed before we reach handle_current_async, and
the timer is started even though it's finished processing, which results
in a NULL pointer crash later in async_timeout_cb.

To fix this, we check that it's still processing before calling
handle_current_async.

Fixes #1683

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4936>
2023-06-30 08:52:38 +03:00
He Junyan a10e05000d video-info-dma: add gst_video_info_dma_drm_to_video_info()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4883>
2023-06-26 16:18:24 +00:00
Carlos Rafael Giani 8febc4102a audiosink: Add support for DSD data
Code is partially based on the DSD of Robert Tiemann <rtie@gmx.de>:
https://gitlab.freedesktop.org/rtiemann/gstreamer/-/tree/dsd

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3901>
2023-06-23 01:27:04 +00:00
Carlos Rafael Giani b65eab915a audioringbuffer: Add support for DSD data
Code is partially based on the DSD of Robert Tiemann <rtie@gmx.de>:
https://gitlab.freedesktop.org/rtiemann/gstreamer/-/tree/dsd

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3901>
2023-06-23 01:27:03 +00:00
Carlos Rafael Giani 4cce9a77c9 audioringbuffer: Introduce accessor macros
This follows the design ideas behind GstVideoInfo to provide an API
capable of hiding any underlying ABI compatibility mechanisms.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3901>
2023-06-23 01:27:03 +00:00
Carlos Rafael Giani 8c5a8f4466 dsd: Add code for DSD audio support
Related to:

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/972

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3901>
2023-06-23 01:27:03 +00:00
Sebastian Dröge 3144f63302 tags: Don't allow image tags with G_MAXUINT32 length
This will cause an integer overflow a little bit further down because we
allocate a bit more memory to allow for a NUL-terminator.

The caller should've avoided passing that much data in already as it's
not going to be a valid image and there's likely not even that much data
available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4894>
2023-06-20 10:02:19 +00:00
He Junyan 0b981a216c gl: Add a print function to dump all EGL image drm format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4877>
2023-06-19 12:58:02 +00:00
Nicolas Dufresne c17e648fcf video: Add NV12_10LE32_4L4 tiled format
This 10bit format is identical to NV12_4L4, but uses NV12_10LE40 format
internally. In show, the tiles is made af 4 rows of 5 bytes, which contains
4 fully packed 10bit values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447>
2023-06-15 14:32:32 +00:00
Nicolas Dufresne b832a20d35 video: Fix tile info UV width
The width in pixel should consider a UV pair as 1 pixel, fix the metadata
accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447>
2023-06-15 14:32:32 +00:00
Haihua Hu 5716ee3513 glfilter: add parent meta to output buffer for input buffer
glfilter will unref input buffer after _transform() call immidiately,
but gpu may still reading input buffer for rendering because gl
api is executed async. Need hold reference for input buffer by
adding parent meta to output buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4801>
2023-06-13 07:53:49 +00:00