summaryrefslogtreecommitdiffstats
path: root/polyp/tagstruct.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-09-10 22:35:12 +0000
committerLennart Poettering <lennart@poettering.net>2004-09-10 22:35:12 +0000
commit25123469d53e2ef555549984ea4e8b028c1632fb (patch)
tree4a1374c5e7ca11afff25d240b81809d23f791eb1 /polyp/tagstruct.c
parent0c99fb31826fba0ed4f904d04dd56f1df3663a3e (diff)
add support for module search path as command line argument
protocol-native: move first data request into ack of stream creation improve mainloop API: return the number of dispatched sources on iterate() fix a resampling bug introduce network latency measurement WARNING: all these changes together may break some applications git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@189 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/tagstruct.c')
-rw-r--r--polyp/tagstruct.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/polyp/tagstruct.c b/polyp/tagstruct.c
index 5aa79e6c..55132cae 100644
--- a/polyp/tagstruct.c
+++ b/polyp/tagstruct.c
@@ -43,6 +43,7 @@ enum tags {
TAG_ARBITRARY = 'x',
TAG_BOOLEAN_TRUE = '1',
TAG_BOOLEAN_FALSE = '0',
+ TAG_TIMEVAL = 'T',
};
struct pa_tagstruct {
@@ -145,6 +146,15 @@ void pa_tagstruct_put_boolean(struct pa_tagstruct*t, int b) {
t->length += 1;
}
+void pa_tagstruct_put_timeval(struct pa_tagstruct*t, const struct timeval *tv) {
+ assert(t);
+ extend(t, 9);
+ t->data[t->length] = TAG_TIMEVAL;
+ *((uint32_t*) (t->data+t->length+1)) = htonl(tv->tv_sec);
+ *((uint32_t*) (t->data+t->length+5)) = htonl(tv->tv_usec);
+ t->length += 9;
+}
+
int pa_tagstruct_gets(struct pa_tagstruct*t, const char **s) {
int error = 0;
size_t n;
@@ -263,4 +273,18 @@ int pa_tagstruct_get_boolean(struct pa_tagstruct*t, int *b) {
return 0;
}
+int pa_tagstruct_get_timeval(struct pa_tagstruct*t, struct timeval *tv) {
+
+ if (t->rindex+9 > t->length)
+ return -1;
+
+ if (t->data[t->rindex] != TAG_TIMEVAL)
+ return -1;
+
+ tv->tv_sec = ntohl(*((uint32_t*) (t->data+t->rindex+1)));
+ tv->tv_usec = ntohl(*((uint32_t*) (t->data+t->rindex+5)));
+ t->rindex += 9;
+ return 0;
+
+}