Commit graph

112613 commits

Author SHA1 Message Date
Tim-Philipp Müller 67a49be61f openh264enc: fix broken header AU emission by base class
This encoder advertises alignment=au as output format, which means
each output frame should contain a full decodable access unit.

The video encoder base class is not aware of our output alignment
and will output spurious buffers with just the SPS/PPS inside when
we call gst_video_encoder_set_headers(), which is broken because
each buffer is supposed to contain a full decodable access unit
in our case.

Just don't tell the base class about our headers, they will be
sent at the beginning of each IDR frame anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
2021-08-24 23:42:27 +01:00
Tim-Philipp Müller 90c1732849 openh264enc: fix caps and header buffer leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
2021-08-24 23:42:27 +01:00
Tim-Philipp Müller 42a7edd40f openh264enc: fix broken sps/pps header generation
This was putting a truncated SPS into the initial header instead
of the PPS because it was always reading from the beginning of the
bitstream buffer (pBsBuf) and not from the offset where the current
NAL is at in the bitstream buffer (psBsBuf + nal_offset).

This was broken in commit 17113695.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1576

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
2021-08-24 23:42:27 +01:00
Xavier Claessens 8f62c0c933 Update to sqlite3 from wrapdb
`meson subprojects update` fails with Meson >= 0.59 because 'sqlite'
wrap got renamed to 'sqlite3' in wrapdb v2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/252>
2021-08-24 20:52:06 +00:00
Jan Alexander Steffens (heftig) 148ac71a1f pad: Keep IDLE probe hook alive during immediate callback
When the probe returns GST_PAD_PROBE_REMOVE and gets called concurrently
from the streaming thread while we're in the callback here, the hook has
already been destroyed by the time we've reacquired the object lock.
Consequently, cleanup_hook gets passed an invalid pointer.

Keep another reference to the hook alive to avoid this situation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/873>
2021-08-24 15:13:19 +02:00
Tim-Philipp Müller 43f2fd8081 qtdemux: add depth for ProRes 4:4:4:4 variants if available
Might be 24bpp in case an alpha channel is coded but
the image is always opaque.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1061>
2021-08-24 12:35:47 +00:00
Ruslan Khamidullin f510d48ecf qtmux: for Apple ProRes, allow overriding pixel bit depth for 4:4:4:4 variants
e.g. when exporting an opaque image, yet with alpha channel.

Apple ProRes certification requires that, when a ProRes-writing
application *knows* that the entire frame is opaque, the application
writes only RGB without alpha even when the clip is RGBA. For that,
this tiny change allows the app to override pixel depth when writing ProRes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1061>
2021-08-24 12:35:47 +00:00
Seungha Yang c654f86859 video-converter: Add support for A420 to RGB fast path
Add fast path for A420 -> RGB format conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1245>
2021-08-24 11:09:28 +00:00
Havard Graff 068c2a71ba vpxdec: Fix direct rendering, avoid holding write access
When a buffer is pushed downstream, we should try not to hold the
buffer mapped with write access. Doing so would often lead to
an unneccesary memcpy later.

For instance, gst_buffer_make_writable() in
gst_video_decoder_finish_frame() will cause a memcpy because of
_memory_get_exclusive_reference().

We know that we can perform a two-step remap when using system
memory, as this will not cause the location of the memory to
change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/812>
2021-08-23 14:31:37 +00:00
Matthew Waters 6605174358 isomp4/mux: add a function for seeking to a specific output byte position
We do it enough times that this makes sense.  Also add a debug log line
for the seek position requested.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1060>
2021-08-23 04:17:36 +00:00
Matthew Waters 9dc5cb34ae isomp4/mux: don't overwrite with a bigger moov when fragmenting
When outputting fragmented mp4, with a seekable downstream, we rewrite
the moov to maybe add a duration to the mvex.  If we start by not
writing the initial moov->mvex->mhed duration and then overwrite with a
moov containing mhed atom, the moov's will have different sizes and
could overwrite subsequent data and result in an unplayable file.

e.g. The initial moov would be of size 842 and the final moov would have
a size of 862.

Fix by always pushing out the mhed duration in the moov when
fragmenting.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/898

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1060>
2021-08-23 04:17:36 +00:00
Matthew Waters 0d27e6f86e isomp4: actually make streamable fallback work
We weren't setting the fragment_mode field anymore now that the
implementation doesn't change based on the value of the streamable
property.  This lead to invalid files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1060>
2021-08-23 04:17:36 +00:00
Matthew Waters d806486503 isomp4: fix trun data offset handling
The trun offset was missing a calculation for one of the box type
headers.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/866

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1060>
2021-08-23 04:17:36 +00:00
Matthew Waters 467829358c isomp4/mux: fixes for fragmented mp4 output
Various buffer offset calculations were not quite correct in all cases.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/866

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1060>
2021-08-23 04:17:36 +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
Seungha Yang f5a79ce05f compositor: Fix crash while drawing background and/or blending for subsampled YUV
Fix crash caused by out-of-bounds memory accesses when drawing
background and/or blending. This fix is conceptually identical to the
approach as the commit of 8ff5079e5e

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1229>
2021-08-21 01:19:06 +09: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
Edward Hervey 637b0d8dc2 concat: Properly propagate seqnum of segment events
Was broken by https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/819

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/871>
2021-08-20 16:35:53 +02:00
Mathieu Duponchelle ebb6b9778a encoding-profile: ignore more encoding private fields
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1249>
2021-08-20 14:20:25 +00:00
Thibault Saunier acf98372a3 smartencoder: Respect user stream-format when specified
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1249>
2021-08-20 14:20:25 +00:00
Mathieu Duponchelle 4aa72cea4f smartencoder: clean up and extend accepted formats
* Add support for H265

* Don't overwrite original codec_data / streamheader in the output
  caps, but instead allow them to change and send them to the
  combiner at the right moment: encoder caps, reencoded GOP,
  original caps, original GOP(s), and potentially encoder caps
  and rencoded last GOP.

* For H264 / H265, force usage of a format with inband SPS / PPS
  (avc3 / hev1), this is cleaner than misadvertising avc1, hvc1 and
  some muxers like mp4mux will actually advertise both differently.

  Unfortunately, while mp4 supports updating the codec_data and using
  avc1 with no in-band SPS / PPS updates, it turns out some decoders
  (eg chrome / firefox) don't handle this particularly well and stop
  decoding after the reencoded GOP. We could expose a switch to
  force usage of avc1 / hvc1 nevertheless, but for now stick to
  requiring that the parser output SPS / PPS in-band with
  config-interval=-1 (that has not changed)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1249>
2021-08-20 14:20:25 +00:00
Edward Hervey e9996be658 dashdemux: Properly initalize GError
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2476>
2021-08-20 14:35:43 +02:00
Seungha Yang 1ae8b61ec0 compositor: Add "max-threads" property
Adding new property for user to be able to set expected the maximum
number of blend task threads. This can be useful in case that user
wants to restrict the number of parallel task runners for system
resource management or debugging/development purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1242>
2021-08-20 18:43:26 +09:00
Edward Hervey 1e1e9f2197 validate-utils: Only modify structure fields that really need updates
This avoids memory corruption in users of that structure which
were (rightfullly) assuming static fields (such as name) wouldn't
change. Without this, they would be using strings which will have been freed in
the meantime.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/252>
2021-08-20 09:22:28 +02:00
Théo MAILLART adc565ff4a tests: elementfactory: add element creation tests
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/736>
2021-08-20 01:41:30 +00:00
Théo MAILLART aadf84837b elementfactory: enable construct only property passing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/736>
2021-08-20 01:41:30 +00:00
Mathieu Duponchelle 9bd8d608d5 matroska-mux: support H264 avc3 / H265 hev1
The matroska codec specs is unfortunately vague on the subject,
stating for H264:

AVC/H.264 stored as described in [@!ISO.14496-15]

and for H265:

HEVC/H.265 stored as described in [@!ISO.14496-15]

This spec however specifies multiple stream formats, our
implementation has opted for interpreting this as avc1 / hvc1,
both of which disallow in-band SPS.

Most decoders however will support in-band SPS / PPS, and
this commit gives the option to explicitly mux in avc3 / hev1,
which allows changing stream parameters on the fly, that is
useful for smart encoding for example.

When either of these stream formats are picked as the input,
changes in codec_data / tier / level / profile do not cause
renegotiation failure, a warning is logged however as it isn't
clear how compliant such a stream is.

The stream-format field is correctly ordered in the template
caps to avoid selecting potentially non-compliant options on
automatic negotiation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047>
2021-08-20 00:16:43 +00:00
Mathieu Duponchelle cb75eda13b isomp4/qtmux: allow renegotiating when tier / level / profile change
Those are carried either in codec_data or in-band SPS (for avc3),
and it is OK for those to change, though decoders obviously need
to support it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047>
2021-08-20 00:16:43 +00:00
Mathieu Duponchelle 896c49cf49 isomp4/qtmux: accept video/x-h264, stream-format=avc3
The main difference between avc1 and avc3 is that avc3 is allowed
to contain in-band SPS / PPS. In practice decoders will always use
in-band parameter sets anyway, but it is cleaner to explicitly
advertise it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047>
2021-08-20 00:16:43 +00:00
Mathieu Duponchelle fa835d686f isomp4/qtmux: make sure to switch to next chunk on new caps
For example, with single video sink pad, and new codec_data is
received, current_chunk_offset must be reset to -1 for the
aggregate loop to open a new chunk.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047>
2021-08-20 00:16:43 +00:00
Mathieu Duponchelle e069824c7d isomp4/atoms: fix multiple stsd entries
stsd entries are serialized in reverse order (starting from
g_list_last()), and must be prepended to the entry list for their
index to be correct when referenced from stsc entries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1047>
2021-08-20 00:16:43 +00:00
Mathieu Duponchelle 0ec4893c8e ges-uri-source: fix object debug
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/265>
2021-08-20 00:11:45 +02:00
Mathieu Duponchelle 5ca6576f5b ges-launcher: add option to forward tags
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/265>
2021-08-20 00:11:45 +02:00
Mathieu Duponchelle 148c751bc0 ges-launcher: allow using a clip to determine the rendering format
This includes both topology and profile

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/265>
2021-08-20 00:11:45 +02: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
Olivier Crête a4a1782872 tracer: Add new tracer to list loaded elements and other features
This new tracer will list loaded elements and plugins. This should
make it easier to generate minimal builds of GStreamer.

This also traces other features such as typefind functions, device
providers and dynamic types.

The format of the output of gst-stats should match the parameters
expected by the meson based gst-build system.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/782>
2021-08-18 17:01:27 -04:00
Olivier Crête 8332b44a2a tracers: Add tracepoint when a plugin feature it loaded
This makes it possible to trace which ones are loaded in a specific
program to make nice statistics.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/782>
2021-08-18 17:01:27 -04: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
Arun Raghavan 2c6be7373f matroska-mux: Add a timestamp-offset property
Adds a user-controllable timestamp offset to clusters and blocks. This
should be useful if we want to have timestamps that have significance
outside of the current file (for example, we might set the offset to the
wallclock when the file is being created, or some other common base, if
we want to correlate streams across multiple files).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1051>
2021-08-18 10:51:15 -04:00
Víctor Manuel Jáquez Leal 5c5083586d example: va: Add skin tone enhancement.
If camera is used as input stream and skin tone parameter is available
in vapostproc, and no random changes are enabled, the skin tone will
be enabled.

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 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
Sebastian Dröge bf71ef17e3 pbutils: Expose functions for getting a file extension for caps and flags for describing the format of the caps
This information was available internally already but not available from
the outside.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1221>
2021-08-18 12:06:16 +00:00
Sebastian Dröge 52bca104e4 playbin/uridecodebin: Emit source-setup signal early before doing the scheduling query
Some elements will require the source to be set up properly before the
scheduling query returns useful results, e.g. appsrc and giostreamsrc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1241>
2021-08-18 09:07:07 +00:00
Víctor Manuel Jáquez Leal e9395bbcd1 examples: va: Add random cropping.
And remove unused caps filter.

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 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