decoder: add GstVaapiDecoder::flush() hook.

This commit is contained in:
Gwenole Beauchesne 2013-01-17 18:33:32 +01:00
parent e4e3a58bc0
commit 60acedb56e
2 changed files with 23 additions and 0 deletions

View file

@ -257,6 +257,16 @@ do_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *base_frame)
return status;
}
static inline GstVaapiDecoderStatus
do_flush(GstVaapiDecoder *decoder)
{
GstVaapiDecoderClass * const klass = GST_VAAPI_DECODER_GET_CLASS(decoder);
if (klass->flush)
return klass->flush(decoder);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
}
static GstVaapiDecoderStatus
decode_step(GstVaapiDecoder *decoder)
{
@ -896,3 +906,12 @@ gst_vaapi_decoder_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame)
return status;
return do_decode(decoder, frame);
}
GstVaapiDecoderStatus
gst_vaapi_decoder_flush(GstVaapiDecoder *decoder)
{
g_return_val_if_fail(GST_VAAPI_IS_DECODER(decoder),
GST_VAAPI_DECODER_STATUS_ERROR_INVALID_PARAMETER);
return do_flush(decoder);
}

View file

@ -123,6 +123,7 @@ struct _GstVaapiDecoderClass {
GstVaapiDecoderStatus (*start_frame)(GstVaapiDecoder *decoder,
struct _GstVaapiDecoderUnit *unit);
GstVaapiDecoderStatus (*end_frame)(GstVaapiDecoder *decoder);
GstVaapiDecoderStatus (*flush)(GstVaapiDecoder *decoder);
};
GType
@ -156,6 +157,9 @@ gst_vaapi_decoder_parse(GstVaapiDecoder *decoder,
GstVaapiDecoderStatus
gst_vaapi_decoder_decode(GstVaapiDecoder *decoder, GstVideoCodecFrame *frame);
GstVaapiDecoderStatus
gst_vaapi_decoder_flush(GstVaapiDecoder *decoder);
G_END_DECLS
#endif /* GST_VAAPI_DECODER_H */