vaapidecode: handle flush() vmethod

Since GStreamer 1.2 the vmethod reset() in GstVideoDecoderClass was deprecated
and flush() was added.

This patch set the vmethod flush() if the installed GStreamer version is 1.2 or
superior. Otherwise, reset() is set.

v2: 1) In order to avoid symbol collision, the old method gst_vaapidecode_flush()
       was renamed to gst_vaapidecode_internal_flush().
    2) The new vmethod flush() always do a hard full reset.
v3: 1) Call gst_vaapidecode_internal_flush() first in flush() vmethod, in order to
       gather all collected data with  gst_video_decoder_have_frame()

https://bugzilla.gnome.org/show_bug.cgi?id=742922

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-03-16 23:36:33 +02:00 committed by Sreerenj Balachandran
parent d8d2f00bd0
commit 1bd810fe99

View file

@ -482,7 +482,7 @@ not_negotiated:
}
static gboolean
gst_vaapidecode_flush (GstVideoDecoder * vdec)
gst_vaapidecode_internal_flush (GstVideoDecoder * vdec)
{
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
GstVaapiDecoderStatus status;
@ -518,7 +518,7 @@ gst_vaapidecode_finish (GstVideoDecoder * vdec)
if (!decode->decoder)
return GST_FLOW_OK;
if (!gst_vaapidecode_flush (vdec)) {
if (!gst_vaapidecode_internal_flush (vdec)) {
gst_vaapidecode_push_all_decoded_frames (decode);
return GST_FLOW_ERROR;
}
@ -736,16 +736,31 @@ gst_vaapidecode_close (GstVideoDecoder * vdec)
return TRUE;
}
#if GST_CHECK_VERSION(1,2,0)
static gboolean
gst_vaapidecode_flush (GstVideoDecoder * vdec)
{
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
if (decode->decoder && !gst_vaapidecode_internal_flush (vdec))
return FALSE;
/* There could be issues if we avoid the reset_full() while doing
* seeking: we have to reset the internal state */
return gst_vaapidecode_reset_full (decode, decode->sinkpad_caps, TRUE);
}
#else
static gboolean
gst_vaapidecode_reset (GstVideoDecoder * vdec, gboolean hard)
{
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
/* In GStreamer 1.0 context, this means a flush */
if (decode->decoder && !hard && !gst_vaapidecode_flush (vdec))
if (decode->decoder && !hard && !gst_vaapidecode_internal_flush (vdec))
return FALSE;
return gst_vaapidecode_reset_full (decode, decode->sinkpad_caps, hard);
}
#endif
static gboolean
gst_vaapidecode_set_format (GstVideoDecoder * vdec, GstVideoCodecState * state)
@ -839,7 +854,11 @@ gst_vaapidecode_class_init (GstVaapiDecodeClass * klass)
vdec_class->open = GST_DEBUG_FUNCPTR (gst_vaapidecode_open);
vdec_class->close = GST_DEBUG_FUNCPTR (gst_vaapidecode_close);
vdec_class->set_format = GST_DEBUG_FUNCPTR (gst_vaapidecode_set_format);
#if GST_CHECK_VERSION(1,2,0)
vdec_class->flush = GST_DEBUG_FUNCPTR (gst_vaapidecode_flush);
#else
vdec_class->reset = GST_DEBUG_FUNCPTR (gst_vaapidecode_reset);
#endif
vdec_class->parse = GST_DEBUG_FUNCPTR (gst_vaapidecode_parse);
vdec_class->handle_frame = GST_DEBUG_FUNCPTR (gst_vaapidecode_handle_frame);
vdec_class->finish = GST_DEBUG_FUNCPTR (gst_vaapidecode_finish);