summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-10-03 17:43:40 +0200
committerLennart Poettering <lennart@poettering.net>2008-10-03 17:43:40 +0200
commitebb2ecbe12b30ced855b6497d903e3250e356327 (patch)
tree3b3f48b75594ccac665d365a711ba91a6316c457
parent619ed8a82d05ec2c505600ed6937574739220400 (diff)
add new API call pa_cvolume_compatible()
-rw-r--r--src/map-file1
-rw-r--r--src/pulse/volume.c14
-rw-r--r--src/pulse/volume.h4
3 files changed, 19 insertions, 0 deletions
diff --git a/src/map-file b/src/map-file
index 2ef2ad63..7f38be11 100644
--- a/src/map-file
+++ b/src/map-file
@@ -98,6 +98,7 @@ pa_context_unload_module;
pa_context_unref;
pa_cvolume_avg;
pa_cvolume_channels_equal_to;
+pa_cvolume_compatible;
pa_cvolume_equal;
pa_cvolume_max;
pa_cvolume_remap;
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 4d5fcf08..e809ef9c 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -325,3 +325,17 @@ pa_cvolume *pa_cvolume_remap(pa_cvolume *v, pa_channel_map *from, pa_channel_map
*v = result;
return v;
}
+
+int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) {
+
+ pa_assert(v);
+ pa_assert(ss);
+
+ if (!pa_cvolume_valid(v))
+ return 0;
+
+ if (!pa_sample_spec_valid(ss))
+ return 0;
+
+ return v->channels == ss->channels;
+}
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index d6eb6061..90fb59e5 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -192,6 +192,10 @@ double pa_sw_volume_to_linear(pa_volume_t v) PA_GCC_CONST;
/** Remap a volume from one channel mapping to a different channel mapping. \since 0.9.12 */
pa_cvolume *pa_cvolume_remap(pa_cvolume *v, pa_channel_map *from, pa_channel_map *to);
+/** Return non-zero if the specified volume is compatible with
+ * the specified sample spec. \since 0.9.13 */
+int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_PURE;
+
PA_C_DECL_END
#endif