## GstEGLImage

GstEGLImage — EGLImage abstraction

## Functions

GstEGLImage * | gst_egl_image_from_dmabuf ()
GstEGLImage * | gst_egl_image_from_texture ()
gpointer | gst_egl_image_get_image ()
gboolean | gst_egl_image_export_dmabuf ()
GstEGLImage * | gst_egl_image_new_wrapped ()
GstEGLImage * | gst_egl_image_ref ()
void | gst_egl_image_unref ()
void | (*GstEGLImageDestroyNotify) ()

## Types and Values

struct | GstEGLImage

## Includes

    #include <gst/gl/egl/gsteglimage.h>

## Description

GstEGLImage represents and holds an EGLImage handle.

A GstEGLImage can be created from a dmabuf with `gst_egl_image_from_dmabuf()`, or `gst_egl_image_from_dmabuf_direct()`, or GstGLMemoryEGL provides a GstAllocator to allocate EGLImage's bound to and OpenGL texture.

## Functions

### gst_egl_image_from_dmabuf ()

    GstEGLImage *
    gst_egl_image_from_dmabuf (GstGLContext *context,
                               gint dmabuf,
                               GstVideoInfo *in_info,
                               gint plane,
                               gsize offset);

Creates an EGL image that imports the dmabuf FD. The dmabuf data is passed as RGBA data. Shaders later take this "RGBA" data and convert it from its true format (described by in_info) to actual RGBA output. For example, with I420, three EGL images are created, one for each plane, each EGL image with a single-channel R format. With NV12, two EGL images are created, one with R format, one with RG format etc.

#### Parameters

context | a GstGLContext (must be an EGL context) |
dmabuf | the DMA-Buf file descriptor |
in_info | the GstVideoInfo in `dmabuf` |
plane | the plane in `in_info` to create and GstEGLImage for |
offset | the byte-offset in the data |

#### Returns

a GstEGLImage wrapping `dmabuf` or `NULL` on failure

### gst_egl_image_from_texture ()

    GstEGLImage *
    gst_egl_image_from_texture (GstGLContext *context,
                                GstGLMemory *gl_mem,
                                guintptr *attribs);

#### Parameters

context | a GstGLContext (must be an EGL context) |
gl_mem | a GstGLMemory |
attribs | additional attributes to add to the `eglCreateImage()` call. |

#### Returns

a GstEGLImage wrapping `gl_mem` or `NULL` on failure.

[transfer full]

### gst_egl_image_get_image ()

    gpointer
    gst_egl_image_get_image (GstEGLImage *image);

#### Parameters

image | a GstEGLImage |

#### Returns

the EGLImageKHR of `image`

### gst_egl_image_export_dmabuf ()

    gboolean
    gst_egl_image_export_dmabuf (GstEGLImage *image,
                                 int *fd,
                                 gint *stride,
                                 gsize *offset);

### gst_egl_image_new_wrapped ()

    GstEGLImage *
    gst_egl_image_new_wrapped (GstGLContext *context,
                               gpointer image,
                               GstGLFormat format,
                               gpointer user_data,
                               GstEGLImageDestroyNotify user_data_destroy);

#### Parameters

context | a GstGLContext (must be an EGL context) |
image | the image to wrap |
format | the GstGLFormat |
user_data | user data |
user_data_destroy | called when `user_data` is no longer needed. | [destroy user_data]

#### Returns

a new GstEGLImage wrapping `image`

### gst_egl_image_ref ()

    GstEGLImage *
    gst_egl_image_ref (GstEGLImage *image);

Increases the refcount of the given image by one.

#### Parameters

image | a GstEGLImage. |

#### Returns

`image` .

[transfer full]

### gst_egl_image_unref ()

    void
    gst_egl_image_unref (GstEGLImage *image);

Decreases the refcount of the image. If the refcount reaches 0, the image with the associated metadata and memory will be freed.

#### Parameters

image | a GstEGLImage. | [transfer full]

### GstEGLImageDestroyNotify ()

    void
    (*GstEGLImageDestroyNotify) (GstEGLImage *image,
                                 gpointer data);

Function to be called when the GstEGLImage is destroyed. It should free the associated EGLImage if necessary

#### Parameters

image | a GstEGLImage |
data | user data passed to `gst_egl_image_new_wrapped()` |

## Types and Values

### struct GstEGLImage

    struct GstEGLImage {
    };

Opaque GstEGLImage struct.

## See Also

GstGLMemoryEGL, GstGLContext