libs: decoder: h265: implement reset() callback

and remove create() and destroy()
and use g_clear_pointer for dpb structure

https://bugzilla.gnome.org/show_bug.cgi?id=796308
This commit is contained in:
Víctor Manuel Jáquez Leal 2018-05-21 13:13:31 +02:00
parent 7a9f7f09c7
commit 3dbddfa682

View file

@ -987,8 +987,7 @@ gst_vaapi_decoder_h265_destroy (GstVaapiDecoder * base_decoder)
guint i;
gst_vaapi_decoder_h265_close (decoder);
g_free (priv->dpb);
priv->dpb = NULL;
g_clear_pointer (&priv->dpb, g_free);
priv->dpb_count = priv->dpb_size_max = priv->dpb_size = 0;
for (i = 0; i < G_N_ELEMENTS (priv->pps); i++)
@ -1018,6 +1017,13 @@ gst_vaapi_decoder_h265_create (GstVaapiDecoder * base_decoder)
return TRUE;
}
static GstVaapiDecoderStatus
gst_vaapi_decoder_h265_reset (GstVaapiDecoder * base_decoder)
{
gst_vaapi_decoder_h265_destroy (base_decoder);
gst_vaapi_decoder_h265_create (base_decoder);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
}
static void
fill_profiles (GstVaapiProfile profiles[16], guint * n_profiles_ptr,
@ -3052,8 +3058,7 @@ gst_vaapi_decoder_h265_class_init (GstVaapiDecoderH265Class * klass)
object_class->finalize = gst_vaapi_decoder_h265_finalize;
decoder_class->create = gst_vaapi_decoder_h265_create;
decoder_class->destroy = gst_vaapi_decoder_h265_destroy;
decoder_class->reset = gst_vaapi_decoder_h265_reset;
decoder_class->parse = gst_vaapi_decoder_h265_parse;
decoder_class->decode = gst_vaapi_decoder_h265_decode;
decoder_class->start_frame = gst_vaapi_decoder_h265_start_frame;