mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 14:38:48 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/369>
This commit is contained in:
parent
ecd1ca81a7
commit
83d48837d2
1 changed files with 11 additions and 8 deletions
|
@ -73,20 +73,22 @@ ensure_attributes (GstVaapiContext * context)
|
||||||
return (context->attribs != NULL);
|
return (context->attribs != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* looks for the (very arbritrary) preferred format from the requested
|
/* XXX(victor): verify the preferred video format concords with the
|
||||||
* context chroma type, in the context attributes */
|
* chroma type; otherwise it is changed for the (very arbritrary)
|
||||||
static GstVideoFormat
|
* preferred format from the requested context chroma type, in the
|
||||||
get_preferred_format (GstVaapiContext * context)
|
* context attributes */
|
||||||
|
static void
|
||||||
|
ensure_preferred_format (GstVaapiContext * context)
|
||||||
{
|
{
|
||||||
const GstVaapiContextInfo *const cip = &context->info;
|
const GstVaapiContextInfo *const cip = &context->info;
|
||||||
GArray *formats;
|
GArray *formats;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
if (context->preferred_format != GST_VIDEO_FORMAT_UNKNOWN)
|
if (context->preferred_format != GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
return context->preferred_format;
|
return;
|
||||||
|
|
||||||
if (!ensure_attributes (context) || !context->attribs->formats)
|
if (!ensure_attributes (context) || !context->attribs->formats)
|
||||||
return GST_VIDEO_FORMAT_UNKNOWN;
|
return;
|
||||||
|
|
||||||
formats = context->attribs->formats;
|
formats = context->attribs->formats;
|
||||||
for (i = 0; i < formats->len; i++) {
|
for (i = 0; i < formats->len; i++) {
|
||||||
|
@ -97,7 +99,7 @@ get_preferred_format (GstVaapiContext * context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return context->preferred_format;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
|
@ -167,7 +169,8 @@ context_ensure_surfaces (GstVaapiContext * context)
|
||||||
GstVideoFormat format;
|
GstVideoFormat format;
|
||||||
guint i, capacity;
|
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++) {
|
for (i = context->surfaces->len; i < num_surfaces; i++) {
|
||||||
if (format != GST_VIDEO_FORMAT_UNKNOWN) {
|
if (format != GST_VIDEO_FORMAT_UNKNOWN) {
|
||||||
surface = gst_vaapi_surface_new_with_format (display, format, cip->width,
|
surface = gst_vaapi_surface_new_with_format (display, format, cip->width,
|
||||||
|
|
Loading…
Reference in a new issue