va: display: add function precondition check

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1938>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-01-04 20:56:26 +01:00 committed by GStreamer Merge Bot
parent 00e44e8ed7
commit 543d54d492
2 changed files with 6 additions and 2 deletions

View File

@ -374,11 +374,15 @@ gst_va_display_get_image_formats (GstVaDisplay * self)
{ {
GArray *ret = NULL; GArray *ret = NULL;
GstVideoFormat format; GstVideoFormat format;
VADisplay dpy = gst_va_display_get_va_dpy (self); VADisplay dpy;
VAImageFormat *va_formats; VAImageFormat *va_formats;
VAStatus status; VAStatus status;
int i, max, num = 0; int i, max, num = 0;
g_return_val_if_fail (GST_IS_VA_DISPLAY (self), NULL);
dpy = gst_va_display_get_va_dpy (self);
gst_va_display_lock (self); gst_va_display_lock (self);
max = vaMaxNumImageFormats (dpy); max = vaMaxNumImageFormats (dpy);
gst_va_display_unlock (self); gst_va_display_unlock (self);

View File

@ -44,6 +44,6 @@ VADisplay gst_va_display_get_va_dpy (GstVaDisplay * self);
GArray * gst_va_display_get_profiles (GstVaDisplay * self, GArray * gst_va_display_get_profiles (GstVaDisplay * self,
guint32 codec, guint32 codec,
VAEntrypoint entrypoint); VAEntrypoint entrypoint);
GArray * gst_va_display_get_image_formats (GstVaDisplay * display); GArray * gst_va_display_get_image_formats (GstVaDisplay * self);
G_END_DECLS G_END_DECLS