mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
libs: encoder: dummy context for get_surface_formats()
Instead of creating (if it doesn't exist, yet) the encoder's context the method gst_vaapi_encoder_get_surface_formats() now it creates dummy contexts, unless the encoder has it already created. The purpose of this is to avoid setting a encoder's context with a wrong profile. https://bugzilla.gnome.org/show_bug.cgi?id=771291
This commit is contained in:
parent
31d326c9ee
commit
9aa63e4595
1 changed files with 16 additions and 9 deletions
|
@ -1160,17 +1160,18 @@ error:
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_encoder_ensure_context_config (GstVaapiEncoder * encoder)
|
||||
static GstVaapiContext *
|
||||
create_test_context_config (GstVaapiEncoder * encoder)
|
||||
{
|
||||
GstVaapiContextInfo *const cip = &encoder->context_info;
|
||||
GstVaapiContextInfo cip = { 0, };
|
||||
GstVaapiContext *ctxt;
|
||||
|
||||
if (encoder->context)
|
||||
return TRUE;
|
||||
return gst_vaapi_object_ref (encoder->context);
|
||||
|
||||
init_context_info (encoder, cip, get_profile (encoder));
|
||||
encoder->context = gst_vaapi_context_new (encoder->display, cip);
|
||||
return (encoder->context != NULL);
|
||||
init_context_info (encoder, &cip, get_profile (encoder));
|
||||
ctxt = gst_vaapi_context_new (encoder->display, &cip);
|
||||
return ctxt;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1184,9 +1185,15 @@ gst_vaapi_encoder_ensure_context_config (GstVaapiEncoder * encoder)
|
|||
GArray *
|
||||
gst_vaapi_encoder_get_surface_formats (GstVaapiEncoder * encoder)
|
||||
{
|
||||
if (!gst_vaapi_encoder_ensure_context_config (encoder))
|
||||
GstVaapiContext *ctxt;
|
||||
GArray *formats;
|
||||
|
||||
ctxt = create_test_context_config (encoder);
|
||||
if (!ctxt)
|
||||
return NULL;
|
||||
return gst_vaapi_context_get_surface_formats (encoder->context);
|
||||
formats = gst_vaapi_context_get_surface_formats (ctxt);
|
||||
gst_vaapi_object_unref (ctxt);
|
||||
return formats;
|
||||
}
|
||||
|
||||
/** Returns a GType for the #GstVaapiEncoderTune set */
|
||||
|
|
Loading…
Reference in a new issue