codecparsers: av1: add the set_operating_point() API.

The av1 can support multi layers when scalability is enabled. We
need an API to set the operating point and filter the OBUs just
belonging to some layers(the layers are specified by the operating
point).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1464>
This commit is contained in:
He Junyan 2020-09-28 13:33:00 +08:00 committed by Víctor Manuel Jáquez Leal
parent c4aaeb0509
commit 33fcb0faf0
2 changed files with 35 additions and 2 deletions

View file

@ -1289,7 +1289,8 @@ gst_av1_parser_parse_sequence_header_obu (GstAV1Parser * parser,
} }
} }
/* Let user decide the operatingPoint, move it later /* Let user decide the operatingPoint,
implemented by calling gst_av1_parser_set_operating_point()
operatingPoint = choose_operating_point( ) operatingPoint = choose_operating_point( )
operating_point_idc = operating_point_idc[ operatingPoint ] */ operating_point_idc = operating_point_idc[ operatingPoint ] */
@ -1451,7 +1452,7 @@ gst_av1_parser_parse_sequence_header_obu (GstAV1Parser * parser,
if (parser->state.operating_point < 0 || if (parser->state.operating_point < 0 ||
parser->state.operating_point > parser->state.operating_point >
seq_header->operating_points_cnt_minus_1) { seq_header->operating_points_cnt_minus_1) {
GST_INFO ("Invalid operating_point %d set by user, just use 0", GST_WARNING ("Invalid operating_point %d set by user, just use 0",
parser->state.operating_point); parser->state.operating_point);
parser->state.operating_point_idc = seq_header->operating_points[0].idc; parser->state.operating_point_idc = seq_header->operating_points[0].idc;
} else { } else {
@ -4647,6 +4648,33 @@ gst_av1_parser_parse_frame_obu (GstAV1Parser * parser, GstAV1OBU * obu,
return retval; return retval;
} }
/**
* gst_av1_parser_set_operating_point:
* @parser: the #GstAV1Parser
* @operating_point: the operating point to set
*
* Set the operating point to filter OBUs.
*
* Returns: The #GstAV1ParserResult.
*
* Since: 1.20
*/
GstAV1ParserResult
gst_av1_parser_set_operating_point (GstAV1Parser * parser,
gint32 operating_point)
{
g_return_val_if_fail (parser != NULL, GST_AV1_PARSER_INVALID_OPERATION);
g_return_val_if_fail (operating_point >= 0, GST_AV1_PARSER_INVALID_OPERATION);
if (parser->seq_header &&
operating_point > parser->seq_header->operating_points_cnt_minus_1)
return GST_AV1_PARSER_INVALID_OPERATION;
/* Decide whether it is valid when sequence comes. */
parser->state.operating_point = operating_point;
return GST_AV1_PARSER_OK;
}
/** /**
* gst_av1_parser_new: * gst_av1_parser_new:
* *

View file

@ -1830,6 +1830,11 @@ GstAV1ParserResult
gst_av1_parser_reference_frame_update (GstAV1Parser * parser, gst_av1_parser_reference_frame_update (GstAV1Parser * parser,
GstAV1FrameHeaderOBU * frame_header); GstAV1FrameHeaderOBU * frame_header);
GST_CODEC_PARSERS_API
GstAV1ParserResult
gst_av1_parser_set_operating_point (GstAV1Parser * parser,
gint32 operating_point);
GST_CODEC_PARSERS_API GST_CODEC_PARSERS_API
GstAV1Parser * gst_av1_parser_new (void); GstAV1Parser * gst_av1_parser_new (void);