gavl

metadata.h
1 /*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5 * gmerlin-general@lists.sourceforge.net
6 * http://gmerlin.sourceforge.net
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * *****************************************************************/
21
22 #ifndef GAVL_METADATA_H_INCLUDED
23 #define GAVL_METADATA_H_INCLUDED
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <gavl/gavldefs.h>
30
54 #define GAVL_METADATA_DATE_STRING_LEN 11
55
59 #define GAVL_METADATA_DATE_TIME_STRING_LEN 20
60
64 typedef struct
65 {
66 char * key;
67 char * val;
68 } gavl_metadata_tag_t;
69
74 typedef struct
75 {
76 gavl_metadata_tag_t * tags;
77 int tags_alloc;
78 int num_tags;
79 } gavl_metadata_t;
80
85 GAVL_PUBLIC void
86 gavl_metadata_free(gavl_metadata_t * m);
87
96 GAVL_PUBLIC void
97 gavl_metadata_init(gavl_metadata_t * m);
98
107 GAVL_PUBLIC void
108 gavl_metadata_set(gavl_metadata_t * m,
109 const char * key,
110 const char * val);
111
121 GAVL_PUBLIC void
122 gavl_metadata_set_nocpy(gavl_metadata_t * m,
123 const char * key,
124 char * val);
125
132 GAVL_PUBLIC
133 const char * gavl_metadata_get(const gavl_metadata_t * m,
134 const char * key);
135
142 GAVL_PUBLIC void
143 gavl_metadata_set_int(gavl_metadata_t * m,
144 const char * key,
145 int val);
146
154 GAVL_PUBLIC
155 int gavl_metadata_get_int(const gavl_metadata_t * m,
156 const char * key, int * ret);
157
166 GAVL_PUBLIC void
167 gavl_metadata_set_date(gavl_metadata_t * m,
168 const char * key,
169 int year,
170 int month,
171 int day);
172
182 GAVL_PUBLIC int
183 gavl_metadata_get_date(gavl_metadata_t * m,
184 const char * key,
185 int * year,
186 int * month,
187 int * day);
188
200 GAVL_PUBLIC void
201 gavl_metadata_set_date_time(gavl_metadata_t * m,
202 const char * key,
203 int year,
204 int month,
205 int day,
206 int hour,
207 int minute,
208 int second);
209
222 GAVL_PUBLIC int
223 gavl_metadata_get_date_time(gavl_metadata_t * m,
224 const char * key,
225 int * year,
226 int * month,
227 int * day,
228 int * hour,
229 int * minute,
230 int * second);
231
242 GAVL_PUBLIC void
243 gavl_metadata_date_to_string(int year,
244 int month,
245 int day, char * ret);
246
260 GAVL_PUBLIC void
261 gavl_metadata_date_time_to_string(int year,
262 int month,
263 int day,
264 int hour,
265 int minute,
266 int second,
267 char * ret);
268
279 GAVL_PUBLIC
280 void gavl_metadata_merge(gavl_metadata_t * dst,
281 const gavl_metadata_t * src1,
282 const gavl_metadata_t * src2);
283
292 GAVL_PUBLIC
293 void gavl_metadata_merge2(gavl_metadata_t * dst,
294 const gavl_metadata_t * src);
295
303 GAVL_PUBLIC void
304 gavl_metadata_copy(gavl_metadata_t * dst,
305 const gavl_metadata_t * src);
306
312 GAVL_PUBLIC void
313 gavl_metadata_dump(const gavl_metadata_t * m, int indent);
314
321 GAVL_PUBLIC int
322 gavl_metadata_equal(const gavl_metadata_t * m1,
323 const gavl_metadata_t * m2);
324
329 #ifdef __cplusplus
330 }
331 #endif
332
333 #endif // GAVL_METADATA_H_INCLUDED
gavl_metadata_dump
GAVL_PUBLIC void gavl_metadata_dump(const gavl_metadata_t *m, int indent)
Dump metadata structure to stderr.
gavl_metadata_set_int
GAVL_PUBLIC void gavl_metadata_set_int(gavl_metadata_t *m, const char *key, int val)
Set an integer tag.
gavl_metadata_tag_t::val
char * val
Value.
Definition: metadata.h:67
gavl_metadata_t::num_tags
int num_tags
Number of valid tags.
Definition: metadata.h:78
gavl_metadata_t::tags
gavl_metadata_tag_t * tags
Array of tags.
Definition: metadata.h:76
gavl_metadata_tag_t::key
char * key
Key.
Definition: metadata.h:66
gavl_metadata_get_int
GAVL_PUBLIC int gavl_metadata_get_int(const gavl_metadata_t *m, const char *key, int *ret)
Get an integer tag.
gavl_metadata_t
Single metadata structure.
Definition: metadata.h:74
gavl_metadata_date_to_string
GAVL_PUBLIC void gavl_metadata_date_to_string(int year, int month, int day, char *ret)
Format a date string.
gavl_metadata_init
GAVL_PUBLIC void gavl_metadata_init(gavl_metadata_t *m)
Initialize structre.
gavl_metadata_set_nocpy
GAVL_PUBLIC void gavl_metadata_set_nocpy(gavl_metadata_t *m, const char *key, char *val)
Set a tag.
gavl_metadata_get
GAVL_PUBLIC const char * gavl_metadata_get(const gavl_metadata_t *m, const char *key)
Get the value of a tag.
gavl_metadata_copy
GAVL_PUBLIC void gavl_metadata_copy(gavl_metadata_t *dst, const gavl_metadata_t *src)
Copy metadata structure.
gavl_metadata_merge
GAVL_PUBLIC void gavl_metadata_merge(gavl_metadata_t *dst, const gavl_metadata_t *src1, const gavl_metadata_t *src2)
Merge two metadata structures.
gavl_metadata_date_time_to_string
GAVL_PUBLIC void gavl_metadata_date_time_to_string(int year, int month, int day, int hour, int minute, int second, char *ret)
Format a date string.
gavl_metadata_set
GAVL_PUBLIC void gavl_metadata_set(gavl_metadata_t *m, const char *key, const char *val)
Set a tag.
gavl_metadata_set_date
GAVL_PUBLIC void gavl_metadata_set_date(gavl_metadata_t *m, const char *key, int year, int month, int day)
Set a date tag.
gavl_metadata_merge2
GAVL_PUBLIC void gavl_metadata_merge2(gavl_metadata_t *dst, const gavl_metadata_t *src)
Merge two metadata structures.
gavl_metadata_get_date_time
GAVL_PUBLIC int gavl_metadata_get_date_time(gavl_metadata_t *m, const char *key, int *year, int *month, int *day, int *hour, int *minute, int *second)
Get a date/time tag.
gavl_metadata_t::tags_alloc
int tags_alloc
Number of allocated tags (never touch this)
Definition: metadata.h:77
gavl_metadata_equal
GAVL_PUBLIC int gavl_metadata_equal(const gavl_metadata_t *m1, const gavl_metadata_t *m2)
Check if 2 metadata structures are equal.
gavl_metadata_free
GAVL_PUBLIC void gavl_metadata_free(gavl_metadata_t *m)
Free all metadata tags.
gavl_metadata_tag_t
Single metadata tag.
Definition: metadata.h:64
gavl_metadata_get_date
GAVL_PUBLIC int gavl_metadata_get_date(gavl_metadata_t *m, const char *key, int *year, int *month, int *day)
Get a date tag.
gavl_metadata_set_date_time
GAVL_PUBLIC void gavl_metadata_set_date_time(gavl_metadata_t *m, const char *key, int year, int month, int day, int hour, int minute, int second)
Set a date/time tag.