static void gst_vaapidecode_purge (GstVaapiDecode * decode) { GstVaapiDecoderStatus status; if (!decode->decoder) return; status = gst_vaapi_decoder_flush (decode->decoder); if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) GST_INFO_OBJECT (decode, "failed to flush decoder (status %d)", status); /* Purge all decoded frames as we don't need them (e.g. flush and close) * Releasing the frames is important, otherwise the frames are not * freed. */ do { GstVideoCodecFrame *frame = NULL; status = gst_vaapi_decoder_get_frame_with_timeout (decode->decoder, &frame, 0); if (frame) { gst_video_decoder_release_frame (GST_VIDEO_DECODER (decode), frame); gst_video_codec_frame_unref (frame); } } while (status == GST_VAAPI_DECODER_STATUS_SUCCESS); }
/** * gst_vaapi_decoder_get_frame: * @decoder: a #GstVaapiDecoder * @out_frame_ptr: the next decoded frame as a #GstVideoCodecFrame * * On successful return, *@out_frame_ptr contains the next decoded * frame available as a #GstVideoCodecFrame. The caller owns this * object, so gst_video_codec_frame_unref() shall be called after * usage. Otherwise, @GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA is * returned if no decoded frame is available. * * The actual surface is available as a #GstVaapiSurfaceProxy attached * to the user-data anchor of the output frame. Ownership of the proxy * is transferred to the frame. * * This is equivalent to gst_vaapi_decoder_get_frame_with_timeout() * with a timeout value of zero. * * Return value: a #GstVaapiDecoderStatus */ GstVaapiDecoderStatus gst_vaapi_decoder_get_frame (GstVaapiDecoder * decoder, GstVideoCodecFrame ** out_frame_ptr) { return gst_vaapi_decoder_get_frame_with_timeout (decoder, out_frame_ptr, 0); }