]> code.delx.au - pulseaudio/blob - src/pulsecore/tagstruct.h
fix proplist serialization
[pulseaudio] / src / pulsecore / tagstruct.h
1 #ifndef footagstructhfoo
2 #define footagstructhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of PulseAudio.
8
9 Copyright 2004-2006 Lennart Poettering
10
11 PulseAudio is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as
13 published by the Free Software Foundation; either version 2.1 of the
14 License, or (at your option) any later version.
15
16 PulseAudio is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public
22 License along with PulseAudio; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 USA.
25 ***/
26
27 #include <inttypes.h>
28 #include <sys/types.h>
29 #include <sys/time.h>
30 #include <time.h>
31
32 #include <pulse/sample.h>
33 #include <pulse/channelmap.h>
34 #include <pulse/volume.h>
35 #include <pulse/proplist.h>
36 #include <pulse/gccmacro.h>
37
38 #include <pulsecore/macro.h>
39
40 typedef struct pa_tagstruct pa_tagstruct;
41
42 enum {
43 PA_TAG_INVALID = 0,
44 PA_TAG_STRING = 't',
45 PA_TAG_STRING_NULL = 'N',
46 PA_TAG_U32 = 'L',
47 PA_TAG_U8 = 'B',
48 PA_TAG_U64 = 'R',
49 PA_TAG_S64 = 'r',
50 PA_TAG_SAMPLE_SPEC = 'a',
51 PA_TAG_ARBITRARY = 'x',
52 PA_TAG_BOOLEAN_TRUE = '1',
53 PA_TAG_BOOLEAN_FALSE = '0',
54 PA_TAG_BOOLEAN = PA_TAG_BOOLEAN_TRUE,
55 PA_TAG_TIMEVAL = 'T',
56 PA_TAG_USEC = 'U' /* 64bit unsigned */,
57 PA_TAG_CHANNEL_MAP = 'm',
58 PA_TAG_CVOLUME = 'v',
59 PA_TAG_PROPLIST = 'P'
60 };
61
62 pa_tagstruct *pa_tagstruct_new(const uint8_t* data, size_t length);
63 void pa_tagstruct_free(pa_tagstruct*t);
64 uint8_t* pa_tagstruct_free_data(pa_tagstruct*t, size_t *l);
65
66 int pa_tagstruct_eof(pa_tagstruct*t);
67 const uint8_t* pa_tagstruct_data(pa_tagstruct*t, size_t *l);
68
69 void pa_tagstruct_put(pa_tagstruct *t, ...);
70
71 void pa_tagstruct_puts(pa_tagstruct*t, const char *s);
72 void pa_tagstruct_putu8(pa_tagstruct*t, uint8_t c);
73 void pa_tagstruct_putu32(pa_tagstruct*t, uint32_t i);
74 void pa_tagstruct_putu64(pa_tagstruct*t, uint64_t i);
75 void pa_tagstruct_puts64(pa_tagstruct*t, int64_t i);
76 void pa_tagstruct_put_sample_spec(pa_tagstruct *t, const pa_sample_spec *ss);
77 void pa_tagstruct_put_arbitrary(pa_tagstruct*t, const void *p, size_t length);
78 void pa_tagstruct_put_boolean(pa_tagstruct*t, pa_bool_t b);
79 void pa_tagstruct_put_timeval(pa_tagstruct*t, const struct timeval *tv);
80 void pa_tagstruct_put_usec(pa_tagstruct*t, pa_usec_t u);
81 void pa_tagstruct_put_channel_map(pa_tagstruct *t, const pa_channel_map *map);
82 void pa_tagstruct_put_cvolume(pa_tagstruct *t, const pa_cvolume *cvolume);
83 void pa_tagstruct_put_proplist(pa_tagstruct *t, pa_proplist *p);
84
85 int pa_tagstruct_get(pa_tagstruct *t, ...);
86
87 int pa_tagstruct_gets(pa_tagstruct*t, const char **s);
88 int pa_tagstruct_getu8(pa_tagstruct*t, uint8_t *c);
89 int pa_tagstruct_getu32(pa_tagstruct*t, uint32_t *i);
90 int pa_tagstruct_getu64(pa_tagstruct*t, uint64_t *i);
91 int pa_tagstruct_gets64(pa_tagstruct*t, int64_t *i);
92 int pa_tagstruct_get_sample_spec(pa_tagstruct *t, pa_sample_spec *ss);
93 int pa_tagstruct_get_arbitrary(pa_tagstruct *t, const void **p, size_t length);
94 int pa_tagstruct_get_boolean(pa_tagstruct *t, pa_bool_t *b);
95 int pa_tagstruct_get_timeval(pa_tagstruct*t, struct timeval *tv);
96 int pa_tagstruct_get_usec(pa_tagstruct*t, pa_usec_t *u);
97 int pa_tagstruct_get_channel_map(pa_tagstruct *t, pa_channel_map *map);
98 int pa_tagstruct_get_cvolume(pa_tagstruct *t, pa_cvolume *v);
99 int pa_tagstruct_get_proplist(pa_tagstruct *t, pa_proplist *p);
100
101
102 #endif