## GstSurfaceBuffer

GstSurfaceBuffer — Accelerated surface base class

## Synopsis

    #define             GST_VIDEO_CAPS_SURFACE
                        GstSurfaceBuffer;
    struct              GstSurfaceBufferClass;
    GType               gst_surface_buffer_get_type         (void);
    GstSurfaceConverter * gst_surface_buffer_create_converter
                                                            (GstSurfaceBuffer *buffer,
                                                             const gchar *type,
                                                             GValue *dest);

## Description

This base class is used to abstract hardware accelerated buffers and enable generic convertion to standard type such as GL textures. The media type for those buffers is defined by GST_VIDEO_CAPS_SURFACE. An implementation specific type must be set using the "type" key (e.g. type="vaapi"). Available convertion type are speficied using seperate boolean arguement (e.g. opengl=true). Having this information in the capabilities allow easy negotiating of such feature with other elements (e.g. a ClutterGstVideoSink can claim accpeting caps "video/x-surface,opengl=true").

### Note

The GstVideoContext interface is unstable API and may change in future. One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning.

## Details

### GST_VIDEO_CAPS_SURFACE

    #define GST_VIDEO_CAPS_SURFACE "video/x-surface"

Base caps for GstSurfaceBuffer. Implementation specific type must be marked using the type attribute (e.g. type=vaapi). Available convertion shall be specified using boolean attributes (e.g. opengl=true).

### GstSurfaceBuffer

    typedef struct {
      GstBuffer parent;
    } GstSurfaceBuffer;

GstBuffer `parent`; | parent object

### struct GstSurfaceBufferClass

    struct GstSurfaceBufferClass {
      GstBufferClass parent_class;

      GstSurfaceConverter * (*create_converter) (GstSurfaceBuffer *buffer,
                                                 const gchar *type,
                                                 GValue *dest);
    };

GstVideoContextInterface interface.

GstBufferClass `parent_class`; | parent class type.
`create_converter` () | vmethod to create a converter.

### gst_surface_buffer_get_type ()

    GType               gst_surface_buffer_get_type         (void);

### gst_surface_buffer_create_converter ()

    GstSurfaceConverter * gst_surface_buffer_create_converter
                                                            (GstSurfaceBuffer *buffer,
                                                             const gchar *type,
                                                             GValue *dest);

This method is used to create a type specific converter. The converter will serve as context to accelerate the data convertion. This converter object shall be discarded when the pipeline state changes to NULL and renewed when caps are changed.

`buffer` : | a GstSurfaceBuffer
`type` : | the type to convert to
`dest` : | a GValue containing the destination to upload
Returns : | newly allocated GstSurfaceConverter