diff options
Diffstat (limited to 'polyp/module-oss-mmap.c')
-rw-r--r-- | polyp/module-oss-mmap.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/polyp/module-oss-mmap.c b/polyp/module-oss-mmap.c index 8a0dd9a4b..8151a13af 100644 --- a/polyp/module-oss-mmap.c +++ b/polyp/module-oss-mmap.c @@ -45,6 +45,7 @@ #include "util.h" #include "modargs.h" #include "xmalloc.h" +#include "log.h" struct userdata { struct pa_sink *sink; @@ -122,7 +123,7 @@ static void do_write(struct userdata *u) { update_usage(u); if (ioctl(u->fd, SNDCTL_DSP_GETOPTR, &info) < 0) { - fprintf(stderr, "SNDCTL_DSP_GETOPTR: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s\n", strerror(errno)); return; } @@ -184,7 +185,7 @@ static void do_read(struct userdata *u) { update_usage(u); if (ioctl(u->fd, SNDCTL_DSP_GETIPTR, &info) < 0) { - fprintf(stderr, "SNDCTL_DSP_GETIPTR: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s\n", strerror(errno)); return; } @@ -230,17 +231,17 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) { u->core = c; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - fprintf(stderr, __FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments.\n"); goto fail; } if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) { - fprintf(stderr, __FILE__": record= and playback= expect numeric arguments.\n"); + pa_log(__FILE__": record= and playback= expect numeric arguments.\n"); goto fail; } if (!playback && !record) { - fprintf(stderr, __FILE__": neither playback nor record enabled for device.\n"); + pa_log(__FILE__": neither playback nor record enabled for device.\n"); goto fail; } @@ -249,13 +250,13 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) { nfrags = 12; frag_size = 1024; if (pa_modargs_get_value_s32(ma, "fragments", &nfrags) < 0 || nfrags < 2 || pa_modargs_get_value_s32(ma, "fragment_size", &frag_size) < 0 || frag_size < 1) { - fprintf(stderr, __FILE__": failed to parse fragments arguments\n"); + pa_log(__FILE__": failed to parse fragments arguments\n"); goto fail; } u->sample_spec = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &u->sample_spec) < 0) { - fprintf(stderr, __FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification\n"); goto fail; } @@ -263,11 +264,11 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) { goto fail; if (!(caps & DSP_CAP_MMAP) || !(caps & DSP_CAP_REALTIME) || !(caps & DSP_CAP_TRIGGER)) { - fprintf(stderr, "OSS device not mmap capable.\n"); + pa_log(__FILE__": OSS device not mmap capable.\n"); goto fail; } - fprintf(stderr, "module-oss: device opened in %s mode.\n", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); + pa_log(__FILE__": device opened in %s mode.\n", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); if (pa_oss_set_fragments(u->fd, nfrags, frag_size) < 0) goto fail; @@ -277,19 +278,19 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) { if (mode != O_WRONLY) { if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) { - fprintf(stderr, "SNDCTL_DSP_GETISPACE: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETISPACE: %s\n", strerror(errno)); goto fail; } - fprintf(stderr, "module-oss-mmap: input -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); + pa_log(__FILE__": input -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); u->in_mmap_length = (u->in_fragment_size = info.fragsize) * (u->in_fragments = info.fragstotal); if ((u->in_mmap = mmap(NULL, u->in_mmap_length, PROT_READ, MAP_SHARED, u->fd, 0)) == MAP_FAILED) { if (mode == O_RDWR) { - fprintf(stderr, "module-oss-mmap: mmap failed for input. Changing to O_WRONLY mode.\n"); + pa_log(__FILE__": mmap failed for input. Changing to O_WRONLY mode.\n"); mode = O_WRONLY; } else { - fprintf(stderr, "modeule-oss-mmap: mmap(): %s\n", strerror(errno)); + pa_log(__FILE__": mmap(): %s\n", strerror(errno)); goto fail; } } else { @@ -308,19 +309,19 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) { if (mode != O_RDONLY) { if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { - fprintf(stderr, "SNDCTL_DSP_GETOSPACE: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s\n", strerror(errno)); goto fail; } - fprintf(stderr, "module-oss: output -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); + pa_log(__FILE__": output -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); u->out_mmap_length = (u->out_fragment_size = info.fragsize) * (u->out_fragments = info.fragstotal); if ((u->out_mmap = mmap(NULL, u->out_mmap_length, PROT_WRITE, MAP_SHARED, u->fd, 0)) == MAP_FAILED) { if (mode == O_RDWR) { - fprintf(stderr, "module-oss-mmap: mmap filed for output. Changing to O_RDONLY mode.\n"); + pa_log(__FILE__": mmap filed for output. Changing to O_RDONLY mode.\n"); mode = O_RDONLY; } else { - fprintf(stderr, "module-oss-mmap: mmap(): %s\n", strerror(errno)); + pa_log(__FILE__": mmap(): %s\n", strerror(errno)); goto fail; } } else { @@ -341,12 +342,12 @@ int pa_module_init(struct pa_core *c, struct pa_module*m) { zero = 0; if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &zero) < 0) { - fprintf(stderr, "SNDCTL_DSP_SETTRIGGER: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s\n", strerror(errno)); goto fail; } if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) < 0) { - fprintf(stderr, "SNDCTL_DSP_SETTRIGGER: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s\n", strerror(errno)); goto fail; } |