Commit graph

48 commits

Author SHA1 Message Date
L. E. Segovia 07b18a6de5 applemedia: Also fix inconsistent pixel format definition for NV12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5191>
2023-08-16 14:15:52 +00:00
L. E. Segovia e52e1db5ab applemedia: Fix pixel format for I420
In Intel Macs, using full range 8-bit 4:2:0 YCbCr results in a failure on
initialization. I've validated this to be the correct pixel format with FFmpeg:

8653dcaf7d/libavutil/hwcontext_videotoolbox.c (L45)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5191>
2023-08-16 14:15:52 +00:00
Piotr Brzeziński 510e227996 vtenc: Fix cosmetic issues
Removes accidental GST_VIDEO_DECODER macro usage.
Also sets the initial size of the output queue to avoid having to expand when first buffers come through.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5164>
2023-08-09 07:35:32 +00:00
Matthew Waters f954d93f27 applemedia: silence some deprecation warnings from ios 12.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5111>
2023-07-27 13:05:37 +00:00
Piotr Brzeziński dc494d9edb vtenc: Move output loop to a separate thread
vtenc has an async output queue, which we only iterate over after another frame is enqueued.
At the very least it means we're always a frame behind the fastest possible output.
In edge cases it's also bug-prone - for example if we only have 1 frame, the downstream caps negotiation
will never happen.

This commit adds a separate task running on the source pad, which only iterates over the output queue
and pushes frames out as soon as they're put there. The queue length is limited to ensure we don't encode
too far ahead compared to what downstream can consume. Any failures that occur when pushing data downstream
will be signalled in self->downstream_ret so that other parts of code can act accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4967>
2023-07-21 13:05:26 +00:00
Andoni Morales Alastruey fc6e6fb547 vtenc: remove duplicated framerate and size variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4282>
2023-06-19 08:37:55 +00:00
Andoni Morales Alastruey 23812bbc92 vtenc: apply DTS offset to ensure DTS <= PTS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4282>
2023-06-19 08:37:54 +00:00
Víctor Manuel Jáquez Leal ce7256e0d3 vulkan: use gst_vulkan_format_get_aspect()
In order to use it, without depending in a previous calling of
_create_info_from_args(), VkFormat as input parameter to
gst_vulkan_image_memory_init() was added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
2023-05-19 04:26:29 +00:00
Stéphane Cerveau cc81e961a0 applemedia: fix missing definition
Fix missing kCVPixelFormatType_64RGBALE definition
on Catalina for example

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4478>
2023-04-24 17:05:03 +00:00
Tim-Philipp Müller 81716a1097 gst-plugins-bad: re-indent with GNU indent 2.2.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4182>
2023-03-17 03:18:54 +00:00
Nirbheek Chauhan 2d6da02653 applemedia: Consolidate GstVideoFormat <-> CVPixelFormat conversion
In the process we have changed the color value range from video-range
to full-range, which is probably what people want in the first place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4135>
2023-03-14 23:35:16 +00:00
Nirbheek Chauhan 3b9ce6cb54 avfvideosrc: GL texture cache also supports YUY2 on macOS
BGRA gives black frames, and everything else fails to negotiate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4134>
2023-03-14 00:00:24 +00:00
Nirbheek Chauhan a8ed817d30 avfvideosrc: Use frame duration instead of frame rate
These days you're can use minFrameDuration and maxFrameDuration which
are CMTime with fractional values. That way we don't need to convert
between double and fractions in a really weird way.

This fixes really odd fractional values exposed in caps, like:

2000000/76923, 1000000/37037, 5000000/178571, 10000000/344827, 10000000/333333

Which are actually just 26/1, 27/1, 28/1, 29/1, 30/1

We can also delete a lot of outdated code for iOS versions older than
7.0 by using newer APIs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4134>
2023-03-14 00:00:24 +00:00
Piotr Brzeziński 3c739b9b76 vtdec: Correctly retrieve reorder queue length from SPS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4057>
2023-03-03 19:26:11 +00:00
Jan Schmidt 47e97251af avfvideosrc: Fix description and trailing whitespace
Minor fix to mention that the element is also useful on MacOS,
and remove some trailing whitespace

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4083>
2023-03-01 20:05:32 +00:00
Jan Schmidt 855e86f6a2 avfvideosrc: Don't wait on main thread for permissions request
Recursively invoking the NSMainLoop can cause crashes in
applications that don't expect it. Instead of waiting for
permission to be granted, move the wait later - until we
actually need device permissions when starting the capture
session. That moves the wait into the streaming thread
instead of the application thread that's setting the pipeline
state to READY.

Instead of a manual state change implementation to open
and close the device, use the basesrc start/stop methods that
are intended for the purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4083>
2023-03-01 20:05:32 +00:00
Piotr Brzeziński b3830b08fd vtenc: Fix checking for certain CPU variants when running in VMs
These checks were introduced to prevent exposing ARGB64/RGBA64 in the caps
when running on M1 Pro/Max with macOS <13 because of a bug in VideoToolbox.
Unfortunately, the initial buffer size of 15 is too short when running
in a VM - the CPU brand string there looks like "Apple M1 Pro (Virtual)",
which due to its length causes sysctlbyname to return -1, resulting in
broken formats still showing up in the caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4080>
2023-02-28 16:00:07 +00:00
Piotr Brzeziński 04615ca55a vtenc/vtdec: Fix typo in RGBA64_LE availability define
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3912>
2023-02-13 17:48:37 +00:00
Piotr Brzeziński 8d81c4827c vtenc: Disable ARGB/RGBA64 caps on M1 Pro/Max with macOS <13
Fixes #1358.
Passing ARGB64/RGBA64 to vtenc caused the encoding to fail
when running on M1 Pro/Max variants with macOS 12.x, so let's
remove these formats from caps when such scenario is detected.
This issue appears to have been fixed OS-side in macOS 13.0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3912>
2023-02-13 17:48:37 +00:00
Piotr Brzeziński e2deebb103 vtdec: Fix not waiting for async frames when flushing
This was causing incorrect output when seeking, especially
when used with a multithreaded source like `videotestsrc n-threads=2`.
It should now correctly wait for frames still being processed by VT
while vtdec is flushing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3922>
2023-02-10 18:35:40 +00:00
Piotr Brzeziński ae200a4d62 vtenc: Disable HW acceleration for interlaced ProRes
Due to a bug in the VT API, attempting to encode interlaced content
with ProRes results in an error, halting the pipeline instead of
gracefully falling back to software encoding.
Should be removed in the future if Apple ever fixes this issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3222>
2023-02-02 06:18:02 +00:00
Nirbheek Chauhan b3806da265 avfvideosrc: Report latency when doing screen capture
There is no `device` when doing screen capture, but there is always an
`input`, so use that to decide when we can reply to a latency query.
Without this, the latency query just fails.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3589>
2022-12-16 23:58:07 +00:00
Ignacio Casal Quinteiro d44eb4b2fa avfdeviceprovider: do not leak the properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3268>
2022-10-26 10:29:25 +00:00
Piotr Brzeziński 1e70525bc9 avfvideosrc: Allow specifying crop coordinates during screen capture
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3153>
2022-10-12 21:19:31 +00:00
Thibault Saunier 6a4425e46a meson: Call pkgconfig.generate in the loop where we declare plugins dependencies
Removing some copy pasted code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
Piotr Brzeziński 0d72a6209c avfvideosrc: Fix wrong default framerate value
Current default G_MAXINT is not a correct value under any circumstances.
This creates an issue with screen capture, during which we currently do
not get any framerate info causing G_MAXINT to show up, where elements
downstream can possibly misbehave - for example, `vtenc` causes
a kernel panic.
Replace with 30/1 to avoid such scenarios.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2944>
2022-08-25 14:24:57 +00:00
Piotr Brzeziński 6bf15124e7 applemedia: Add HEVC support to vtenc and vtdec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2754>
2022-07-16 05:20:56 +00:00
Diogo Goncalves acfc9ae216 avfvideosrc: fix wrong framerate selected for caps
This fix solves an issue where a format that doesn't support the
requested framerate would be selected. It ensures that we use the first
format and framerate pair that supports the requested caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2331>
2022-05-13 19:38:45 +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
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
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
Nirbheek Chauhan b8d6fd905e applemedia: Add ARGB64_BE, RGBA64_LE support to vtenc/vtdec
We can add this now that ARGB64_BE videoconvert support was added in:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1247

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan fed69c48b6 vtenc: Add FieldDetail properties for interlaced input
Standard interlace handling:
* If we have interlace-mode=interleaved and the field order, we just
  set it when creating the session
* If we have interlace-mode=(interleaved|mixed) and no field order, we
  set the field order on the first buffer

The encoder session does not support changing the FieldDetail after it
has started encoding frames, so we cannot support mixed streams
correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan 29a32703a5 vtenc: Add a property to forcibly ignore alpha values
This PropertyKey is not documented in any headers anywhere, so we need
to define it ourselves.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan 4e37f99975 vtenc: Set colorimetry information
It looks like VideoToolbox doesn't support all our colorimetries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan 0f0e68080c applemedia: Add ProRes support to vtenc and vtdec
For vtdec, we continue to prefer NV12; else we pick whatever
downstream wants. In the special case where we're decoding 10-bit or
12-bit ProRes formats, we will prefer AYUV64.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan db638134e7 vtenc: Improve error reporting in chain function
Otherwise it is quite difficult to figure out why the chain function
failed. Also assert not reached for case statements that should not be
hit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Nirbheek Chauhan d7f6f8172a vtdec: Remove dead code in switch statement
We never advertise these formats, so these cases will never be hit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1214>
2021-11-01 09:24:52 +00:00
Thibault Saunier 019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00