gstaudio

gstaudio — Support library for audio elements

Synopsis


#include <gst/audio/audio.h>


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);

Description

This library contains some helper functions for audio elements.

Details

enum GstAudioFieldFlag

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;

Do not use anymore. Deprecated: use gst_structure_set() directly


GST_FRAMES_TO_CLOCK_TIME()

#define     GST_FRAMES_TO_CLOCK_TIME(frames, rate)

Calculate clocktime from sample frames and rate.

frames : sample frames
rate : sampling rate

GST_CLOCK_TIME_TO_FRAMES()

#define     GST_CLOCK_TIME_TO_FRAMES(clocktime, rate)

Calculate frames from clocktime and sample rate.

clocktime : clock time
rate : sampling rate

GST_AUDIO_DEF_RATE

#define GST_AUDIO_DEF_RATE 44100

Standard sampling rate used in consumer audio.


GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS

#define     GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS


GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS

#define     GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS


GST_AUDIO_INT_PAD_TEMPLATE_CAPS

#define     GST_AUDIO_INT_PAD_TEMPLATE_CAPS


GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS

#define     GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS


gst_audio_frame_byte_size ()

int         gst_audio_frame_byte_size       (GstPad *pad);

Calculate byte size of an audio frame.

pad : the GstPad to get the caps from
Returns : the byte size, or 0 if there was an error

gst_audio_frame_length ()

long        gst_audio_frame_length          (GstPad *pad,
                                             GstBuffer *buf);

Calculate length of buffer in frames.

pad : the GstPad to get the caps from
buf : the GstBuffer
Returns : 0 if there's an error, or the number of frames if everything's ok

gst_audio_duration_from_pad_buffer ()

GstClockTime gst_audio_duration_from_pad_buffer
                                            (GstPad *pad,
                                             GstBuffer *buf);

Calculate length in nanoseconds of audio buffer buf based on capabilities of pad.

Return: the length.

pad : the GstPad to get the caps from
buf : the GstBuffer
Returns :

gst_audio_is_buffer_framed ()

gboolean    gst_audio_is_buffer_framed      (GstPad *pad,
                                             GstBuffer *buf);

Check if the buffer size is a whole multiple of the frame size.

pad : the GstPad to get the caps from
buf : the GstBuffer
Returns : TRUE if buffer size is multiple.

gst_audio_structure_set_int ()

void        gst_audio_structure_set_int     (GstStructure *structure,
                                             GstAudioFieldFlag flag);

Do not use anymore. Deprecated: use gst_structure_set()

structure : a GstStructure
flag : a set of GstAudioFieldFlag