GstGLMemory: GStreamer Bad Plugins 1.0 Library Reference Manual

## GstGLMemory GstGLMemory — memory subclass for GL textures |

## Functions

#define | GST_GL_MEMORY_ALLOCATOR()
void | gst_gl_memory_init ()
gboolean | gst_gl_memory_setup_buffer ()
GstVideoGLTextureType | gst_gl_texture_type_from_format ()
gboolean | gst_is_gl_memory ()

## Types and Values

| GstGLMemory

## Description

GstGLMemory is a GstGLBaseBuffer subclass providing support for the mapping of GL textures.

GstGLMemory is created through `gst_gl_memory_alloc()` or system memory can be wrapped through `gst_gl_memory_wrapped()`.

Data is uploaded or downloaded from the GPU as is necessary.

## Functions

### GST_GL_MEMORY_ALLOCATOR()

    #define GST_GL_MEMORY_ALLOCATOR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_ALLOCATOR, GstGLMemoryAllocator))

### gst_gl_memory_init ()

    void
    gst_gl_memory_init (GstGLMemory *mem,
                        GstAllocator *allocator,
                        GstMemory *parent,
                        GstGLContext *context,
                        GstGLTextureTarget target,
                        GstAllocationParams *params,
                        GstVideoInfo *info,
                        guint plane,
                        GstVideoAlignment *valign,
                        gpointer user_data,
                        GDestroyNotify notify);

Initializes `mem` with the required parameters

#### Parameters

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 |
params | the `GstAllocationParams` to initialize with. | [allow-none]
size | the number of bytes to be allocated |
notify | a GDestroyNotify. | [allow-none]
user_data | user data to call `notify` with. | [allow-none]

### gst_gl_memory_setup_buffer ()

    gboolean
    gst_gl_memory_setup_buffer (GstGLMemoryAllocator *allocator,
                                GstBuffer *buffer,
                                GstGLVideoAllocationParams *params);

#### Parameters

allocator | the `GstGLMemoryAllocator` to allocate from |
buffer | a GstBuffer to setup |
params | the GstGLVideoAllocationParams to allocate with |

#### Returns

whether the buffer was correctly setup

### gst_gl_texture_type_from_format ()

    GstVideoGLTextureType
    gst_gl_texture_type_from_format (GstGLContext *context,
                                     GstVideoFormat v_format,
                                     guint plane);

### gst_is_gl_memory ()

    gboolean
    gst_is_gl_memory (GstMemory *mem);

#### Parameters

mem | a GstMemory |

#### Returns

whether the memory at `mem` is a GstGLMemoryPBO

## Types and Values

### GstGLMemory

    typedef struct {
      GstGLBaseMemory           mem;

      guint                     tex_id;
      GstGLTextureTarget        tex_target;
      GstVideoGLTextureType     tex_type;
      GstVideoInfo              info;
      GstVideoAlignment         valign;
      guint                     plane;
      gfloat                    tex_scaling[2];
    } GstGLMemory;

Represents information about a GL texture

#### Members

GstGLBaseMemory `mem`; | the parent object |
guint `tex_id`; | the GL texture id for this memory |
GstGLTextureTarget `tex_target`; | the GL texture target for this memory |
GstVideoGLTextureType `tex_type`; | the texture type |
GstVideoInfo `info`; | the texture's GstVideoInfo |
GstVideoAlignment `valign`; | data alignment for system memory mapping |
guint `plane`; | data plane in `info` |
gfloat `tex_scaling`[2]; | GL shader scaling parameters for `valign` and/or width/height |

## See Also

GstMemory, GstAllocator, GstGLBufferPool