## appsrc appsrc — Allow the application to feed buffers to a pipeline |

## Synopsis

                        GstAppSrc;

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstAppSrc

## Implemented Interfaces

GstAppSrc implements GstURIHandler.

## Properties

      "block"                    gboolean              : Read / Write
      "caps"                     GstCaps*              : Read / Write
      "format"                   GstFormat             : Read / Write
      "is-live"                  gboolean              : Read / Write
      "max-bytes"                guint64               : Read / Write
      "max-latency"              gint64                : Read / Write
      "min-latency"              gint64                : Read / Write
      "size"                     gint64                : Read / Write
      "stream-type"              GstAppStreamType      : Read / Write
      "emit-signals"             gboolean              : Read / Write

## Signals

      "end-of-stream"                                  : Run Last / Action
      "enough-data"                                    : Run Last
      "need-data"                                      : Run Last
      "push-buffer"                                    : Run Last / Action
      "seek-data"                                      : Run Last

## Description

The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, Appsrc provides external API functions.

For the documentation of the API, please see the libgstapp section in the GStreamer Plugins Base Libraries documentation.

## Synopsis

### Element Information

plugin | app
author | David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>
class | Generic/Src

### Element Pads

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

## Synopsis

### Element Information

plugin | app
author | David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>
class | Generic/Src

### Element Pads

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

## Details

### GstAppSrc

    typedef struct _GstAppSrc GstAppSrc;

## Property Details

### The `"block"` property

      "block"                    gboolean              : Read / Write

Block push-buffer when max-bytes are queued.

Default value: FALSE

### The `"caps"` property

      "caps"                     GstCaps*              : Read / Write

The allowed caps for the src pad.

### The `"format"` property

      "format"                   GstFormat             : Read / Write

The format of the segment events and seek.

Default value: GST_FORMAT_BYTES

### The `"is-live"` property

      "is-live"                  gboolean              : Read / Write

Whether to act as a live source.

Default value: FALSE

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

      "max-bytes"                guint64               : Read / Write

The maximum number of bytes to queue internally (0 = unlimited).

Default value: 200000

### The `"max-latency"` property

      "max-latency"              gint64                : Read / Write

The maximum latency (-1 = unlimited).

Allowed values: >= -1

Default value: -1

### The `"min-latency"` property

      "min-latency"              gint64                : Read / Write

The minimum latency (-1 = default).

Allowed values: >= -1

Default value: -1

### The `"size"` property

      "size"                     gint64                : Read / Write

The size of the data stream in bytes (-1 if unknown).

Allowed values: >= -1

Default value: -1

### The `"stream-type"` property

      "stream-type"              GstAppStreamType      : Read / Write

the type of the stream.

Default value: Stream

### The `"emit-signals"` property

      "emit-signals"             gboolean              : Read / Write

Emit new-preroll and new-buffer signals.

Default value: TRUE

## Signal Details

### The `"end-of-stream"` signal

    GstFlowReturn       user_function                      (GstAppSrc *appsrc,
                                                            gpointer   user_data)      : Run Last / Action

Notify `appsrc` that no more buffer are available.

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

### The `"enough-data"` signal

    void                user_function                      (GstAppSrc *appsrc,
                                                            gpointer   user_data)      : Run Last

Signal that the source has enough data. It is recommended that the application stops calling push-buffer until the need-data signal is emited again to avoid excessive buffer queueing.

`appsrc` : | the appsrc element that emited the signal
`user_data` : | user data set when the signal handler was connected.

### The `"need-data"` signal

    void                user_function                      (GstAppSrc *appsrc,
                                                            guint      length,
                                                            gpointer   user_data)      : Run Last

Signal that the source needs more data. In the callback or from another thread you should call push-buffer or end-of-stream.

`length` is just a hint and when it is set to -1, any number of bytes can be pushed into `appsrc`.

You can call push-buffer multiple times until the enough-data signal is fired.

`appsrc` : | the appsrc element that emited the signal
`length` : | the amount of bytes needed.
`user_data` : | user data set when the signal handler was connected.

### The `"push-buffer"` signal

    GstFlowReturn       user_function                      (GstAppSrc *appsrc,
                                                            GstBuffer *buffer,
                                                            gpointer   user_data)      : Run Last / Action

Adds a buffer to the queue of buffers that the appsrc element will push to its source pad. This function does not take ownership of the buffer so the buffer needs to be unreffed after calling this function.

When the block property is TRUE, this function can block until free space becomes available in the queue.

`appsrc` : | the appsrc
`buffer` : | a buffer to push
`user_data` : | user data set when the signal handler was connected.

### The `"seek-data"` signal

    gboolean            user_function                      (GstAppSrc *appsrc,
                                                            guint64    offset,
                                                            gpointer   user_data)      : Run Last

Seek to the given offset. The next push-buffer should produce buffers from the new `offset`. This callback is only called for seekable stream types.

`appsrc` : | the appsrc element that emited the signal
`offset` : | the offset to seek to
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` if the seek succeeded.