audiorate

audiorate — Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream

Synopsis

struct              GstAudioRate;

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GstObject
               +----GstElement
                     +----GstAudioRate

Properties

  "add"                      guint64               : Read
  "drop"                     guint64               : Read
  "in"                       guint64               : Read
  "out"                      guint64               : Read
  "silent"                   gboolean              : Read / Write
  "tolerance"                guint64               : Read / Write
  "skip-to-first"            gboolean              : Read / Write

Description

This element takes an incoming stream of timestamped raw audio frames and produces a perfect stream by inserting or dropping samples as needed.

This operation may be of use to link to elements that require or otherwise implicitly assume a perfect stream as they do not store timestamps, but derive this by some means (e.g. bitrate for some AVI cases).

The properties "in", "out", "add" and "drop" can be read to obtain information about number of input samples, output samples, dropped samples (i.e. the number of unused input samples) and inserted samples (i.e. the number of samples added to stream).

When the "silent" property is set to FALSE, a GObject property notification will be emitted whenever one of the "add" or "drop" values changes. This can potentially cause performance degradation. Note that property notification will happen from the streaming thread, so applications should be prepared for this.

If the "tolerance" property is non-zero, and an incoming buffer's timestamp deviates less than the property indicates from what would make a 'perfect time', then no samples will be added or dropped. Note that the output is still guaranteed to be a perfect stream, which means that the incoming data is then simply shifted (by less than the indicated tolerance) to a perfect time.

Example pipelines

1
gst-launch -v alsasrc ! audiorate ! wavenc ! filesink location=alsa.wav
Capture audio from an ALSA device, and turn it into a perfect stream for saving in a raw audio file.

Synopsis

Element Information

plugin

audiorate

author

Wim Taymans <wim@fluendo.com>

class

Filter/Effect/Audio

Element Pads

name

sink

direction

sink

presence

always

details

audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }

name

src

direction

source

presence

always

details

audio/x-raw, format=(string){ S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], layout=(string){ interleaved, non-interleaved }

Details

struct GstAudioRate

struct GstAudioRate;

Opaque data structure.

Property Details

The "add" property

  "add"                      guint64               : Read

Number of added samples.

Default value: 0


The "drop" property

  "drop"                     guint64               : Read

Number of dropped samples.

Default value: 0


The "in" property

  "in"                       guint64               : Read

Number of input samples.

Default value: 0


The "out" property

  "out"                      guint64               : Read

Number of output samples.

Default value: 0


The "silent" property

  "silent"                   gboolean              : Read / Write

Don't emit notify for dropped and duplicated frames.

Default value: TRUE


The "tolerance" property

  "tolerance"                guint64               : Read / Write

The difference between incoming timestamp and next timestamp must exceed the given value for audiorate to add or drop samples.

Default value: 40000000

Since 0.10.26


The "skip-to-first" property

  "skip-to-first"            gboolean              : Read / Write

Don't produce buffers before the first one we receive.

Default value: FALSE

Since 0.10.33

See Also

GstVideoRate