summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-10-03 17:13:17 +0200
committerLennart Poettering <lennart@poettering.net>2008-10-03 17:13:17 +0200
commit891989896d8c8c2d3645933c7ff93527d4eb4a9c (patch)
tree2049e925aed23fe6b07073956840857fbe544264 /src
parent8a50105fe0568598ef5bc0f5360d60536a8bf5cd (diff)
add new API function pa_sample_spec_init()
Diffstat (limited to 'src')
-rw-r--r--src/pulse/sample.c10
-rw-r--r--src/pulse/sample.h5
2 files changed, 15 insertions, 0 deletions
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 39891d25..29501595 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -80,6 +80,16 @@ size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) {
return (size_t) (((t * spec->rate) / PA_USEC_PER_SEC)) * pa_frame_size(spec);
}
+pa_sample_spec* pa_sample_spec_init(pa_sample_spec *spec) {
+ pa_assert(spec);
+
+ spec->format = PA_SAMPLE_INVALID;
+ spec->rate = 0;
+ spec->channels = 0;
+
+ return spec;
+}
+
int pa_sample_spec_valid(const pa_sample_spec *spec) {
pa_assert(spec);
diff --git a/src/pulse/sample.h b/src/pulse/sample.h
index 3f1b2fcf..0053bf0a 100644
--- a/src/pulse/sample.h
+++ b/src/pulse/sample.h
@@ -232,6 +232,11 @@ pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_P
* return values. \since 0.9 */
size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE;
+/** Initialize the specified sample spec and return a pointer to
+ * it. The sample spec will have a defined state but
+ * pa_sample_spec_valid() will fail for it. \since 0.9.13 */
+pa_sample_spec* pa_sample_spec_init(pa_sample_spec *spec);
+
/** Return non-zero when the sample type specification is valid */
int pa_sample_spec_valid(const pa_sample_spec *spec) PA_GCC_PURE;