mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-22 08:56:52 -05:00
name the sink/source after the device file, just like we already do for the non-mmaped driver
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1224 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
bf79e97591
commit
28f86ea698
1 changed files with 28 additions and 5 deletions
|
|
@ -37,6 +37,7 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include <pulse/xmalloc.h>
|
#include <pulse/xmalloc.h>
|
||||||
|
#include <pulse/util.h>
|
||||||
|
|
||||||
#include <pulsecore/core-error.h>
|
#include <pulsecore/core-error.h>
|
||||||
#include <pulsecore/iochannel.h>
|
#include <pulsecore/iochannel.h>
|
||||||
|
|
@ -104,8 +105,6 @@ static const char* const valid_modargs[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_SINK_NAME "oss_output"
|
|
||||||
#define DEFAULT_SOURCE_NAME "oss_input"
|
|
||||||
#define DEFAULT_DEVICE "/dev/dsp"
|
#define DEFAULT_DEVICE "/dev/dsp"
|
||||||
#define DEFAULT_NFRAGS 12
|
#define DEFAULT_NFRAGS 12
|
||||||
#define DEFAULT_FRAGSIZE 1024
|
#define DEFAULT_FRAGSIZE 1024
|
||||||
|
|
@ -399,6 +398,9 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
pa_modargs *ma = NULL;
|
pa_modargs *ma = NULL;
|
||||||
char hwdesc[64], *t;
|
char hwdesc[64], *t;
|
||||||
pa_channel_map map;
|
pa_channel_map map;
|
||||||
|
const char *name;
|
||||||
|
char *name_buf = NULL;
|
||||||
|
int namereg_fail;
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
@ -478,8 +480,14 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ((name = pa_modargs_get_value(ma, "source_name", NULL)))
|
||||||
|
namereg_fail = 1;
|
||||||
|
else {
|
||||||
|
name = name_buf = pa_sprintf_malloc("oss_input.%s", pa_path_get_filename(p));
|
||||||
|
namereg_fail = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &u->sample_spec, &map)))
|
if (!(u->source = pa_source_new(c, __FILE__, name, namereg_fail, &u->sample_spec, &map)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
u->source->userdata = u;
|
u->source->userdata = u;
|
||||||
|
|
@ -501,6 +509,9 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pa_xfree(name_buf);
|
||||||
|
name_buf = NULL;
|
||||||
|
|
||||||
if (mode != O_RDONLY) {
|
if (mode != O_RDONLY) {
|
||||||
if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
|
if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
|
||||||
pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno));
|
pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno));
|
||||||
|
|
@ -521,7 +532,14 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
} else {
|
} else {
|
||||||
pa_silence_memory(u->out_mmap, u->out_mmap_length, &u->sample_spec);
|
pa_silence_memory(u->out_mmap, u->out_mmap_length, &u->sample_spec);
|
||||||
|
|
||||||
if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &u->sample_spec, &map)))
|
if ((name = pa_modargs_get_value(ma, "sink_name", NULL)))
|
||||||
|
namereg_fail = 1;
|
||||||
|
else {
|
||||||
|
name = name_buf = pa_sprintf_malloc("oss_output.%s", pa_path_get_filename(p));
|
||||||
|
namereg_fail = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(u->sink = pa_sink_new(c, __FILE__, name, namereg_fail, &u->sample_spec, &map)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
u->sink->get_latency = sink_get_latency_cb;
|
u->sink->get_latency = sink_get_latency_cb;
|
||||||
|
|
@ -543,6 +561,9 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pa_xfree(name_buf);
|
||||||
|
name_buf = NULL;
|
||||||
|
|
||||||
zero = 0;
|
zero = 0;
|
||||||
if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &zero) < 0) {
|
if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &zero) < 0) {
|
||||||
pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", pa_cstrerror(errno));
|
pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", pa_cstrerror(errno));
|
||||||
|
|
@ -575,6 +596,8 @@ fail:
|
||||||
if (ma)
|
if (ma)
|
||||||
pa_modargs_free(ma);
|
pa_modargs_free(ma);
|
||||||
|
|
||||||
|
pa_xfree(name_buf);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue