![]() |
![]() |
![]() |
GStreamer Base Plugins 0.10 Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gst/audio/audio.h> enum GstAudioFlags; enum GstAudioFormat; enum GstAudioFormatFlags; struct GstAudioFormatInfo; struct GstAudioInfo; void gst_audio_info_init (GstAudioInfo *info
); void gst_audio_info_clear (GstAudioInfo *info
); GstAudioInfo * gst_audio_info_copy (GstAudioInfo *info
); void gst_audio_info_free (GstAudioInfo *info
); gboolean gst_audio_info_from_caps (GstAudioInfo *info
,const GstCaps *caps
); GstCaps * gst_audio_info_to_caps (GstAudioInfo *info
); gboolean gst_audio_info_convert (GstAudioInfo *info
,GstFormat src_fmt
,gint64 src_val
,GstFormat dest_fmt
,gint64 *dest_val
); const GstAudioFormatInfo * gst_audio_format_get_info (GstAudioFormat format
); #define GST_AUDIO_FORMAT_INFO_DEPTH (info) #define GST_AUDIO_FORMAT_INFO_ENDIANNESS (info) #define GST_AUDIO_FORMAT_INFO_FLAGS (info) #define GST_AUDIO_FORMAT_INFO_FORMAT (info) #define GST_AUDIO_FORMAT_INFO_IS_FLOAT (info) #define GST_AUDIO_FORMAT_INFO_IS_INTEGER (info) #define GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN (info) #define GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN(info) #define GST_AUDIO_FORMAT_INFO_IS_SIGNED (info) #define GST_AUDIO_FORMAT_INFO_NAME (info) #define GST_AUDIO_FORMAT_INFO_WIDTH (info) #define GST_AUDIO_INFO_BPF (info) #define GST_AUDIO_INFO_BPS (info) #define GST_AUDIO_INFO_CHANNELS (info) #define GST_AUDIO_INFO_DEPTH (i) #define GST_AUDIO_INFO_FLAGS (info) #define GST_AUDIO_INFO_FORMAT (i) #define GST_AUDIO_INFO_HAS_DEFAULT_POSITIONS(info) #define GST_AUDIO_INFO_NAME (i) #define GST_AUDIO_INFO_POSITION (info, c) #define GST_AUDIO_INFO_RATE (info) #define GST_AUDIO_INFO_WIDTH (i) enum GstAudioFieldFlag; #define GST_FRAMES_TO_CLOCK_TIME (frames, rate) #define GST_CLOCK_TIME_TO_FRAMES (clocktime, rate) #define GST_AUDIO_DEF_RATE #define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS #define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS #define GST_AUDIO_INT_PAD_TEMPLATE_CAPS #define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS int gst_audio_frame_byte_size (GstPad *pad
); long gst_audio_frame_length (GstPad *pad
,GstBuffer *buf
); GstClockTime gst_audio_duration_from_pad_buffer (GstPad *pad
,GstBuffer *buf
); gboolean gst_audio_is_buffer_framed (GstPad *pad
,GstBuffer *buf
); void gst_audio_structure_set_int (GstStructure *structure
,GstAudioFieldFlag flag
); GstBuffer * gst_audio_buffer_clip (GstBuffer *buffer
,GstSegment *segment
,gint rate
,gint frame_size
);
typedef enum { GST_AUDIO_FLAG_NONE = 0, GST_AUDIO_FLAG_DEFAULT_POSITIONS = (1 << 0) } GstAudioFlags;
Extra audio flags
no valid flag | |
unpositioned audio layout, position array contains the default layout (meaning that the channel layout was not explicitly specified in the caps) |
Since 0.10.36
typedef enum { GST_AUDIO_FORMAT_UNKNOWN, /* 8 bit */ GST_AUDIO_FORMAT_S8, GST_AUDIO_FORMAT_U8, /* 16 bit */ GST_AUDIO_FORMAT_S16LE, GST_AUDIO_FORMAT_S16BE, GST_AUDIO_FORMAT_U16LE, GST_AUDIO_FORMAT_U16BE, /* 24 bit in low 3 bytes of 32 bits*/ GST_AUDIO_FORMAT_S24_32LE, GST_AUDIO_FORMAT_S24_32BE, GST_AUDIO_FORMAT_U24_32LE, GST_AUDIO_FORMAT_U24_32BE, /* 32 bit */ GST_AUDIO_FORMAT_S32LE, GST_AUDIO_FORMAT_S32BE, GST_AUDIO_FORMAT_U32LE, GST_AUDIO_FORMAT_U32BE, /* 24 bit in 3 bytes*/ GST_AUDIO_FORMAT_S24LE, GST_AUDIO_FORMAT_S24BE, GST_AUDIO_FORMAT_U24LE, GST_AUDIO_FORMAT_U24BE, /* 20 bit in 3 bytes*/ GST_AUDIO_FORMAT_S20LE, GST_AUDIO_FORMAT_S20BE, GST_AUDIO_FORMAT_U20LE, GST_AUDIO_FORMAT_U20BE, /* 18 bit in 3 bytes*/ GST_AUDIO_FORMAT_S18LE, GST_AUDIO_FORMAT_S18BE, GST_AUDIO_FORMAT_U18LE, GST_AUDIO_FORMAT_U18BE, /* float */ GST_AUDIO_FORMAT_F32LE, GST_AUDIO_FORMAT_F32BE, GST_AUDIO_FORMAT_F64LE, GST_AUDIO_FORMAT_F64BE, /* native endianness equivalents */ GST_AUDIO_FORMAT_S16 = _GST_AUDIO_FORMAT_NE(S16), GST_AUDIO_FORMAT_U16 = _GST_AUDIO_FORMAT_NE(U16), GST_AUDIO_FORMAT_S24_32 = _GST_AUDIO_FORMAT_NE(S24_32), GST_AUDIO_FORMAT_U24_32 = _GST_AUDIO_FORMAT_NE(U24_32), GST_AUDIO_FORMAT_S32 = _GST_AUDIO_FORMAT_NE(S32), GST_AUDIO_FORMAT_U32 = _GST_AUDIO_FORMAT_NE(U32), GST_AUDIO_FORMAT_S24 = _GST_AUDIO_FORMAT_NE(S24), GST_AUDIO_FORMAT_U24 = _GST_AUDIO_FORMAT_NE(U24), GST_AUDIO_FORMAT_S20 = _GST_AUDIO_FORMAT_NE(S20), GST_AUDIO_FORMAT_U20 = _GST_AUDIO_FORMAT_NE(U20), GST_AUDIO_FORMAT_S18 = _GST_AUDIO_FORMAT_NE(S18), GST_AUDIO_FORMAT_U18 = _GST_AUDIO_FORMAT_NE(U18), GST_AUDIO_FORMAT_F32 = _GST_AUDIO_FORMAT_NE(F32), GST_AUDIO_FORMAT_F64 = _GST_AUDIO_FORMAT_NE(F64) } GstAudioFormat;
Enum value describing the most common audio formats.
unknown audio format | |
8 bits in 8 bits, signed | |
8 bits in 8 bits, unsigned | |
16 bits in 16 bits, signed, little endian | |
16 bits in 16 bits, signed, big endian | |
16 bits in 16 bits, unsigned, little endian | |
16 bits in 16 bits, unsigned, big endian | |
24 bits in 32 bits, signed, little endian | |
24 bits in 32 bits, signed, big endian | |
24 bits in 32 bits, unsigned, little endian | |
24 bits in 32 bits, unsigned, big endian | |
32 bits in 32 bits, signed, little endian | |
32 bits in 32 bits, signed, big endian | |
32 bits in 32 bits, unsigned, little endian | |
32 bits in 32 bits, unsigned, big endian | |
24 bits in 24 bits, signed, little endian | |
24 bits in 24 bits, signed, big endian | |
24 bits in 24 bits, unsigned, little endian | |
24 bits in 24 bits, unsigned, big endian | |
20 bits in 24 bits, signed, little endian | |
20 bits in 24 bits, signed, big endian | |
20 bits in 24 bits, unsigned, little endian | |
20 bits in 24 bits, unsigned, big endian | |
18 bits in 24 bits, signed, little endian | |
18 bits in 24 bits, signed, big endian | |
18 bits in 24 bits, unsigned, little endian | |
18 bits in 24 bits, unsigned, big endian | |
32-bit floating point samples, little endian | |
32-bit floating point samples, big endian | |
64-bit floating point samples, little endian | |
64-bit floating point samples, big endian | |
16 bits in 16 bits, signed, native endianness | |
16 bits in 16 bits, unsigned, native endianness | |
24 bits in 32 bits, signed, native endianness | |
24 bits in 32 bits, unsigned, native endianness | |
32 bits in 32 bits, signed, native endianness | |
32 bits in 32 bits, unsigned, native endianness | |
24 bits in 24 bits, signed, native endianness | |
24 bits in 24 bits, unsigned, native endianness | |
20 bits in 24 bits, signed, native endianness | |
20 bits in 24 bits, unsigned, native endianness | |
18 bits in 24 bits, signed, native endianness | |
18 bits in 24 bits, unsigned, native endianness | |
32-bit floating point samples, native endianness | |
64-bit floating point samples, native endianness |
Since 0.10.36
typedef enum { GST_AUDIO_FORMAT_FLAG_INTEGER = (1 << 0), GST_AUDIO_FORMAT_FLAG_FLOAT = (1 << 1), GST_AUDIO_FORMAT_FLAG_SIGNED = (1 << 2), GST_AUDIO_FORMAT_FLAG_COMPLEX = (1 << 4) } GstAudioFormatFlags;
The different audio flags that a format info can have.
integer samples | |
float samples | |
signed samples | |
complex layout |
Since 0.10.36
struct GstAudioFormatInfo { GstAudioFormat format; const gchar * name; GstAudioFormatFlags flags; gint endianness; gint width; gint depth; guint8 silence[8]; };
Information for an audio format.
GstAudioFormat |
GstAudioFormat |
const gchar * |
string representation of the format |
GstAudioFormatFlags |
GstAudioFormatFlags |
gint |
the endianness |
gint |
amount of bits used for one sample |
gint |
amount of valid bits in width
|
width /8 bytes with 1 silent sample |
Since 0.10.36
struct GstAudioInfo { const GstAudioFormatInfo *finfo; GstAudioFlags flags; gint rate; gint channels; gint bpf; GstAudioChannelPosition position[64]; };
Information describing audio properties. This information can be filled
in from GstCaps with gst_audio_info_from_caps()
.
Use the provided macros to access the info in this structure.
const GstAudioFormatInfo * |
the format info of the audio |
GstAudioFlags |
additional audio flags |
gint |
the audio sample rate |
gint |
the number of channels |
gint |
the number of bytes for one frame, this is the size of one
sample * channels
|
GstAudioChannelPosition |
the position for each channel (assume all NONE for >64 channels) |
Since 0.10.36
gboolean gst_audio_info_from_caps (GstAudioInfo *info
,const GstCaps *caps
);
Parse caps
and update info
.
|
a GstAudioInfo |
|
a GstCaps |
Returns : |
TRUE if caps could be parsed |
Since 0.10.36
GstCaps * gst_audio_info_to_caps (GstAudioInfo *info
);
Convert the values of info
into a GstCaps.
|
a GstAudioInfo |
Returns : |
the new GstCaps containing the
info of info . [transfer full]
|
Since 0.10.36
gboolean gst_audio_info_convert (GstAudioInfo *info
,GstFormat src_fmt
,gint64 src_val
,GstFormat dest_fmt
,gint64 *dest_val
);
const GstAudioFormatInfo * gst_audio_format_get_info (GstAudioFormat format
);
#define GST_AUDIO_FORMAT_INFO_ENDIANNESS(info) ((info)->endianness)
#define GST_AUDIO_FORMAT_INFO_IS_FLOAT(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_FLOAT)
#define GST_AUDIO_FORMAT_INFO_IS_INTEGER(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_INTEGER)
#define GST_AUDIO_FORMAT_INFO_IS_BIG_ENDIAN(info) ((info)->endianness == G_BIG_ENDIAN)
#define GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN(info) ((info)->endianness == G_LITTLE_ENDIAN)
#define GST_AUDIO_FORMAT_INFO_IS_SIGNED(info) !!((info)->flags & GST_AUDIO_FORMAT_FLAG_SIGNED)
#define GST_AUDIO_INFO_HAS_DEFAULT_POSITIONS(info) ((info)->flags & GST_AUDIO_FLAG_DEFAULT_POSITIONS)
typedef enum { GST_AUDIO_FIELD_RATE = (1 << 0), GST_AUDIO_FIELD_CHANNELS = (1 << 1), GST_AUDIO_FIELD_ENDIANNESS = (1 << 2), GST_AUDIO_FIELD_WIDTH = (1 << 3), GST_AUDIO_FIELD_DEPTH = (1 << 4), GST_AUDIO_FIELD_SIGNED = (1 << 5) } GstAudioFieldFlag;
GstAudioFieldFlag
is deprecated and should not be used in newly-written code. use gst_structure_set()
directly
Do not use anymore.
#define GST_FRAMES_TO_CLOCK_TIME(frames, rate)
Calculate clocktime from sample frames
and rate
.
|
sample frames |
|
sampling rate |
#define GST_CLOCK_TIME_TO_FRAMES(clocktime, rate)
Calculate frames from clocktime
and sample rate
.
|
clock time |
|
sampling rate |
#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS
Template caps for float audio. Can be used when defining a GstStaticPadTemplate
#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
Template caps for 32bit float mono audio in native byte-order. Can be used when defining a GstStaticPadTemplate
#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS
Template caps for integer audio. Can be used when defining a GstStaticPadTemplate
#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS
Template caps for 16bit integer stereo audio in native byte-order. Can be used when defining a GstStaticPadTemplate
int gst_audio_frame_byte_size (GstPad *pad
);
Calculate byte size of an audio frame.
|
the GstPad to get the caps from |
Returns : |
the byte size, or 0 if there was an error |
long gst_audio_frame_length (GstPad *pad
,GstBuffer *buf
);
Calculate length of buffer in frames.
GstClockTime gst_audio_duration_from_pad_buffer (GstPad *pad
,GstBuffer *buf
);
Calculate length in nanoseconds of audio buffer buf
based on capabilities of
pad
.
gboolean gst_audio_is_buffer_framed (GstPad *pad
,GstBuffer *buf
);
Check if the buffer size is a whole multiple of the frame size.
void gst_audio_structure_set_int (GstStructure *structure
,GstAudioFieldFlag flag
);
gst_audio_structure_set_int
is deprecated and should not be used in newly-written code. use gst_structure_set()
Do not use anymore.
|
a GstStructure |
|
a set of GstAudioFieldFlag |
GstBuffer * gst_audio_buffer_clip (GstBuffer *buffer
,GstSegment *segment
,gint rate
,gint frame_size
);
Clip the buffer to the given GstSegment
.
After calling this function the caller does not own a reference to
buffer
anymore.
|
The buffer to clip. |
|
Segment in GST_FORMAT_TIME or GST_FORMAT_DEFAULT to which the buffer should be clipped. |
|
sample rate. |
|
size of one audio frame in bytes. |
Returns : |
NULL if the buffer is completely outside the configured segment,
otherwise the clipped buffer is returned.
If the buffer has no timestamp, it is assumed to be inside the segment and
is not clipped |
Since 0.10.14