summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e5417b2)
And even that vaav1dec doesn't use vabasedec negotiate vmethod, it should align
with the new scheme of using base's width & height for surface size and
output_info structure for downstream display size negotiation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3480>
GstVaBaseDec parent;
GstAV1SequenceHeaderOBU seq;
GstVaBaseDec parent;
GstAV1SequenceHeaderOBU seq;
- gint max_width;
- gint max_height;
GstVideoFormat preferred_format;
/* Used for layers not output. */
GstBufferPool *internal_pool;
GstVideoFormat preferred_format;
/* Used for layers not output. */
GstBufferPool *internal_pool;
{
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
{
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
- GstAV1Decoder *av1dec = GST_AV1_DECODER (decoder);
- GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
- GstCapsFeatures *capsfeatures = NULL;
/* Ignore downstream renegotiation request. */
if (!base->need_negotiation)
/* Ignore downstream renegotiation request. */
if (!base->need_negotiation)
/* Do not re-create the context if only the frame size changes */
if (!gst_va_decoder_config_is_equal (base->decoder, base->profile,
/* Do not re-create the context if only the frame size changes */
if (!gst_va_decoder_config_is_equal (base->decoder, base->profile,
- base->rt_format, self->max_width, self->max_height)) {
+ base->rt_format, base->width, base->height)) {
if (gst_va_decoder_is_open (base->decoder)
&& !gst_va_decoder_close (base->decoder))
return FALSE;
if (gst_va_decoder_is_open (base->decoder)
&& !gst_va_decoder_close (base->decoder))
return FALSE;
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
- if (!gst_va_decoder_set_frame_size (base->decoder, self->max_width,
- self->max_height))
+ if (!gst_va_decoder_set_frame_size (base->decoder, base->width,
+ base->height))
- if (base->output_state)
- gst_video_codec_state_unref (base->output_state);
-
- gst_va_base_dec_get_preferred_format_and_caps_features (base, &format,
- &capsfeatures);
- if (format == GST_VIDEO_FORMAT_UNKNOWN)
+ if (!gst_va_base_dec_set_output_state (base))
return FALSE;
if (self->preferred_format != GST_VIDEO_FORMAT_UNKNOWN &&
return FALSE;
if (self->preferred_format != GST_VIDEO_FORMAT_UNKNOWN &&
- self->preferred_format != format) {
+ self->preferred_format !=
+ GST_VIDEO_INFO_FORMAT (&base->output_state->info)) {
GST_WARNING_OBJECT (self, "The preferred_format is different from"
" the last result");
return FALSE;
}
GST_WARNING_OBJECT (self, "The preferred_format is different from"
" the last result");
return FALSE;
}
- self->preferred_format = format;
-
- base->output_state = gst_video_decoder_set_output_state (decoder, format,
- base->width, base->height, av1dec->input_state);
-
- base->output_state->caps = gst_video_info_to_caps (&base->output_state->info);
- if (capsfeatures)
- gst_caps_set_features_simple (base->output_state->caps, capsfeatures);
-
- GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
- base->output_state->caps);
+ self->preferred_format = GST_VIDEO_INFO_FORMAT (&base->output_state->info);
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
}
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
}
}
gst_object_unref (allocator);
}
gst_object_unref (allocator);
gst_buffer_pool_set_active (pool, TRUE);
gst_buffer_pool_set_active (pool, TRUE);
{
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
{
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
+ GstVideoInfo *info = &base->output_info;
VAProfile profile;
guint rt_format;
VAProfile profile;
guint rt_format;
GST_LOG_OBJECT (self, "new sequence");
GST_LOG_OBJECT (self, "new sequence");
+ width = seq_hdr->max_frame_width_minus_1 + 1;
+ height = seq_hdr->max_frame_height_minus_1 + 1;
+
if (!gst_va_decoder_config_is_equal (base->decoder, profile,
if (!gst_va_decoder_config_is_equal (base->decoder, profile,
- rt_format, seq_hdr->max_frame_width_minus_1 + 1,
- seq_hdr->max_frame_height_minus_1 + 1)) {
+ rt_format, width, height)) {
_clear_internal_pool (self);
self->preferred_format = GST_VIDEO_FORMAT_UNKNOWN;
base->profile = profile;
base->rt_format = rt_format;
_clear_internal_pool (self);
self->preferred_format = GST_VIDEO_FORMAT_UNKNOWN;
base->profile = profile;
base->rt_format = rt_format;
- self->max_width = seq_hdr->max_frame_width_minus_1 + 1;
- self->max_height = seq_hdr->max_frame_height_minus_1 + 1;
+ GST_VIDEO_INFO_WIDTH (info) = base->width = width;
+ GST_VIDEO_INFO_HEIGHT (info) = base->height = height;
base->need_negotiation = TRUE;
base->need_negotiation = TRUE;
base->min_buffers = 7 + 4; /* dpb size + scratch surfaces */
base->min_buffers = 7 + 4; /* dpb size + scratch surfaces */
-
- /* May be changed by frame header */
- base->width = self->max_width;
- base->height = self->max_height;
base->need_valign = FALSE;
}
base->need_valign = FALSE;
}
+ g_clear_pointer (&base->input_state, gst_video_codec_state_unref);
+ base->input_state = gst_video_codec_state_ref (decoder->input_state);
+
if (!self->internal_pool) {
self->internal_pool =
if (!self->internal_pool) {
self->internal_pool =
- _create_internal_pool (self, self->max_width, self->max_height);
+ _create_internal_pool (self, base->width, base->height);
if (!self->internal_pool)
return GST_FLOW_ERROR;
}
if (!self->internal_pool)
return GST_FLOW_ERROR;
}
{
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
{
GstVaAV1Dec *self = GST_VA_AV1_DEC (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
- GstVaDecodePicture *pic;
GstAV1FrameHeaderOBU *frame_hdr = &picture->frame_hdr;
GstAV1FrameHeaderOBU *frame_hdr = &picture->frame_hdr;
+ GstVaDecodePicture *pic;
+ GstVideoInfo *info = &base->output_info;
GstFlowReturn ret;
/* Only output the highest spatial layer. For non output pictures,
GstFlowReturn ret;
/* Only output the highest spatial layer. For non output pictures,
if (ret != GST_FLOW_OK)
return ret;
} else {
if (ret != GST_FLOW_OK)
return ret;
} else {
- if (frame_hdr->upscaled_width != base->width
- || frame_hdr->frame_height != base->height) {
- base->width = frame_hdr->upscaled_width;
- base->height = frame_hdr->frame_height;
+ if (frame_hdr->upscaled_width != GST_VIDEO_INFO_WIDTH (info)
+ || frame_hdr->frame_height != GST_VIDEO_INFO_HEIGHT (info)) {
+ GST_VIDEO_INFO_WIDTH (info) = frame_hdr->upscaled_width;
+ GST_VIDEO_INFO_HEIGHT (info) = frame_hdr->frame_height;
- if (base->width < self->max_width || base->height < self->max_height) {
+ if (GST_VIDEO_INFO_WIDTH (info) < base->width
+ || GST_VIDEO_INFO_HEIGHT (info) < base->height) {
base->need_valign = TRUE;
/* *INDENT-OFF* */
base->need_valign = TRUE;
/* *INDENT-OFF* */
- base->valign = (GstVideoAlignment){
- .padding_bottom = self->max_height - base->height,
- .padding_right = self->max_width - base->width,
+ base->valign = (GstVideoAlignment) {
+ .padding_bottom = base->height - GST_VIDEO_INFO_HEIGHT (info),
+ .padding_right = base->width - GST_VIDEO_INFO_WIDTH (info),