## GstVaapiVideoPool

GstVaapiVideoPool — Video object pool abstraction

## Functions

GstVaapiDisplay * | gst_vaapi_video_pool_get_display ()
GstVaapiVideoPoolObjectType | gst_vaapi_video_pool_get_object_type ()
gpointer | gst_vaapi_video_pool_get_object ()
void | gst_vaapi_video_pool_put_object ()
gboolean | gst_vaapi_video_pool_add_object ()
gboolean | gst_vaapi_video_pool_add_objects ()
guint | gst_vaapi_video_pool_get_capacity ()
void | gst_vaapi_video_pool_set_capacity ()
guint | gst_vaapi_video_pool_get_size ()
gboolean | gst_vaapi_video_pool_reserve ()

## Types and Values

| GstVaapiVideoPool

## Object Hierarchy

## Description

## Functions

### gst_vaapi_video_pool_get_display ()

    GstVaapiDisplay *
    gst_vaapi_video_pool_get_display (GstVaapiVideoPool *pool);

Retrieves the GstVaapiDisplay the `pool` is bound to. The `pool` owns the returned object and it shall not be unref'ed.

#### Parameters

pool | a GstVaapiVideoPool |

#### Returns

the GstVaapiDisplay the `pool` is bound to

### gst_vaapi_video_pool_get_object_type ()

    GstVaapiVideoPoolObjectType
    gst_vaapi_video_pool_get_object_type (GstVaapiVideoPool *pool);

Retrieves the type of objects the video `pool` supports.

#### Parameters

pool | a GstVaapiVideoPool |

#### Returns

the GstVaapiVideoPoolObjectType of the underlying pool objects

### gst_vaapi_video_pool_get_object ()

    gpointer
    gst_vaapi_video_pool_get_object (GstVaapiVideoPool *pool);

Retrieves a new object from the `pool` , or allocates a new one if none was found. The `pool` holds a reference on the returned object and thus shall be released through `gst_vaapi_video_pool_put_object()` when it's no longer needed.

#### Parameters

pool | a GstVaapiVideoPool |

#### Returns

a possibly newly allocated object, or `NULL` on error

### gst_vaapi_video_pool_put_object ()

    void
    gst_vaapi_video_pool_put_object (GstVaapiVideoPool *pool,
                                     gpointer object);

Pushes the `object` back into the pool. The `object` shall be obtained from the `pool` through `gst_vaapi_video_pool_get_object()`. Calling this function with an arbitrary object yields undefined behaviour.

#### Parameters

pool | a GstVaapiVideoPool |
object | the object to add back to the pool |

### gst_vaapi_video_pool_add_object ()

    gboolean
    gst_vaapi_video_pool_add_object (GstVaapiVideoPool *pool,
                                     gpointer object);

Adds the `object` to the pool. The pool then holds a reference on the `object` . This operation does not change the capacity of the pool.

#### Parameters

pool | a GstVaapiVideoPool |
object | the object to add to the pool |

#### Returns

`TRUE` on success.

### gst_vaapi_video_pool_add_objects ()

    gboolean
    gst_vaapi_video_pool_add_objects (GstVaapiVideoPool *pool,
                                      GPtrArray *objects);

Adds the `objects` to the pool. The pool then holds a reference on the `objects` . This operation does not change the capacity of the pool and is just a wrapper around `gst_vaapi_video_pool_add_object()`.

#### Parameters

pool | a GstVaapiVideoPool |
objects | a GPtrArray of objects |

#### Returns

`TRUE` on success.

### gst_vaapi_video_pool_get_capacity ()

    guint
    gst_vaapi_video_pool_get_capacity (GstVaapiVideoPool *pool);

Returns the maximum number of objects in the pool. i.e. the maximum number of objects that can be returned by `gst_vaapi_video_pool_get_object()`.

#### Parameters

pool | a GstVaapiVideoPool |

#### Returns

the capacity of the pool

### gst_vaapi_video_pool_set_capacity ()

    void
    gst_vaapi_video_pool_set_capacity (GstVaapiVideoPool *pool,
                                       guint capacity);

Sets the maximum number of objects that can be allocated in the pool.

#### Parameters

pool | a GstVaapiVideoPool |
capacity | the maximal capacity of the pool |

### gst_vaapi_video_pool_get_size ()

    guint
    gst_vaapi_video_pool_get_size (GstVaapiVideoPool *pool);

Returns the number of free objects available in the pool.

#### Parameters

pool | a GstVaapiVideoPool |

#### Returns

number of free objects in the pool

### gst_vaapi_video_pool_reserve ()

    gboolean
    gst_vaapi_video_pool_reserve (GstVaapiVideoPool *pool,
                                  guint n);

Pre-allocates up to `n` objects in the pool. If `n` is less than or equal to the number of free and used objects in the pool, this call has no effect. Otherwise, it is a request for allocation of additional objects.

#### Parameters

pool | a GstVaapiVideoPool |
n | the number of objects to pre-allocate |

#### Returns

`TRUE` on success

## Types and Values

### GstVaapiVideoPool

    typedef struct {
    } GstVaapiVideoPool;

A pool of lazily allocated video objects. e.g. surfaces, images.