rawaudioparse

rawaudioparse

Properties

GValueArray * channel-positions Read / Write
GstRawAudioParseFormat format Read / Write
gboolean interleaved Read / Write
gint num-channels Read / Write
GstAudioFormat pcm-format Read / Write
gint sample-rate Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GstObject
            ╰── GstElement
                ╰── GstBaseParse
                    ╰── GstRawBaseParse
                        ╰── GstRawAudioParse

Description

This element parses incoming data as raw audio samples and timestamps it. It also handles seek queries in said raw audio data, and ensures that output buffers contain an integer number of samples, even if the input buffers don't. For example, with sample format S16LE and 2 channels, an input buffer of 411 bytes contains 102.75 samples. rawaudioparse will then output 102 samples (= 408 bytes) and keep the remaining 3 bytes. These will then be prepended to the next input data.

The element implements the properties and sink caps configuration as specified in the GstRawBaseParse documentation. The properties configuration can be modified by using the sample-rate, num-channels, channel-positions, format, and pcm-format properties.

Currently, this parser supports raw data in a-law, mu-law, or linear PCM format.

To facilitate operation with the unalignedaudioparse element, rawaudioparse supports the "audio/x-unaligned-raw" media type. This is treated identically to "audio/x-raw", except that it is used by source elements which do not guarantee that the buffers they push out are timestamped and contain an integer amount of samples (see the 411 bytes example above). By using a different media type, it is guaranteed that unalignedaudioparse is autoplugged, making sure that the autoplugged chain does not push unparsed content downstream. The source caps' media type with linear PCM data is always "audio/x-raw", even if the sink caps use "audio/x-unaligned-raw".

The channel-positions property can be used to set explicit position information for each channel. If the array that is passed to this property does not match the number of channels indicated by num-channels, then said number of channels is updated to the array length. If channel-positions is NULL, then the default GStreamer positioning is used. This property is also useful for swapping left and right in a stereo signal for example.

Example pipelines

1
2
gst-launch-1.0 souphttpsrc http://my-dlna-server/track.l16 \
    rawaudioparse ! audioconvert ! audioresample ! autoaudiosink

Receive L16 data from a DLNA server, parse and timestamp it with rawaudioparse, and play it. use-sink-caps is set to true since souphttpsrc will set its source pad's caps to audio/x-unaligned-raw for the L16 stream.

1
2
3
gst-launch-1.0 filesrc location=audio.raw ! rawaudioparse use-sink-caps=false \
        format=pcm pcm-format=s16le sample-rate=48000 num-channels=2 \
        audioconvert ! audioresample ! autoaudiosink

Read raw data from a local file and parse it as PCM data with 48000 Hz sample rate, signed 16 bit integer samples, and 2 channels. use-sink-caps is set to false to ensure the property information is used and the parser does not expect audio/x-raw or audio/x-unaligned-raw caps.

Synopsis

Element Information

plugin

rawparse

author

Carlos Rafael Giani <dv@pseudoterminal.org>

class

Codec/Parser/Audio

Element Pads

name

sink

direction

sink

presence

always

details

audio/x-unaligned-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 }

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 }

audio/x-alaw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-mulaw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

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 }

audio/x-alaw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

audio/x-mulaw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ]

Functions

Types and Values

struct GstRawAudioParse

struct GstRawAudioParse;

Property Details

The “channel-positions” property

  “channel-positions”        GValueArray *

Channel positions used on the output.

Flags: Read / Write


The “format” property

  “format”                   GstRawAudioParseFormat

Format of the raw audio stream.

Flags: Read / Write

Default value: PCM


The “interleaved” property

  “interleaved”              gboolean

True if audio has interleaved layout.

Flags: Read / Write

Default value: TRUE


The “num-channels” property

  “num-channels”             gint

Number of channels in raw stream.

Flags: Read / Write

Allowed values: >= 1

Default value: 2


The “pcm-format” property

  “pcm-format”               GstAudioFormat

Format of audio samples in PCM stream (ignored if format property is not set to pcm).

Flags: Read / Write

Default value: GST_AUDIO_FORMAT_UNKNOWN


The “sample-rate” property

  “sample-rate”              gint

Rate of audio samples in raw stream.

Flags: Read / Write

Allowed values: >= 1

Default value: 44100