summaryrefslogtreecommitdiff
path: root/libgupnp-dlna/gupnp-dlna-values.h
blob: c80dfe00e7f5e3fc3751ba55deacd2cd8a102397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*
 * Copyright (C) 2012 Intel Corporation.
 *
 * Authors: Krzesimir Nowak <krnowak@openismus.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GUPNP_DLNA_VALUES_H__
#define __GUPNP_DLNA_VALUES_H__

#include <glib.h>

G_BEGIN_DECLS

/**
 * SECTION:gupnp-dlna-values
 * @short_description: State values for metadata attributes.
 * @title: GUPnP DLNA Values
 *
 * The #GUPnPDLNABoolValue, #GUPnPDLNAFractionValue,
 * #GUPnPDLNAIntValue and #GUPnPDLNAStringValue hold respectively
 * boolean, fraction, integer and string values.
 *
 * The value can be in one of three possible states - set, unset or
 * unsupported. When value is in set state it is possible to use the
 * underlying value it holds. In other states using such value is
 * undefined.
 *
 * Main difference between unset state and unsupported state is that
 * the former is set when metadata extractor is capable of extracting
 * some attribute in general, but current media file does not have
 * such attribute, while the latter means that metadata extractor has
 * no idea how to extract such attribute at all.
 *
 * One note on #GUPnPDLNAStringValue - it holds a string that has to
 * be allocated with g_malloc() (that is - g_strdup() and others are
 * fine as well as they use g_malloc() internally). The string is
 * freed by consumer.
 */

/**
 * GUPnPDLNAValueState:
 * @GUPNP_DLNA_VALUE_STATE_SET: Value is set.
 * @GUPNP_DLNA_VALUE_STATE_UNSET: Value is unset.
 * @GUPNP_DLNA_VALUE_STATE_UNSUPPORTED: Value is unsupported.
 *
 * Flags describing a state of GUPnP DLNA Value.
 */
typedef enum {
        GUPNP_DLNA_VALUE_STATE_SET,
        GUPNP_DLNA_VALUE_STATE_UNSET,
        GUPNP_DLNA_VALUE_STATE_UNSUPPORTED
} GUPnPDLNAValueState;

/**
 * GUPnPDLNABoolValue:
 * @value: The boolean value.
 * @state: The state of #GUPnPDLNABoolValue.
 *
 * GUPnP DLNA Value representing a boolean value of some metadata attribute.
 */
typedef struct {
        gboolean            value;
        GUPnPDLNAValueState state;
} GUPnPDLNABoolValue;

/**
 * GUPNP_DLNA_BOOL_VALUE_UNSET:
 *
 * Static initializer for unset #GUPnPDLNABoolValue. Can be used in
 * two ways:
 *
 * |[
 *   GUPnPDLNABoolValue value = GUPNP_DLNA_BOOL_VALUE_UNSET;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_BOOL_VALUE_UNSET;
 * ]|
 */
#define GUPNP_DLNA_BOOL_VALUE_UNSET \
        ((GUPnPDLNABoolValue) {FALSE, GUPNP_DLNA_VALUE_STATE_UNSET})
/**
 * GUPNP_DLNA_BOOL_VALUE_UNSUPPORTED:
 *
 * Static initializer for unsupported #GUPnPDLNABoolValue. Can be used
 * in two ways:
 *
 * |[
 *   GUPnPDLNABoolValue value = GUPNP_DLNA_BOOL_VALUE_UNSUPPORTED;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_BOOL_VALUE_UNSUPPORTED;
 * ]|
 */
#define GUPNP_DLNA_BOOL_VALUE_UNSUPPORTED \
        ((GUPnPDLNABoolValue) {FALSE, GUPNP_DLNA_VALUE_STATE_UNSUPPORTED})

/**
 * GUPnPDLNAFractionValue:
 * @numerator: The numerator of fraction.
 * @denominator: The denominator of fraction.
 * @state: The state of #GUPnPDLNAFractionValue.
 *
 * GUPnP DLNA Value representing a fraction value of some metadata attribute.
 */
typedef struct {
        gint                numerator;
        gint                denominator;
        GUPnPDLNAValueState state;
} GUPnPDLNAFractionValue;

/**
 * GUPNP_DLNA_FRACTION_VALUE_UNSET:
 *
 * Static initializer for unset #GUPnPDLNAFractionValue. Can be used
 * in two ways:
 *
 * |[
 *   GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSET;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_FRACTION_VALUE_UNSET;
 * ]|
 */
#define GUPNP_DLNA_FRACTION_VALUE_UNSET \
        ((GUPnPDLNAFractionValue) {0, 0, GUPNP_DLNA_VALUE_STATE_UNSET})
/**
 * GUPNP_DLNA_FRACTION_VALUE_UNSUPPORTED:
 *
 * Static initializer for unsupported #GUPnPDLNAFractionValue. Can be
 * used in two ways:
 *
 * |[
 *   GUPnPDLNAFractionValue value = GUPNP_DLNA_FRACTION_VALUE_UNSUPPORTED;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_FRACTION_VALUE_UNSUPPORTED;
 * ]|
 */
#define GUPNP_DLNA_FRACTION_VALUE_UNSUPPORTED \
        ((GUPnPDLNAFractionValue) {0, 0, GUPNP_DLNA_VALUE_STATE_UNSUPPORTED})

/**
 * GUPnPDLNAIntValue:
 * @value: The integer value.
 * @state: The state of #GUPnPDLNAIntValue.
 *
 * GUPnP DLNA Value representing an integer value of some metadata attribute.
 */
typedef struct {
        gint                value;
        GUPnPDLNAValueState state;
} GUPnPDLNAIntValue;

/**
 * GUPNP_DLNA_INT_VALUE_UNSET:
 *
 * Static initializer for unset #GUPnPDLNAIntValue. Can be used in
 * two ways:
 *
 * |[
 *   GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSET;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_INT_VALUE_UNSET;
 * ]|
 */
#define GUPNP_DLNA_INT_VALUE_UNSET \
        ((GUPnPDLNAIntValue) {0, GUPNP_DLNA_VALUE_STATE_UNSET})
/**
 * GUPNP_DLNA_INT_VALUE_UNSUPPORTED:
 *
 * Static initializer for unsupported #GUPnPDLNAIntValue. Can be used in
 * two ways:
 *
 * |[
 *   GUPnPDLNAIntValue value = GUPNP_DLNA_INT_VALUE_UNSUPPORTED;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_INT_VALUE_UNSUPPORTED;
 * ]|
 */
#define GUPNP_DLNA_INT_VALUE_UNSUPPORTED \
        ((GUPnPDLNAIntValue) {0, GUPNP_DLNA_VALUE_STATE_UNSUPPORTED})

/**
 * GUPnPDLNAStringValue:
 * @value: The string value.
 * @state: The state of #GUPnPDLNAStringValue.
 *
 * GUPnP DLNA Value representing a string value of some metadata
 * attribute.
 */
typedef struct {
        gchar               *value;
        GUPnPDLNAValueState  state;
} GUPnPDLNAStringValue;

/**
 * GUPNP_DLNA_STRING_VALUE_UNSET:
 *
 * Static initializer for unset #GUPnPDLNAStringValue. Can be used in
 * two ways:
 *
 * |[
 *   GUPnPDLNAStringValue value = GUPNP_DLNA_STRING_VALUE_UNSET;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_STRING_VALUE_UNSET;
 * ]|
 */
#define GUPNP_DLNA_STRING_VALUE_UNSET \
        ((GUPnPDLNAStringValue) {NULL, GUPNP_DLNA_VALUE_STATE_UNSET})
/**
 * GUPNP_DLNA_STRING_VALUE_UNSUPPORTED:
 *
 * Static initializer for unsupported #GUPnPDLNAStringValue. Can be
 * used in two ways:
 *
 * |[
 *   GUPnPDLNAStringValue value = GUPNP_DLNA_STRING_VALUE_UNSUPPORTED;
 * ]|
 *
 * or
 *
 * |[
 *   return GUPNP_DLNA_STRING_VALUE_UNSUPPORTED;
 * ]|
 */
#define GUPNP_DLNA_STRING_VALUE_UNSUPPORTED \
        ((GUPnPDLNAStringValue) {NULL, GUPNP_DLNA_VALUE_STATE_UNSUPPORTED})

G_END_DECLS

#endif /* __GUPNP_DLNA_VALUES_H__ */