if a volume or channel map is invalid show so when printing it

This commit is contained in:
Lennart Poettering 2008-10-03 15:16:26 +02:00
parent 33b186e74d
commit 8a50105fe0
3 changed files with 16 additions and 1 deletions

View file

@ -466,6 +466,13 @@ char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map) {
pa_assert(l > 0); pa_assert(l > 0);
pa_assert(map); pa_assert(map);
pa_init_i18n();
if (!pa_channel_map_valid(map)) {
pa_snprintf(s, l, _("(invalid)"));
return s;
}
*(e = s) = 0; *(e = s) = 0;
for (channel = 0; channel < map->channels && l > 1; channel++) { for (channel = 0; channel < map->channels && l > 1; channel++) {

View file

@ -131,7 +131,7 @@ char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) {
pa_init_i18n(); pa_init_i18n();
if (!pa_sample_spec_valid(spec)) if (!pa_sample_spec_valid(spec))
pa_snprintf(s, l, _("Invalid")); pa_snprintf(s, l, _("(invalid)"));
else else
pa_snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate); pa_snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate);

View file

@ -26,6 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <pulse/i18n.h>
#include <pulsecore/core-util.h> #include <pulsecore/core-util.h>
#include <pulsecore/macro.h> #include <pulsecore/macro.h>
@ -134,6 +135,13 @@ char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) {
pa_assert(l > 0); pa_assert(l > 0);
pa_assert(c); pa_assert(c);
pa_init_i18n();
if (!pa_cvolume_valid(c)) {
pa_snprintf(s, l, _("(invalid)"));
return s;
}
*(e = s) = 0; *(e = s) = 0;
for (channel = 0; channel < c->channels && l > 1; channel++) { for (channel = 0; channel < c->channels && l > 1; channel++) {