mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
store the identification key in the module-stream-restore.id property
This commit is contained in:
parent
9e2a2f88df
commit
12c29e1832
1 changed files with 17 additions and 9 deletions
|
|
@ -62,6 +62,7 @@ PA_MODULE_USAGE(
|
||||||
"restore_muted=<Save/restore muted states?>");
|
"restore_muted=<Save/restore muted states?>");
|
||||||
|
|
||||||
#define SAVE_INTERVAL 10
|
#define SAVE_INTERVAL 10
|
||||||
|
#define IDENTIFICATION_PROPERTY "module-stream-restore.id"
|
||||||
|
|
||||||
static const char* const valid_modargs[] = {
|
static const char* const valid_modargs[] = {
|
||||||
"restore_device",
|
"restore_device",
|
||||||
|
|
@ -129,20 +130,27 @@ static void save_time_callback(pa_mainloop_api*a, pa_time_event* e, const struct
|
||||||
|
|
||||||
static char *get_name(pa_proplist *p, const char *prefix) {
|
static char *get_name(pa_proplist *p, const char *prefix) {
|
||||||
const char *r;
|
const char *r;
|
||||||
|
char *t;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ((r = pa_proplist_gets(p, PA_PROP_MEDIA_ROLE)))
|
if ((r = pa_proplist_gets(p, IDENTIFICATION_PROPERTY)))
|
||||||
return pa_sprintf_malloc("%s-by-media-role:%s", prefix, r);
|
return pa_xstrdup(r);
|
||||||
else if ((r = pa_proplist_gets(p, PA_PROP_APPLICATION_ID)))
|
|
||||||
return pa_sprintf_malloc("%s-by-application-id:%s", prefix, r);
|
|
||||||
else if ((r = pa_proplist_gets(p, PA_PROP_APPLICATION_NAME)))
|
|
||||||
return pa_sprintf_malloc("%s-by-application-name:%s", prefix, r);
|
|
||||||
else if ((r = pa_proplist_gets(p, PA_PROP_MEDIA_NAME)))
|
|
||||||
return pa_sprintf_malloc("%s-by-media-name:%s", prefix, r);
|
|
||||||
|
|
||||||
return pa_sprintf_malloc("%s-fallback:%s", prefix, r);
|
if ((r = pa_proplist_gets(p, PA_PROP_MEDIA_ROLE)))
|
||||||
|
t = pa_sprintf_malloc("%s-by-media-role:%s", prefix, r);
|
||||||
|
else if ((r = pa_proplist_gets(p, PA_PROP_APPLICATION_ID)))
|
||||||
|
t = pa_sprintf_malloc("%s-by-application-id:%s", prefix, r);
|
||||||
|
else if ((r = pa_proplist_gets(p, PA_PROP_APPLICATION_NAME)))
|
||||||
|
t = pa_sprintf_malloc("%s-by-application-name:%s", prefix, r);
|
||||||
|
else if ((r = pa_proplist_gets(p, PA_PROP_MEDIA_NAME)))
|
||||||
|
t = pa_sprintf_malloc("%s-by-media-name:%s", prefix, r);
|
||||||
|
else
|
||||||
|
t = pa_sprintf_malloc("%s-fallback:%s", prefix, r);
|
||||||
|
|
||||||
|
pa_proplist_sets(p, IDENTIFICATION_PROPERTY, t);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct entry* read_entry(struct userdata *u, const char *name) {
|
static struct entry* read_entry(struct userdata *u, const char *name) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue