From 25123469d53e2ef555549984ea4e8b028c1632fb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 10 Sep 2004 22:35:12 +0000 Subject: 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 --- polyp/tagstruct.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'polyp/tagstruct.c') 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; + +} -- cgit