This file is part of polypaudio.
polypaudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
+ it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with polypaudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
#include "alsa-util.h"
#include "xmalloc.h"
#include "log.h"
+#include "module-alsa-sink-symdef.h"
PA_MODULE_AUTHOR("Lennart Poettering")
PA_MODULE_DESCRIPTION("ALSA Sink")
PA_MODULE_VERSION(PACKAGE_VERSION)
+PA_MODULE_USAGE("sink_name=<name for the sink> device=<ALSA device> format=<sample format> channels=<number of channels> rate=<sample rate> fragments=<number of fragments> fragment_size=<fragment size>")
struct userdata {
snd_pcm_t *pcm_handle;
}
static pa_usec_t sink_get_latency_cb(struct pa_sink *s) {
+ pa_usec_t r = 0;
struct userdata *u = s->userdata;
snd_pcm_sframes_t frames;
assert(s && u && u->sink);
if (frames < 0)
frames = 0;
- return pa_bytes_to_usec(frames * u->frame_size, &s->sample_spec);
+ r += pa_bytes_to_usec(frames * u->frame_size, &s->sample_spec);
+
+ if (u->memchunk.memblock)
+ r += pa_bytes_to_usec(u->memchunk.length, &s->sample_spec);
+
+ return r;
}
int pa__init(struct pa_core *c, struct pa_module*m) {
if (!(u = m->userdata))
return;
- if (u->sink)
- pa_sink_free(u->sink);
+ if (u->sink) {
+ pa_sink_disconnect(u->sink);
+ pa_sink_unref(u->sink);
+ }
if (u->io_events)
pa_free_io_events(c->mainloop, u->io_events, u->n_io_events);