libs: surface: surfacepool: rename variable for clearity

In order to be readable, the meaningless 'flags' is renamed to
surface_allocation_flags, which is clearer.
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-01-22 10:42:35 +01:00
parent 4778882728
commit dd3df4589d
4 changed files with 18 additions and 16 deletions

View file

@ -131,7 +131,7 @@ error_unsupported_chroma_type:
static gboolean static gboolean
gst_vaapi_surface_init_full (GstVaapiSurface * surface, gst_vaapi_surface_init_full (GstVaapiSurface * surface,
const GstVideoInfo * vip, guint flags) const GstVideoInfo * vip, guint surface_allocation_flags)
{ {
GstVaapiDisplay *const display = GST_VAAPI_SURFACE_DISPLAY (surface); GstVaapiDisplay *const display = GST_VAAPI_SURFACE_DISPLAY (surface);
const GstVideoFormat format = GST_VIDEO_INFO_FORMAT (vip); const GstVideoFormat format = GST_VIDEO_INFO_FORMAT (vip);
@ -159,18 +159,18 @@ gst_vaapi_surface_init_full (GstVaapiSurface * surface,
extbuf.pixel_format = va_format->fourcc; extbuf.pixel_format = va_format->fourcc;
extbuf.width = GST_VIDEO_INFO_WIDTH (vip); extbuf.width = GST_VIDEO_INFO_WIDTH (vip);
extbuf.height = GST_VIDEO_INFO_HEIGHT (vip); extbuf.height = GST_VIDEO_INFO_HEIGHT (vip);
if (flags & GST_VAAPI_SURFACE_ALLOC_FLAG_LINEAR_STORAGE) { if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_LINEAR_STORAGE) {
extbuf.flags &= ~VA_SURFACE_EXTBUF_DESC_ENABLE_TILING; extbuf.flags &= ~VA_SURFACE_EXTBUF_DESC_ENABLE_TILING;
extbuf_needed = TRUE; extbuf_needed = TRUE;
} }
extbuf.num_planes = GST_VIDEO_INFO_N_PLANES (vip); extbuf.num_planes = GST_VIDEO_INFO_N_PLANES (vip);
if (flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES) { if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_STRIDES) {
for (i = 0; i < extbuf.num_planes; i++) for (i = 0; i < extbuf.num_planes; i++)
extbuf.pitches[i] = GST_VIDEO_INFO_PLANE_STRIDE (vip, i); extbuf.pitches[i] = GST_VIDEO_INFO_PLANE_STRIDE (vip, i);
extbuf_needed = TRUE; extbuf_needed = TRUE;
} }
if (flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS) { if (surface_allocation_flags & GST_VAAPI_SURFACE_ALLOC_FLAG_FIXED_OFFSETS) {
for (i = 0; i < extbuf.num_planes; i++) for (i = 0; i < extbuf.num_planes; i++)
extbuf.offsets[i] = GST_VIDEO_INFO_PLANE_OFFSET (vip, i); extbuf.offsets[i] = GST_VIDEO_INFO_PLANE_OFFSET (vip, i);
extbuf_needed = TRUE; extbuf_needed = TRUE;
@ -385,7 +385,7 @@ error:
* gst_vaapi_surface_new_full: * gst_vaapi_surface_new_full:
* @display: a #GstVaapiDisplay * @display: a #GstVaapiDisplay
* @vip: the pointer to a #GstVideoInfo * @vip: the pointer to a #GstVideoInfo
* @flags: (optional) allocation flags * @surface_allocation_flags: (optional) allocation flags
* *
* Creates a new #GstVaapiSurface with the specified video information * Creates a new #GstVaapiSurface with the specified video information
* and optional #GstVaapiSurfaceAllocFlags * and optional #GstVaapiSurfaceAllocFlags
@ -395,20 +395,21 @@ error:
* supported or failed. * supported or failed.
*/ */
GstVaapiSurface * GstVaapiSurface *
gst_vaapi_surface_new_full (GstVaapiDisplay * display, gst_vaapi_surface_new_full (GstVaapiDisplay * display, const GstVideoInfo * vip,
const GstVideoInfo * vip, guint flags) guint surface_allocation_flags)
{ {
GstVaapiSurface *surface; GstVaapiSurface *surface;
GST_DEBUG ("size %ux%u, format %s, flags 0x%08x", GST_VIDEO_INFO_WIDTH (vip), GST_DEBUG ("size %ux%u, format %s, flags 0x%08x", GST_VIDEO_INFO_WIDTH (vip),
GST_VIDEO_INFO_HEIGHT (vip), GST_VIDEO_INFO_HEIGHT (vip),
gst_vaapi_video_format_to_string (GST_VIDEO_INFO_FORMAT (vip)), flags); gst_vaapi_video_format_to_string (GST_VIDEO_INFO_FORMAT (vip)),
surface_allocation_flags);
surface = gst_vaapi_surface_create (display); surface = gst_vaapi_surface_create (display);
if (!surface) if (!surface)
return NULL; return NULL;
if (!gst_vaapi_surface_init_full (surface, vip, flags)) if (!gst_vaapi_surface_init_full (surface, vip, surface_allocation_flags))
goto error; goto error;
return surface; return surface;

View file

@ -212,7 +212,7 @@ gst_vaapi_surface_new (GstVaapiDisplay * display,
GstVaapiSurface * GstVaapiSurface *
gst_vaapi_surface_new_full (GstVaapiDisplay * display, gst_vaapi_surface_new_full (GstVaapiDisplay * display,
const GstVideoInfo * vip, guint flags); const GstVideoInfo * vip, guint surface_allocation_flags);
GstVaapiSurface * GstVaapiSurface *
gst_vaapi_surface_new_with_format (GstVaapiDisplay * display, gst_vaapi_surface_new_with_format (GstVaapiDisplay * display,

View file

@ -51,12 +51,12 @@ struct _GstVaapiSurfacePool
static gboolean static gboolean
surface_pool_init (GstVaapiSurfacePool * pool, const GstVideoInfo * vip, surface_pool_init (GstVaapiSurfacePool * pool, const GstVideoInfo * vip,
guint flags) guint surface_allocation_flags)
{ {
const GstVideoFormat format = GST_VIDEO_INFO_FORMAT (vip); const GstVideoFormat format = GST_VIDEO_INFO_FORMAT (vip);
pool->video_info = *vip; pool->video_info = *vip;
pool->alloc_flags = flags; pool->alloc_flags = surface_allocation_flags;
if (format == GST_VIDEO_FORMAT_UNKNOWN) if (format == GST_VIDEO_FORMAT_UNKNOWN)
return FALSE; return FALSE;
@ -134,7 +134,7 @@ gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
* gst_vaapi_surface_pool_new_full: * gst_vaapi_surface_pool_new_full:
* @display: a #GstVaapiDisplay * @display: a #GstVaapiDisplay
* @vip: a #GstVideoInfo * @vip: a #GstVideoInfo
* @flags: (optional) allocation flags * @surface_allocation_flags: (optional) allocation flags
* *
* Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the * Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the
* specified format and dimensions in @vip. * specified format and dimensions in @vip.
@ -143,7 +143,7 @@ gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
*/ */
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display, gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
const GstVideoInfo * vip, guint flags) const GstVideoInfo * vip, guint surface_allocation_flags)
{ {
GstVaapiVideoPool *pool; GstVaapiVideoPool *pool;
@ -157,7 +157,8 @@ gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
gst_vaapi_video_pool_init (pool, display, gst_vaapi_video_pool_init (pool, display,
GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_SURFACE); GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_SURFACE);
if (!surface_pool_init (GST_VAAPI_SURFACE_POOL (pool), vip, flags)) if (!surface_pool_init (GST_VAAPI_SURFACE_POOL (pool), vip,
surface_allocation_flags))
goto error; goto error;
return pool; return pool;

View file

@ -42,7 +42,7 @@ gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display, gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
const GstVideoInfo * vip, guint flags); const GstVideoInfo * vip, guint surface_allocation_flags);
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display, gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,