mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
include host name in default sink/default source file
This commit is contained in:
parent
bb7f80d4d8
commit
b983c0bd14
1 changed files with 15 additions and 4 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <pulse/timeval.h>
|
#include <pulse/timeval.h>
|
||||||
|
#include <pulse/util.h>
|
||||||
|
|
||||||
#include <pulsecore/core-util.h>
|
#include <pulsecore/core-util.h>
|
||||||
#include <pulsecore/module.h>
|
#include <pulsecore/module.h>
|
||||||
|
|
@ -41,8 +42,6 @@ PA_MODULE_DESCRIPTION("Automatically restore the default sink and source");
|
||||||
PA_MODULE_VERSION(PACKAGE_VERSION);
|
PA_MODULE_VERSION(PACKAGE_VERSION);
|
||||||
PA_MODULE_LOAD_ONCE(TRUE);
|
PA_MODULE_LOAD_ONCE(TRUE);
|
||||||
|
|
||||||
#define DEFAULT_SINK_FILE "default-sink"
|
|
||||||
#define DEFAULT_SOURCE_FILE "default-source"
|
|
||||||
#define DEFAULT_SAVE_INTERVAL 5
|
#define DEFAULT_SAVE_INTERVAL 5
|
||||||
|
|
||||||
struct userdata {
|
struct userdata {
|
||||||
|
|
@ -155,16 +154,28 @@ static void subscribe_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t id
|
||||||
|
|
||||||
int pa__init(pa_module *m) {
|
int pa__init(pa_module *m) {
|
||||||
struct userdata *u;
|
struct userdata *u;
|
||||||
|
char hn[256], *fn;
|
||||||
|
|
||||||
pa_assert(m);
|
pa_assert(m);
|
||||||
|
|
||||||
m->userdata = u = pa_xnew0(struct userdata, 1);
|
m->userdata = u = pa_xnew0(struct userdata, 1);
|
||||||
u->core = m->core;
|
u->core = m->core;
|
||||||
|
|
||||||
if (!(u->sink_filename = pa_state_path(DEFAULT_SINK_FILE)))
|
if (!pa_get_host_name(hn, sizeof(hn)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!(u->source_filename = pa_state_path(DEFAULT_SOURCE_FILE)))
|
fn = pa_sprintf_malloc("default-sink.%s", hn);
|
||||||
|
u->sink_filename = pa_state_path(fn);
|
||||||
|
pa_xfree(fn);
|
||||||
|
|
||||||
|
if (!u->sink_filename)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
fn = pa_sprintf_malloc("default-source.%s", hn);
|
||||||
|
u->source_filename = pa_state_path(fn);
|
||||||
|
pa_xfree(fn);
|
||||||
|
|
||||||
|
if (!u->source_filename)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
load(u);
|
load(u);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue