Commit graph

597 commits

Author SHA1 Message Date
Seungha Yang
cd50b02bc9 vp9parse: Skip parsing decode-only frame
Decode-only frame (i.e., show_existing_frame == 1) doesn't hold
any valid information apart from the index of frame to be duplicated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2408>
2021-07-14 14:32:57 +00:00
He Junyan
8ba730a564 h265parse: Add special profile case for profile_idc 0.
This is a work-around to identify some main profile streams having
wrong profile_idc. There are some wrongly encoded main profile streams
which doesn't have any of the profile_idc values mentioned in Annex-A,
instead, general_profile_idc has been set as zero and the
general_profile_compatibility_flag[general_profile_idc] is TRUE.
Assuming them as MAIN profile for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>
2021-07-02 10:27:41 +00:00
He Junyan
42a861fe59 h265parse: Map -intra profiles to non-intra compatible profiles.
All the -intra profiles can map to non-intra profiles as compatible
profiles, except the monochrome case for main and main-10.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2322>
2021-07-02 10:27:41 +00:00
Seungha Yang
058957fc22 h264parse,h265parse: Push parameter set NAL units again per segment-done
Some decoder implementations might drain out internal buffers and
reset its status on segment-done event. So, in case that
upstream stream-format is packetized but downstream supports only
byte-format, required codec-data might not be forwarded toward
downstream if such parameter set NAL units don't exist in inband
bitstream. Therefore, parse elements should re-send parameter set NAL
units like the case of flush event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2334>
2021-06-16 18:00:39 +00:00
He Junyan
7feed2f1ac h265parse: Fix a typo in get_compatible_profile_caps().
The GST_H265_PROFILE_MAIN_444_10 profile should be compatible with
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10, not the current
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2328>
2021-06-16 13:23:50 +00:00
Stéphane Cerveau
a71ec17cf0 jpeg2000parse, openjpeg: add support for YCrCb 4:1:1 sampling
Add YCrCb 4:1:1 support in openjpeg elements
and fix in jpeg2000parse the YCrCb 4:1:0 support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2321>
2021-06-14 11:05:45 +02:00
Tim-Philipp Müller
8e04651b8b Use gst_buffer_new_memdup()
Update for function rename in core.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/827

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2281>
2021-05-24 19:05:27 +01:00
Tim-Philipp Müller
0151276d7f Use new gst_buffer_new_copy()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2279>
2021-05-23 17:20:16 +01:00
Nicolas Dufresne
b884bcb93e vp9parse: Manually fixate codec-alpha field
This is a newly introduced field, and we interpret it as false when missing in
the caps. Otherwise, a simple capsfilter will just add the missing field and
keep going, despite the upstream caps being a superset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2199>
2021-05-11 16:06:56 -04:00
Nirbheek Chauhan
4c4f031207 h265parse: don't invalidate the last PPS when parsing a new SPS
This is a port of https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2019
to h265parse.

When a SPS is received then any previous PPS remains valid. So don't clear
the PPS flag from the parser state.

This is important because there are encoders that don't generated a PPS after
every SPS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2217>
2021-05-05 10:02:28 +00:00
Stéphane Cerveau
891be51105 gst-plugins: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2110>
2021-04-11 16:16:55 +00:00
Haihua Hu
e69d0151d2 jpeg2000parse: fix critical log when play one gray colorspace video
Need guess color space based on number of components when cannot
got it from sink caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1955>
2021-04-08 01:06:12 +00:00
Stéphane Cerveau
b0a9ba4ccf mpegvideoparse: do not clip the frame
If the current buffer is delta unit such as P or B
frame, the buffer should not be clipped and need to
let the decoder handle the segment boundary situation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2070>
2021-03-11 15:01:38 +01:00
Michael Olbrich
5a03862fca h264parse: don't invalidate the last PPS when parsing a new SPS
When a SPS is received then any previous PPS remains valid. So don't clear
the PPS flag from the parser state.

This is important because there are encoders that don't generated a PPS after
every SPS.

Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/571

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2019>
2021-02-17 16:22:18 +00:00
Vivia Nikolaidou
66bfd0e8ae h265parse: Detect height change on field-based interlaced files
The first time update_src_caps is called, there's no frame parsed yet,
therefore we don't know whether the file has alternate-field interlacing
mode. If we run it again after we have a frame, it might be that now we
have the SEI pic_struct parsed, and therefore we know that it's
field-based interlaced, and therefore the height must be multiplied by
two. Earlier on this was not detected as a change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2022>
2021-02-17 13:46:41 +00:00
Vivia Nikolaidou
21347e13f5 h265parse: Fix FPS/duration for interlaced files
There can be h265 files with frame-based, not field-based, interlacing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2020>
2021-02-17 13:46:03 +02:00
Mathieu Duponchelle
8ae56d60a3 h264parse: fix timestamping of interlaced fields in output
Instead of relying on GstBaseParse default behaviour of computing
the duration of a parsed buffer based on the framerate passed
to gst_base_parse_set_framerate(), we instead compute the duration
ourselves, as we have more information available.

In particular, this means we now output buffers with a duration
that matches that of raw interlaced buffers when each field is
output in a separate buffer.

This fixes DTS interpolation performed by GstBaseParse, as the
previous behaviour of outputting each field with the duration of
a full frame was messing up the base class calculations.

When not enough information is available, h264parse simply falls
back to calculating the duration based on the framerate and hope
for the best as was the case previously.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1973>
2021-02-16 17:15:27 +01:00
Vivia Nikolaidou
ae66a5772c h265parse: Support for alternate-field interlacing
Also don't set interlacing information on the caps, see #1313

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1996>
2021-02-03 16:09:45 +02:00
Jan Alexander Steffens (heftig)
0f084d4624 h264/h265parse: Add VideoTimeCodeMeta to the outgoing buffer
The parsers attempted to add the meta to the incoming buffer, which
might not be the outgoing buffer or may not have been writable yet.

To fix this, call `gst_buffer_make_writable` earlier and make sure to
use the `parse_buffer` to add the meta.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2002>
2021-02-02 18:44:49 +01:00
He Junyan
db134d27a0 av1parse: set the default alignment for input and output.
1. Set the default output alignment to frame, rather than current
   alignment of obu. This make it the same behaviour as h264/h265
   parse, which default align to AU.
2. Set the default input alignment to byte. It can handle the "not
   enough data" error while the OBU alignment can not. Also make it
   conform to the comments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
2021-01-26 12:22:31 +00:00
He Junyan
5abf4ad4dd av1parse: Reset the annex_b when meet TU inside a buffer.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
2021-01-26 12:22:31 +00:00
He Junyan
d83f253258 av1parse: Output each OBU when output is aligned to obu.
The current behaviour for obu aligned output is not very precise.
Several OBUs will be output together within one gst buffer. We
should output each gst buffer just containing one OBU. This is
the same way as the h264/h265 parse do when NAL aligned.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
2021-01-26 12:22:31 +00:00
He Junyan
ee1f6017ac av1parse: Always copy the OBU to cache.
The current optimization when input align and out out align are
the same is not very correct. We simply copy the data from input
buffer to output buffer, but we failed to consider the dropping of
OBUs. When we need to drop some OBUs(such as filter out the OBUs
of some temporal ID), we can not do simple copy. So we need to
always copy the input OBUs into a cache.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
2021-01-26 12:22:31 +00:00
He Junyan
a9c8aa4788 av1parse: Improve the logic when to drop the OBU.
When drop some OBU, we need to go on. The current manner will make
the data access out range of the buffer mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1979>
2021-01-26 12:22:31 +00:00
He Junyan
7196abf7a3 av1parse: Fix some issues in the src caps.
1. Add the mono_chrome to identify 4:0:0 chroma-format.
2. Correct the mapping between subsampling_x/y and chroma-format.
   There is no 4:4:0 format definition in AV1. And 4:4:4 should
   let both subsampling_x/y be equal to 0.
3. Send the chroma-format when the color space is not RGB.

Fixes: #1502
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1974>
2021-01-23 10:53:44 +00:00
He Junyan
1029c84dbf vp9parse: Fix the subsampling_x/y to chroma format mapping.
The chroma format 4:4:4 needs both subsampling_x and subsampling_y
equal to 0.

Fixes: #1502
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1974>
2021-01-23 10:53:44 +00:00
He Junyan
fe19bc0a2e videoparsers: av1: Add the AV1 parse.
This AV1 parse implements the conversion between alignment of obu,
tu and frame, and the conversion between stream-format of obu-stream
and annexb.

TODO:
1. May need a property of operating_point to filter the OBUs
2. May add a property to disable deep parse.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1614>
2021-01-19 18:38:03 +00:00
Mathieu Duponchelle
c969239c7c h264parse: try harder to update timecode
NumClockTS is the maximum number of timecodes the pic_timing SEI
can carry, but it is perfectly OK for it to carry fewer, and have
one of the clock_timestamp_flags set to 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1804>
2020-11-13 13:09:01 +00:00
Mathieu Duponchelle
e93558efac h264parse: fix installing of update-timecode property
Simply fixes a typo that did not have any adverse effect,
and avoid hardcoding initializer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1805>
2020-11-12 21:34:18 +00:00
Aaron Boxer
b2a0fd9e96 jpeg2000parse: sub-sampling parse should take component into account
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1653>
2020-10-27 08:26:23 +01:00
Stéphane Cerveau
7edff6e746 jpeg2000parse: no pts interpolation with subframe.
The jpeg2000parser must not interpolate PTS with subframes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1653>
2020-10-27 08:26:23 +01:00
Aaron Boxer
db13dc9d02 jpeg2000parse: support frame and stripe alignment in caps
forward alignment and num-stripes caps properties

Use caps height when setting caps for subframe

We want downstream to use full frame height, not subframe height

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1653>
2020-10-27 08:26:23 +01:00
Seungha Yang
634eb1fc38 h265parse: Don't enable passthrough by default
SEI messages contain various information which wouldn't be conveyed
by using upstream CAPS (HDR, timecode for example).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1639>
2020-10-15 03:25:17 +09:00
Guillaume Desmottes
75dc98cc08 h265parse: set interlace-mode=interleaved on interlaced content
interlace-mode=alternate is a special case of interlace-mode=interleaved
where the fields are split using two different buffers.

We should use the latter instead of the former to no break compat with
elements supporting only 'interleaved'.
Decoders producing alternate, such as OMX on the Zynq, should change the
interlace-mode on their output caps.

Fix https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/825

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1655>
2020-10-09 10:19:52 +00:00
Haihao Xiang
4a93f6e651 h265parse: recognize more HEVC extension streams
There are streams which have the right general_profile_idc and
general_profile_compatibility_flag, but don't have the right extension
flags. We may try to use chroma_format_idc and bit_depth to
recognize these streams.

e.g.
https://www.itu.int/wftp3/av-arch/jctvc-site/bitstream_exchange/draft_conformance/SCC/IBF_Disabled_A_MediaTek_2.zip

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1328>
2020-09-16 16:51:45 +00:00
Seungha Yang
2b152eae69 videoparsers: Add vp9parse element
Adding vp9parse element to parse various stream information such as
resolution, profile, and so on. If upstream does not provide resolution and/or
profile, this would be useful for decodebin pipeline for autoplugging
suitable decoder element depending on template caps of each decoder element.

In addition, vp9parse element supports unpacking superframe into
single frame for decoders. The vp9 superframe is a frame which consists
of multiple frames (or superframe with one frame is allowed) followed by superframe
index block. Then unpacked each frame will be considered as normal frame
by decoder. The decision for unpacking will be done by downstream element's
"alignment" caps field, which can be "super-frame" or "frame".
If downstream specifies the "alignment" as "frame",
then vp9parse element will split an incoming superframe into single frames
and the superframe index (located at the end of the superframe) data
will be discarded by vp9parse element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1041>
2020-09-10 14:56:52 +00:00
Sebastian Dröge
64039cdf84 gst: Update for gst_video_transfer_function_*() function renaming
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1557>
2020-09-07 12:14:47 +03:00
Felix Yan
5886138c13 Correct typos in gsth264parse.c
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1511>
2020-08-12 17:03:00 +00:00
Nicolas Dufresne
76b4de79ca h264parse: Add new H.264 levels
The spec now list 6, 6.1 and 6.2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1509>
2020-08-12 08:30:14 -04:00
Tim-Philipp Müller
510e8ef8cb docs: fix element names in section headers
Hopefully that'll make hotdoc pick up the docs for these elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1428>
2020-07-10 19:22:29 +00:00
Vivia Nikolaidou
31d5d04bb1 videoparseutils: Only add a single closed caption meta
Otherwise, having a stream go through a parser multiple times would
result in duplicate closed caption meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1396>
2020-07-03 08:25:54 +00:00
Jan Alexander Steffens (heftig)
afdde9fa40 videoparsers: Fix parsing ATSC bar data
It rejected the case of all bars being disabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1394>
2020-07-01 20:02:35 +00:00
Jan Alexander Steffens (heftig)
01896c11d2 videoparsers: Fix parsing of ATSC AFD data
The test for 0x40 being set is repeated by
gst_video_parse_utils_parse_afd, which also extracts the low nibble
again, so we must not clear it here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1394>
2020-07-01 20:02:35 +00:00
Jan Alexander Steffens (heftig)
cedb07fe46 videoparsers: Give gstvideoparseutils.c a debug category
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1394>
2020-07-01 20:02:35 +00:00
Vivia Nikolaidou
652773de36 Revert "h264parse: Include interlace-mode in caps"
This reverts commit b75a61342f.

The parser would only set the mode to progressive or mixed, missing the
cases where it should have been interleaved. Interleaved is more
difficult to detect because in h264 it happens per frame. On the other
hand, h264 decoders detect the interlacing information per-frame and set
the caps correctly. By giving potentially incorrect interlacing
information in the parser already, it's being enforced downstream even
after decoding, breaking some use cases (e.g. an encoder can't properly
mark the stream as TFF or BFF). On the other hand, there's no valid use
case for having interlacing information on the caps at the parsing
stage, so after a lot of discussion, it was decided to revert this.

Initial commit message:
=========================
Those are the rules:

In the SPS:
  * if frame_mbs_only_flag=1 => all frame progressive
  * if frame_mbs_only_flag=0 => field_pic_flag defines if each frame is
    progressive or interlaced, thus the mode is 'mixed' in GStreamer
    terms.

https://bugzilla.gnome.org/show_bug.cgi?id=779309
=========================

Fixes #1313

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1335>
2020-06-22 16:08:41 +00:00
Nicolas Dufresne
269ab891c5 h264/h265parse: Fix initial skip
Account for start codes possibly be 4 bytes. For HEVC, also take into
account that we might be missing only one of the two identification
bytes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne
3784bd4a73 h265parse: Ensure correct timestamps
If the input has a miss-placed filler zero byte (e.g. a filler without a 4
bytes start code on the next NAL), we would endup using the same timestamp
twice. Ask the base class to read the timestamp from the buffer were the NAL
actually starts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne
dc4c470d75 h264parse: Properly handle 4 bytes start code
This will stop stripping four bytes start code. This was fixed and broken
again as it was causing the a timestamp shift. We now call
gst_base_parse_set_ts_at_offset() with the offset of the first NAL to ensure
that fixing a moderatly broken input stream won't affect the timestamps. We
also fixes the unit test, removing a comment about the stripping behaviour not
being correct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
2020-05-07 12:08:36 -04:00
Nicolas Dufresne
0d637c14c5 h264/h265parse: Fix handling of very last frame
Baseparse will never call us back on draining, so going into more: label will
cause the current frame to be discarded. So if we have a complete NAL, but not
a complete AU, make sure to terminate the frame properly.

This is a gression introduce by commit e88d848070 and
a194a87b26.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1208>
2020-04-23 12:28:54 +00:00
Xavier Claessens
95134cfda8 h264parse: Remove unused arguments 2020-04-15 14:10:16 +00:00