GstVaapiImage: GStreamer VA-API Plugins 1.4 Library Reference Manual

## GstVaapiImage GstVaapiImage — VA image abstraction |

## Functions

#define | GST_VAAPI_IMAGE_FORMAT()
#define | GST_VAAPI_IMAGE_WIDTH()
#define | GST_VAAPI_IMAGE_HEIGHT()
GstVaapiImage * | gst_vaapi_image_new ()
GstVaapiImage * | gst_vaapi_image_new_with_image ()
GstVaapiID | gst_vaapi_image_get_id ()
gboolean | gst_vaapi_image_get_image ()
GstVideoFormat | gst_vaapi_image_get_format ()
guint | gst_vaapi_image_get_width ()
guint | gst_vaapi_image_get_height ()
void | gst_vaapi_image_get_size ()
gboolean | gst_vaapi_image_is_linear ()
gboolean | gst_vaapi_image_is_mapped ()
gboolean | gst_vaapi_image_map ()
gboolean | gst_vaapi_image_unmap ()
guint | gst_vaapi_image_get_plane_count ()
guchar * | gst_vaapi_image_get_plane ()
guint | gst_vaapi_image_get_pitch ()
guint | gst_vaapi_image_get_data_size ()
gboolean | gst_vaapi_image_get_buffer ()
gboolean | gst_vaapi_image_update_from_buffer ()
gboolean | gst_vaapi_image_copy ()

## Types and Values

| GstVaapiImage

## Description

## Functions

### GST_VAAPI_IMAGE_FORMAT()

    #define             GST_VAAPI_IMAGE_FORMAT(image)

Macro that evaluates to the GstVideoFormat of `image` .

#### Parameters

image | a GstVaapiImage |

### GST_VAAPI_IMAGE_WIDTH()

    #define             GST_VAAPI_IMAGE_WIDTH(image)

Macro that evaluates to the width of `image` .

#### Parameters

image | a GstVaapiImage |

### GST_VAAPI_IMAGE_HEIGHT()

    #define             GST_VAAPI_IMAGE_HEIGHT(image)

Macro that evaluates to the height of `image` .

#### Parameters

image | a GstVaapiImage |

### gst_vaapi_image_new ()

    GstVaapiImage *
    gst_vaapi_image_new (GstVaapiDisplay *display,
                         GstVideoFormat format,
                         guint width,
                         guint height);

Creates a new GstVaapiImage with the specified format and dimensions.

#### Parameters

display | a GstVaapiDisplay |
format | a GstVideoFormat |
width | the requested image width |
height | the requested image height |

#### Returns

the newly allocated GstVaapiImage object

### gst_vaapi_image_new_with_image ()

    GstVaapiImage *
    gst_vaapi_image_new_with_image (GstVaapiDisplay *display,
                                    VAImage *va_image);

Creates a new GstVaapiImage from a foreign VA image. The image format and dimensions will be extracted from `va_image` . This function is mainly used by `gst_vaapi_surface_derive_image()` to bind a VA image to a GstVaapiImage object.

#### Parameters

display | a GstVaapiDisplay |
va_image | a VA image |

#### Returns

the newly allocated GstVaapiImage object

### gst_vaapi_image_get_id ()

    GstVaapiID
    gst_vaapi_image_get_id (GstVaapiImage *image);

Returns the underlying VAImageID of the `image` .

#### Parameters

image | a GstVaapiImage |

#### Returns

the underlying VA image id

### gst_vaapi_image_get_image ()

    gboolean
    gst_vaapi_image_get_image (GstVaapiImage *image,
                               VAImage *va_image);

Fills `va_image` with the VA image used internally.

#### Parameters

image | a GstVaapiImage |
va_image | a VA image |

#### Returns

`TRUE` on success

### gst_vaapi_image_get_format ()

    GstVideoFormat
    gst_vaapi_image_get_format (GstVaapiImage *image);

Returns the GstVideoFormat the `image` was created with.

#### Parameters

image | a GstVaapiImage |

#### Returns

the GstVideoFormat

### gst_vaapi_image_get_width ()

    guint
    gst_vaapi_image_get_width (GstVaapiImage *image);

Returns the `image` width.

#### Parameters

image | a GstVaapiImage |

#### Returns

the image width, in pixels

### gst_vaapi_image_get_height ()

    guint
    gst_vaapi_image_get_height (GstVaapiImage *image);

Returns the `image` height.

#### Parameters

image | a GstVaapiImage |

#### Returns

the image height, in pixels.

### gst_vaapi_image_get_size ()

    void
    gst_vaapi_image_get_size (GstVaapiImage *image,
                              guint *pwidth,
                              guint *pheight);

Retrieves the dimensions of a GstVaapiImage.

#### Parameters

image | a GstVaapiImage |
pwidth | return location for the width, or `NULL` |
pheight | return location for the height, or `NULL` |

### gst_vaapi_image_is_linear ()

    gboolean
    gst_vaapi_image_is_linear (GstVaapiImage *image);

Checks whether the `image` has data planes allocated from a single buffer and offsets into that buffer are in increasing order with the number of planes.

#### Parameters

image | a GstVaapiImage |

#### Returns

`TRUE` if image data planes are allocated from a single buffer

### gst_vaapi_image_is_mapped ()

    gboolean
    gst_vaapi_image_is_mapped (GstVaapiImage *image);

Checks whether the `image` is currently mapped or not.

#### Parameters

image | a GstVaapiImage |

#### Returns

`TRUE` if the `image` is mapped

### gst_vaapi_image_map ()

    gboolean
    gst_vaapi_image_map (GstVaapiImage *image);

Maps the image data buffer. The actual pixels are returned by the `gst_vaapi_image_get_plane()` function.

#### Parameters

image | a GstVaapiImage |

#### Returns

`TRUE` on success

### gst_vaapi_image_unmap ()

    gboolean
    gst_vaapi_image_unmap (GstVaapiImage *image);

Unmaps the image data buffer. Pointers to pixels returned by `gst_vaapi_image_get_plane()` are then no longer valid.

#### Parameters

image | a GstVaapiImage |

#### Returns

`TRUE` on success

### gst_vaapi_image_get_plane_count ()

    guint
    gst_vaapi_image_get_plane_count (GstVaapiImage *image);

Retrieves the number of planes available in the `image` . The `image` must be mapped for this function to work properly.

#### Parameters

image | a GstVaapiImage |

#### Returns

the number of planes available in the `image`

### gst_vaapi_image_get_plane ()

    guchar *
    gst_vaapi_image_get_plane (GstVaapiImage *image,
                               guint plane);

Retrieves the pixels data to the specified `plane` . The `image` must be mapped for this function to work properly.

#### Parameters

image | a GstVaapiImage |
plane | the requested plane number |

#### Returns

the pixels data of the specified `plane`

### gst_vaapi_image_get_pitch ()

    guint
    gst_vaapi_image_get_pitch (GstVaapiImage *image,
                               guint plane);

Retrieves the line size (stride) of the specified `plane` . The `image` must be mapped for this function to work properly.

#### Parameters

image | a GstVaapiImage |
plane | the requested plane number |

#### Returns

the line size (stride) of the specified plane

### gst_vaapi_image_get_data_size ()

    guint
    gst_vaapi_image_get_data_size (GstVaapiImage *image);

Retrieves the underlying image data size. This function could be used to determine whether the image has a compatible layout with another image structure.

#### Parameters

image | a GstVaapiImage |

#### Returns

the whole image data size of the `image`

### gst_vaapi_image_get_buffer ()

    gboolean
    gst_vaapi_image_get_buffer (GstVaapiImage *image,
                                GstBuffer *buffer,
                                GstVaapiRectangle *rect);

Transfers pixels data contained in the `image` into the GstBuffer. Both image structures shall have the same format.

#### Parameters

image | a GstVaapiImage |
buffer | a GstBuffer |
rect | a GstVaapiRectangle expressing a region, or `NULL` for the whole image |

#### Returns

`TRUE` on success

### gst_vaapi_image_update_from_buffer ()

    gboolean
    gst_vaapi_image_update_from_buffer (GstVaapiImage *image,
                                        GstBuffer *buffer,
                                        GstVaapiRectangle *rect);

Transfers pixels data contained in the GstBuffer into the `image` . Both image structures shall have the same format.

#### Parameters

image | a GstVaapiImage |
buffer | a GstBuffer |
rect | a GstVaapiRectangle expressing a region, or `NULL` for the whole image |

#### Returns

`TRUE` on success

### gst_vaapi_image_copy ()

    gboolean
    gst_vaapi_image_copy (GstVaapiImage *dst_image,
                          GstVaapiImage *src_image);

Copies pixels data from `src_image` to `dst_image` . Both images shall have the same format and size.

#### Parameters

dst_image | the target GstVaapiImage |
src_image | the source GstVaapiImage |

#### Returns

`TRUE` on success

## Types and Values

### GstVaapiImage

    typedef struct {
    } GstVaapiImage;

A VA image wrapper