GstStateChange transition);
static GstFlowReturn gst_alsasrc_create (GstBaseSrc * bsrc, guint64 offset,
guint length, GstBuffer ** outbuf);
-static GstClockTime gst_alsasrc_get_timestamp (GstAlsaSrc * src);
+GstClockTime gst_alsasrc_get_timestamp (GObject * object);
/* AlsaSrc signals and args */
DEFAULT_PROP_CARD_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
-static GstClockTime
-gst_alsasrc_get_timestamp (GstAlsaSrc * src)
+GstClockTime
+gst_alsasrc_get_timestamp (GstAlsaSrc * asrc)
{
snd_pcm_status_t *status;
snd_htimestamp_t tstamp;
GstClockTime timestamp;
snd_pcm_uframes_t availmax;
- GST_DEBUG_OBJECT (src, "Getting alsa timestamp!");
+ GST_DEBUG_OBJECT (object, "Getting alsa timestamp!");
- if (!src) {
- GST_ERROR_OBJECT (src, "No alsa handle created yet !");
+ if (!asrc) {
+ GST_ERROR_OBJECT (asrc, "No alsa handle created yet !");
return 0;
}
if (snd_pcm_status_malloc (&status) != 0) {
- GST_ERROR_OBJECT (src, "snd_pcm_status_malloc failed");
+ GST_ERROR_OBJECT (asrc, "snd_pcm_status_malloc failed");
}
- if (snd_pcm_status (src->handle, status) != 0) {
- GST_ERROR_OBJECT (src, "snd_pcm_status failed");
+ if (snd_pcm_status (asrc->handle, status) != 0) {
+ GST_ERROR_OBJECT (asrc, "snd_pcm_status failed");
}
/* get high resolution time stamp from driver */
availmax = snd_pcm_status_get_avail_max (status);
/* Compensate the fact that the timestamp references the last sample */
- timestamp -= gst_util_uint64_scale_int (availmax * 2, GST_SECOND, src->rate);
+ timestamp -= gst_util_uint64_scale_int (availmax * 2, GST_SECOND, asrc->rate);
/* Compensate for the delay until the package is available */
timestamp += gst_util_uint64_scale_int (snd_pcm_status_get_delay (status),
- GST_SECOND, src->rate);
+ GST_SECOND, asrc->rate);
snd_pcm_status_free (status);
- GST_DEBUG_OBJECT (src, "ALSA timestamp : %" GST_TIME_FORMAT,
- GST_TIME_ARGS (timestamp));
+ GST_DEBUG ("ALSA timestamp : %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp));
return timestamp;
}
GST_BASE_SRC_CLASS (parent_class)->create (bsrc, offset, length, outbuf);
if (asrc->driver_timestamps == TRUE && *outbuf) {
GST_BUFFER_TIMESTAMP (*outbuf) =
- gst_alsasrc_get_timestamp ((GstAlsaSrc *) bsrc);
+ gst_alsasrc_get_timestamp ((GObject *) bsrc);
}
return ret;