struct _GstVaVp8Dec
{
GstVaBaseDec parent;
-
- GstFlowReturn last_ret;
-
- gboolean need_negotiation;
};
+static GstElementClass *parent_class = NULL;
+
/* *INDENT-OFF* */
static const gchar *src_caps_str =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
GstVp8Decoder *vp8dec = GST_VP8_DECODER (decoder);
/* Ignore downstream renegotiation request. */
- if (!self->need_negotiation)
+ if (!base->need_negotiation)
return TRUE;
- self->need_negotiation = FALSE;
+ base->need_negotiation = FALSE;
if (gst_va_decoder_is_open (base->decoder)
&& !gst_va_decoder_close (base->decoder))
gst_va_base_dec_get_preferred_format_and_caps_features (base, &format,
&capsfeatures);
+ if (format == GST_VIDEO_FORMAT_UNKNOWN)
+ return FALSE;
base->output_state =
gst_video_decoder_set_output_state (decoder, format,
GST_INFO_OBJECT (self, "Negotiated caps %" GST_PTR_FORMAT,
base->output_state->caps);
- return GST_VIDEO_DECODER_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS
- (decoder))->negotiate (decoder);
+ return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
}
static VAProfile
static GstFlowReturn
gst_va_vp8_dec_new_sequence (GstVp8Decoder * decoder,
- const GstVp8FrameHdr * frame_hdr)
+ const GstVp8FrameHdr * frame_hdr, gint max_dpb_size)
{
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
base->min_buffers = 3 + 4; /* max num pic references + scratch surfaces */
- if (negotiation_needed) {
- self->need_negotiation = TRUE;
- if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
+ base->need_negotiation = negotiation_needed;
return GST_FLOW_OK;
}
{
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
GstVaDecodePicture *pic;
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
+ GstFlowReturn ret;
- self->last_ret = gst_video_decoder_allocate_output_frame (vdec, frame);
- if (self->last_ret != GST_FLOW_OK)
+ ret = gst_va_base_dec_prepare_output_frame (base, frame);
+ if (ret != GST_FLOW_OK)
goto error;
pic = gst_va_decode_picture_new (base->decoder, frame->output_buffer);
{
GST_WARNING_OBJECT (self,
"Failed to allocated output buffer, return %s",
- gst_flow_get_name (self->last_ret));
- return self->last_ret;
+ gst_flow_get_name (ret));
+ return ret;
}
}
{
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
+ GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
+ gboolean ret;
GST_LOG_OBJECT (self,
"Outputting picture %p (system_frame_number %d)",
picture, picture->system_frame_number);
- if (self->last_ret != GST_FLOW_OK) {
- gst_vp8_picture_unref (picture);
- gst_video_decoder_drop_frame (GST_VIDEO_DECODER (self), frame);
- return self->last_ret;
- }
-
- if (base->copy_frames)
- gst_va_base_dec_copy_output_buffer (base, frame);
-
+ ret = gst_va_base_dec_process_output (base, frame, 0);
gst_vp8_picture_unref (picture);
- return gst_video_decoder_finish_frame (GST_VIDEO_DECODER (self), frame);
+ if (ret)
+ return gst_video_decoder_finish_frame (vdec, frame);
+ return GST_FLOW_ERROR;
}
static void
gst_va_vp8_dec_dispose (GObject * object)
{
gst_va_base_dec_close (GST_VIDEO_DECODER (object));
- G_OBJECT_CLASS (GST_VA_BASE_DEC_GET_PARENT_CLASS (object))->dispose (object);
+ G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
sink_doc_caps = gst_caps_from_string (sink_caps_str);
src_doc_caps = gst_caps_from_string (src_caps_str);
+ parent_class = g_type_class_peek_parent (g_class);
+
+ /**
+ * GstVaVp8Dec:device-path:
+ *
+ * It shows the DRM device path used for the VA operation, if any.
+ *
+ * Since: 1.22
+ */
gst_va_base_dec_class_init (GST_VA_BASE_DEC_CLASS (g_class), VP8,
cdata->render_device_path, cdata->sink_caps, cdata->src_caps,
src_doc_caps, sink_doc_caps);
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaVp8dec");
- feature_name = g_strdup ("vavp8dec");
-
/* The first decoder to be registered should use a constant name,
* like vavp8dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaVp8Dec");
+ feature_name = g_strdup ("vavp8dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
- type_name = g_strdup_printf ("GstVa%sVP8Dec", basename);
+ type_name = g_strdup_printf ("GstVa%sVp8Dec", basename);
feature_name = g_strdup_printf ("va%svp8dec", basename);
cdata->description = basename;