codecs: h265decoder: Consider the conformance window changes when new_sequence().

The change of conformance_window_flag and crop windows size also has impact on the
output resolution and caps. So it deserves a trigger of new_sequence() to notify
the sub class to update caps and pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2312>
This commit is contained in:
He Junyan 2021-06-09 15:16:39 +08:00 committed by GStreamer Marge Bot
parent b5b13a6f5c
commit 5d96e9e7bd

View file

@ -54,6 +54,12 @@ struct _GstH265DecoderPrivate
{
gint width, height;
guint8 conformance_window_flag;
gint crop_rect_width;
gint crop_rect_height;
gint crop_rect_x;
gint crop_rect_y;
/* input codec_data, if any */
GstBuffer *codec_data;
guint nal_length_size;
@ -254,6 +260,25 @@ gst_h265_decoder_parse_vps (GstH265Decoder * self, GstH265NalUnit * nalu)
return ret;
}
static gboolean
gst_h265_decoder_is_crop_rect_changed (GstH265Decoder * self, GstH265SPS * sps)
{
GstH265DecoderPrivate *priv = self->priv;
if (priv->conformance_window_flag != sps->conformance_window_flag)
return TRUE;
if (priv->crop_rect_width != sps->crop_rect_width)
return TRUE;
if (priv->crop_rect_height != sps->crop_rect_height)
return TRUE;
if (priv->crop_rect_x != sps->crop_rect_x)
return TRUE;
if (priv->crop_rect_y != sps->crop_rect_y)
return TRUE;
return FALSE;
}
static gboolean
gst_h265_decoder_process_sps (GstH265Decoder * self, GstH265SPS * sps)
{
@ -292,7 +317,8 @@ gst_h265_decoder_process_sps (GstH265Decoder * self, GstH265SPS * sps)
prev_max_dpb_size != max_dpb_size ||
priv->field_seq_flag != field_seq_flag ||
priv->progressive_source_flag != progressive_source_flag ||
priv->interlaced_source_flag != interlaced_source_flag) {
priv->interlaced_source_flag != interlaced_source_flag ||
gst_h265_decoder_is_crop_rect_changed (self, sps)) {
GstH265DecoderClass *klass = GST_H265_DECODER_GET_CLASS (self);
GST_DEBUG_OBJECT (self,
@ -313,6 +339,11 @@ gst_h265_decoder_process_sps (GstH265Decoder * self, GstH265SPS * sps)
priv->width = sps->width;
priv->height = sps->height;
priv->conformance_window_flag = sps->conformance_window_flag;
priv->crop_rect_width = sps->crop_rect_width;
priv->crop_rect_height = sps->crop_rect_height;
priv->crop_rect_x = sps->crop_rect_x;
priv->crop_rect_y = sps->crop_rect_y;
priv->field_seq_flag = field_seq_flag;
priv->progressive_source_flag = progressive_source_flag;
priv->interlaced_source_flag = interlaced_source_flag;