mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
add new call pa_alsa_open_by_device_id_profile()
This commit is contained in:
parent
04e9214065
commit
b88b89a676
4 changed files with 106 additions and 41 deletions
|
|
@ -1087,7 +1087,7 @@ int pa__init(pa_module*m) {
|
|||
pa_bool_t namereg_fail;
|
||||
pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d;
|
||||
pa_source_new_data data;
|
||||
const char *profile_description = NULL, *profile_name = NULL;
|
||||
const pa_alsa_profile_info *profile = NULL;
|
||||
|
||||
snd_pcm_info_alloca(&pcm_info);
|
||||
|
||||
|
|
@ -1161,13 +1161,13 @@ int pa__init(pa_module*m) {
|
|||
|
||||
if ((dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
|
||||
|
||||
if (!(u->pcm_handle = pa_alsa_open_by_device_id(
|
||||
if (!(u->pcm_handle = pa_alsa_open_by_device_id_auto(
|
||||
dev_id,
|
||||
&u->device_name,
|
||||
&ss, &map,
|
||||
SND_PCM_STREAM_CAPTURE,
|
||||
&nfrags, &period_frames, tsched_frames,
|
||||
&b, &d, &profile_description, &profile_name)))
|
||||
&b, &d, &profile)))
|
||||
goto fail;
|
||||
|
||||
} else {
|
||||
|
|
@ -1185,8 +1185,8 @@ int pa__init(pa_module*m) {
|
|||
pa_assert(u->device_name);
|
||||
pa_log_info("Successfully opened device %s.", u->device_name);
|
||||
|
||||
if (profile_description)
|
||||
pa_log_info("Selected configuration '%s' (%s).", profile_description, profile_name);
|
||||
if (profile)
|
||||
pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
|
||||
|
||||
if (use_mmap && !b) {
|
||||
pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode.");
|
||||
|
|
@ -1271,10 +1271,10 @@ int pa__init(pa_module*m) {
|
|||
pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (period_frames * frame_size));
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_ACCESS_MODE, u->use_tsched ? "mmap+timer" : (u->use_mmap ? "mmap" : "serial"));
|
||||
|
||||
if (profile_name)
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, profile_name);
|
||||
if (profile_description)
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile_description);
|
||||
if (profile) {
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, profile->name);
|
||||
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
|
||||
}
|
||||
|
||||
u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
|
||||
pa_source_new_data_done(&data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue