X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_writer.c;h=5aa908518b113305372d126ead651ec961243046;hp=6a3d18a33464e3fe652afeadeae9e47579d92dae;hb=1b39496da38155b84636c0f7cee7f7dbbea33632;hpb=24495e62d3896d98d6c27f9665edfe6492ddd757 diff --git a/alsa_writer.c b/alsa_writer.c index 6a3d18a3..5aa90851 100644 --- a/alsa_writer.c +++ b/alsa_writer.c @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ -/** \file alsa_writer.c Data specific to the alsa writer */ +/** \file alsa_writer.c paraslash's alsa output plugin */ /* * Based in parts on aplay.c from the alsa-utils-1.0.8 package, @@ -37,9 +37,13 @@ extern struct gengetopt_args_info conf; #define FORMAT SND_PCM_FORMAT_S16_LE + +/** data specific to the alsa writer */ struct private_alsa_data { - snd_pcm_t *handle; - size_t bytes_per_frame; +/** the alsa handle */ +snd_pcm_t *handle; +/** determined and set by alsa_open() */ +size_t bytes_per_frame; }; /* @@ -124,6 +128,8 @@ static int alsa_open(struct writer_node *w) return -E_SW_PARAMS; pad->bytes_per_frame = snd_pcm_format_physical_width(FORMAT) * conf.channels_arg / 8; +// if (snd_pcm_nonblock(pad->handle, 1)) +// PARA_ERROR_LOG("%s\n", "failed to set nonblock mode"); return period_size * pad->bytes_per_frame; } @@ -138,7 +144,7 @@ static int alsa_write(char *data, size_t nbytes, struct writer_node *wn) { struct private_alsa_data *pad = wn->private_data; size_t frames = nbytes / pad->bytes_per_frame; - unsigned char *d = data; + unsigned char *d = (unsigned char*)data; snd_pcm_sframes_t r, result = 0; while (frames > 0) { @@ -170,6 +176,7 @@ static void alsa_close(struct writer_node *wn) free(pad); } +/** the init function of the alsa writer */ void alsa_writer_init(struct writer *w) { w->open = alsa_open;