GstCodecParsers.H265Parser¶
Fields¶
Name |
Type |
Access |
Description |
|---|---|---|---|
last_pps |
r |
||
last_sps |
r |
||
last_vps |
r |
||
pps |
r |
||
sps |
r |
||
vps |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
GstCodecParsers.H265Parser.identify_nalu() to identify the following nalu in non-HEVC bitstreamsGstCodecParsers.H265Parser.identify_nalu_hevc() to identify the nalu in HEVC bitstreams
Then, depending on the
GstCodecParsers.H265NalUnitTypeof the newly parsedGstCodecParsers.H265NalUnit, you should call the differents functions to parse the structure:From
GstCodecParsers.H265NalUnitType.SLICE_TRAIL_NtoGstCodecParsers.H265NalUnitType.SLICE_CRA_NUT:GstCodecParsers.H265Parser.parse_slice_hdr()GST_H265_NAL_*_SEI:GstCodecParsers.H265Parser.parse_sei()GstCodecParsers.H265NalUnitType.VPS:GstCodecParsers.H265Parser.parse_vps()GstCodecParsers.H265NalUnitType.SPS:GstCodecParsers.H265Parser.parse_sps()GstCodecParsers.H265NalUnitType.PPS:GstCodecParsers.H265Parser.parse_pps()Any other:
GstCodecParsers.H265Parser.parse_nal()
Note: You should always call
GstCodecParsers.H265Parser.parse_nal() if you don’t actually needGstCodecParsers.H265NalUnitTypeto be parsed for your personal use, in order to guarantee that theGstCodecParsers.H265Parseris 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 unitoffset (
int) – the offset from which to parse datasize (
int) – the size of datanal_length_size (
int) – the size in bytes of the HEVC nal length prefix.nalus ([
GstCodecParsers.H265NalUnit]) – a caller allocatedGLib.ArrayofGstCodecParsers.H265NalUnitwhere to store parsed nal headersconsumed (
int) – the size of consumed bytes
- Returns:
- Return type:
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:
data (
int) – The data to parseoffset (
int) – the offset from which to parse datasize (
int) – the size of datanalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitwhere to store parsed nal headers
- Returns:
- Return type:
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 unitoffset (
int) – the offset from which to parse datasize (
int) – the size of datanal_length_size (
int) – the size in bytes of the HEVC nal length prefix.nalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitwhere to store parsed nal headers
- Returns:
- Return type:
Parses data and sets nalu.
- identify_nalu_unchecked(data, offset, size, nalu)¶
- Parameters:
data (
int) – The data to parseoffset (
int) – the offset from which to parse datasize (
int) – the size of datanalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitwhere to store parsed nal headers
- Returns:
- Return type:
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:
au (
Gst.Buffer) – aGst.Buffercontaining AU datasei (
Gst.Memory) – aGst.Memorycontaining a SEI nal
- Returns:
a SEI inserted
Gst.BufferorNoneif cannot figure out proper position to insert a sei- Return type:
Gst.BufferorNone
Copy au into new
Gst.Bufferand insert sei into theGst.Buffer. The validation for completeness of au and sei is caller’s responsibility. Both au and sei must be byte-stream formattedNew in version 1.18.
- insert_sei_hevc(nal_length_size, au, sei)¶
- Parameters:
nal_length_size (
int) – a size of nal length field, allowed range is [1, 4]au (
Gst.Buffer) – aGst.Buffercontaining AU datasei (
Gst.Memory) – aGst.Memorycontaining a SEI nal
- Returns:
a SEI inserted
Gst.BufferorNoneif cannot figure out proper position to insert a sei- Return type:
Gst.BufferorNone
Copy au into new
Gst.Bufferand insert sei into theGst.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_sizeNew in version 1.18.
- link_slice_hdr(slice)¶
- Parameters:
slice (
GstCodecParsers.H265SliceHdr) – TheGstCodecParsers.H265SliceHdrto fill.- Returns:
- Return type:
Link SPS and PPS of self to slice. slice must be valid and parsed already by self or other
GstCodecParsers.H265ParserNew in version 1.28.
- parse_decoder_config_record(data, size)¶
- Parameters:
- Returns:
a
GstCodecParsers.H265ParserResult- config:
parsed
GstCodecParsers.H265DecoderConfigRecorddata
- 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) – TheGstCodecParsers.H265NalUnitto parse- Returns:
- Return type:
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:
nalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitType.PPSGstCodecParsers.H265NalUnitto parsepps (
GstCodecParsers.H265PPS) – TheGstCodecParsers.H265PPSto fill.
- Returns:
- Return type:
Parses data, and fills the pps structure.
- parse_sei(nalu, messages)¶
- Parameters:
nalu (
GstCodecParsers.H265NalUnit) – TheGST_H265_NAL_*_SEIGstCodecParsers.H265NalUnitto parsemessages ([
GstCodecParsers.H265SEIMessage]) – TheGLib.ArrayofGstCodecParsers.H265SEIMessageto fill. The caller must free it when done.
- Returns:
- Return type:
Parses data, create and fills the messages array.
- parse_slice_hdr(nalu, slice)¶
- Parameters:
nalu (
GstCodecParsers.H265NalUnit) – TheGST_H265_NAL_SLICEGstCodecParsers.H265NalUnitto parseslice (
GstCodecParsers.H265SliceHdr) – TheGstCodecParsers.H265SliceHdrto fill.
- Returns:
- Return type:
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:
nalu (
GstCodecParsers.H265NalUnit) – TheGST_H265_NAL_SLICEGstCodecParsers.H265NalUnitto parseslice (
GstCodecParsers.H265SliceHdr) – TheGstCodecParsers.H265SliceHdrto fill.sps_ext (
GstCodecParsers.H265SPSEXT) – TheGstCodecParsers.H265SPSEXTto fill.
- Returns:
- Return type:
Parses data, and fills the slice structure. The resulting slice_hdr structure shall be deallocated with
GstCodecParsers.H265SliceHdr.free() when it is no longer neededNew in version 1.28.
- parse_sps(nalu, sps, parse_vui_params)¶
- Parameters:
nalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitType.SPSGstCodecParsers.H265NalUnitto parsesps (
GstCodecParsers.H265SPS) – TheGstCodecParsers.H265SPSto fill.parse_vui_params (
bool) – Whether to parse the vui_params or not
- Returns:
- Return type:
Parses data, and fills the sps structure.
- parse_sps_ext(nalu, sps, sps_ext, parse_vui_params)¶
- Parameters:
nalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitType.SPSGstCodecParsers.H265NalUnitto parsesps (
GstCodecParsers.H265SPS) – TheGstCodecParsers.H265SPSto fill.sps_ext (
GstCodecParsers.H265SPSEXT) – TheGstCodecParsers.H265SPSEXTmatching theGstCodecParsers.H265SPSto fill.parse_vui_params (
bool) – Whether to parse the vui_params or not
- Returns:
- Return type:
Parses data, and fills the sps structure.
New in version 1.28.
- parse_vps(nalu, vps)¶
- Parameters:
nalu (
GstCodecParsers.H265NalUnit) – TheGstCodecParsers.H265NalUnitType.VPSGstCodecParsers.H265NalUnitto parsevps (
GstCodecParsers.H265VPS) – TheGstCodecParsers.H265VPSto fill.
- Returns:
- Return type:
Parses data, and fills the vps structure.
- update_pps(pps)¶
- Parameters:
pps (
GstCodecParsers.H265PPS) – aGstCodecParsers.H265PPS.- Returns:
- Return type:
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) – aGstCodecParsers.H265SPS.- Returns:
- Return type:
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) – aGstCodecParsers.H265VPS.- Returns:
- Return type:
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.