conversion: Add generic string lookup.
This commit is contained in:
parent
fcb720b6a3
commit
82b46a9ec4
2 changed files with 30 additions and 0 deletions
|
|
@ -117,6 +117,34 @@ static char *list_string(struct string_conversion *list, uint32_t flags) {
|
|||
return str;
|
||||
}
|
||||
|
||||
/* Generic conversion */
|
||||
bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str) {
|
||||
switch (type) {
|
||||
case CONV_STRING_FORMAT:
|
||||
return string_convert_num_to_str(string_conversion_table_format, value, to_str);
|
||||
|
||||
case CONV_STRING_OUTPUT_CHANNELS:
|
||||
return string_convert_num_to_str(string_conversion_table_output_channels, value, to_str);
|
||||
|
||||
case CONV_STRING_INPUT_CHANNELS:
|
||||
return string_convert_num_to_str(string_conversion_table_input_channels, value, to_str);
|
||||
|
||||
case CONV_STRING_OUTPUT_DEVICE:
|
||||
return string_convert_num_to_str(string_conversion_table_output_device, value, to_str);
|
||||
|
||||
case CONV_STRING_INPUT_DEVICE:
|
||||
return string_convert_num_to_str(string_conversion_table_input_device, value, to_str);
|
||||
|
||||
case CONV_STRING_OUTPUT_FLAG:
|
||||
return string_convert_num_to_str(string_conversion_table_output_flag, value, to_str);
|
||||
|
||||
case CONV_STRING_INPUT_FLAG:
|
||||
return string_convert_num_to_str(string_conversion_table_input_flag, value, to_str);
|
||||
}
|
||||
|
||||
pa_assert_not_reached();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Output device */
|
||||
bool pa_string_convert_output_device_num_to_str(audio_devices_t value, const char **to_str) {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ typedef enum {
|
|||
CONV_STRING_INPUT_FLAG
|
||||
} pa_conversion_string_t;
|
||||
|
||||
bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str);
|
||||
|
||||
bool pa_convert_output_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
|
||||
bool pa_convert_input_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
|
||||
bool pa_convert_format(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue