pa_format_info_free;
pa_format_info_from_string;
pa_format_info_from_sample_spec;
+pa_format_info_get_channel_map;
+pa_format_info_get_channels;
pa_format_info_get_prop_type;
pa_format_info_get_prop_int;
pa_format_info_get_prop_int_range;
pa_format_info_get_prop_int_array;
pa_format_info_get_prop_string;
pa_format_info_get_prop_string_array;
+pa_format_info_get_rate;
+pa_format_info_get_sample_format;
pa_format_info_free_string_array;
pa_format_info_is_compatible;
pa_format_info_is_pcm;
pa_xfree(values);
}
+int pa_format_info_get_sample_format(const pa_format_info *f, pa_sample_format_t *sf) {
+ int r;
+ char *sf_str;
+ pa_sample_format_t sf_local;
+
+ pa_assert(f);
+ pa_assert(sf);
+
+ r = pa_format_info_get_prop_string(f, PA_PROP_FORMAT_SAMPLE_FORMAT, &sf_str);
+ if (r < 0)
+ return r;
+
+ sf_local = pa_parse_sample_format(sf_str);
+ pa_xfree(sf_str);
+
+ if (!pa_sample_format_valid(sf_local)) {
+ pa_log_debug("Invalid sample format.");
+ return -PA_ERR_INVALID;
+ }
+
+ *sf = sf_local;
+
+ return 0;
+}
+
+int pa_format_info_get_rate(const pa_format_info *f, uint32_t *rate) {
+ int r;
+ int rate_local;
+
+ pa_assert(f);
+ pa_assert(rate);
+
+ r = pa_format_info_get_prop_int(f, PA_PROP_FORMAT_RATE, &rate_local);
+ if (r < 0)
+ return r;
+
+ if (!pa_sample_rate_valid(rate_local)) {
+ pa_log_debug("Invalid sample rate: %i", rate_local);
+ return -PA_ERR_INVALID;
+ }
+
+ *rate = rate_local;
+
+ return 0;
+}
+
+int pa_format_info_get_channels(const pa_format_info *f, uint8_t *channels) {
+ int r;
+ int channels_local;
+
+ pa_assert(f);
+ pa_assert(channels);
+
+ r = pa_format_info_get_prop_int(f, PA_PROP_FORMAT_CHANNELS, &channels_local);
+ if (r < 0)
+ return r;
+
+ if (!pa_channels_valid(channels_local)) {
+ pa_log_debug("Invalid channel count: %i", channels_local);
+ return -PA_ERR_INVALID;
+ }
+
+ *channels = channels_local;
+
+ return 0;
+}
+
+int pa_format_info_get_channel_map(const pa_format_info *f, pa_channel_map *map) {
+ int r;
+ char *map_str;
+
+ pa_assert(f);
+ pa_assert(map);
+
+ r = pa_format_info_get_prop_string(f, PA_PROP_FORMAT_CHANNEL_MAP, &map_str);
+ if (r < 0)
+ return r;
+
+ map = pa_channel_map_parse(map, map_str);
+ pa_xfree(map_str);
+
+ if (!map) {
+ pa_log_debug("Failed to parse channel map.");
+ return -PA_ERR_INVALID;
+ }
+
+ return 0;
+}
+
void pa_format_info_set_sample_format(pa_format_info *f, pa_sample_format_t sf) {
pa_format_info_set_prop_string(f, PA_PROP_FORMAT_SAMPLE_FORMAT, pa_sample_format_to_string(sf));
}
/** Frees a string array returned by \ref pa_format_info_get_prop_string_array. \since 2.0 */
void pa_format_info_free_string_array(char **values, int n_values);
+/** Gets the sample format stored in the format info. Returns a negative error
+ * code on failure. If the sample format property is not set at all, returns a
+ * negative integer. \since 13.0 */
+int pa_format_info_get_sample_format(const pa_format_info *f, pa_sample_format_t *sf);
+
+/** Gets the sample rate stored in the format info. Returns a negative error
+ * code on failure. If the sample rate property is not set at all, returns a
+ * negative integer. \since 13.0 */
+int pa_format_info_get_rate(const pa_format_info *f, uint32_t *rate);
+
+/** Gets the channel count stored in the format info. Returns a negative error
+ * code on failure. If the channels property is not set at all, returns a
+ * negative integer. \since 13.0 */
+int pa_format_info_get_channels(const pa_format_info *f, uint8_t *channels);
+
+/** Gets the channel map stored in the format info. Returns a negative error
+ * code on failure. If the channel map property is not
+ * set at all, returns a negative integer. \since 13.0 */
+int pa_format_info_get_channel_map(const pa_format_info *f, pa_channel_map *map);
+
/** Sets an integer property on the given format info. \since 1.0 */
void pa_format_info_set_prop_int(pa_format_info *f, const char *key, int value);
/** Sets a property with a list of integer values on the given format info. \since 1.0 */
#include <pulsecore/macro.h>
-int pa_format_info_get_sample_format(const pa_format_info *f, pa_sample_format_t *sf) {
- int r;
- char *sf_str;
- pa_sample_format_t sf_local;
-
- pa_assert(f);
- pa_assert(sf);
-
- r = pa_format_info_get_prop_string(f, PA_PROP_FORMAT_SAMPLE_FORMAT, &sf_str);
- if (r < 0)
- return r;
-
- sf_local = pa_parse_sample_format(sf_str);
- pa_xfree(sf_str);
-
- if (!pa_sample_format_valid(sf_local)) {
- pa_log_debug("Invalid sample format.");
- return -PA_ERR_INVALID;
- }
-
- *sf = sf_local;
-
- return 0;
-}
-
-int pa_format_info_get_rate(const pa_format_info *f, uint32_t *rate) {
- int r;
- int rate_local;
-
- pa_assert(f);
- pa_assert(rate);
-
- r = pa_format_info_get_prop_int(f, PA_PROP_FORMAT_RATE, &rate_local);
- if (r < 0)
- return r;
-
- if (!pa_sample_rate_valid(rate_local)) {
- pa_log_debug("Invalid sample rate: %i", rate_local);
- return -PA_ERR_INVALID;
- }
-
- *rate = rate_local;
-
- return 0;
-}
-
-int pa_format_info_get_channels(const pa_format_info *f, uint8_t *channels) {
- int r;
- int channels_local;
-
- pa_assert(f);
- pa_assert(channels);
-
- r = pa_format_info_get_prop_int(f, PA_PROP_FORMAT_CHANNELS, &channels_local);
- if (r < 0)
- return r;
-
- if (!pa_channels_valid(channels_local)) {
- pa_log_debug("Invalid channel count: %i", channels_local);
- return -PA_ERR_INVALID;
- }
-
- *channels = channels_local;
-
- return 0;
-}
-
-int pa_format_info_get_channel_map(const pa_format_info *f, pa_channel_map *map) {
- int r;
- char *map_str;
-
- pa_assert(f);
- pa_assert(map);
-
- r = pa_format_info_get_prop_string(f, PA_PROP_FORMAT_CHANNEL_MAP, &map_str);
- if (r < 0)
- return r;
-
- map = pa_channel_map_parse(map, map_str);
- pa_xfree(map_str);
-
- if (!map) {
- pa_log_debug("Failed to parse channel map.");
- return -PA_ERR_INVALID;
- }
-
- return 0;
-}
-
pa_format_info *pa_format_info_from_sample_spec2(const pa_sample_spec *ss, const pa_channel_map *map, bool set_format,
bool set_rate, bool set_channels) {
pa_format_info *format = NULL;
#include <stdbool.h>
-/* Gets the sample format stored in the format info. Returns a negative error
- * code on failure. If the sample format property is not set at all, returns
- * -PA_ERR_NOENTITY. */
-int pa_format_info_get_sample_format(const pa_format_info *f, pa_sample_format_t *sf);
-
-/* Gets the sample rate stored in the format info. Returns a negative error
- * code on failure. If the sample rate property is not set at all, returns
- * -PA_ERR_NOENTITY. */
-int pa_format_info_get_rate(const pa_format_info *f, uint32_t *rate);
-
-/* Gets the channel count stored in the format info. Returns a negative error
- * code on failure. If the channels property is not set at all, returns
- * -PA_ERR_NOENTITY. */
-int pa_format_info_get_channels(const pa_format_info *f, uint8_t *channels);
-
-/* Gets the channel map stored in the format info. Returns a negative error
- * code on failure. If the channel map property is not set at all, returns
- * -PA_ERR_NOENTITY. */
-int pa_format_info_get_channel_map(const pa_format_info *f, pa_channel_map *map);
-
/* Convert a sample spec and an optional channel map to a new PCM format info
* object (remember to free it). If map is NULL, then the channel map will be
* left unspecified. If some fields of the sample spec should be ignored, pass