null-sink: Add avoid-processing support

This commit is contained in:
Arun Raghavan 2018-10-11 19:21:04 +05:30 committed by Arun Raghavan
parent ecbe1e8c22
commit e4a085f6d3

View file

@ -57,7 +57,7 @@ PA_MODULE_USAGE(
"channel_map=<channel map> "
"formats=<semi-colon separated sink formats> "
"norewinds=<disable rewinds> "
"dump=<name of file to dump to, automatically prefixed with /tmp/pulse-> "
"dump=<path to file to dump to, automatically prefixed with /tmp/pulse-> "
"avoid_processing=<use stream original sample spec if possible?> "
);
@ -94,6 +94,7 @@ static const char* const valid_modargs[] = {
"formats",
"norewinds",
"dump",
"avoid_processing",
NULL
};
@ -355,6 +356,7 @@ int pa__init(pa_module*m) {
pa_format_info *format;
const char *formats, *dump_file;
size_t nbytes;
bool avoid_processing;
pa_assert(m);
@ -365,6 +367,8 @@ int pa__init(pa_module*m) {
ss = m->core->default_sample_spec;
map = m->core->default_channel_map;
avoid_processing = m->core->avoid_processing;
if (pa_modargs_get_sample_spec_and_channel_map(ma, &ss, &map, PA_CHANNEL_MAP_DEFAULT) < 0) {
pa_log("Invalid sample format specification or channel map");
goto fail;
@ -393,6 +397,13 @@ int pa__init(pa_module*m) {
}
}
if (pa_modargs_get_value_boolean(ma, "avoid_processing", &avoid_processing) < 0) {
pa_log("Failed to parse avoid_processing argument.");
pa_sink_new_data_done(&data);
goto fail;
}
data.avoid_processing = avoid_processing;
pa_sink_new_data_init(&data);
data.driver = __FILE__;
data.module = m;