Commit graph

1720 commits

Author SHA1 Message Date
Matthew Waters
b4ea8332f5 videoaggregator: ensure peek_next_sample() uses the correct caps
gst_pad_get_current_caps() may be wrong when there is a renegotiation in
progress for the pad and we have not yet received or selected the buffer
with different caps yet.

Fix by storing the caps through in a similar way to the existing code
for buffer/video-info selection machinery.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/813>
2020-09-11 22:08:30 +10:00
Stian Selnes
eaedb5c2de videodecoder: Bump log level of marking a sync point
Sync points are often important when debugging and deserves DEBUG
level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 20:31:10 +02:00
Sebastian Dröge
d26eede464 videodecoder: Add API for subclasses to request a new sync point
This allows subclasses that notice missing reference frames to request a
new sync point to allow seamless decoding again. While doing so the
subclass can also signal whether it wants a) all following input frames
until the sync point to be discarded or b) all output frames until the
sync point to be marked as corrupt.

Sending of force-keyunit events for this can be throttled by the
application via the "min-force-keyunit-interval" property.

This replaces custom behaviour for the same in various decoders, for
example openh264dec.

Based on patches by Haakon Sporsheim <haakon@pexip.com> and
Stian Selnes <stian@pexip.com>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 20:31:10 +02:00
Sebastian Dröge
fdf79a786c videodecoder: Add API for subclasses to signal that they need the stream to start with a sync point
If the first frame(s) at the very beginning or after a flush are not a
sync point then the base class would discard them before passing them to
the subclass.

This also fixes the previously broken distance_from_sync handling: it
was never reset at sync points.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00
Sebastian Dröge
1afb145dc5 videodecoder: Add "discard-corrupted-frames" property
This can be used by applications to configure decoders so that corrupted
frames are directly discarded instead of being forwarded inside the
pipeline. It is a replacement for the "output-corrupt" property of the
ffmpeg decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00
Sebastian Dröge
06bcf95ebf videodecoder: Add API for marking output frames as corrupted
This can be used by subclasses to mark output frames as known to be
corrupted, for example if reference frames were missing. ffmpeg's
decoders can signal this.

In addition this flag is propagated downstream if the input frame had it
set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00
Sebastian Dröge
74889206eb videodecoder: Remove unused reorder_depth variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/730>
2020-09-10 17:22:14 +00:00
Sebastian Dröge
f54ef6c74e videoaggregator: Don't require any pads to be configured for negotiating source pad caps
This is not actually required (anymore?). Source pad caps can be
negotiated at any time regardless of any configured (or existing) sink
pads and videoaggregator comes up with some fixated caps based on the
downstream caps.

Subclasses can override this behaviour as needed by overriding
update_src_caps().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/793>
2020-09-09 11:35:02 +00:00
Marijn Suijten
0ea3279df1 gst-libs: gl: Fix documentation typo and clarify gl_memory_texsubimage
`gst_gl_memory_read_pixels` reads pixels from `GLMemory` into the
pointer, effectively writing to it. This is opposite from
`gst_gl_memory_texsubimage` which reads texture data from `read_pointer`
into `GLMemory`.

Both cases are clarified by changing `read_pointer` to `write_pointer`,
and explaining what `gst_gl_memory_texsubimage` does in addition to
referring back to `gst_gl_memory_read_pixels`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/806>
2020-09-09 09:54:48 +00:00
Sebastian Dröge
5bfb438d3b video-anc: Implement transform functions for AFD/Bar metas
If the transformation is just a copy, copy over the metadata. For AFD
also copy over the metadata if the aspect ratio stays the same in
scaling transformations. In all other cases fail the transformation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/791>
2020-09-09 07:48:02 +00:00
Sebastian Dröge
805b1ee9b3 video-converter: Add fast paths from v210 to I420/YV12, Y42B, UYVY and YUY2
These then don't require going through the generic code path via AYUV64
first but can be converted directly.

This speeds up processing of
  videotestsrc ! v210 ! videoconvert ! other_format ! fakesink
by a factor of 1.55 for I420/YV12 and 1.40 for the other destination
formats and reduces memory pressure considerably.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/775>
2020-09-08 21:10:30 +00:00
Sebastian Dröge
91ec4e06d7 video: Rename gst_video_color_transfer_*() to gst_video_transfer_function_*() in new API
The type is called GstVideoTransferFunction so the function names should
match, otherwise gobject-introspection is keeping the functions as
global functions instead of methods on the type.

The same mistake was also made in lots of other APIs over the years, but
here we can at least fix it for 1.18 still.

Thanks to Marijn Suijten for noticing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/807>
2020-09-07 13:04:20 +03:00
Sebastian Dröge
391d09dc24 audio/video: Copy more metas by default in the codec base classes
For audio we copy metas that have no tags at all, or that only have the
"audio" and/or "audio-channels" tag. Audio codecs don't change the
audio aspect of the stream and in almost all cases don't change the
number of channels. They might however change the sample rate (e.g.
Opus). Subclasses that change the number of channels will have to
override ::transform_meta() accordingly.

For video we copy metas that have no tags at all, or that only have the
"video" and/or "video-size" and/or "video-orientation" tag. Video codecs
don't change the "video" aspect of the stream and in almost all cases
don't change the resolution or orientation. Subclasses that rescale or
change the orientation will have to override ::transform_meta()
accordingly.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/576#note_610581

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/801>
2020-08-30 22:12:22 +00:00
Sebastian Dröge
61064257ef videoaggregator: Update for additional info parameter to the "samples-selected" signal
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/590

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/780>
2020-08-07 09:34:37 +03:00
Mathieu Duponchelle
1de8af6f8b videoaggregator: update to new samples selection API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/778>
2020-08-05 20:09:52 +02:00
Mathieu Duponchelle
2faeb7d394 videoaggregator: implement samples selection API
Call gst_aggregator_selected_samples() after filling the queues
(but before preparing frames).

Implement GstAggregator.peek_next_sample.

Add an example that demonstrates usage of the new API in combination
with the existing buffer-consumed signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/728>
2020-07-31 07:54:56 +00:00
Nicolas Dufresne
98b44fdb46 video: Add support for linear 32x32 NV12 tiles
This adds linear 32x32 NV12 based tiles. This format is notably used by
Allwinner VCU and exposed in V4L2 as being "SUNXI Tiled" format. In this
patch we generalize the plane info calculation so we can share this part
with the 4L4 variant.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/754>
2020-07-14 21:43:56 -04:00
Nicolas Dufresne
7d1028424c video: Add NV12_4L4 tile format
This format is produced by Verisillicon VC8000D VPU decoder, it is a simple 4x4
tiling layout in a linear way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/753>
2020-07-14 17:33:31 +00:00
Aaron Boxer
c770f0b68e video: allow frame copy destination to have dimensions smaller than source
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/707>
2020-07-14 16:39:05 +00:00
Sebastian Dröge
81e7cd1fca video-converter: Add scaling fast-path for GBRA format
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/684

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/749>
2020-07-10 12:25:56 +00:00
Nicolas Dufresne
dcc7242ba5 videoconverter: Relax frame size checks
Since we are using VideoMeta, the converter (similarly to the video_frame_copy
utility) should have no issue dealing with frames that are slightly larger.
This situation occure as some element will use padded width/height for
allocation, which results in a VideoMeta width/height being larger then the
display width/height found in the negotiated caps.

Fixes #790

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/747>
2020-07-09 20:35:05 +00:00
Tim-Philipp Müller
6bb3e01918 meson: add update-orc-dist target
Add target to update backup orc -dist.[ch] files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/734>
2020-07-04 14:01:56 +01:00
Mathieu Duponchelle
e82eb9d0fa video-color.h: fix comment syntax 2020-07-04 00:39:18 +02:00
Vivia Nikolaidou
ad55d3ce9d video-converter: Make fast path work for equivalent transfer functions
For example, BT709, BT601, and BT2020_10 all have theoretically
different transfer functions, but the same function in practice. In
these cases, we should use the fast path for negotiating. Also,
BT2020_12 is essentially the same as the other three, just with one more
decimal point, so it gives the same result for fewer bits. This is now
also aliased to the former three.

Also make videoconvert do passthrough if the caps have equivalent
transfer functions but are otherwise matching.

As of the previous commit, we write the correct transfer function for
BT601, instead of the (functionally identical but different ISO code)
transfer function for BT709. Files created using GStreamer prior to that
commit write the wrong transfer function for BT601 and are, strictly
speaking, 2:4:5:4 instead. However, this commit takes care of
negotiation, so that conversions from/to the same transfer function are
done using the fast path.

Fixes #783

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/724>
2020-07-03 11:57:49 +03:00
Vivia Nikolaidou
1d0ccf8baa video-color: Add bt601 transfer function
Functionally the same as 709 but technically has a different value, and
external software (e.g. ffmpeg) finds "wrong" values produced by
GStreamer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/724>
2020-07-03 11:57:49 +03:00
Jan Alexander Steffens (heftig)
7570d20871 video-anc: Fix gst_buffer_get_video_(afd|bar)_meta
The macros were not passing the meta GType to gst_buffer_get_meta,
rendering them unusable.

Also, the doc comments were specifying parameters meant for the
add_video_X_meta functions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/732>
2020-07-01 19:40:28 +00:00
Havard Graff
0826fb95b7 audio: video: Optimize by using cached quark for meta tag
Avoid taking the global quark lock for every single buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/295>
2020-06-27 09:23:10 +00:00
Seungha Yang
946e00f581 videometa: Fix documentation
Fix gst_video_region_of_interest_meta_add_params to
gst_video_region_of_interest_meta_add_param and add newline to be
more readable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/722>
2020-06-24 02:02:50 +09:00
Haakon Sporsheim
226a371e3f videodecoder: Add max-errors property
The number of consecutive decode errors that should be tolerated before
returning flow error should be up to the application, not the element.

Hence max-error should be exposed as a property.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/720>
2020-06-23 07:17:00 +00:00
Aaron Boxer
b813c40788 video: allow frame copy where destination dimensions are smaller than source
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/695>
2020-06-15 09:46:17 -04:00
Jan Schmidt
205bb066ed video-converter: Add checks for configuration sanity.
If the cropping or scaling input or output rects put us completely
outside the input/output frame respectively, we can't draw anything
except black safely. Check for those conditions and don't set up a
configuration that attempts to access out of bounds memory outside
the input/output framebuffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/696>
2020-06-12 06:49:56 +00:00
Jan Schmidt
bf5d51c5da video-converter: Guard against invalid frame input
If the frames passed in to gst_video_converter_frame()
have a different layout than was configured for, the
conversion code might go out of bounds and crash.

Do a sanity check on each frame passed in, and in the
absence of a return value in the API, just
refuse the conversion in invalid cases and leave the
destination frame untouched so it's obvious to
users that it was broken.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/696>
2020-06-12 06:49:56 +00:00
Mathieu Duponchelle
a90968997a videooverlay: chevrons don't need to be escaped in code examples
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/700>
2020-06-11 22:19:09 +00:00
Guillaume Desmottes
62254f93a3 video: sort formats by quality
Will ensure that we pick the "best" format when negotiating caps.

Fix #649

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/689>
2020-06-09 08:09:58 +00:00
Sebastian Dröge
76364ebfe7 videoencoder: Also don't request a new key-unit if we already got one after the requested running time
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
19fecabdf7 videoencoder: Don't request another keyunit if another one is pending or we requested one for a future time already
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
c5b081edc2 videoencoder: Add min-force-key-unit-interval property
This allows configuring the minimum interval between subsequent
force-key-unit requests and prevents a big bitrate increase if a lot of
key-units are requested.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
6260c4be7e videoencoder: When pushing headers as part of a keyframe mark the first header as keyframe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
401d56a6a7 videoencoder: Handle all matching force-keyunit events at once
Previously we only handled one event at a time, which could lead to the
following two suboptimal situations:
- frame 0 at 20ms, frame 1 at 40ms and two force-keyunit events at 10ms
  and 15ms. We would create a new keyframe for both of the frames.
- 100 force-keyunit events with running-time NONE would cause all
  following 100 frames to be made into a keyframe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Sebastian Dröge
9b1f1f431a videoencoder: Sort force-keyunit-events by their running time
That way we can more easily work with the whole list without iterating
over all of the elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/684>
2020-06-05 10:04:43 +00:00
Stéphane Cerveau
42dcbcd61f video-hdr: fix memset warning
Fix warning on fedora arm64 target

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/685>
2020-06-05 08:13:32 +00:00
Nicolas Dufresne
8e3c4a5d5a video: Fix NV12_64Z32 number of component
This format has 3 components, just like NV12.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/686>
2020-06-04 20:12:59 +00:00
Thibault Saunier
c2610d7f41 doc: Add a minimal GstVideoMultiviewFlagsSet documentation 2020-06-03 22:44:24 -04:00
Sebastian Dröge
fb7ab33e03 videoencoder: Simplify header buffer metadata updating
Instead of doing a shallow copy of the list just to call make_writable()
on each buffer, do that inline in the same loop and modify the list
contents.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/683>
2020-06-03 16:21:41 +03:00
Sebastian Dröge
caaa5ac864 video: Use GQueue instead of plain GList in a few places
Also not optimal but at least simplifies the code a bit and doesn't
require g_list_length() and g_list_append() in a few places.

For 2.0 there are some more candidates to change but unfortunately
they're currently part of the API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/683>
2020-06-03 16:21:41 +03:00
Sebastian Dröge
4fcc1121e6 video-format: RGB16/15 are not 16 bit per component but only 5.333 and 5
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/682>
2020-06-02 14:38:55 +00:00
Guillaume Desmottes
84e0689d58 video: add gst_video_make_raw_caps()
More binding friendly version of GST_VIDEO_CAPS_MAKE().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Guillaume Desmottes
f42e67c639 video-format: add gst_video_formats_raw()
The existing GST_VIDEO_FORMATS_ALL macro is not binding friendly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/676>
2020-06-02 11:57:42 +00:00
Stéphane Cerveau
c7a956aede video-anc: init type before g_once_init_enter
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/675>
2020-05-27 17:13:35 +02:00
Stéphane Cerveau
be3745cb92 video-hdr: fix typo
fix typo in video_hdr_ascii_string_to_unsigned
method name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/675>
2020-05-27 16:04:29 +02:00