format: Expose pa_format_info<->pa_sample_spec conversion functions

These utility functions could be handy to clients.
pa_format_info_to_sample_spec_fake() isn't made public, but the return
value is changed to keep in sync with pa_format_info_to_sample_spec().
This commit is contained in:
Arun Raghavan 2012-02-06 11:34:47 +05:30
parent 63429b67c7
commit c60f698f1e
5 changed files with 19 additions and 14 deletions

View file

@ -273,12 +273,12 @@ int pa_source_output_new(
/* Now populate the sample spec and format according to the final
* format that we've negotiated */
if (PA_LIKELY(data->format->encoding == PA_ENCODING_PCM)) {
pa_return_val_if_fail(pa_format_info_to_sample_spec(data->format, &ss, &map), -PA_ERR_INVALID);
pa_return_val_if_fail(pa_format_info_to_sample_spec(data->format, &ss, &map) == 0, -PA_ERR_INVALID);
pa_source_output_new_data_set_sample_spec(data, &ss);
if (pa_channel_map_valid(&map))
pa_source_output_new_data_set_channel_map(data, &map);
} else {
pa_return_val_if_fail(pa_format_info_to_sample_spec_fake(data->format, &ss), -PA_ERR_INVALID);
pa_return_val_if_fail(pa_format_info_to_sample_spec_fake(data->format, &ss) == 0, -PA_ERR_INVALID);
pa_source_output_new_data_set_sample_spec(data, &ss);
}