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