Commit graph

104 commits

Author SHA1 Message Date
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
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
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
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
Nicolas Dufresne
ff137a2059 h265parse: Don't push NALs before we have HEADERS
Otherwise we may endup pushing incomplete caps. Note that this has the side
effect that caps are no longer pushed twice in presence of VUI with valid
framerate.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
c51922b06c h265parse: Differentiate PREFIX SEI from SUFFIX
There is some code to fixup broken stream that uses the SEI location,
this code is meant to locate SUFFIX SEI only. This should prevent
unwanted side effect if SUFFIX SEI is used.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
1aede43af6 h265parse: Don't add latency when not needed
We no longer add latency when doing AU->AU, AU->NAL and NAL->NAL
parsing.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
ceb68c4cf8 h265parse: Propagate MARKER flag 2020-04-15 14:10:16 +00:00
Nicolas Dufresne
e88d848070 h265parse: Don't wait for next NAL if input is aligned
Waiting for the next NAL increases the latency. If alignment=nal/au
has been negotiated, assumes the the buffer contains a complete
NAL and don't expect a second start-code. This way, nal -> nal,
au -> au and au -> nal no longer introduce latency.

As a side effect, the collect_pad() function was not able to poke at the
following NAL. This call is now moved before processing the NAL, so
it's looking at the current NAL before it's ingested into the parser
state in order to dermin if the end of an AU has been reached. The AUD
injection state as been adapted to support this.

This change will break pipelines if alignment=nal is used without respecting the
alignment. Effectively, the parser will no longer fix the broken aligment
which will result in parser error and the termination of the pipeline. Such
issue existed in tsdemux element and might exist in any forks of that code.

Related to https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1193
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
7cba3847ec h265parse: Set PTS/DTS and DISCONT on crafted NAL
When we inject a NAL in the bitstream before another one, make
sure to pass both DTS and PTS. Also make sure to transfer the
DISCONT flag properly.
2020-04-15 14:10:16 +00:00
Nicolas Dufresne
84a58b3633 h265parse: Fix content light level value changes
The comparision was not testing anything meaninful. This fixes the comparision
so we now update the caps whenever the value differ. This was detected by
coverity.

CID 1461291
2020-04-08 13:58:51 -04:00
Seungha Yang
f05effe024 h264parse,h265parse: Update for video-hdr struct change
See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
2020-04-01 05:18:11 +00:00
Zeeshan Ali
355719bae7 h265parse: Set duration on buffers base on framerate 2020-03-31 14:13:30 +00:00
Zeeshan Ali
158d69fd45 h265parse: Derive src fps from vui_time_scale & vui_num_units_in_tick 2020-03-31 14:13:30 +00:00
Zeeshan Ali
51bc67d4ef h265parse: Handle interlaced video
For interlaced video:
* set the interlace mode in the src caps
* double the height from SPS in the caps.
* set field latency, instead of frame latency.

Fix #778
2020-03-31 14:13:30 +00:00
Seungha Yang
4b06b1a56e h265parse: In-band sps/pps update if only codec_data differs in src caps
Apply in-band sps/pps resending implementation to h265parse.
2020-03-10 08:51:04 +00:00
Seungha Yang
959320264a h265parser: Add helper macro for nal type classification
Add some macros to remove code duplication and to make it more readable
2020-03-05 23:22:34 +09:00
Stéphane Cerveau
4b8c47ee37 h26xparse: Handle state change on IDR first slice
As the H265/H264 bitstream can support multiple slices,
mastering_display_info_state and content_light_level_state
should be changed only on first slice segment.

Fix #1152
2020-01-07 08:55:28 +00:00
Stéphane Cerveau
d414e90eff h265parse: use same algo for MDCV and CLL SEI management 2020-01-07 08:55:28 +00:00
Yeongjin Jeong
3f2240498b h265parser: Add simple GstH265Profile/string public utilites
It makes more simplifies the conversion between GstH265Profile and string.
2019-12-20 15:43:55 +00:00
Vivia Nikolaidou
851682629e videoparsers: Disable gst_base_parse_set_infer_ts
From the documentation of gst_base_parse_set_infer_ts, it should be
disabled for non-audio data. Currently just disabling for all video
parsers that have reordered data: h264, h265, mpeg, mpeg4, vc1. Was
already disabled in h263.
2019-11-19 10:23:31 +02:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Yeongjin Jeong
732735cab0 h265parse: Fix wrong NALU minimum length check
Fixes a problem where an EOS/EOB NALU placed at the end of
an AU is detected as an other AU and create a buffer that
does not have valid pts.
2019-11-04 14:16:49 +09:00
Guillaume Desmottes
403cffeace h265parse: fix colorimetry in src caps if sink caps has no structure
We do want to include the colorimetry in the src caps if the sink caps
doesn't have any structure associated.
2019-08-27 06:06:01 +00:00
Aaron Boxer
40212aaf00 h265parse: add support for SEI registered user data 2019-08-26 18:14:17 -04:00
Seungha Yang
b624c6a067 h265parse: Fix mastering display info parsing
Fix mismatched Red Y coordinate value.
2019-08-08 20:01:41 +09:00
Seungha Yang
5e7dbdf585 h265parse: Add support for compatible profiles of extensions
From decoder's capability point of view as defined by the h265 specification,
accept peer profile caps.
2019-07-31 00:32:40 +09:00
Mathieu Duponchelle
2305bf272c h26{4,5}parse: add support for forward predicted trick mode
Also stop assigning TRUE to fields with |=
2019-07-18 13:46:45 +00:00
Seungha Yang
0e4efb86c8 h265parse: Expose parsed colorimetry when VUI provided it
... and also if upstream did not specify the colorimetry.
2019-07-16 17:53:42 +00:00
Jan Schmidt
bd46630b62 h265parse: Don't segfault when SPS hasn't been seen yet.
Fix a recently introduced segfault. Don't de-reference a NULL
SPS pointer when attempting to update source caps before SPS
has been seen in the stream.
2019-07-04 01:12:06 +10:00
Nicola Murino
59d8e56e95 h265parse: update parser state and header flag when using fallback sps
When sps parsing fails we use a fallback sps from the caps, since we
have got an sps we need to update parser state and header as in the case the
sps was successfully parsed
2019-06-15 20:02:10 -04:00
Seungha Yang
4f6ac87f67 h265parse: Add more string representations of extension profiles 2019-06-13 23:05:09 -04:00
Dong Il Park
392f86ae35 h265parse: Update framerate when we found vps_timing_info
The timing_info was described at vps or vui parameter.
So we can update the framerate field of GstCaps when we could
parse vps_timing_info parameters.
2019-06-14 02:15:46 +00:00
Seungha Yang
6843b663b6 h265parse: Don't miss constraint indicator flags in codec data
Set more unhandled flags to general_constraint_indicator_flags field.
The field is required for building "Codecs" parameter as defined
ISO/IEC 14496-15 Annex E. The resulting "Codecs" string might be used
in various places (e.g., HLS/DASH manifest, browser, player, etc)
2019-06-11 21:15:49 +09:00
Seungha Yang
a24367132b h265parse: Parse mastering display info and content light level from SEI
... and set to caps if necessary.

Note 1) the mastering display info and content light level SEI meessages
are persistent in the corresponding codec video sequence (i.e., GOP).
So any bitstream containing those SEI messages
(and also all pictures are intended to be HDR rendered) should be ensured that
each first slice of codec video sequence follows those SEI messages.

Note 2) The codec video sequence is a group an [IRAP + NoRaslOutputFlag == 1]
and following AUs which are not [IRAP + NoRaslOutputFlag == 1]
The NoRaslOutputFlag is equal to 1 for each IDR AU, BLA AU and some CRA AU.
For a CRA AU to have NoRaslOutputFlag equal to 1, following condition should required.
* When the CRA AU is the first AU in the bitstream in decoding order
* or the CRA AU is the first AU that follows an end of sequence NAL in decoding order
* or the HandleCraAsBlaFlag equal to 1.

Due to the limited context in parse element, in this commint, CRA AU will not considered as
having the NoRaslOutputFlag equal to 1. Therefore, in the worst case,
mastering-display-info and content-light-level could be cleared one GOP after
when stream was chagned from HDR to SDR.
2019-05-03 19:44:15 +00:00
Mathieu Duponchelle
0e89f2a6d9 h264parse, h265parse: take unit_field_based_flag into account ..
when computing timecode metas. Depending on the value of that flag,
n_frames is to be interpreted as a number of fields or a number of
frames. As GstVideoTimeCodeMeta always deals with frames, we want
to scale that number when needed.
2019-04-02 15:18:03 +02:00
Mathieu Duponchelle
55bb8966e1 h265parse: forward time codes
This transforms time code SEIs into GstVideoTimeCodeMeta
2019-04-01 10:02:33 +00:00
Haihua Hu
5498252750 h265parse: ignore VUI parse fail when parse SPS
VUI is an optional for SPS parse, some HEVC file has incorrect VUI
parameters but still can be decoded
2019-03-26 02:06:03 +00:00
Seungha Yang
8766a45ee4 h26{4,5}parse: Don't confuse nal of codec_data with frame
vps/sps/pps in codec_data shouldn't be considered as inband data.
Otherwise, h26{4,5}parse never insert them to nal when transform
(packetized to byte-stream) use case
2018-12-13 10:32:30 +00:00
Guillaume Desmottes
5efe9944e0 h265parse: process SEI recovery point
Similar change as the on I did in h264parse. We want to process SEI
recovery point as keyframe so muxers will mark them as seek points and
decoders will be able to start decoding from them rather than waiting
for an IDR.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/790
2018-12-02 02:07:39 +00:00
Guillaume Desmottes
99bd3f716c h265parse: parse SEI messages
Don't do anything with them yet. I just copied the parsing and
processing logic from h264parse.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/790
2018-12-02 02:07:39 +00:00
Seungha Yang
68a5697c1a h265parse: Don't duplicate VPS/SPS/PPS per config-interval if exists
Don't need to manually insert VPS/SPS/PPS since inband data could be useable.

Also fixes #824
2018-11-30 02:19:17 +00:00
Seungha Yang
da7143078f h265parse: Fix periodic SPS/PPS sending work after a seek
Apply the commit ef71b61
See also https://bugzilla.gnome.org/show_bug.cgi?id=742212

https://bugzilla.gnome.org/show_bug.cgi?id=754124
2018-09-10 22:36:59 -04:00
Seungha Yang
fd79d8d7a3 h265parse: Add support insert parameter set per IDR
Apply commits 0c04e00, bf0d952 and a0876aa to h265parse.
See also https://bugzilla.gnome.org/show_bug.cgi?id=766803

https://bugzilla.gnome.org/show_bug.cgi?id=754124
2018-09-10 22:36:59 -04:00
Seungha Yang
8b57392b92 h265parse: Don't discard first AU delimiter
Apply the commit 48a1f27

https://bugzilla.gnome.org/show_bug.cgi?id=754124
2018-09-10 22:36:59 -04:00
Seungha Yang
60d8b7184f h265parse: Consider SEI NALU as "HEADER" packets
Apply the commit 69c09c3

https://bugzilla.gnome.org/show_bug.cgi?id=754124
2018-09-10 22:36:59 -04:00
Seungha Yang
3ad30ef76e h265parse: Don't unref buffer that was unreffed just a few lines before already
Apply the commit 9b50a12

https://bugzilla.gnome.org/show_bug.cgi?id=754124
2018-09-10 22:36:59 -04:00