From 83d48837d25aa7876e559bf39e3314d21691f0c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 29 Jul 2020 12:02:50 +0200 Subject: [PATCH] libs: context: change function to internal code style Instead of a getter the function `get_preferred_format()` to `ensure_preferred_format()` which aligns to the code style. Part-of: --- gst-libs/gst/vaapi/gstvaapicontext.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c index 8a361f3..5283a13 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext.c +++ b/gst-libs/gst/vaapi/gstvaapicontext.c @@ -73,20 +73,22 @@ ensure_attributes (GstVaapiContext * context) return (context->attribs != NULL); } -/* looks for the (very arbritrary) preferred format from the requested - * context chroma type, in the context attributes */ -static GstVideoFormat -get_preferred_format (GstVaapiContext * context) +/* XXX(victor): verify the preferred video format concords with the + * chroma type; otherwise it is changed for the (very arbritrary) + * preferred format from the requested context chroma type, in the + * context attributes */ +static void +ensure_preferred_format (GstVaapiContext * context) { const GstVaapiContextInfo *const cip = &context->info; GArray *formats; guint i; if (context->preferred_format != GST_VIDEO_FORMAT_UNKNOWN) - return context->preferred_format; + return; if (!ensure_attributes (context) || !context->attribs->formats) - return GST_VIDEO_FORMAT_UNKNOWN; + return; formats = context->attribs->formats; for (i = 0; i < formats->len; i++) { @@ -97,7 +99,7 @@ get_preferred_format (GstVaapiContext * context) } } - return context->preferred_format; + return; } static inline gboolean @@ -167,7 +169,8 @@ context_ensure_surfaces (GstVaapiContext * context) GstVideoFormat format; guint i, capacity; - format = get_preferred_format (context); + ensure_preferred_format (context); + format = context->preferred_format; for (i = context->surfaces->len; i < num_surfaces; i++) { if (format != GST_VIDEO_FORMAT_UNKNOWN) { surface = gst_vaapi_surface_new_with_format (display, format, cip->width, -- 2.7.4