struct _GstVaVp8Dec
{
GstVaBaseDec parent;
-
- GstFlowReturn last_ret;
};
static GstElementClass *parent_class = NULL;
{
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
GstVaDecodePicture *pic;
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
+ GstFlowReturn ret;
- if (base->need_negotiation) {
- if (!gst_video_decoder_negotiate (vdec)) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
-
- 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
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);
feature_name = g_strdup_printf ("va%svp8dec", basename);
cdata->description = basename;