## queue

queue — Simple asynchronous data queue.

## Synopsis

                        GstQueue;
                        GstQueueSize;

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstQueue

## Properties

      "current-level-buffers"    guint                 : Read
      "current-level-bytes"      guint                 : Read
      "current-level-time"       guint64               : Read
      "leaky"                    GstQueueLeaky         : Read / Write
      "max-size-buffers"         guint                 : Read / Write
      "max-size-bytes"           guint                 : Read / Write
      "max-size-time"            guint64               : Read / Write
      "min-threshold-buffers"    guint                 : Read / Write
      "min-threshold-bytes"      guint                 : Read / Write
      "min-threshold-time"       guint64               : Read / Write

## Signals

      "overrun"                                        : Run First
      "running"                                        : Run First
      "underrun"                                       : Run First
      "pushing"                                        : Run First

## Description

Data is queued until one of the limits specified by the GstQueue:max-size-buffers, GstQueue:max-size-bytes and/or GstQueue:max-size-time properties has been reached. Any attempt to push more buffers into the queue will block the pushing thread until more space becomes available.

The queue will create a new thread on the source pad to decouple the processing on sink and source pad.

You can query how many buffers are queued by reading the GstQueue:current-level-buffers property. You can track changes by connecting to the notify::current-level-buffers signal (which like all signals will be emitted from the streaming thread). The same applies to the GstQueue:current-level-time and GstQueue:current-level-bytes properties.

The default queue size limits are 200 buffers, 10MB of data, or one second worth of data, whichever is reached first.

As said earlier, the queue blocks by default when one of the specified maximums (bytes, time, buffers) has been reached. You can set the GstQueue:leaky property to specify that instead of blocking it should leak (drop) new or old buffers.

The GstQueue::underrun signal is emitted when the queue has less data than the specified minimum thresholds require (by default: when the queue is empty). The GstQueue::overrun signal is emitted when the queue is filled up. Both signals are emitted from the context of the streaming thread.

### Element Information

plugin | coreelements
author | Erik Walthinsen <omega@cse.ogi.edu>
class | Generic

### Element Pads

name | src
direction | source
presence | always
details | ANY

name | sink
direction | sink
presence | always
details | ANY

## Details

### GstQueue

    typedef struct _GstQueue GstQueue;

Opaque GstQueue structure.

### GstQueueSize

    typedef struct {
        guint   buffers;
        guint   bytes;
        guint64 time;
    } GstQueueSize;

Structure describing the size of a queue.

guint `buffers`; | number of buffers
guint `bytes`; | number of bytes
guint64 `time`; | amount of time

## Property Details

### The "`current-level-buffers`" property

      "current-level-buffers"    guint                 : Read

Current number of buffers in the queue.

Default value: 0

### The "`current-level-bytes`" property

      "current-level-bytes"      guint                 : Read

Current amount of data in the queue (bytes).

Default value: 0

### The "`current-level-time`" property

      "current-level-time"       guint64               : Read

Current amount of data in the queue (in ns).

Default value: 0

### The "`leaky`" property

      "leaky"                    GstQueueLeaky         : Read / Write

Where the queue leaks, if at all.

Default value: Not Leaky

### The "`max-size-buffers`" property

      "max-size-buffers"         guint                 : Read / Write

Max. number of buffers in the queue (0=disable).

Default value: 200

### The "`max-size-bytes`" property

      "max-size-bytes"           guint                 : Read / Write

Max. amount of data in the queue (bytes, 0=disable).

Default value: 10485760

### The "`max-size-time`" property

      "max-size-time"            guint64               : Read / Write

Max. amount of data in the queue (in ns, 0=disable).

Default value: 1000000000

### The "`min-threshold-buffers`" property

      "min-threshold-buffers"    guint                 : Read / Write

Min. number of buffers in the queue to allow reading (0=disable).

Default value: 0

### The "`min-threshold-bytes`" property

      "min-threshold-bytes"      guint                 : Read / Write

Min. amount of data in the queue to allow reading (bytes, 0=disable).

Default value: 0

### The "`min-threshold-time`" property

      "min-threshold-time"       guint64               : Read / Write

Min. amount of data in the queue to allow reading (in ns, 0=disable).

Default value: 0

## Signal Details

### The "overrun" signal

    void                user_function                      (GstQueue *queue,
                                                            gpointer  user_data)      : Run First

Reports that the buffer became full (overrun). A buffer is full if the total amount of data inside it (num-buffers, time, size) is higher than the boundary values which can be set through the GObject properties.

`queue` : | the queue instance
`user_data` : | user data set when the signal handler was connected.

### The "running" signal

    void                user_function                      (GstQueue *queue,
                                                            gpointer  user_data)      : Run First

Reports that enough (min-threshold) data is in the queue. Use this signal together with the underrun signal to pause the pipeline on underrun and wait for the queue to fill-up before resume playback.

`queue` : | the queue instance
`user_data` : | user data set when the signal handler was connected.

### The "underrun" signal

    void                user_function                      (GstQueue *queue,
                                                            gpointer  user_data)      : Run First

Reports that the buffer became empty (underrun). A buffer is empty if the total amount of data inside it (num-buffers, time, size) is lower than the boundary values which can be set through the GObject properties.

`queue` : | the queue instance
`user_data` : | user data set when the signal handler was connected.

### The "pushing" signal

    void                user_function                      (GstQueue *queue,
                                                            gpointer  user_data)      : Run First

Reports when the queue has enough data to start pushing data again on the source pad.

`queue` : | the queue instance
`user_data` : | user data set when the signal handler was connected.