Top |
GBoxed ╰── GstGLVideoAllocationParams GObject ╰── GInitiallyUnowned ╰── GstObject ╰── GstAllocator ╰── GstGLBaseMemoryAllocator ╰── GstGLMemoryAllocator ╰── GstGLMemoryPBOAllocator
GstGLMemory is a GstGLBaseMemory subclass providing support for the mapping of OpenGL textures.
GstGLMemory is created or wrapped through gst_gl_base_memory_alloc()
with GstGLVideoAllocationParams.
Data is uploaded or downloaded from the GPU as is necessary.
void gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams *src_vid
,GstGLVideoAllocationParams *dest_vid
);
Copy and set any dynamically allocated resources in dest_vid
. Intended
for subclass usage only to chain up at the end of a subclass copy function.
src_vid |
source GstGLVideoAllocationParams to copy from |
|
dest_vid |
destination GstGLVideoAllocationParams to copy into |
Since: 1.8
void
gst_gl_video_allocation_params_free_data
(GstGLVideoAllocationParams *params
);
Unset and free any dynamically allocated resources. Intended for subclass usage only to chain up at the end of a subclass free function.
Since: 1.8
gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams *params
,gsize struct_size
,guint alloc_flags
,GstGLAllocationParamsCopyFunc copy
,GstGLAllocationParamsFreeFunc free
,GstGLContext *context
,GstAllocationParams *alloc_params
,GstVideoInfo *v_info
,guint plane
,GstVideoAlignment *valign
,GstGLTextureTarget target
,GstGLFormat tex_format
,gpointer wrapped_data
,gpointer gl_handle
,gpointer user_data
,GDestroyNotify notify
);
Intended for subclass usage
[skip]
params |
a GstGLVideoAllocationParams to initialize |
|
struct_size |
the size of the struct in |
|
alloc_flags |
some allocation flags |
|
copy |
a copy function |
|
free |
a free function |
|
context |
||
alloc_params |
the GstAllocationParams for |
[allow-none] |
v_info |
the GstVideoInfo for |
|
plane |
the video plane |
|
valign |
any GstVideoAlignment applied to symem mappings of |
[allow-none] |
target |
||
tex_format |
the GstGLFormat |
|
wrapped_data |
the optional data pointer to wrap. |
[allow-none] |
gl_handle |
the optional OpenGL handle to wrap or 0 |
|
user_data |
user data to call |
[allow-none] |
notify |
[allow-none] |
Since: 1.8
GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext *context
,GstAllocationParams *alloc_params
,GstVideoInfo *v_info
,guint plane
,GstVideoAlignment *valign
,GstGLTextureTarget target
,GstGLFormat tex_format
);
context |
||
alloc_params |
the GstAllocationParams for sysmem mappings of the texture. |
[allow-none] |
v_info |
the GstVideoInfo for the texture |
|
plane |
the video plane of |
|
valign |
any GstVideoAlignment applied to symem mappings of the texture. |
[allow-none] |
target |
the GstGLTextureTarget for the created textures |
|
tex_format |
the GstGLFormat for the created textures |
Since: 1.8
GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data (GstGLContext *context
,GstAllocationParams *alloc_params
,GstVideoInfo *v_info
,guint plane
,GstVideoAlignment *valign
,GstGLTextureTarget target
,GstGLFormat tex_format
,gpointer wrapped_data
,gpointer user_data
,GDestroyNotify notify
);
context |
||
alloc_params |
the GstAllocationParams for |
[allow-none] |
v_info |
the GstVideoInfo for |
|
plane |
the video plane |
|
valign |
any GstVideoAlignment applied to symem mappings of |
[allow-none] |
target |
the GstGLTextureTarget for |
|
tex_format |
the GstGLFormat for |
|
wrapped_data |
the data pointer to wrap |
|
user_data |
user data to call |
[allow-none] |
notify |
[allow-none] |
Since: 1.8
GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext *context
,GstAllocationParams *alloc_params
,GstVideoInfo *v_info
,guint plane
,GstVideoAlignment *valign
,GstGLTextureTarget target
,GstGLFormat tex_format
,gpointer gl_handle
,gpointer user_data
,GDestroyNotify notify
);
gl_handle
is defined by the specific OpenGL handle being wrapped
For GstGLMemory and GstGLMemoryPBO it is an OpenGL texture id.
Other memory types may define it to require a different type of parameter.
context |
||
alloc_params |
the GstAllocationParams for |
[allow-none] |
v_info |
the GstVideoInfo for |
|
plane |
the video plane |
|
valign |
any GstVideoAlignment applied to symem mappings of |
[allow-none] |
target |
the GstGLTextureTarget for |
|
tex_format |
the GstGLFormat for |
|
gl_handle |
the GL handle to wrap |
|
user_data |
user data to call |
[allow-none] |
notify |
[allow-none] |
Since: 1.8
GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext *context
,GstAllocationParams *alloc_params
,GstVideoInfo *v_info
,guint plane
,GstVideoAlignment *valign
,GstGLTextureTarget target
,GstGLFormat tex_format
,guint tex_id
,gpointer user_data
,GDestroyNotify notify
);
context |
||
alloc_params |
the GstAllocationParams for |
[allow-none] |
v_info |
the GstVideoInfo for |
|
plane |
the video plane |
|
valign |
any GstVideoAlignment applied to symem mappings of |
[allow-none] |
target |
the GstGLTextureTarget for |
|
tex_format |
the GstGLFormat for |
|
tex_id |
the GL texture to wrap |
|
user_data |
user data to call |
[allow-none] |
notify |
[allow-none] |
Since: 1.8
GstGLMemoryAllocator *
gst_gl_memory_allocator_get_default (GstGLContext *context
);
Since: 1.8
void
gst_gl_memory_init_once (void
);
Initializes the GL Base Texture allocator. It is safe to call this function multiple times. This must be called before any other GstGLMemory operation.
Since: 1.4
void gst_gl_memory_init (GstGLMemory *mem
,GstAllocator *allocator
,GstMemory *parent
,GstGLContext *context
,GstGLTextureTarget target
,GstGLFormat tex_format
,GstAllocationParams *params
,GstVideoInfo *info
,guint plane
,GstVideoAlignment *valign
,gpointer user_data
,GDestroyNotify notify
);
Initializes mem
with the required parameters. info
is assumed to have
already have been modified with gst_video_info_align()
.
mem |
the GstGLBaseMemory to initialize |
|
allocator |
the GstAllocator to initialize with |
|
parent |
the parent GstMemory to initialize with. |
[allow-none] |
context |
the GstGLContext to initialize with |
|
target |
the GstGLTextureTarget for this GstGLMemory |
|
tex_format |
the GstGLFormat for this GstGLMemory |
|
params |
the |
[allow-none] |
info |
the GstVideoInfo for this GstGLMemory |
|
plane |
the plane number (starting from 0) for this GstGLMemory |
|
valign |
optional GstVideoAlignment parameters. |
[allow-none] |
notify |
[allow-none] | |
user_data |
user data to call |
[allow-none] |
Since: 1.8
gboolean gst_gl_memory_copy_into (GstGLMemory *gl_mem
,guint tex_id
,GstGLTextureTarget target
,GstGLFormat tex_format
,gint width
,gint height
);
Copies gl_mem
into the texture specfified by tex_id
. The format of tex_id
is specified by tex_format
, width
and height
.
gl_mem |
||
tex_id |
OpenGL texture id |
|
target |
||
tex_format |
the GstGLFormat |
|
width |
width of |
|
height |
height of |
Since: 1.8
gboolean gst_gl_memory_copy_teximage (GstGLMemory *src
,guint tex_id
,GstGLTextureTarget out_target
,GstGLFormat out_tex_format
,gint out_width
,gint out_height
);
Copies the texture in GstGLMemory into the texture specified by tex_id
,
out_target
, out_tex_format
, out_width
and out_height
.
src |
the source GstGLMemory |
|
tex_id |
the destination texture id |
|
out_target |
the destination GstGLTextureTarget |
|
out_tex_format |
the destination GstGLFormat |
|
out_width |
the destination width |
|
out_height |
the destination height |
Since: 1.8
gboolean gst_gl_memory_read_pixels (GstGLMemory *gl_mem
,gpointer read_pointer
);
Reads the texture in GstGLMemory into read_pointer
if no buffer is bound
to GL_PIXEL_PACK_BUFFER
. Otherwise read_pointer
is the byte offset into
the currently bound GL_PIXEL_PACK_BUFFER
buffer to store the result of
glReadPixels. See the OpenGL specification for glReadPixels for more
details.
Since: 1.8
void gst_gl_memory_texsubimage (GstGLMemory *gl_mem
,gpointer read_pointer
);
See gst_gl_memory_read_pixels()
for what read_pointer
signifies.
Since: 1.8
gint
gst_gl_memory_get_texture_height (GstGLMemory *gl_mem
);
Since: 1.8
guint
gst_gl_memory_get_texture_id (GstGLMemory *gl_mem
);
Since: 1.8
GstGLTextureTarget
gst_gl_memory_get_texture_target (GstGLMemory *gl_mem
);
Since: 1.8
GstGLFormat
gst_gl_memory_get_texture_format (GstGLMemory *gl_mem
);
Since: 1.12
gint
gst_gl_memory_get_texture_width (GstGLMemory *gl_mem
);
Since: 1.8
gboolean gst_gl_memory_setup_buffer (GstGLMemoryAllocator *allocator
,GstBuffer *buffer
,GstGLVideoAllocationParams *params
,GstGLFormat *tex_formats
,gpointer *wrapped_data
,gsize n_wrapped_pointers
);
allocator |
the |
|
buffer |
a GstBuffer to setup |
|
params |
the GstGLVideoAllocationParams to allocate with |
|
tex_formats |
a list of GstGLFormat's to allocate with. |
[allow-none][array length=n_wrapped_pointers] |
wrapped_data |
a list of wrapped data pointers. |
[array length=n_wrapped_pointers][element-type gpointer] |
n_wrapped_pointers |
the number of elements in |
Since: 1.8
#define GST_GL_MEMORY_VIDEO_FORMATS_STR
List of video formats that are supported by GstGLMemory
#define GST_CAPS_FEATURE_MEMORY_GL_MEMORY "memory:GLMemory"
Name of the caps feature for indicating the use of GstGLMemory
struct GstGLVideoAllocationParams { GstGLAllocationParams parent; GstVideoInfo *v_info; guint plane; GstVideoAlignment *valign; GstGLTextureTarget target; GstGLFormat tex_format; };
GstGLAllocationParams |
the parent GstGLAllocationParams structure |
|
GstVideoInfo * |
the GstVideoInfo to allocate |
|
guint |
the video plane index to allocate |
|
GstVideoAlignment * |
the GstVideoAlignment to align the system representation to (may be |
|
GstGLTextureTarget |
the GstGLTextureTarget to allocate |
|
GstGLFormat |
the GstGLFormat to allocate |
#define GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO (1 << 3)
GL allocation flag indicating the allocation of 2D video frames
typedef struct _GstGLMemoryAllocator GstGLMemoryAllocator;
Opaque GstGLMemoryAllocator struct
typedef struct { GstGLBaseMemoryAllocatorMapFunction map; GstGLBaseMemoryAllocatorCopyFunction copy; GstGLBaseMemoryAllocatorUnmapFunction unmap; } GstGLMemoryAllocatorClass;
typedef struct { GstGLBaseMemory mem; guint tex_id; GstGLTextureTarget tex_target; GstGLFormat tex_format; GstVideoInfo info; GstVideoAlignment valign; guint plane; gfloat tex_scaling[2]; } GstGLMemory;
Represents information about a GL texture
GstGLBaseMemory |
the parent GstGLBaseMemory object |
|
guint |
the GL texture id for this memory |
|
GstGLTextureTarget |
the GL texture target for this memory |
|
GstGLFormat |
||
GstVideoInfo |
the texture's GstVideoInfo |
|
GstVideoAlignment |
data alignment for system memory mapping |
|
guint |
data plane in |
|
gfloat |
GL shader scaling parameters for |