Commit graph

893 commits

Author SHA1 Message Date
Edward Hervey 597b684cd6 adaptivedemux2: Fix non-accurate seeking
If no accurate positioning was required, default to snap to the previous segment
for improved responsiveness

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3914>
2023-06-22 06:56:33 +00:00
Edward Hervey adc07d77d5 adaptivedemux2: Handle return in seek handling
Various code path were repeating the same logic, and risk forgetting a lock
release.

Unify all of them

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3914>
2023-06-22 06:56:33 +00:00
Edward Hervey 630eb61273 adaptivedemux2: Move API lock usage
It is not needed so early

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3914>
2023-06-22 06:56:33 +00:00
Edward Hervey 2c9aef64c0 adaptivedemux2: Handle early key-unit seek
Is a seek is done on stream-collection post, there are no selected streams
yet. Therefore none would be chosen to adjust the key-unit seek.

If no streams are selected, fallback to a default stream (i.e. one which has
track(s) with GST_STREAM_FLAG_SELECT).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3914>
2023-06-22 06:56:33 +00:00
Edward Hervey 39c8b060f4 adaptivedemux2: Fix early seeking
When seeking is handled by the collection posting thread, there is a possibility
that some leftover data will be pushed by the stream thread.

Properly detect and reject those early segments (and buffers) by comparing it to
the main segment seqnum

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3914>
2023-06-22 06:56:33 +00:00
François Laignel 1d00f726a0 qtdemux: opus: set entry as sampled
... otherwise streams with constant size samples defined with a single
`sample_size` for all samples in the `stsz` box fall in the category
`chunks_are_samples` in `qtdemux_stbl_init`, overriding the actual
sample count.

`FOURCC_soun` would set this automatically for `compression_id == 0xfffe`,
however `compression_id` is read from the Audio Sample Entry box at an offset
marked as "pre-defined" in some version of the spec and set to 0 both by
GStreamer and FFmpeg for opus streams.

Considering the stream `sampled` flag is set explicitely by other fourcc
variants, doing so for opus seems consistent.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4903>
2023-06-20 17:15:22 +00:00
Sebastian Dröge dbbfc917fe flacparse: Avoid integer overflow in available data check for image tags
If the image length as stored in the file is some bogus integer then
adding it to the current byte readers position can overflow and wrongly
have the check for enough available data succeed.

This then later can cause NULL pointer dereferences or out of bounds
reads/writes when actually reading the image data.

Fixes ZDI-CAN-20775
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4894>
2023-06-20 10:02:19 +00:00
François Laignel fa30504ec2 qtdemux: parse Opus and dOps as qtdemux nodes and add size checks
This allows checking the nodes conformity and dumping parsed values.

Note: Audio Sample Entry version parsing and offset handling is handled as part
of `FOURCC_soun` common processing and in `qtdemux_parse_node`.

Also, only read `stream_count` and `coupled_count` when
`channel_mapping_family` != 0. See:

https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
2023-06-19 14:31:55 +00:00
François Laignel 439717ab65 qtdemux: fix byte order for opus extension and version field type
The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
2023-06-19 14:31:55 +00:00
François Laignel f3496ea3bf qtmux: fix byte order for opus extension
The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

In `build_opus_extension`, `gst_byte_writer_put*_le ()` variants were used,
causing audio streams conversion to Opus in mp4 to offset samples due to the
PreSkip field incorrect value (29ms early in our test cases).

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
2023-06-19 14:31:55 +00:00
Daniel Morin 6f43bdce49 v4l2src: adding support for bayer 10,12,14,16
- Adding bayer 10,12,14,16 bits components with 16 bits storage. These
  changes only adds capabilities. Capability format string is a complete
  description of the frame and pixels layout. Only mapping LE bayer
  formats as v4l2 only define LE bayer formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4852>
2023-06-15 18:41:42 +00:00
Nicolas Dufresne 42c12c9c73 doc: Update plugin cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447>
2023-06-15 10:41:26 -04:00
Nicolas Dufresne aea74db1a2 v4l2: Sync headers to current media_stage
commit d78b9d6671decdaedb539635b1d0a34f8f5934f8

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447>
2023-06-15 14:32:32 +00:00
Daniel Morin 6ece5f3b90 v4l2src: fix support for bayer format
- Define a new function that identify if the v4l2object is raw based
on pixel format
- Only consider setting delta flag on buffer if the video is not raw.

Sponsored by Living Optics Ltd.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4848>
2023-06-14 18:32:45 +00:00
Mark Hymers 1ae8af4909 matroska: Add support for more pixel formats
- Add support for GRAY16_LE (using ffmpeg fourcc mapping)
- Update documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4824>
2023-06-14 13:40:58 +00:00
Daniel Morin 00178cbd89 matroska: Add new pixels format support
- Add support for GRAY10_BE32
- Add support for RGBA64_LE and BGRA64_LE

Sponsored by Living Optics

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4824>
2023-06-14 13:40:57 +00:00
Tim-Philipp Müller 2abdfb9657 tests: rtpbin_buffer_list: fix possible unaligned read on 32-bit ARM
Fixes #2666

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4842>
2023-06-14 04:59:05 +00:00
Tim-Philipp Müller f3c126d07c matroska-demux: fix accumulated base offset in segment seeks
When doing a segment seek, the base offset in the new segment
would be increased by segment.position which is basically the
timestamp of the last packet. This does not include the duration
of the last packet though, so might be slightly shorter than the
actual duration of the clip or the requested segment.

Increase the base offset by the segment duration instead when
accumulating segments, which is more correct as it doesn't cut
off the last frame and makes the effective loop segment duration
consistent with the actual duration returned from a duration
query.

In case a segment stop was specified it's also possible that
some data was sent beyond the stop that's necessary for decoding
so the base offset increment should be based on that then and
not on the timestamp of the last buffer pushed out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4604>
2023-06-13 18:19:48 +00:00
ekwange e7cfc1f5bd v4l2: Change to query only up to V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS
Fix to prevent infinite querying.
There are devices that exceed V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS
but do not return EINVAL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4790>
2023-06-13 13:04:37 +00:00
Jonas Kvinge 513dd2c219 adaptivedemux2: Allow data dash+xml manifest for uri
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4811>
2023-06-13 11:32:23 +00:00
Jochen Henneberg fd1d208446 rtspsrc: Cleanup code for next pending command
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4792>
2023-06-07 20:30:36 +00:00
Jochen Henneberg 4790a8d2be rtspsrc: Do not try send dropped get/set parameter
If the set_get_param_q has been emptied we have to reset the cached
pending command to CMD_LOOP as we will not have the request parameters
anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4792>
2023-06-07 20:30:36 +00:00
Xabier Rodriguez Calvar bdff780fe9 qtdemux: Fix critical message on cenc sample grouping parsing
Inside qtdemux_parse_sbgp there is already a check to ensure the fragment group
properties are not null but it is being hit in some examples and it is better to
directly avoid the critical.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4576>
2023-06-07 11:01:20 +00:00
Guillaume Desmottes 9b0736c85d videoflip: update orientation tag in auto mode
The frames are flipped according to the tag orientation so it's no longer accurate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4778>
2023-06-06 19:28:09 +00:00
Hou Qi fe21b750f9 v4l2videodec: treat MPEG 1 format as MPEG 2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4770>
2023-06-06 15:41:47 +00:00
Matthew Waters c3af29db1e build/android: remove all references to gnustl
Not needed anymore with NDK R25.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4747>
2023-06-03 23:21:34 +00:00
Jan Alexander Steffens (heftig) 93699123b4 isomp4: Fix (E)AC-3 channel count handling
The muxer used a fixed value of 2 channels because the TR 102 366 spec
says they're to be ignored. However, the demuxer still trusted them,
resulting in bad caps.

Make the muxer fill in the correct channel count anyway (FFmpeg already
does) and make the demuxer ignore the value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4739>
2023-06-02 19:07:58 +00:00
Nirbheek Chauhan ca4762168f meson: Support building qml6glsink on win32
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4742>
2023-06-02 14:27:44 +05:30
Piotr Brzeziński 476d350b03 pngdec: Fix 16bit RGB images display
Due to the alpha value being inserted with _BEFORE, we were ending up
with ARGB instead of RGBA, thus displaying completely wrong colours.
According to libpng's manual, "to add an opaque alpha channel, use filler=0xff
or 0xffff and PNG_FILLER_AFTER which will generate RGBA pixels".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4756>
2023-06-02 05:38:54 +00:00
Stéphane Cerveau dd17beb681 gstreamer-full: add full static support
Allow a project to use gstreamer-full as a static library
and link to create a binary without dependencies.

Introduce the option 'gst-full-target-type' to
select the build type, dynamic(default) or static.

In gstreamer-full/static build configuration gstreamer (gst.c)
needs the symbol gst_init_static_plugins which is defined
in gstreamer-full.
All the tests and examples are linking with gstreamer but the
symbol gst_init_static_plugins is only defined in the gstreamer-full
library. gstreamer-full can not be built first as it needs to know what plugins
will be built.

One option would be to build all the examples and tests after
gstreamer-full as the tools.

Disable tools build in subprojects too as it will be built at the end of
build process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4128>
2023-05-31 15:17:11 +00:00
Matthew Waters 74f914077d qt6/glrenderer: don't attempt to use QWindow from non-Qt main thread
Use QObject::deleteLater() to schedule deletion in the main thread.

Remove the moveToThread of the QWindow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4728>
2023-05-31 02:10:26 +00:00
Matthew Waters c64efe494d qt/glrenderer: don't attempt to use QWindow from non-Qt main thread
Use QObject::deleteLater() to schedule deletion in the main thread.

Remove the moveToThread of the QWindow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4728>
2023-05-31 02:10:26 +00:00
Hyung Song d68a7fbd94 aacparse: parse GASpecificConfig for channels
Some media have valid channel information in GASpecificConfig which is
not yet implemented in gstaacparse. Parse data according to ISO/IEC
14496-3 just enough to get channels.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4720>
2023-05-30 09:09:16 +00:00
Guillaume Desmottes 0fd3c28620 flvmux: push metadata on caps change
The metdata contains tags but also caps dependent info such as the
resolution and the framerate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4730>
2023-05-30 09:35:43 +02:00
Guillaume Desmottes 3ae2904f3d flvmux: rename 'new_tags' to 'new_metadata'
The metadata contains more than just tags: resolution, framerate, etc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4730>
2023-05-30 08:27:18 +02:00
Guillaume Desmottes 853fad001e flvmux: add some logs when input is changing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4730>
2023-05-30 08:27:18 +02:00
Michael Olbrich 2197cdc289 flvmux: use the correct timestamp to calculate wait times
Since c0bf793c05 ("flvmux: Set PTS based on
running time") the timestamp of the output buffer is already in running
time. So using that for 'srcpad->segment.position' does not work correctly
because gst_aggregator_simple_get_next_time() will convert it again with
gst_segment_to_running_time().
This means that the timestamp returned by
gst_aggregator_simple_get_next_time() may be incorrect. For example, if
flvmux is added to a already runinng pipeline then the timestamp is too
small and gst_aggregator_wait_and_check() returns immediately. As a result,
buffers may be muxed in the wrong order.

To fix this, use the PTS of the incoming buffer instead of the outgoing
buffer. Also add the duration as get_next_time() is supposed to return the
timestamp of the next buffer, not the current one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4701>
2023-05-29 14:56:13 +00:00
Michael Olbrich 285811e7a7 jpegdec: be stricter when detecting interlaced video
There are broken(?) mjpeg videos that are incorrectly detected as
interlaced. This happens because 'info.height > height' (e.g. 1088 > 1080).

In the interlaced case info.height is approximately 'height * 2' but not
exactly because height is a multiple of DCTSIZE. Make the check more
restrictive but take the rounding effect into account.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4696>
2023-05-25 18:34:34 +00:00
Michael Olbrich 59290feca4 jpegdec: decode the correct number of lines for interlaced frames
For interlaced jpeg, gst_jpeg_dec_decode_direct() is called twice, once for each
field. In this case, stride[n] is plane_stride[n] * 2 to ensure that only every
other line is written. So the loop must stop at height / num_fields.

If the frame is really interlaced then continuing beyound this, is not harmful,
because jpeg_read_raw_data() will do nothing and return 0, so am info message is
printed.

However, if the frame is not actually interlaced, just misdetected as interlaced
then there is still data available from the second half of the frame. Now
line[0][j] is set to the scratch buffer. If the scratch buffer is not allocated
(because the height is a multiple of v_samp[0] * DCTSIZE) then the result is a
segfault due to a null-pointer dereference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4696>
2023-05-25 18:34:34 +00:00
YURI FEDOSEEV 8dd51501d0 v4l2videoenc: support force keyframe event in v4l2 encoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4663>
2023-05-24 12:42:24 +00:00
Ruben Gonzalez 059965fe53 doc: Fix newline char between authors
Found running `gst-inspect-1.0 -a |& grep -v ":" | grep @`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4682>
2023-05-20 05:48:23 +00:00
Nicolas Dufresne 0c9ab49579 v4l2: videodec: Fix stalls on empty buffer
Drivers may signal end of sequence using an empty buffer and LAST buffer
set, or just an empty buffer on certain legacy implementation. When this
occured, we'd send GST_V4L2_FLOW_LAST_BUFFER were the code expected
GST_FLOW_EOS. Stop abusing GST_FLOW_EOS and port all the code to the new
GST_V4L2_FLOW_LAST_BUFFER.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4669>
2023-05-19 23:06:06 +00:00
Sebastian Dröge d5a0cfc563 qtdemux: Add support for SpeedHQ video codec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3982>
2023-05-19 07:16:03 +00:00
Matthew Waters 3f4bfa097a qml6: add a mixer element
Can take multiple input streams and a qml scene and layout the input
videos inside the qml scene.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4609>
2023-05-19 01:48:57 +00:00
Shengqi Yu 5da9a8e2f4 v4l2object: fix some errors in probe_caps_for_fromat
1, there is a mistake when print stepwise.max_height, fix it
2, modify the calculation of width and height under the step wise
condition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4562>
2023-05-18 13:45:11 +00:00
Ruben Gonzalez 5c0f6b88d8 README.md: fix current version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4662>
2023-05-18 06:25:50 +00:00
Hou Qi 783ebbeecb v4l2videoenc: fix set format failure when needs reset encoder
In cases that encoder needs to reset format, there is race while draining.
v4l2videoenc finish() sends CMD_STOP command to driver, and desire to return
GST_FLOW_OK. But at this time, encoder CAPTURE may have dequeued the last
buffer and got eos. finish() return value changes to be GST_FLOW_EOS which
causes set format fail. So there is no need to check return value for finish()
when set format.

Also need to flush encoder after draining to make sure flush is finished.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4495>
2023-05-17 17:59:29 +00:00
Sebastian Dröge 99285bb566 qtmux: Fix extraction of CEA608 data from S334-1A packets
The index is already incremented by 3 every iteration so multiplying it
by 3 additionally on each array access is doing it twice and does not
work.

This caused invalid files to be created if there's more than one CEA608
triplet in a buffer, and out of bounds memory reads.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4634>
2023-05-16 11:29:45 +00:00
Jan Schmidt 131d59518e splitmuxsrc: Make PTS contiguous by preference
Make splitmuxsrc deal better with stream reordering by
making the largest observed PTS contiguous in the
next fragment. Previously, it selected DTS, but then
aligned that with the segment start of the next fragment,
which holds PTS values - leading to glitches in
streams that don't have PTS = DTS at the start.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4637>
2023-05-16 04:34:16 +00:00
Sebastian Dröge bb2c5981fe pulse: Change bitfield booleans to normal gbooleans
Assigning TRUE (1) to a signed 1 bit integer will cause truncation
from 1 to -1 because the only non-zero value that can be stored is -1
due to how two's-complement works.

As this is a proper GObject let's not bother with all this and simply
use a normal gboolean instead.

../subprojects/gst-plugins-good/ext/pulse/pulsesink.c:1490:19: warning: implicit truncation from 'int' to a one-bit
        wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
  pbuf->in_commit = TRUE;
                  ^ ~~~~

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4617>
2023-05-14 15:58:35 +00:00