return klass->add(dpb, picture);
}
+guint
+gst_vaapi_dpb_size(GstVaapiDpb *dpb)
+{
+ g_return_val_if_fail(GST_VAAPI_IS_DPB(dpb), 0);
+
+ return dpb->num_pictures;
+}
+
/* ------------------------------------------------------------------------- */
/* --- MPEG-2 Decoded Picture Buffer --- */
/* ------------------------------------------------------------------------- */
picture->structure = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
break;
}
+
+ /* Allocate dummy picture for first field based I-frame */
+ if (picture->type == GST_VAAPI_PICTURE_TYPE_I &&
+ !GST_VAAPI_PICTURE_IS_FRAME(picture) &&
+ gst_vaapi_dpb_size(priv->dpb) == 0) {
+ GstVaapiPicture *dummy_picture;
+ gboolean success;
+
+ dummy_picture = GST_VAAPI_PICTURE_NEW(MPEG2, decoder);
+ if (!dummy_picture) {
+ GST_ERROR("failed to allocate dummy picture");
+ return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
+ }
+
+ dummy_picture->type = GST_VAAPI_PICTURE_TYPE_I;
+ dummy_picture->pts = GST_CLOCK_TIME_NONE;
+ dummy_picture->poc = -1;
+ dummy_picture->structure = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
+
+ GST_VAAPI_PICTURE_FLAG_SET(
+ dummy_picture,
+ (GST_VAAPI_PICTURE_FLAG_SKIPPED |
+ GST_VAAPI_PICTURE_FLAG_REFERENCE)
+ );
+
+ success = gst_vaapi_dpb_add(priv->dpb, dummy_picture);
+ gst_vaapi_picture_unref(dummy_picture);
+ if (!success) {
+ GST_ERROR("failed to add dummy picture into DPB");
+ return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
+ }
+ GST_INFO("allocated dummy picture for first field based I-frame");
+ }
return GST_VAAPI_DECODER_STATUS_SUCCESS;
}