mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
ec55017a83
This patch adds general mechanism for handling specific hacks. In this case for jpeg decoder in i965 driver, which cannot create surfaces with fourcc specified. From jpeg decoder to the allocator, which creates the surfaces, there's a non-simple path: basedec pseudo-class adds a hacks guint32 which will be set by actual elements (vajpegdec, in this case) and basedec will always set the hack to the allocator when the allocator is instantiated. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1575>
118 lines
6 KiB
C
118 lines
6 KiB
C
/* GStreamer
|
|
* Copyright (C) 2020 Igalia, S.L.
|
|
* Author: Víctor Jáquez <vjaquez@igalia.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <gst/allocators/allocators.h>
|
|
#include <gst/va/gstva.h>
|
|
#include <gst/video/video.h>
|
|
#include <stdint.h>
|
|
#include <va/va.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GST_TYPE_VA_DMABUF_ALLOCATOR (gst_va_dmabuf_allocator_get_type())
|
|
#define GST_VA_DMABUF_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_DMABUF_ALLOCATOR, GstVaDmabufAllocator))
|
|
#define GST_VA_DMABUF_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_DMABUF_ALLOCATOR, GstVaDmabufAllocatorClass))
|
|
#define GST_IS_VA_DMABUF_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_DMABUF_ALLOCATOR))
|
|
#define GST_IS_VA_DMABUF_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_DMABUF_ALLOCATOR))
|
|
#define GST_VA_DMABUF_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_DMABUF_ALLOCATOR, GstVaDmabufAllocatorClass))
|
|
|
|
GST_VA_API
|
|
GType gst_va_dmabuf_allocator_get_type (void);
|
|
GST_VA_API
|
|
GstAllocator * gst_va_dmabuf_allocator_new (GstVaDisplay * display);
|
|
GST_VA_API
|
|
gboolean gst_va_dmabuf_allocator_setup_buffer (GstAllocator * allocator,
|
|
GstBuffer * buffer);
|
|
GST_VA_API
|
|
gboolean gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
|
|
GstBuffer * buffer);
|
|
GST_VA_API
|
|
void gst_va_dmabuf_allocator_flush (GstAllocator * allocator);
|
|
GST_VA_API
|
|
gboolean gst_va_dmabuf_allocator_set_format (GstAllocator * allocator,
|
|
GstVideoInfo * info,
|
|
guint usage_hint);
|
|
GST_VA_API
|
|
gboolean gst_va_dmabuf_allocator_get_format (GstAllocator * allocator,
|
|
GstVideoInfo * info,
|
|
guint * usage_hint);
|
|
|
|
GST_VA_API
|
|
gboolean gst_va_dmabuf_memories_setup (GstVaDisplay * display,
|
|
GstVideoInfo * info,
|
|
guint n_planes,
|
|
GstMemory * mem[GST_VIDEO_MAX_PLANES],
|
|
uintptr_t * fds,
|
|
gsize offset[GST_VIDEO_MAX_PLANES],
|
|
guint usage_hint);
|
|
|
|
#define GST_TYPE_VA_ALLOCATOR (gst_va_allocator_get_type())
|
|
#define GST_VA_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_ALLOCATOR, GstVaAllocator))
|
|
#define GST_VA_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_ALLOCATOR, GstVaAllocatorClass))
|
|
#define GST_IS_VA_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_ALLOCATOR))
|
|
#define GST_IS_VA_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_ALLOCATOR))
|
|
#define GST_VA_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_ALLOCATOR, GstVaAllocatorClass))
|
|
|
|
#define GST_ALLOCATOR_VASURFACE "VAMemory"
|
|
|
|
#define GST_MAP_VA (GST_MAP_FLAG_LAST << 1)
|
|
|
|
GST_VA_API
|
|
GType gst_va_allocator_get_type (void);
|
|
GST_VA_API
|
|
GstAllocator * gst_va_allocator_new (GstVaDisplay * display,
|
|
GArray * surface_formats);
|
|
GST_VA_API
|
|
GstMemory * gst_va_allocator_alloc (GstAllocator * allocator);
|
|
GST_VA_API
|
|
gboolean gst_va_allocator_setup_buffer (GstAllocator * allocator,
|
|
GstBuffer * buffer);
|
|
GST_VA_API
|
|
gboolean gst_va_allocator_prepare_buffer (GstAllocator * allocator,
|
|
GstBuffer * buffer);
|
|
GST_VA_API
|
|
void gst_va_allocator_flush (GstAllocator * allocator);
|
|
GST_VA_API
|
|
gboolean gst_va_allocator_set_format (GstAllocator * allocator,
|
|
GstVideoInfo * info,
|
|
guint usage_hint,
|
|
GstVaFeature use_derived);
|
|
GST_VA_API
|
|
gboolean gst_va_allocator_get_format (GstAllocator * allocator,
|
|
GstVideoInfo * info,
|
|
guint * usage_hint,
|
|
GstVaFeature * use_derived);
|
|
GST_VA_API
|
|
void gst_va_allocator_set_hacks (GstAllocator * allocator,
|
|
guint32 hack);
|
|
|
|
GST_VA_API
|
|
VASurfaceID gst_va_memory_get_surface (GstMemory * mem);
|
|
GST_VA_API
|
|
VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer);
|
|
|
|
GST_VA_API
|
|
gboolean gst_va_buffer_create_aux_surface (GstBuffer * buffer);
|
|
GST_VA_API
|
|
VASurfaceID gst_va_buffer_get_aux_surface (GstBuffer * buffer);
|
|
|
|
G_END_DECLS
|