mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
vaapivideomemory: rename dmabuf allocator parameters
Rename the parameters 'vip' and 'flags' to 'alloc_info' and 'surface_alloc_flags' respectively. The purpose of this change is to auto-document those parameters. Also, aligned to this patch, the local 'alloc_info' variable was renamed as 'surface_info', because it stores the possible surface's video info, not the allocate one.
This commit is contained in:
parent
2534dab8d8
commit
eb1d396536
2 changed files with 21 additions and 16 deletions
|
@ -943,23 +943,25 @@ gst_vaapi_dmabuf_memory_new (GstAllocator * base_allocator,
|
||||||
GstVaapiSurfaceProxy *proxy;
|
GstVaapiSurfaceProxy *proxy;
|
||||||
GstVaapiBufferProxy *dmabuf_proxy;
|
GstVaapiBufferProxy *dmabuf_proxy;
|
||||||
gint dmabuf_fd;
|
gint dmabuf_fd;
|
||||||
const GstVideoInfo *vip;
|
const GstVideoInfo *surface_info;
|
||||||
guint flags;
|
guint surface_alloc_flags;
|
||||||
GstVaapiDmaBufAllocator *const allocator =
|
GstVaapiDmaBufAllocator *const allocator =
|
||||||
GST_VAAPI_DMABUF_ALLOCATOR_CAST (base_allocator);
|
GST_VAAPI_DMABUF_ALLOCATOR_CAST (base_allocator);
|
||||||
|
|
||||||
g_return_val_if_fail (allocator != NULL, NULL);
|
g_return_val_if_fail (allocator != NULL, NULL);
|
||||||
g_return_val_if_fail (meta != NULL, NULL);
|
g_return_val_if_fail (meta != NULL, NULL);
|
||||||
|
|
||||||
vip = gst_allocator_get_vaapi_video_info (base_allocator, &flags);
|
surface_info = gst_allocator_get_vaapi_video_info (base_allocator,
|
||||||
if (!vip)
|
&surface_alloc_flags);
|
||||||
|
if (!surface_info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
display = gst_vaapi_video_meta_get_display (meta);
|
display = gst_vaapi_video_meta_get_display (meta);
|
||||||
if (!meta)
|
if (!meta)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
surface = gst_vaapi_surface_new_full (display, vip, flags);
|
surface = gst_vaapi_surface_new_full (display, surface_info,
|
||||||
|
surface_alloc_flags);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
goto error_create_surface;
|
goto error_create_surface;
|
||||||
|
|
||||||
|
@ -996,8 +998,9 @@ gst_vaapi_dmabuf_memory_new (GstAllocator * base_allocator,
|
||||||
error_create_surface:
|
error_create_surface:
|
||||||
{
|
{
|
||||||
GST_ERROR ("failed to create VA surface (format:%s size:%ux%u)",
|
GST_ERROR ("failed to create VA surface (format:%s size:%ux%u)",
|
||||||
GST_VIDEO_INFO_FORMAT_STRING (vip), GST_VIDEO_INFO_WIDTH (vip),
|
GST_VIDEO_INFO_FORMAT_STRING (surface_info),
|
||||||
GST_VIDEO_INFO_HEIGHT (vip));
|
GST_VIDEO_INFO_WIDTH (surface_info),
|
||||||
|
GST_VIDEO_INFO_HEIGHT (surface_info));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
error_create_surface_proxy:
|
error_create_surface_proxy:
|
||||||
|
@ -1049,15 +1052,15 @@ gst_vaapi_dmabuf_allocator_init (GstVaapiDmaBufAllocator * allocator)
|
||||||
|
|
||||||
GstAllocator *
|
GstAllocator *
|
||||||
gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
|
gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
|
||||||
const GstVideoInfo * vip, guint flags)
|
const GstVideoInfo * alloc_info, guint surface_alloc_flags)
|
||||||
{
|
{
|
||||||
GstVaapiDmaBufAllocator *allocator = NULL;
|
GstVaapiDmaBufAllocator *allocator = NULL;
|
||||||
GstVaapiSurface *surface = NULL;
|
GstVaapiSurface *surface = NULL;
|
||||||
GstVideoInfo alloc_info;
|
GstVideoInfo surface_info;
|
||||||
GstAllocator *base_allocator;
|
GstAllocator *base_allocator;
|
||||||
|
|
||||||
g_return_val_if_fail (display != NULL, NULL);
|
g_return_val_if_fail (display != NULL, NULL);
|
||||||
g_return_val_if_fail (vip != NULL, NULL);
|
g_return_val_if_fail (alloc_info != NULL, NULL);
|
||||||
|
|
||||||
allocator = g_object_new (GST_VAAPI_TYPE_DMABUF_ALLOCATOR, NULL);
|
allocator = g_object_new (GST_VAAPI_TYPE_DMABUF_ALLOCATOR, NULL);
|
||||||
if (!allocator)
|
if (!allocator)
|
||||||
|
@ -1065,16 +1068,18 @@ gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
|
||||||
|
|
||||||
base_allocator = GST_ALLOCATOR_CAST (allocator);
|
base_allocator = GST_ALLOCATOR_CAST (allocator);
|
||||||
|
|
||||||
gst_video_info_set_format (&alloc_info, GST_VIDEO_INFO_FORMAT (vip),
|
gst_video_info_set_format (&surface_info, GST_VIDEO_INFO_FORMAT (alloc_info),
|
||||||
GST_VIDEO_INFO_WIDTH (vip), GST_VIDEO_INFO_HEIGHT (vip));
|
GST_VIDEO_INFO_WIDTH (alloc_info), GST_VIDEO_INFO_HEIGHT (alloc_info));
|
||||||
surface = gst_vaapi_surface_new_full (display, vip, flags);
|
surface = gst_vaapi_surface_new_full (display, alloc_info,
|
||||||
|
surface_alloc_flags);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
goto error_no_surface;
|
goto error_no_surface;
|
||||||
if (!gst_video_info_update_from_surface (&alloc_info, surface))
|
if (!gst_video_info_update_from_surface (&surface_info, surface))
|
||||||
goto fail;
|
goto fail;
|
||||||
gst_vaapi_object_replace (&surface, NULL);
|
gst_vaapi_object_replace (&surface, NULL);
|
||||||
|
|
||||||
gst_allocator_set_vaapi_video_info (base_allocator, &alloc_info, flags);
|
gst_allocator_set_vaapi_video_info (base_allocator, &surface_info,
|
||||||
|
surface_alloc_flags);
|
||||||
|
|
||||||
return base_allocator;
|
return base_allocator;
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,7 @@ gst_vaapi_dmabuf_allocator_get_type (void) G_GNUC_CONST;
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GstAllocator *
|
GstAllocator *
|
||||||
gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
|
gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
|
||||||
const GstVideoInfo * vip, guint flags);
|
const GstVideoInfo * alloc_info, guint surface_alloc_flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const GstVideoInfo *
|
const GstVideoInfo *
|
||||||
|
|
Loading…
Reference in a new issue