This file is part of polypaudio.
polypaudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
polypaudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with polypaudio; if not, write to the Free Software
+ You should have received a copy of the GNU Lesser General Public
+ License along with polypaudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
#include <netinet/in.h>
#include <assert.h>
t->length += 9;
}
+void pa_tagstruct_putu64(struct pa_tagstruct*t, uint64_t u) {
+ assert(t);
+ extend(t, 9);
+ t->data[t->length] = TAG_U64;
+ *((uint32_t*) (t->data+t->length+1)) = htonl((uint32_t) (u >> 32));
+ *((uint32_t*) (t->data+t->length+5)) = htonl((uint32_t) u);
+ t->length += 9;
+}
+
int pa_tagstruct_gets(struct pa_tagstruct*t, const char **s) {
int error = 0;
size_t n;
t->rindex +=9;
return 0;
}
+
+int pa_tagstruct_getu64(struct pa_tagstruct*t, uint64_t *u) {
+ assert(t && u);
+
+ if (t->rindex+9 > t->length)
+ return -1;
+
+ if (t->data[t->rindex] != TAG_U64)
+ return -1;
+
+ *u = (uint64_t) ntohl(*((uint32_t*) (t->data+t->rindex+1))) << 32;
+ *u |= (uint64_t) ntohl(*((uint32_t*) (t->data+t->rindex+5)));
+ t->rindex +=9;
+ return 0;
+}