summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/tagstruct.c
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-05-15 13:14:33 +0100
committerColin Guthrie <colin@mageia.org>2011-05-15 13:14:33 +0100
commit26b4bd74aa92ed51a33a59af46ec32d7e5b66628 (patch)
treeba0105baedff9f796f89b31b10953748a119d644 /src/pulsecore/tagstruct.c
parentbe4208d0799f21663f58f50430b4883e87709480 (diff)
parent7ebc5033637d7f0ca8ece80259d8a5dc6b30557b (diff)
Merge branch 'passthrough'
Diffstat (limited to 'src/pulsecore/tagstruct.c')
-rw-r--r--src/pulsecore/tagstruct.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/pulsecore/tagstruct.c b/src/pulsecore/tagstruct.c
index 804b9f90..5694a0da 100644
--- a/src/pulsecore/tagstruct.c
+++ b/src/pulsecore/tagstruct.c
@@ -291,6 +291,17 @@ void pa_tagstruct_put_proplist(pa_tagstruct *t, pa_proplist *p) {
pa_tagstruct_puts(t, NULL);
}
+void pa_tagstruct_put_format_info(pa_tagstruct *t, pa_format_info *f) {
+ pa_assert(t);
+ pa_assert(f);
+
+ extend(t, 1);
+
+ t->data[t->length++] = PA_TAG_FORMAT_INFO;
+ pa_tagstruct_putu8(t, (uint8_t) f->encoding);
+ pa_tagstruct_put_proplist(t, f->plist);
+}
+
int pa_tagstruct_gets(pa_tagstruct*t, const char **s) {
int error = 0;
size_t n;
@@ -631,6 +642,37 @@ fail:
return -1;
}
+int pa_tagstruct_get_format_info(pa_tagstruct *t, pa_format_info *f) {
+ size_t saved_rindex;
+ uint8_t encoding;
+
+ pa_assert(t);
+ pa_assert(f);
+
+ if (t->rindex+1 > t->length)
+ return -1;
+
+ if (t->data[t->rindex] != PA_TAG_FORMAT_INFO)
+ return -1;
+
+ saved_rindex = t->rindex;
+ t->rindex++;
+
+ if (pa_tagstruct_getu8(t, &encoding) < 0)
+ goto fail;
+
+ f->encoding = encoding;
+
+ if (pa_tagstruct_get_proplist(t, f->plist) < 0)
+ goto fail;
+
+ return 0;
+
+fail:
+ t->rindex = saved_rindex;
+ return -1;
+}
+
void pa_tagstruct_put(pa_tagstruct *t, ...) {
va_list va;
pa_assert(t);