X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_writer.c;h=5aa908518b113305372d126ead651ec961243046;hp=53cf7e369b585c079c1f0beeed71582498d4e1d4;hb=1b39496da38155b84636c0f7cee7f7dbbea33632;hpb=abc1c0b936dfe3eeaf73560be9e6e276d2993ef3 diff --git a/alsa_writer.c b/alsa_writer.c index 53cf7e36..5aa90851 100644 --- a/alsa_writer.c +++ b/alsa_writer.c @@ -40,8 +40,10 @@ extern struct gengetopt_args_info conf; /** 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; }; /* @@ -126,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; } @@ -140,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) { @@ -172,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;