};
/* GObject functions */
-static void gst_alsa_class_init (GstAlsaClass *klass);
-static void gst_alsa_init (GstAlsa *this);
-static void gst_alsa_dispose (GObject *object);
-static void gst_alsa_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gst_alsa_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+static void gst_alsa_class_init (GstAlsaClass * klass);
+static void gst_alsa_init (GstAlsa * this);
+static void gst_alsa_dispose (GObject * object);
+static void gst_alsa_set_property (GObject * object,
+ guint prop_id,
+ const GValue * value,
+ GParamSpec * pspec);
+static void gst_alsa_get_property (GObject * object,
+ guint prop_id,
+ GValue * value,
+ GParamSpec * pspec);
/* GStreamer functions for pads and state changing */
static GstPadTemplate * gst_alsa_src_pad_factory (void);
static GstPadTemplate * gst_alsa_sink_pad_factory (void);
static GstPadTemplate * gst_alsa_sink_request_pad_factory (void);
-static GstPad * gst_alsa_request_new_pad (GstElement *element,
- GstPadTemplate *templ,
- const gchar *name);
-static GstPadLinkReturn gst_alsa_link (GstPad *pad,
- GstCaps *caps);
-static GstCaps * gst_alsa_get_caps (GstPad *pad,
- GstCaps *caps);
-static GstCaps * gst_alsa_caps (snd_pcm_format_t format,
- gint rate,
- gint channels);
+static GstPad * gst_alsa_request_new_pad (GstElement * element,
+ GstPadTemplate * templ,
+ const gchar * name);
+static GstPadLinkReturn gst_alsa_link (GstPad * pad,
+ GstCaps * caps);
+static GstCaps * gst_alsa_get_caps (GstPad * pad,
+ GstCaps * caps);
+static GstCaps * gst_alsa_caps (snd_pcm_format_t format,
+ gint rate,
+ gint channels);
-static GstBufferPool * gst_alsa_src_get_buffer_pool (GstPad *pad);
+static GstBufferPool * gst_alsa_src_get_buffer_pool (GstPad * pad);
-static GstElementStateReturn gst_alsa_change_state (GstElement *element);
+static GstElementStateReturn gst_alsa_change_state (GstElement * element);
/* audio processing functions */
-static int gst_alsa_do_mmap (GstAlsa *this,
- snd_pcm_sframes_t *avail);
+static int gst_alsa_do_mmap (GstAlsa * this,
+ snd_pcm_sframes_t * avail);
-static void gst_alsa_sink_loop (GstElement *element);
-static void gst_alsa_src_loop (GstElement *element);
-static void gst_alsa_xrun_recovery (GstAlsa *this);
+static void gst_alsa_sink_loop (GstElement * element);
+static void gst_alsa_src_loop (GstElement * element);
+static void gst_alsa_xrun_recovery (GstAlsa * this);
-static gboolean gst_alsa_sink_check_event (GstAlsa *this,
- gint pad_nr,
- GstEvent *event);
+static gboolean gst_alsa_sink_check_event (GstAlsa * this,
+ gint pad_nr,
+ GstEvent * event);
/* alsa setup / start / stop functions */
-static void gst_alsa_set_eos (GstAlsa *this);
+static void gst_alsa_set_eos (GstAlsa * this);
-static gboolean gst_alsa_probe_hw_params (GstAlsa *this,
- GstAlsaFormat *format);
-static gboolean gst_alsa_set_hw_params (GstAlsa *this);
-static gboolean gst_alsa_set_sw_params (GstAlsa *this);
+static gboolean gst_alsa_probe_hw_params (GstAlsa * this,
+ GstAlsaFormat * format);
+static gboolean gst_alsa_set_hw_params (GstAlsa * this);
+static gboolean gst_alsa_set_sw_params (GstAlsa * this);
-static gboolean gst_alsa_open_audio (GstAlsa *this);
-static gboolean gst_alsa_start_audio (GstAlsa *this);
-static gboolean gst_alsa_drain_audio (GstAlsa *this);
-static gboolean gst_alsa_stop_audio (GstAlsa *this);
-static gboolean gst_alsa_close_audio (GstAlsa *this);
+static gboolean gst_alsa_open_audio (GstAlsa * this);
+static gboolean gst_alsa_start_audio (GstAlsa * this);
+static gboolean gst_alsa_drain_audio (GstAlsa * this);
+static gboolean gst_alsa_stop_audio (GstAlsa * this);
+static gboolean gst_alsa_close_audio (GstAlsa * this);
/* clock functions */
-static void gst_alsa_clock_class_init (GstAlsaClockClass *klass);
-static void gst_alsa_clock_init (GstAlsaClock *clock);
+static void gst_alsa_clock_class_init (GstAlsaClockClass * klass);
+static void gst_alsa_clock_init (GstAlsaClock * clock);
static GstAlsaClock * gst_alsa_clock_new (gchar *name,
GstAlsaClockGetTimeFunc func,
- GstAlsa* owner);
-
-static void gst_alsa_clock_start (GstAlsaClock *clock);
-static void gst_alsa_clock_stop (GstAlsaClock *clock);
-
-static GstClockTime gst_alsa_clock_get_internal_time (GstClock *clock);
-static guint64 gst_alsa_clock_get_resolution (GstClock *clock);
-static GstClockEntryStatus gst_alsa_clock_wait (GstClock *clock,
- GstClockEntry *entry);
-static void gst_alsa_clock_unlock (GstClock *clock,
- GstClockEntry *entry);
-
-static GstClockTime gst_alsa_sink_get_time (GstAlsa *this);
-static GstClockTime gst_alsa_src_get_time (GstAlsa *this);
-static GstClock * gst_alsa_get_clock (GstElement *element);
-static void gst_alsa_set_clock (GstElement *element,
- GstClock *clock);
+ GstAlsa* owner);
+
+static void gst_alsa_clock_start (GstAlsaClock * clock);
+static void gst_alsa_clock_stop (GstAlsaClock * clock);
+
+static GstClockTime gst_alsa_clock_get_internal_time (GstClock * clock);
+static guint64 gst_alsa_clock_get_resolution (GstClock * clock);
+static GstClockEntryStatus gst_alsa_clock_wait (GstClock * clock,
+ GstClockEntry * entry);
+static void gst_alsa_clock_unlock (GstClock * clock,
+ GstClockEntry * entry);
+
+static GstClockTime gst_alsa_sink_get_time (GstAlsa * this);
+static GstClockTime gst_alsa_src_get_time (GstAlsa * this);
+static GstClock * gst_alsa_get_clock (GstElement * element);
+static void gst_alsa_set_clock (GstElement * element,
+ GstClock * clock);
static GstClockClass * clock_parent_class = NULL;
/* static guint gst_alsa_clock_signals[LAST_SIGNAL] = { 0 }; */
typedef struct {
GstPad * pad;
- guint8 * data; /* pointer into buffer */
- guint size; /* sink: bytes left in buffer */
- GstBuffer * buf; /* current buffer */
- guint behaviour; /* 0 = data points into buffer (so unref when size == 0),
- 1 = data should be freed, use buffer after that */
+ guint8 * data; /* pointer into buffer */
+ guint size; /* sink: bytes left in buffer */
+ GstBuffer * buf; /* current buffer */
+ guint behaviour; /* 0 = data points into buffer (so unref when size == 0),
+ 1 = data should be freed, use buffer after that */
} GstAlsaPad;
typedef struct {
- snd_pcm_format_t format;
- guint rate;
- gint channels;
+ snd_pcm_format_t format;
+ guint rate;
+ gint channels;
} GstAlsaFormat;
+
struct _GstAlsa {
- GstElement parent;
+ GstElement parent;
/* array of GstAlsaPads */
- GstAlsaPad pads[GST_ALSA_MAX_CHANNELS];
+ GstAlsaPad pads[GST_ALSA_MAX_CHANNELS];
- gchar *device;
- snd_pcm_stream_t stream;
- snd_pcm_t *handle;
- guint pcm_caps; /* capabilities of the pcm device */
- snd_output_t *out;
+ gchar * device;
+ snd_pcm_stream_t stream;
+ snd_pcm_t * handle;
+ guint pcm_caps; /* capabilities of the pcm device, see GstAlsaPcmCaps */
+ snd_output_t * out;
- GstAlsaFormat *format; /* NULL if undefined */
- gboolean mmap; /* use mmap transmit (fast) or read/write (sloooow) */
- GstAlsaTransmitFunction transmit;
+ GstAlsaFormat * format; /* NULL if undefined */
+ gboolean mmap; /* use mmap transmit (fast) or read/write (sloooow) */
+ GstAlsaTransmitFunction transmit;
/* latency / performance parameters */
- snd_pcm_uframes_t period_size;
- unsigned int period_count;
+ snd_pcm_uframes_t period_size;
+ unsigned int period_count;
- gboolean autorecover;
+ gboolean autorecover;
/* clocking */
- GstAlsaClock *clock; /* our provided clock */
- snd_pcm_uframes_t transmitted; /* samples transmitted since last sync
- This thing actually is our master clock.
+ GstAlsaClock * clock; /* our provided clock */
+ snd_pcm_uframes_t transmitted; /* samples transmitted since last sync
+ This thing actually is our master clock.
We will event insert silent samples or
drop some to sync to incoming timestamps.
- */
- GstClockTime max_discont; /* max difference between current
+ */
+ GstClockTime max_discont; /* max difference between current
playback timestamp and buffers timestamps
*/
};