GstCodecParsers.AV1Parser¶
Fields¶
Name |
Type |
Access |
Description |
|---|---|---|---|
annex_b |
r |
||
frame_unit_consumed |
r |
||
frame_unit_size |
r |
||
seq_header |
r |
||
state |
r |
||
temporal_unit_consumed |
r |
||
temporal_unit_size |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GstCodecParsers.AV1Parser¶
For more details about the structures, you can refer to the AV1 Bitstream & Decoding Process Specification V1.0.0 specification
It offers you bitstream parsing of low overhead bistream format (Section 5) or Annex B according to the setting of the parser. By calling the function of
GstCodecParsers.AV1Parser.reset(), user can switch between bistream mode and Annex B mode.To retrieve OBUs and parse its headers, you should firstly call the function of
GstCodecParsers.AV1Parser.identify_one_obu() to get the OBU type if succeeds or just discard the data if fails.Then, depending on the
GstCodecParsers.AV1OBUTypeof the newly parsedGstCodecParsers.AV1OBU, you should call the differents functions to parse the structure details:GstCodecParsers.AV1OBUType.SEQUENCE_HEADER:GstCodecParsers.AV1Parser.parse_sequence_header_obu()GstCodecParsers.AV1OBUType.TEMPORAL_DELIMITER:GstCodecParsers.AV1Parser.parse_temporal_delimiter_obu()GstCodecParsers.AV1OBUType.FRAME:GstCodecParsers.AV1Parser.parse_frame_obu()GstCodecParsers.AV1OBUType.FRAME_HEADER:GstCodecParsers.AV1Parser.parse_frame_header_obu()GstCodecParsers.AV1OBUType.TILE_GROUP:GstCodecParsers.AV1Parser.parse_tile_group_obu()GstCodecParsers.AV1OBUType.METADATA:GstCodecParsers.AV1Parser.parse_metadata_obu()GstCodecParsers.AV1OBUType.REDUNDANT_FRAME_HEADER:GstCodecParsers.AV1Parser.parse_frame_header_obu()GstCodecParsers.AV1OBUType.TILE_LIST:GstCodecParsers.AV1Parser.parse_tile_list_obu()
Note: Some parser functions are dependent on information provided in the sequence header and reference frame’s information. It maintains a state inside itself, which contains all global vars and reference information during the whole parsing process. Calling
GstCodecParsers.AV1Parser.reset() or a new sequence’s arriving can clear and reset this inside state.After successfully handled a frame(for example, decode a frame successfully), you should call
GstCodecParsers.AV1Parser.reference_frame_update() to update the parser’s inside state(such as reference information, global segmentation information, etc).New in version 1.18.
- free()¶
If parser is not
None, frees its allocated memory.It cannot be used afterwards.
New in version 1.18.
- identify_one_obu(data, size, obu)¶
- Parameters:
data (
int) – the data to parsesize (
int) – the size of dataobu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto store the identified result
- Returns:
The
GstCodecParsers.AV1ParserResult.- consumed:
the consumed data size
- Return type:
(
GstCodecParsers.AV1ParserResult, consumed:int)
Identify one obu's type from the incoming data stream. This function should be called first to know the type of obu before other parse APIs.
New in version 1.18.
- parse_frame_header_obu(obu, frame_header)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsedframe_header (
GstCodecParsers.AV1FrameHeaderOBU) – aGstCodecParsers.AV1FrameHeaderOBUto store the parsed result.
- Returns:
- Return type:
Parse one frame header obu based on the self context, store the result in the frame.
New in version 1.18.
- parse_frame_obu(obu, frame)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsedframe (
GstCodecParsers.AV1FrameOBU) – aGstCodecParsers.AV1FrameOBUto store the parsed result.
- Returns:
- Return type:
Parse one frame obu based on the self context, store the result in the frame.
New in version 1.18.
- parse_metadata_obu(obu, metadata)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsedmetadata (
GstCodecParsers.AV1MetadataOBU) – aGstCodecParsers.AV1MetadataOBUto store the parsed result.
- Returns:
- Return type:
Parse one meta data obu based on the self context.
New in version 1.18.
- parse_sequence_header_obu(obu, seq_header)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsedseq_header (
GstCodecParsers.AV1SequenceHeaderOBU) – aGstCodecParsers.AV1SequenceHeaderOBUto store the parsed result.
- Returns:
- Return type:
Parse one sequence header obu based on the self context, store the result in the seq_header.
New in version 1.18.
- parse_temporal_delimiter_obu(obu)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsed- Returns:
- Return type:
Parse one temporal delimiter obu based on the self context. The temporal delimiter is just delimiter and contains no content.
New in version 1.18.
- parse_tile_group_obu(obu, tile_group)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsedtile_group (
GstCodecParsers.AV1TileGroupOBU) – aGstCodecParsers.AV1TileGroupOBUto store the parsed result.
- Returns:
- Return type:
Parse one tile group obu based on the self context, store the result in the tile_group.
New in version 1.18.
- parse_tile_list_obu(obu, tile_list)¶
- Parameters:
obu (
GstCodecParsers.AV1OBU) – aGstCodecParsers.AV1OBUto be parsedtile_list (
GstCodecParsers.AV1TileListOBU) – aGstCodecParsers.AV1TileListOBUto store the parsed result.
- Returns:
- Return type:
Parse one tile list obu based on the self context, store the result in the tile_list. It is for large scale tile coding mode.
New in version 1.18.
- reference_frame_update(frame_header)¶
- Parameters:
frame_header (
GstCodecParsers.AV1FrameHeaderOBU) – aGstCodecParsers.AV1FrameHeaderOBUto load- Returns:
- Return type:
Update the context of frame_header to parser’s state. This function is used when we finish one frame’s decoding/showing, and need to update info such as reference, global parameters.
New in version 1.18.
- reset(annex_b)¶
- Parameters:
annex_b (
bool) – indicate whether conforms to annex b
Reset the current
GstCodecParsers.AV1Parser's state totally.New in version 1.18.
- reset_annex_b()¶
Only reset the current
GstCodecParsers.AV1Parser's annex b context. The other part of the state is kept.New in version 1.20.