pulse-server: rename a variable to avoid confusion

This commit is contained in:
Wim Taymans 2023-08-30 18:32:34 +02:00
parent 3d0b662c5e
commit 20fdafb7f1
2 changed files with 30 additions and 30 deletions

View file

@ -26,7 +26,7 @@ struct module_pipesink_data {
struct pw_impl_module *mod; struct pw_impl_module *mod;
struct pw_properties *global_props; struct pw_properties *global_props;
struct pw_properties *capture_props; struct pw_properties *stream_props;
}; };
static void module_destroy(void *data) static void module_destroy(void *data)
@ -49,7 +49,7 @@ static int module_pipe_sink_load(struct module *module)
char *args; char *args;
size_t size; size_t size;
pw_properties_setf(data->capture_props, "pulse.module.id", pw_properties_setf(data->stream_props, "pulse.module.id",
"%u", module->index); "%u", module->index);
if ((f = open_memstream(&args, &size)) == NULL) if ((f = open_memstream(&args, &size)) == NULL)
@ -58,7 +58,7 @@ static int module_pipe_sink_load(struct module *module)
fprintf(f, "{"); fprintf(f, "{");
pw_properties_serialize_dict(f, &data->global_props->dict, 0); pw_properties_serialize_dict(f, &data->global_props->dict, 0);
fprintf(f, " \"stream.props\": {"); fprintf(f, " \"stream.props\": {");
pw_properties_serialize_dict(f, &data->capture_props->dict, 0); pw_properties_serialize_dict(f, &data->stream_props->dict, 0);
fprintf(f, " } }"); fprintf(f, " } }");
fclose(f); fclose(f);
@ -86,7 +86,7 @@ static int module_pipe_sink_unload(struct module *module)
pw_impl_module_destroy(d->mod); pw_impl_module_destroy(d->mod);
d->mod = NULL; d->mod = NULL;
} }
pw_properties_free(d->capture_props); pw_properties_free(d->stream_props);
pw_properties_free(d->global_props); pw_properties_free(d->global_props);
return 0; return 0;
} }
@ -108,7 +108,7 @@ static int module_pipe_sink_prepare(struct module * const module)
{ {
struct module_pipesink_data * const d = module->user_data; struct module_pipesink_data * const d = module->user_data;
struct pw_properties * const props = module->props; struct pw_properties * const props = module->props;
struct pw_properties *global_props = NULL, *capture_props = NULL; struct pw_properties *global_props = NULL, *stream_props = NULL;
struct spa_audio_info_raw info = { 0 }; struct spa_audio_info_raw info = { 0 };
const char *str; const char *str;
int res = 0; int res = 0;
@ -116,8 +116,8 @@ static int module_pipe_sink_prepare(struct module * const module)
PW_LOG_TOPIC_INIT(mod_topic); PW_LOG_TOPIC_INIT(mod_topic);
global_props = pw_properties_new(NULL, NULL); global_props = pw_properties_new(NULL, NULL);
capture_props = pw_properties_new(NULL, NULL); stream_props = pw_properties_new(NULL, NULL);
if (!global_props || !capture_props) { if (!global_props || !stream_props) {
res = -EINVAL; res = -EINVAL;
goto out; goto out;
} }
@ -133,31 +133,31 @@ static int module_pipe_sink_prepare(struct module * const module)
audioinfo_to_properties(&info, global_props); audioinfo_to_properties(&info, global_props);
if ((str = pw_properties_get(props, "sink_name")) != NULL) { if ((str = pw_properties_get(props, "sink_name")) != NULL) {
pw_properties_set(capture_props, PW_KEY_NODE_NAME, str); pw_properties_set(stream_props, PW_KEY_NODE_NAME, str);
pw_properties_set(props, "sink_name", NULL); pw_properties_set(props, "sink_name", NULL);
} }
if ((str = pw_properties_get(props, "sink_properties")) != NULL) if ((str = pw_properties_get(props, "sink_properties")) != NULL)
module_args_add_props(capture_props, str); module_args_add_props(stream_props, str);
if ((str = pw_properties_get(props, "file")) != NULL) { if ((str = pw_properties_get(props, "file")) != NULL) {
pw_properties_set(global_props, "pipe.filename", str); pw_properties_set(global_props, "pipe.filename", str);
pw_properties_set(props, "file", NULL); pw_properties_set(props, "file", NULL);
} }
if ((str = pw_properties_get(capture_props, PW_KEY_DEVICE_ICON_NAME)) == NULL) if ((str = pw_properties_get(stream_props, PW_KEY_DEVICE_ICON_NAME)) == NULL)
pw_properties_set(capture_props, PW_KEY_DEVICE_ICON_NAME, pw_properties_set(stream_props, PW_KEY_DEVICE_ICON_NAME,
"audio-card"); "audio-card");
if ((str = pw_properties_get(capture_props, PW_KEY_NODE_NAME)) == NULL) if ((str = pw_properties_get(stream_props, PW_KEY_NODE_NAME)) == NULL)
pw_properties_set(capture_props, PW_KEY_NODE_NAME, pw_properties_set(stream_props, PW_KEY_NODE_NAME,
"fifo_output"); "fifo_output");
d->module = module; d->module = module;
d->global_props = global_props; d->global_props = global_props;
d->capture_props = capture_props; d->stream_props = stream_props;
return 0; return 0;
out: out:
pw_properties_free(global_props); pw_properties_free(global_props);
pw_properties_free(capture_props); pw_properties_free(stream_props);
return res; return res;
} }

View file

@ -26,7 +26,7 @@ struct module_pipesrc_data {
struct pw_impl_module *mod; struct pw_impl_module *mod;
struct pw_properties *global_props; struct pw_properties *global_props;
struct pw_properties *playback_props; struct pw_properties *stream_props;
}; };
static void module_destroy(void *data) static void module_destroy(void *data)
@ -49,7 +49,7 @@ static int module_pipe_source_load(struct module *module)
char *args; char *args;
size_t size; size_t size;
pw_properties_setf(data->playback_props, "pulse.module.id", pw_properties_setf(data->stream_props, "pulse.module.id",
"%u", module->index); "%u", module->index);
if ((f = open_memstream(&args, &size)) == NULL) if ((f = open_memstream(&args, &size)) == NULL)
@ -58,7 +58,7 @@ static int module_pipe_source_load(struct module *module)
fprintf(f, "{"); fprintf(f, "{");
pw_properties_serialize_dict(f, &data->global_props->dict, 0); pw_properties_serialize_dict(f, &data->global_props->dict, 0);
fprintf(f, " \"stream.props\": {"); fprintf(f, " \"stream.props\": {");
pw_properties_serialize_dict(f, &data->playback_props->dict, 0); pw_properties_serialize_dict(f, &data->stream_props->dict, 0);
fprintf(f, " } }"); fprintf(f, " } }");
fclose(f); fclose(f);
@ -86,7 +86,7 @@ static int module_pipe_source_unload(struct module *module)
pw_impl_module_destroy(d->mod); pw_impl_module_destroy(d->mod);
d->mod = NULL; d->mod = NULL;
} }
pw_properties_free(d->playback_props); pw_properties_free(d->stream_props);
pw_properties_free(d->global_props); pw_properties_free(d->global_props);
return 0; return 0;
} }
@ -108,7 +108,7 @@ static int module_pipe_source_prepare(struct module * const module)
{ {
struct module_pipesrc_data * const d = module->user_data; struct module_pipesrc_data * const d = module->user_data;
struct pw_properties * const props = module->props; struct pw_properties * const props = module->props;
struct pw_properties *global_props = NULL, *playback_props = NULL; struct pw_properties *global_props = NULL, *stream_props = NULL;
struct spa_audio_info_raw info = { 0 }; struct spa_audio_info_raw info = { 0 };
const char *str; const char *str;
int res = 0; int res = 0;
@ -116,8 +116,8 @@ static int module_pipe_source_prepare(struct module * const module)
PW_LOG_TOPIC_INIT(mod_topic); PW_LOG_TOPIC_INIT(mod_topic);
global_props = pw_properties_new(NULL, NULL); global_props = pw_properties_new(NULL, NULL);
playback_props = pw_properties_new(NULL, NULL); stream_props = pw_properties_new(NULL, NULL);
if (!global_props || !playback_props) { if (!global_props || !stream_props) {
res = -errno; res = -errno;
goto out; goto out;
} }
@ -133,31 +133,31 @@ static int module_pipe_source_prepare(struct module * const module)
audioinfo_to_properties(&info, global_props); audioinfo_to_properties(&info, global_props);
if ((str = pw_properties_get(props, "source_name")) != NULL) { if ((str = pw_properties_get(props, "source_name")) != NULL) {
pw_properties_set(playback_props, PW_KEY_NODE_NAME, str); pw_properties_set(stream_props, PW_KEY_NODE_NAME, str);
pw_properties_set(props, "source_name", NULL); pw_properties_set(props, "source_name", NULL);
} }
if ((str = pw_properties_get(props, "source_properties")) != NULL) if ((str = pw_properties_get(props, "source_properties")) != NULL)
module_args_add_props(playback_props, str); module_args_add_props(stream_props, str);
if ((str = pw_properties_get(props, "file")) != NULL) { if ((str = pw_properties_get(props, "file")) != NULL) {
pw_properties_set(global_props, "pipe.filename", str); pw_properties_set(global_props, "pipe.filename", str);
pw_properties_set(props, "file", NULL); pw_properties_set(props, "file", NULL);
} }
if ((str = pw_properties_get(playback_props, PW_KEY_DEVICE_ICON_NAME)) == NULL) if ((str = pw_properties_get(stream_props, PW_KEY_DEVICE_ICON_NAME)) == NULL)
pw_properties_set(playback_props, PW_KEY_DEVICE_ICON_NAME, pw_properties_set(stream_props, PW_KEY_DEVICE_ICON_NAME,
"audio-input-microphone"); "audio-input-microphone");
if ((str = pw_properties_get(playback_props, PW_KEY_NODE_NAME)) == NULL) if ((str = pw_properties_get(stream_props, PW_KEY_NODE_NAME)) == NULL)
pw_properties_set(playback_props, PW_KEY_NODE_NAME, pw_properties_set(stream_props, PW_KEY_NODE_NAME,
"fifo_input"); "fifo_input");
d->module = module; d->module = module;
d->playback_props = playback_props; d->stream_props = stream_props;
d->global_props = global_props; d->global_props = global_props;
return 0; return 0;
out: out:
pw_properties_free(global_props); pw_properties_free(global_props);
pw_properties_free(playback_props); pw_properties_free(stream_props);
return res; return res;
} }