GstDataQueue

GstDataQueue — Threadsafe queueing object

Synopsis


#include <gst/base/gstdataqueue.h>


            GstDataQueue;
            GstDataQueueSize;
gboolean    (*GstDataQueueCheckFullFunction)
                                            (GstDataQueue *queue,
                                             guint visible,
                                             guint bytes,
                                             guint64 time,
                                             gpointer checkdata);
            GstDataQueueItem;
GstDataQueue* gst_data_queue_new            (GstDataQueueCheckFullFunction checkfull,
                                             gpointer checkdata);
gboolean    gst_data_queue_push             (GstDataQueue *queue,
                                             GstDataQueueItem *item);
gboolean    gst_data_queue_pop              (GstDataQueue *queue,
                                             GstDataQueueItem **item);
void        gst_data_queue_flush            (GstDataQueue *queue);
void        gst_data_queue_set_flushing     (GstDataQueue *queue,
                                             gboolean flushing);
gboolean    gst_data_queue_drop_head        (GstDataQueue *queue,
                                             GType type);
gboolean    gst_data_queue_is_full          (GstDataQueue *queue);
gboolean    gst_data_queue_is_empty         (GstDataQueue *queue);


Description

GstDataQueue is an object that handles threadsafe queueing of object. It also provides size-related functionnality. This object should be used for any GstElement that wishes to provide some sort of queueing functionnality.

Details

GstDataQueue

typedef struct {
  GObject object;
} GstDataQueue;

Opaque GstDataQueue structure.


GstDataQueueSize

typedef struct {
  guint visible;
  guint bytes;
  guint64 time;
} GstDataQueueSize;

Structure describing the size of a queue.

guint visible;guintvisible number of buffers number of buffers guint bytes;guintbytes number of bytes number of bytes guint64 time;guint64time amount of time amount of time
guint visible; number of buffers
guint bytes; number of bytes
guint64 time; amount of time

GstDataQueueCheckFullFunction ()

gboolean    (*GstDataQueueCheckFullFunction)
                                            (GstDataQueue *queue,
                                             guint visible,
                                             guint bytes,
                                             guint64 time,
                                             gpointer checkdata);

The prototype of the function used to inform the queue that it should be considered as full.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueuevisible :visible The number of visible items currently in the queue. The number of visible items currently in the queue. bytes :bytes The amount of bytes currently in the queue. The amount of bytes currently in the queue. time :time The accumulated duration of the items currently in the queue. The accumulated duration of the items currently in the queue. checkdata :checkdata The gpointer registered when the GstDataQueue was created. The gpointer registered when the GstDataQueue was created. gpointergpointerGstDataQueueGstDataQueueReturns :Returns TRUE if the queue should be considered full. TRUE if the queue should be considered full. TRUETRUE
queue : a GstDataQueue.
visible : The number of visible items currently in the queue.
bytes : The amount of bytes currently in the queue.
time : The accumulated duration of the items currently in the queue.
checkdata : The gpointer registered when the GstDataQueue was created.
Returns : TRUE if the queue should be considered full.

GstDataQueueItem

typedef struct {
  GstMiniObject *object;
  guint size;
  guint64 duration;
  gboolean visible;

  /* user supplied destroy function */
  GDestroyNotify destroy;
} GstDataQueueItem;

Structure used by GstDataQueue. You can supply a different structure, as long as the top of the structure is identical to this structure.

GstMiniObject *object;GstMiniObjectobject the GstMiniObject to queue. the GstMiniObject to queue. GstMiniObjectGstMiniObjectguint size;guintsize the size in bytes of the miniobject. the size in bytes of the miniobject. guint64 duration;guint64duration the duration in GstClockTime of the miniobject. Can not be GST_CLOCK_TIME_NONE. the duration in GstClockTime of the miniobject. Can not be GST_CLOCK_TIME_NONE. GstClockTimeGstClockTimeGST_CLOCK_TIME_NONEGST_CLOCK_TIME_NONEgboolean visible;gbooleanvisible TRUE if object should be considered as a visible object. TRUE if object should be considered as a visible object. TRUETRUEobjectGDestroyNotify destroy;GDestroyNotifydestroy The GDestroyNotify to use to free the GstDataQueueItem. The GDestroyNotify to use to free the GstDataQueueItem. GDestroyNotifyGDestroyNotifyGstDataQueueItemGstDataQueueItem
GstMiniObject *object; the GstMiniObject to queue.
guint size; the size in bytes of the miniobject.
guint64 duration; the duration in GstClockTime of the miniobject. Can not be GST_CLOCK_TIME_NONE.
gboolean visible; TRUE if object should be considered as a visible object.
GDestroyNotify destroy; The GDestroyNotify to use to free the GstDataQueueItem.

gst_data_queue_new ()

GstDataQueue* gst_data_queue_new            (GstDataQueueCheckFullFunction checkfull,
                                             gpointer checkdata);

checkfull :checkfull the callback used to tell if the element considers the queue full or not. the callback used to tell if the element considers the queue full or not. checkdata :checkdata a gpointer that will be given in the checkfull callback. a gpointer that will be given in the checkfull callback. gpointergpointercheckfullReturns :Returns a new GstDataQueue. a new GstDataQueue. GstDataQueueGstDataQueue
checkfull : the callback used to tell if the element considers the queue full or not.
checkdata : a gpointer that will be given in the checkfull callback.
Returns : a new GstDataQueue.

gst_data_queue_push ()

gboolean    gst_data_queue_push             (GstDataQueue *queue,
                                             GstDataQueueItem *item);

Pushes a GstDataQueueItem (or a structure that begins with the same fields) on the queue. If the queue is full, the call will block until space is available, OR the queue is set to flushing state. MT safe.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueueitem :item a GstDataQueueItem. a GstDataQueueItem. GstDataQueueItemGstDataQueueItemReturns :Returns TRUE if the item was successfully pushed on the queue. TRUE if the item was successfully pushed on the queue. TRUETRUEitemqueue
queue : a GstDataQueue.
item : a GstDataQueueItem.
Returns : TRUE if the item was successfully pushed on the queue.

gst_data_queue_pop ()

gboolean    gst_data_queue_pop              (GstDataQueue *queue,
                                             GstDataQueueItem **item);

Retrieves the first item available on the queue. If the queue is currently empty, the call will block until at least one item is available, OR the queue is set to the flushing state. MT safe.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueueitem :item pointer to store the returned GstDataQueueItem. pointer to store the returned GstDataQueueItem. GstDataQueueItemGstDataQueueItemReturns :Returns TRUE if an item was successfully retrieved from the queue. TRUE if an item was successfully retrieved from the queue. TRUETRUEitemqueue
queue : a GstDataQueue.
item : pointer to store the returned GstDataQueueItem.
Returns : TRUE if an item was successfully retrieved from the queue.

gst_data_queue_flush ()

void        gst_data_queue_flush            (GstDataQueue *queue);

Flushes all the contents of the queue. Any call to gst_data_queue_pull and gst_data_queue_pop will be released. MT safe.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueue
queue : a GstDataQueue.

gst_data_queue_set_flushing ()

void        gst_data_queue_set_flushing     (GstDataQueue *queue,
                                             gboolean flushing);

Sets the queue to flushing state if flushing is TRUE. If set to flushing state, any incoming data on the queue will be discarded. Any call currently blocking on gst_data_queue_push or gst_data_queue_pop will return straight away with a return value of FALSE. While the queue is in flushing state, all calls to those two functions will return FALSE. MT Safe.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueueflushing :flushing a gboolean stating if the queue will be flushing or not. a gboolean stating if the queue will be flushing or not. gbooleangboolean
queue : a GstDataQueue.
flushing : a gboolean stating if the queue will be flushing or not.

gst_data_queue_drop_head ()

gboolean    gst_data_queue_drop_head        (GstDataQueue *queue,
                                             GType type);

Pop and unref the head-most GstMiniObject with the given GType.

queue :queue The GstDataQueue to drop an item from. The GstDataQueue to drop an item from. GstDataQueueGstDataQueuetype :type The GType of the item to drop. The GType of the item to drop. GTypeGTypeReturns :Returns TRUE if an element was removed. TRUE if an element was removed.
queue : The GstDataQueue to drop an item from.
type : The GType of the item to drop.
Returns : TRUE if an element was removed.

gst_data_queue_is_full ()

gboolean    gst_data_queue_is_full          (GstDataQueue *queue);

Queries if queue is full. This check will be done using the GstDataQueueCheckFullCallback registered with queue. MT safe.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueueReturns :Returns TRUE if queue is full. TRUE if queue is full. TRUETRUEqueue
queue : a GstDataQueue.
Returns : TRUE if queue is full.

gst_data_queue_is_empty ()

gboolean    gst_data_queue_is_empty         (GstDataQueue *queue);

Queries if there are any items in the queue. MT safe.

queue :queue a GstDataQueue. a GstDataQueue. GstDataQueueGstDataQueueReturns :Returns TRUE if queue is empty. TRUE if queue is empty. TRUETRUEqueue
queue : a GstDataQueue.
Returns : TRUE if queue is empty.