721 Commits

Author SHA1 Message Date
Nicolas Dufresne
7205433549 video: pool: Fix pool size configuration for DMA DRM
Now that VideoPool accept DMA DRM, it is quite likely that the size does not get
provided in the configuration even if the format have a matching GstVideoFormat.

Fix this by reporting back the minimum expected size in the configuration. This
allows the configuration handshake to succeed.

Fixes regression caused by !9345

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9600>
2025-08-27 15:30:22 +00:00
Robert Mader
c24dc93944 gl: Add support for the NV24 pixel format
For completeness - and because it came in handy while testing the format
in a related context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9596>
2025-08-24 11:43:23 +02:00
Olivier Crête
e37d5b7b74 rtpbasedepayload: Avoid potential use-after free
Clear the pointer after freeing the reference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9579>
2025-08-19 09:15:03 -04:00
Elliot Chen
fd6168709c video: dma-drm: Add P016_LE format map
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9513>
2025-08-11 17:24:15 +00:00
Elliot Chen
a1faec5f47 glupload: check the return value when transforming caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9478>
2025-08-04 16:00:31 +00:00
Elliot Chen
a374bd51fb videopool: support parsing dma_drm caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9345>
2025-08-04 12:11:41 +00:00
Olivier Crête
14493fa064 Revert "glcolorconvert: should copy metadatas from the incoming buffer"
This reverts commit 199b62570fd201fd67e41af1932d6ae19ead2b76.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6212>
2025-08-01 16:30:01 -04:00
Nicolas Dufresne
6078cee500 opengl: Add opaque 10bit RGB support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9460>
2025-07-31 21:34:35 +00:00
Nicolas Dufresne
b634094928 video: Add more variants of 10bit RGB formats
Add support for RGB10A2/BGR10x2/RGB10x2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9460>
2025-07-31 21:34:35 +00:00
Matthew Waters
9522551e1d gl/basesrc: add get_gl_context
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9455>
2025-07-31 02:24:46 +00:00
Matthew Waters
9dca1f4a6f gl/basesrc: support changing caps
Caps may change the framerate used and the frame counting approach for
timestamps, needs to account for this by taking a snapshot of the current frames
and running time to add to all subsequent produced frames.  Code is mostly taken
from videotestsrc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9455>
2025-07-31 02:24:46 +00:00
Nicolas Dufresne
d45864d77c opengl: upload: Fix and improve DRM modifiers direct import
When using direct DMABuf upload, supported DRM formats and modifiers
pairs should be translated to RGBA. Instead of overwriting the translation
to RGBA, which may endup having nothing to override, we introduce a new
flag for the transform helper, so it can do direct translation.

This fixes a regression introduced by !9306, and fixes more negotiations
issues.

Fixes #4525

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9339>
2025-07-08 15:06:05 +01:00
Doug Nazar
3c8cb96826 glviewconvert: Fix a memory leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9151>
2025-07-08 09:05:29 +00:00
Olivier Crête
f86fb556df sdp: Keep profile-level-id in caps
If it is present in the SDP, then keep it in the caps,
it should be equal for it to work.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9031>
2025-07-07 19:51:39 +00:00
Olivier Crête
5d9abea64c sdpmessage: Try to re-create profile-level-id
Some WebRTC implementations such as Pion are unhappy if the
profile-level-id isn't returned with a compatible profile as the
RFC requires. Let's try to reform it

In practice, the correct way to do this would be to not use caps
intersection, but to instead implement the correct RFC compliant
SDP O/A negotiation of formats.

Include a unit test written by Philippe Normand

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9031>
2025-07-07 19:51:39 +00:00
Olivier Crête
7fb6965ded sdpmessage: Avoid duplicating the extmap when adding multiple codecs
The extmap aren't per-codec in SDP, so if one adds multiple codecs
to the same SDP media, the extmap were duplicated. Look if they are
already present and skip them if they are.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9031>
2025-07-07 19:51:39 +00:00
Doug Nazar
6aca08f155 encoding-target: free fullname on failure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9115>
2025-07-07 13:01:34 +00:00
Thibault Saunier
c604196306 gl: cocoa: Add navigation event support
Implement keyboard, mouse, and scroll wheel event handling for the
OpenGL Cocoa backend.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9276>
2025-07-02 01:31:16 +00:00
Nicolas Dufresne
b6b6bf9370 opengl: Rename to _private EGL and GLX context header
Both only contains private symbols, clarify this by using a very explicit
name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9306>
2025-06-30 21:53:55 +00:00
Nicolas Dufresne
7f18dc5411 gl: upload: Fix direct dmabuf transform function
When doing direct dmabuf upload, we rely on the GL stack for doing the color
transformation. The caps we transform from GL to DMABuf are always with a format
of RGBA. Instead of listing all GstVideoFormat and translating them back into
DRM formats, simply list all supported DRM format for the context.

This enable rendering DRM formats that don't have an shader based emulation
implemented such as NV15.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9306>
2025-06-30 21:53:55 +00:00
Nicolas Dufresne
c475088501 gl: context_egl: Add a helper to list all supported fourcc/modifiers
This helper creates a GST_TYPE_LIST of all possible DRM formats that the context
can support. This will be needed to fix support for formats that aren't emulated
using GStreamer shaders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9306>
2025-06-30 21:53:55 +00:00
Nicolas Dufresne
ef98722709 gl: context_egl: Show all possible translation to GstVideoFormat
The code would simply trace one random format using the DRM fourcc. Instead,
trace the result of translating the pair and skip if there is not match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9306>
2025-06-30 21:53:55 +00:00
Nicolas Dufresne
475083200d gl: utils: Correct gst/dma caps transformation
The transformation was fuzzy, adding random modifiers to the list. Use the newly
introduce helpers from 1.26 to precisely convert GStreamer formats to a DRM
fourcc and modifier pair and vice-versa.

This fixes support for formats that have a GstVideoFormat value and requires a
modifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9306>
2025-06-30 21:53:55 +00:00
Doug Nazar
7bf94c4c46 videodecoder: Print correct frame variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9273>
2025-06-30 12:19:19 +00:00
Loïc Le Page
f47b0c0293 GstAudioAggregator: fix structure unref in peek_next_sample
The GstStructure attached to the audio sample in peek_next_sample() was
freed prematurely before usage as gst_sample_new() is taking full
ownership on it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9248>
2025-06-19 15:25:11 +00:00
F. Duncanh
5268156447 glwindow_cocoa: fix window not closing (w/o user window handle)
A user-supplied window handle (external_view) becomes the superView
of internal_view, which is closed with [view removeFromSuperview].
This fails silently if external_view = NULL (no handle supplied).
Call [win_internal_id close] in this case. Fixes #4432.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9049>
2025-06-19 03:34:09 +00:00
Philippe Normand
fb43941e92 sdp: Add media_add_media_from_structure API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9117>
2025-06-17 14:53:32 +00:00
Robert Mader
d2cd810b07 formats: Add DRM equivalents for 10/12/16 bit SW-decoders formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8965>
2025-06-17 13:54:57 +00:00
Robert Mader
c10aa337b2 video: Update drm_fourcc.h
To drm-misc-next at commit e252e3f3488a492, in order to include
new FOURCCs for SW-decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8965>
2025-06-17 13:54:57 +00:00
Thibault Saunier
97fec43422 discoverer: Make gst_discoverer_info_from_variant nullable
There is no guarantee that the passed in data is valid and we should return
NULL in that case.

Also add API safeguards

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8953>
2025-06-11 10:18:23 -04:00
Xavier Claessens
06851d2e4c python: Fix pulling events from appsink
appsink.pull_object() is introspectable, but it needs a way to convert
the GstMiniObject to its GstEvent/GstSample subclass.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9148>
2025-06-04 20:49:53 +00:00
Thibault Saunier
6d1027f4ce audioencoder: Throttle metadata copy warning to prevent log spam
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9122>
2025-06-04 10:42:54 +02:00
Thibault Saunier
313435f6cb general: Stop checking G_HAVE_GNUC_VARARGS now that we depend on c99
Cleaning up a bit the code now that we can rely on C99 which specifies
varargs for macros.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8990>
2025-05-30 15:30:36 +00:00
Wim Taymans
4417183bae riff-media: fix MS and DVI ADPCM av_bps calculations
Align the calculations for the number of samples per block with the
calculations in adpcmdec.

For MS ADPCM we have in adpcmdec:

       samples = (blocksize - 7 * dec->channels) * 2 + 2 * dec->channels;
       outsize = 2 * samples;
       outbuf = gst_buffer_new_and_alloc (outsize);

This gives us the total output byte size in 16 bits samples. To get back
to the samples, dividing by the channels and 2, we get the right samples per
block as:

       int spb = ((strf->blockalign / strf->channels) - 7) * 2 + 2;

Which we can then use to calculate the bitrate in riff-media.

A similar calculation for DVI ADPCM is needed to get the right bitrate
in all cases.

Tested with the sample in https://bugzilla.gnome.org/show_bug.cgi?id=636245
and another (failing before this patch) sample.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9082>
2025-05-29 10:09:51 +02:00
Doug Nazar
3df63a079c glcontext/egl: Free dma_formats if someone else already initialized
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9044>
2025-05-27 10:44:37 +00:00
L. E. Segovia
7b8d4c0974 orc: Update pregenerated files
Fixes -Wtype-limits on gstbayer.orc when emulating convuuslw.

Regenerated Orc files use OrcOnce, which increases the minimum version to 0.4.34.

See https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/212 (ORC_MIN)

See https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/238 (AVX2 convussql)

See 8a86d51753 (OrcOnce)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9067>
2025-05-25 14:36:17 +00:00
Robert Mader
31660c3ad2 glupload: Promote fixate caps results print to info
And include the input caps. The idea is that this info is
often among the most relevant and having it on INFO level
thus allows to avoid the more noisy DEBUG one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8981>
2025-05-25 00:23:44 +00:00
Thibault Saunier
feb3df61a7 debug: Use log contexts in some places
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6855>
2025-05-22 09:53:35 +00:00
Matthew Waters
daae2c18a4 gl/window: add support for configuring whether a backing surface is needed
Fixes videotestsrc ! glimagesink videotestsrc ! glimagesink under Wayland (at
least).

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2997

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9007>
2025-05-21 08:30:47 +00:00
Robert Mader
c03a5b0c1b glupload: Only add texture-target field to GL caps
So far we simply ignored it for MEMORY_DMABUF passthrough caps
without known negative cosequences, but with upcoming more complicated
caps negotiations it's becoming an issue, thus fix it.

Fixes: 7e71d4f753 ("gl: upload: Add DMA_DRM passthrough upload")
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8964>
2025-05-16 13:40:43 +00:00
Alexander Slobodeniuk
d437e92049 properties: add G_PARAM_STATIC_STRINGS where missing
"Hold on, I know you need to generate the registry, but let me just
create copies of all those strings first", Framework whispered

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8915>
2025-05-10 12:09:38 +00:00
Sebastian Dröge
999c43ada1 mikey: Avoid infinite loop while parsing MIKEY payload with unhandled payload types
Skip over the unhandled payload types for now, and error out if an unknown
payload type is found.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3314

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8917>
2025-05-07 05:56:53 +00:00
Xavier Claessens
352a8a8b12 unifxfdsink: Add an property to allow copying
By design, unixfd is meant to be used for zero-copy and failing when the data is
not FD based memory is wanted to help debug pipelines. Though, there exists
cases, notably with RTP payloader and demuxers, where its not possible
to get all the data into FD memory through allocation queries.

To allow using unixfd for these cases, introduce a property on the unixfdsink
that enable copying the non FD data into freshly allocated memfd.

Co-authored-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8861>
2025-05-05 19:15:56 +00:00
Elliot Chen
c3d8347c81 gl/x11: check whether the display is x11 before using it
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8808>
2025-05-02 01:39:33 +00:00
Biswapriyo Nath
eeb27f1c71 gstaudioutilsprivate: Fix gcc 15 compiler error with function pointer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8904>
2025-04-28 06:45:16 +00:00
Sebastian Dröge
fe7cb2e5b1 appsrc: Only notify drop property and not in/out
This mirrors the behaviour of audiorate / videorate better and observing in/out
buffers can be achieved more cheaply via other means.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8866>
2025-04-22 09:02:53 +03:00
Sebastian Dröge
9920897c4a appsink: Only notify drop property and not in/out
This mirrors the behaviour of audiorate / videorate better and observing in/out
buffers can be achieved more cheaply via other means.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8866>
2025-04-22 09:02:53 +03:00
Nicolas Dufresne
239c0eb5f8 video: Add 10bit 422 NV16_10LE40 format
Similar to NV12_10LE40, this is a 422 variant. This format is also named
NV20 (20bit per pixels) in other stack and is produced by rkvdec
decoder.

Co-authored-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5612>
2025-04-17 15:36:06 +00:00
Sebastian Dröge
37629385d0 videoencoder: Use the correct segment and buffer timestamp in the chain function
The only thing that can be used in the chain function is the input segment. The
output segment might not be available at all yet or out of sync with the current
input segment.

Also because of that, the unadjusted timestamp has to be used for the
calculations as the adjustment is only part of the output segment.

This fixes the deadline calculation and the handling of force-keyunit events for
encoders using frame reordering (i.e. setting a minimum PTS).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8842>
2025-04-15 14:26:08 +03:00
Sebastian Dröge
20739fa673 appsrc: Allow changin leaky-type in PLAYING state
No reason not to.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8824>
2025-04-15 01:18:33 +00:00