Ecore Buffer Consumer functions
Ecore » Ecore_Buffer - Graphics buffer functions » Ecore Buffer Queue functions

This group of functions is applied to an Ecore_Buffer_Consumer object. More...

## Typedefs

typedef struct _Ecore_Buffer_Consumer | Ecore_Buffer_Consumer
| An object representing a consumer of Ecore_Buffer.
typedef void(* | Ecore_Buffer_Consumer_Provider_Add_Cb) (Ecore_Buffer_Consumer *consumer, void *data)
| Called whenever a Ecore_Buffer_Provider connected.
typedef void(* | Ecore_Buffer_Consumer_Provider_Del_Cb) (Ecore_Buffer_Consumer *consumer, void *data)
| Called whenever a Ecore_Buffer_Provider disconnected.
typedef void(* | Ecore_Buffer_Consumer_Enqueue_Cb) (Ecore_Buffer_Consumer *consumer, void *data)
| Called whenever a Ecore_Buffer enqueued in buffer queue.

## Functions

EAPI Ecore_Buffer_Consumer * | ecore_buffer_consumer_new (const char *name, int32_t queue_size, int32_t w, int32_t h)
| Creates a new Buffer Consumer based on name and common parameters.
EAPI void | ecore_buffer_consumer_free (Ecore_Buffer_Consumer *consumer)
| Frees an Ecore_Buffer_Consumer.
EAPI Ecore_Buffer * | ecore_buffer_consumer_buffer_dequeue (Ecore_Buffer_Consumer *consumer)
| Returns the latest Ecore_Buffer submitted by provider.
EAPI Eina_Bool | ecore_buffer_consumer_buffer_release (Ecore_Buffer_Consumer *consumer, Ecore_Buffer *buffer)
| Releases the acquired Ecore_Buffer.
EAPI Eina_Bool | ecore_buffer_consumer_queue_is_empty (Ecore_Buffer_Consumer *consumer)
| Checks if Queue of Ecore_Buffer is empty.
EAPI void | ecore_buffer_consumer_provider_add_cb_set (Ecore_Buffer_Consumer *consumer, Ecore_Buffer_Consumer_Provider_Add_Cb func, void *data)
| Sets a callback for provider connection events.
EAPI void | ecore_buffer_consumer_provider_del_cb_set (Ecore_Buffer_Consumer *consumer, Ecore_Buffer_Consumer_Provider_Del_Cb func, void *data)
| Sets a callback for provider disconnection events.
EAPI void | ecore_buffer_consumer_buffer_enqueued_cb_set (Ecore_Buffer_Consumer *consumer, Ecore_Buffer_Consumer_Enqueue_Cb func, void *data)
| Sets a callback for enqueued buffer events.

## Detailed Description

This group of functions is applied to an Ecore_Buffer_Consumer object.

Ecore_Buffer_Consumer receives Ecore_Buffer enqueued by Ecore_Buffer_Provider. Consumer must release Ecore_Buffer when it's no longer used. Thus, the Ecore_Buffer_Provider is now free to re-use or destroy Ecore_Buffer.

## Typedef Documentation

## Ecore_Buffer_Consumer

typedef struct _Ecore_Buffer_Consumer Ecore_Buffer_Consumer

An object representing a consumer of Ecore_Buffer.

Since
  1.15

## Ecore_Buffer_Consumer_Provider_Add_Cb

typedef void(* Ecore_Buffer_Consumer_Provider_Add_Cb) (Ecore_Buffer_Consumer *consumer, void *data)

Called whenever a Ecore_Buffer_Provider connected.

Since
  1.15

See also
  ecore_buffer_consumer_provider_add_cb_set()

## Ecore_Buffer_Consumer_Provider_Del_Cb

typedef void(* Ecore_Buffer_Consumer_Provider_Del_Cb) (Ecore_Buffer_Consumer *consumer, void *data)

Called whenever a Ecore_Buffer_Provider disconnected.

Since
  1.15

See also
  ecore_buffer_consumer_provider_del_cb_set()

## Ecore_Buffer_Consumer_Enqueue_Cb

typedef void(* Ecore_Buffer_Consumer_Enqueue_Cb) (Ecore_Buffer_Consumer *consumer, void *data)

Called whenever a Ecore_Buffer enqueued in buffer queue.

Since
  1.15

See also
  ecore_buffer_consumer_buffer_enqueued_cb_set()

## Function Documentation

## ecore_buffer_consumer_new()

EAPI Ecore_Buffer_Consumer * ecore_buffer_consumer_new | ( | const char * | name,
|  | int32_t | queue_size,
|  | int32_t | w,
|  | int32_t | h )

Creates a new Buffer Consumer based on name and common parameters.

Since
  1.15

Parameters

  [in] | name | The name of Buffer_Queue, this is needed by Consumer and Provider to connect each other.
  [in] | queue_size | Size of Queue (If you pass this 0, then default size two(2) is appied)
  [in] | w | Width of buffer recommended to provider.
  [in] | h | Height of buffer recommended to provider.

Returns
  Ecore_Buffer_Consumer instance or `NULL` if creation failed.

References DBG, and EINA_SAFETY_ON_NULL_RETURN_VAL.

## ecore_buffer_consumer_free()

EAPI void ecore_buffer_consumer_free | ( | Ecore_Buffer_Consumer * | consumer | ) |

Frees an Ecore_Buffer_Consumer.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to free

This frees up any memory used by the Ecore_Buffer_Consumer.

References DBG, and EINA_SAFETY_ON_NULL_RETURN.

## ecore_buffer_consumer_buffer_dequeue()

EAPI Ecore_Buffer * ecore_buffer_consumer_buffer_dequeue | ( | Ecore_Buffer_Consumer * | consumer | ) |

Returns the latest Ecore_Buffer submitted by provider.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to request for buffer

Returns
  Ecore_Buffer handle or `NULL` if acquirement failed.

See also
  ecore_buffer_consumer_buffer_release()

Consumer can store Ecore_Buffer submitted by Provider as much as size of queue which is passed as a argument of ecore_buffer_consumer_new().

References DBG, EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and ERR.

## ecore_buffer_consumer_buffer_release()

EAPI Eina_Bool ecore_buffer_consumer_buffer_release | ( | Ecore_Buffer_Consumer * | consumer,
|  | Ecore_Buffer * | buffer )

Releases the acquired Ecore_Buffer.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to request release buffer
  [in] | buffer | The Ecore_Buffer to release

Returns
  `EINA_TRUE` on success, `EINA_FALSE` otherwise.

See also
  ecore_buffer_consumer_buffer_dequeue()

Consumer should release the Ecore_Buffer after acquiring and using it. By doing release, Ecore_Buffer will be used by provider again, or freed internally if Ecore_Buffer is not necessary anymore. If not, the resource of Ecore_Buffer is continually owned by consumer until released.

References DBG, ecore_buffer_free(), EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

## ecore_buffer_consumer_queue_is_empty()

EAPI Eina_Bool ecore_buffer_consumer_queue_is_empty | ( | Ecore_Buffer_Consumer * | consumer | ) |

Checks if Queue of Ecore_Buffer is empty.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to query

Returns
  `EINA_TRUE` means queue is empty, `EINA_FALSE` otherwise.

References EINA_FALSE, and EINA_SAFETY_ON_NULL_RETURN_VAL.

## ecore_buffer_consumer_provider_add_cb_set()

EAPI void ecore_buffer_consumer_provider_add_cb_set | ( | Ecore_Buffer_Consumer * | consumer,
|  | Ecore_Buffer_Consumer_Provider_Add_Cb | func,
|  | void * | data )

Sets a callback for provider connection events.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to set callbacks on
  [in] | func | The function to call
  [in] | data | A pointer to the user data to store.

A call to this function will set a callback on an Ecore_Buffer_Consumer, causing `func` to be called whenever `consumer` is connected with provider.

References EINA_SAFETY_ON_NULL_RETURN.

## ecore_buffer_consumer_provider_del_cb_set()

EAPI void ecore_buffer_consumer_provider_del_cb_set | ( | Ecore_Buffer_Consumer * | consumer,
|  | Ecore_Buffer_Consumer_Provider_Del_Cb | func,
|  | void * | data )

Sets a callback for provider disconnection events.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to set callbacks on
  [in] | func | The function to call
  [in] | data | A pointer to the user data to store.

A call to this function will set a callback on an Ecore_Buffer_Consumer, causing `func` to be called whenever `consumer` is disconnected with provider.

References EINA_SAFETY_ON_NULL_RETURN.

## ecore_buffer_consumer_buffer_enqueued_cb_set()

EAPI void ecore_buffer_consumer_buffer_enqueued_cb_set | ( | Ecore_Buffer_Consumer * | consumer,
|  | Ecore_Buffer_Consumer_Enqueue_Cb | func,
|  | void * | data )

Sets a callback for enqueued buffer events.

Since
  1.15

Parameters

  [in] | consumer | The Ecore_Buffer_Consumer to set callbacks on
  [in] | func | The function to call
  [in] | data | A pointer to the user data to store.

A call to this function will set a callback on an Ecore_Buffer_Consumer, causing `func` to be called whenever `consumer` has received buffer submitted from provider.

You may success acquire Ecore_Buffer after this callback called.

References EINA_SAFETY_ON_NULL_RETURN.