134 Commits

Author SHA1 Message Date
Sebastian Dröge
c5520a7cae qtdemux: Add support for DNxHR
Apart from the fourcc it works the same as DNxHD and can be distinguished from
the beginning of each frame header.

ffmpeg uses the same codec ID for DNxHD and DNxHR so we use the same caps with
just an additional, optional profile field for the DNxHR profile.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
9fa7f8b001 qtdemux: Parse content light level and mastering display info if available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
8a30c6b13b qtdemux: Use already parsed codec data boxes instead of parsing a second time
And parse common boxes in a central place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
cba7ce1228 qtdemux: Add missing codec sample entry fourccs to qtdemux_parse_node()
This allows parsing the various common sample entry boxes like btrt, colr, pasp,
chan, chnl, etc. for extending the caps with additional information.

Also unify some cases, which as a side effect makes them more correct because
many were not checking for different versions of the boxes and the corresponding
different offsets.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4403

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
118e66f59d qtdemux: Take Theora headers directly out of the already parsed nodes
Instead of parsing them yet another time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
137044195d qtdemux: Don't parse fiel box a second time for JPEG-2000
It was already parsed above in general for all video codecs. Just put the number
of fields into the JPEG-2000 in the specific field.

As a side effect this also actually checks if enough data is available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
45443603f8 qtdemux: Remove second parsing of fiel box for JPEG
Exactly the same is already done some hundred lines above for all video codecs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
8687ef453c qtdemux: Simplify parsing of SVQ3/VP31 boxes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
98d8bb9a12 qtdemux: Parse codec data for QDM2/QDMC correctly
First find the wave box then include its whole content instead of just including
everything from a random offset onwards.

Also actually do that for QDMC instead of leaving commented code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
cd6d2f16a6 qtdemux: Use already parsed damr box for AMR NB/WB streams
Instead of parsing it again and possibly getting the offset for reading
it wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
18db5538a0 qtdemux: Don't parse audio sample entry a second time in mp4a fallback case
These values were all passed a few hundred lines above already and can directly
be re-used here. The offset for the sample rate was also wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
2b18846e39 qtdemux: Fix endianness/alignment problems with parsing omwa sample description entries
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
f575fe763c qtdemux: Handle stsd entry offset correctly for audio in qtdemux_parse_node()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
ae4d505fe0 qtdemux: Pass stsd entry node to caps creation functions
Also fix lpcm to only read its additional fields from sound sample description v2.
Previously it would read random data if a different stsd entry was used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
3ecb07c674 qtdemux: Don't parse invalid data from ISOBMFF AudioSampleEntryV1
The additional fields only exist in sound sample description v1, which
is only defined for MOV.

ISOBMFF has AudioSampleEntryV1 but it has the exact same layout as
AudioSampleEntry.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
fec61cc546 qtdemux: Don't retrieve video stsd entry multiple times
And remove various duplicated checks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
af5cce9968 qtdemux: Parse uncompressed video uncC / cmpd boxes from already parsed stsd entry
Also simplifies code and error checking considerably.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
a6e58f7331 qtdemux: Don't retrieve enca/encv boxes a second time, wrongly
They need to be retrieved by index and they were already correctly retrieved
just above so let's just use that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
bb50741b73 qtdemux: Use already parsed stsd entries instead of parsing them again
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
cf2b1909ec qtdemux: Fix typo in debug message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8929>
2025-05-17 07:59:46 +00:00
Sebastian Dröge
fff260f1aa qtdemux: Don't configure any channel-mask in fallback case with 1 channel
For mono we don't set any channel mask. Setting 0 would mean an unpositioned
layout with a single channel.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8928>
2025-05-06 13:20:29 +00:00
Sebastian Dröge
7f8b27837c qtdemux: Add channel layouts to three more raw audio fourccs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8928>
2025-05-06 13:20:29 +00:00
Sebastian Dröge
737f653e7c qtdemux: Parse chan box
This is another variant of providing channel positions.

Also if neither chan nor chnl boxes are found, configure a default channel
layout for raw audio tracks.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8928>
2025-05-06 13:20:29 +00:00
Sebastian Dröge
5c16c8f0c1 qtdemux: Check length of JPEG2000 colr box before parsing it
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8930>
2025-05-06 11:09:55 +00:00
Sebastian Dröge
f18123ea15 qtdemux: Remove obsolete TODO comment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8930>
2025-05-06 11:09:55 +00:00
Eli Mallon
068385e83f qtdemux: unref simple caps after use
Otherwise we leak a GSTCaps object every time we
use qtdemux on a file with Opus audio

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8879>
2025-04-23 12:06:48 -07:00
dukesook
daa1ee84b9 qtdemux: Extend Uncompressed Lookup Table
- LUT now supports various subsampling, interleaves, and bit depths.

 - Replaces stride with GstVideoInfo pre_info to represent original data.

 - Simplifies gst_row_align_buffer() with gst_video_frame_copy().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8598>
2025-04-05 07:59:32 +00:00
Sebastian Dröge
f795796f89 qtdemux: Fix stsc size check in qtdemux_merge_sample_table()
There are 3 32bit integers per entry and not one more for all but the last.

Fixes a regression introduced in 5a9e80c01b4b49c6c7630a6d08b600114f38c0db
when playing back files that have one sample table entry per audio sample.

Merging the sample tables would've always failed because of the too strict size
check and one audio sample per GStreamer buffer would've been output, which
doesn't perform very well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8657>
2025-03-25 18:38:45 +00:00
Devon Sookhoo
2f2a6e76bc qtdemux: InterleaveType enum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8578>
2025-03-06 14:40:45 +00:00
dukesook
ee9c8724c3 qtdemux: component to format lookup table
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8578>
2025-03-06 14:40:45 +00:00
Jochen Henneberg
71d8618daf qtdemux: Ignore non-zero values for UV/XY in transformation matrix
But write an info message about that. The values have been ignored
before !8127 as well.

Fixes #4252

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8559>
2025-02-26 14:51:57 +00:00
Brad Hards
ec679507f6 qtdemux: look up uncompressed component type
This fix handles the case where the order of components in the cmpd box
does not correspond to the order used for a specific track. That
is the case where the uncC component_index values are something
other than 0, 1, 2, 3.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8483>
2025-02-17 16:23:37 +00:00
Tim-Philipp Müller
7c3a468056 qtdemux: add mappings for Hap video codec
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3596

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7717>
2025-02-15 21:25:05 +00:00
Brad Hards
49d8921232 qtdemux: fix version 1 profile handling, add diagnostics
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8456>
2025-02-14 00:03:30 +00:00
Brad Hards
c7367addb5 qtdemux: support uncompressed mono with component interleave
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8464>
2025-02-13 08:17:17 +00:00
Carlos Bentzen
a5c6eea957 qtdemux: add support for VVC/H.266
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5088>
2025-02-10 09:20:22 +00:00
dukesook
54830e7c0a qtdemux: Demux Uncompressed MP4
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7985>
2025-02-08 10:15:06 +00:00
Edward Hervey
8bc17b58a2 good: Clearly specify fallthrough in switch/case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8229>
2025-01-13 12:51:45 +00:00
Christian Meissl
422fca76ca qtdemux: fix accumulated base offset in segment seeks
analog to fix for matroska-demux
commit f3c126d07c8a85e76bf5abdfa7f140bbf20545ea

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8240>
2025-01-06 09:44:00 +00:00
Sebastian Dröge
0aeba9275c qtdemux: Add support for ISO/IEC 23003-5 raw PCM audio
And also support the ISO/IEC 14496-12 chnl channel layout box as required
by ISO/IEC 23003-5.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8171>
2025-01-03 10:11:31 +00:00
Jochen Henneberg
68cdeeb882 qtdemux: Undef helper macros after use
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8127>
2025-01-02 15:22:47 +00:00
Jochen Henneberg
d86f60ffdf qtdemux: Validate matrix before doing simplified multiply
The matrix multiplication makes some assumption about the element
values to simplify the math with fixpoint values. If this is allowed
for the given matrices is now checked first.

Then the debug output for matrix and a comment have been fixed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8127>
2025-01-02 15:22:47 +00:00
Jochen Henneberg
5c005733ea qtdemux: Fixup for orientation matrix parsing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8127>
2025-01-02 15:22:47 +00:00
Jochen Henneberg
c4d0f4bbd9 qtdemux: Use mvhd transform matrix and support for flipping
The mvhd matrix is now combined with the tkhd matrix. The combined
matrix is then checked if it matches one of the standard values for
GST_TAG_IMAGE_ORIENTATION.
This check now includes matrices with flipping.

Fixes #4064

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8127>
2025-01-02 15:22:47 +00:00
Sebastian Dröge
519d86d9f3 qtdemux: Add size check for parsing SMI / SEQH atom
Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-244
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3853

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8059>
2024-12-03 21:01:41 +00:00
Sebastian Dröge
bfebca8307 qtdemux: Check for invalid atom length when extracting Closed Caption data
Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-243
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3849

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8059>
2024-12-03 21:01:41 +00:00
Sebastian Dröge
7d3f221d87 qtdemux: Actually handle errors returns from various functions instead of ignoring them
Ignoring them might cause the element to continue as if all is fine despite the
internal state being inconsistent. This can lead to all kinds of follow-up
issues, including memory safety issues.

Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-245
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3847

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8059>
2024-12-03 21:01:41 +00:00
Sebastian Dröge
19359e2b25 qtdemux: Make sure there are enough offsets to read when parsing samples
While this specific case is also caught when initializing co_chunk, the error
is ignored in various places and calling into the function would lead to out of
bounds reads if the error message doesn't cause the pipeline to be shut down
fast enough.

To avoid this, no matter what, make sure enough offsets are available when
parsing them. While this is potentially slower, the same is already done in the
non-chunks_are_samples case.

Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-245
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3847

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8059>
2024-12-03 21:01:41 +00:00
Sebastian Dröge
4a0e8bf92b qtdemux: Fix error handling when parsing cenc sample groups fails
Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-238, GHSL-2024-239, GHSL-2024-240
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3846

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8059>
2024-12-03 21:01:41 +00:00
Sebastian Dröge
98f3934c48 qtdemux: Fix length checks and offsets in stsd entry parsing
Thanks to Antonio Morales for finding and reporting the issue.

Fixes GHSL-2024-242
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3845

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8059>
2024-12-03 21:01:41 +00:00