GstCodecParsers.H265Parser

Fields

Name

Type

Access

Description

last_pps

GstCodecParsers.H265PPS

r

last_sps

GstCodecParsers.H265SPS

r

last_vps

GstCodecParsers.H265VPS

r

pps

[GstCodecParsers.H265PPS]

r

sps

[GstCodecParsers.H265SPS]

r

vps

[GstCodecParsers.H265VPS]

r

Methods

free ()

identify_and_split_nalu_hevc (data, offset, size, nal_length_size, nalus, consumed)

identify_nalu (data, offset, size, nalu)

identify_nalu_hevc (data, offset, size, nal_length_size, nalu)

identify_nalu_unchecked (data, offset, size, nalu)

insert_sei (au, sei)

insert_sei_hevc (nal_length_size, au, sei)

link_slice_hdr (slice)

parse_decoder_config_record (data, size)

parse_nal (nalu)

parse_pps (nalu, pps)

parse_sei (nalu, messages)

parse_slice_hdr (nalu, slice)

parse_slice_hdr_ext (nalu, slice, sps_ext)

parse_sps (nalu, sps, parse_vui_params)

parse_sps_ext (nalu, sps, sps_ext, parse_vui_params)

parse_vps (nalu, vps)

update_pps (pps)

update_sps (sps)

update_vps (vps)

Details

class GstCodecParsers.H265Parser

It offers you bitstream parsing in HEVC mode and non-HEVC mode. To identify Nals in a bitstream and parse its headers, you should call:

Then, depending on the GstCodecParsers.H265NalUnitType of the newly parsed GstCodecParsers.H265NalUnit, you should call the differents functions to parse the structure:

Note: You should always call GstCodecParsers.H265Parser.parse_nal() if you don’t actually need GstCodecParsers.H265NalUnitType to be parsed for your personal use, in order to guarantee that the GstCodecParsers.H265Parser is always up to date.

For more details about the structures, look at the ITU-T H.265 specifications, you can download them from:

  • ITU-T H.265: http://www.itu.int/rec/T-REC-H.265

free()

Frees self

identify_and_split_nalu_hevc(data, offset, size, nal_length_size, nalus, consumed)
Parameters:
  • data (int) – The data to parse, must be the beging of the Nal unit

  • offset (int) – the offset from which to parse data

  • size (int) – the size of data

  • nal_length_size (int) – the size in bytes of the HEVC nal length prefix.

  • nalus ([GstCodecParsers.H265NalUnit]) – a caller allocated GLib.Array of GstCodecParsers.H265NalUnit where to store parsed nal headers

  • consumed (int) – the size of consumed bytes

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data for packetized (e.g., hvc1/hev1) bitstream and sets nalus. In addition to nal identifying process, this method scans start-code prefix to split malformed packet into actual nal chunks.

New in version 1.22.

identify_nalu(data, offset, size, nalu)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data and fills nalu from the next nalu data from data

identify_nalu_hevc(data, offset, size, nal_length_size, nalu)
Parameters:
  • data (int) – The data to parse, must be the beging of the Nal unit

  • offset (int) – the offset from which to parse data

  • size (int) – the size of data

  • nal_length_size (int) – the size in bytes of the HEVC nal length prefix.

  • nalu (GstCodecParsers.H265NalUnit) – The GstCodecParsers.H265NalUnit where to store parsed nal headers

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data and sets nalu.

identify_nalu_unchecked(data, offset, size, nalu)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data and fills nalu from the next nalu data from data.

This differs from gst_h265_parser_identify_nalu in that it doesn’t check whether the packet is complete or not.

Note: Only use this function if you already know the provided data is a complete NALU, else use gst_h265_parser_identify_nalu.

insert_sei(au, sei)
Parameters:
Returns:

a SEI inserted Gst.Buffer or None if cannot figure out proper position to insert a sei

Return type:

Gst.Buffer or None

Copy au into new Gst.Buffer and insert sei into the Gst.Buffer. The validation for completeness of au and sei is caller’s responsibility. Both au and sei must be byte-stream formatted

New in version 1.18.

insert_sei_hevc(nal_length_size, au, sei)
Parameters:
Returns:

a SEI inserted Gst.Buffer or None if cannot figure out proper position to insert a sei

Return type:

Gst.Buffer or None

Copy au into new Gst.Buffer and insert sei into the Gst.Buffer. The validation for completeness of au and sei is caller’s responsibility. Nal prefix type of both au and sei must be packetized, and also the size of nal length field must be identical to nal_length_size

New in version 1.18.

Parameters:

slice (GstCodecParsers.H265SliceHdr) – The GstCodecParsers.H265SliceHdr to fill.

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Link SPS and PPS of self to slice. slice must be valid and parsed already by self or other GstCodecParsers.H265Parser

New in version 1.28.

parse_decoder_config_record(data, size)
Parameters:
  • data (int) – the data to parse

  • size (int) – the size of data

Returns:

a GstCodecParsers.H265ParserResult

config:

parsed GstCodecParsers.H265DecoderConfigRecord data

Return type:

(GstCodecParsers.H265ParserResult, config: GstCodecParsers.H265DecoderConfigRecord)

Parses HEVCDecoderConfigurationRecord data and fill into config. The caller must free config via GstCodecParsers.H265DecoderConfigRecord.free()

This method does not parse VPS, SPS and PPS and therefore the caller needs to parse each NAL unit via appropriate parsing method.

New in version 1.24.

parse_nal(nalu)
Parameters:

nalu (GstCodecParsers.H265NalUnit) – The GstCodecParsers.H265NalUnit to parse

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

This function should be called in the case one doesn’t need to parse a specific structure. It is necessary to do so to make sure self is up to date.

parse_pps(nalu, pps)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, and fills the pps structure.

parse_sei(nalu, messages)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, create and fills the messages array.

parse_slice_hdr(nalu, slice)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, and fills the slice structure. The resulting slice_hdr structure shall be deallocated with GstCodecParsers.H265SliceHdr.free() when it is no longer needed

parse_slice_hdr_ext(nalu, slice, sps_ext)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, and fills the slice structure. The resulting slice_hdr structure shall be deallocated with GstCodecParsers.H265SliceHdr.free() when it is no longer needed

New in version 1.28.

parse_sps(nalu, sps, parse_vui_params)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, and fills the sps structure.

parse_sps_ext(nalu, sps, sps_ext, parse_vui_params)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, and fills the sps structure.

New in version 1.28.

parse_vps(nalu, vps)
Parameters:
Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Parses data, and fills the vps structure.

update_pps(pps)
Parameters:

pps (GstCodecParsers.H265PPS) – a GstCodecParsers.H265PPS.

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Replace internal Sequence Parameter Set struct corresponding to id of pps with pps. nalparser will mark pps as last parsed sps.

New in version 1.18.

update_sps(sps)
Parameters:

sps (GstCodecParsers.H265SPS) – a GstCodecParsers.H265SPS.

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Replace internal Sequence Parameter Set struct corresponding to id of sps with sps. nalparser will mark sps as last parsed sps.

New in version 1.18.

update_vps(vps)
Parameters:

vps (GstCodecParsers.H265VPS) – a GstCodecParsers.H265VPS.

Returns:

a GstCodecParsers.H265ParserResult

Return type:

GstCodecParsers.H265ParserResult

Replace internal Video Parameter Set struct corresponding to id of vps with vps. nalparser will mark vps as last parsed vps.

New in version 1.18.