gavl: /build/gavl/src/gavl-1.4.0/include/gavl/metadata.h Source File

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
26extern "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
85GAVL_PUBLIC void
86gavl_metadata_free(gavl_metadata_t * m);
87
96GAVL_PUBLIC void
97gavl_metadata_init(gavl_metadata_t * m);
98
107GAVL_PUBLIC void
108gavl_metadata_set(gavl_metadata_t * m,
109 const char * key,
110 const char * val);
111
121GAVL_PUBLIC void
122gavl_metadata_set_nocpy(gavl_metadata_t * m,
123 const char * key,
124 char * val);
125
132GAVL_PUBLIC
133 const char * gavl_metadata_get(const gavl_metadata_t * m,
134 const char * key);
135
142GAVL_PUBLIC void
143gavl_metadata_set_int(gavl_metadata_t * m,
144 const char * key,
145 int val);
146
154GAVL_PUBLIC
155 int gavl_metadata_get_int(const gavl_metadata_t * m,
156 const char * key, int * ret);
157
166GAVL_PUBLIC void
167gavl_metadata_set_date(gavl_metadata_t * m,
168 const char * key,
169 int year,
170 int month,
171 int day);
172
182GAVL_PUBLIC int
183gavl_metadata_get_date(gavl_metadata_t * m,
184 const char * key,
185 int * year,
186 int * month,
187 int * day);
188
200GAVL_PUBLIC void
201gavl_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
222GAVL_PUBLIC int
223gavl_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
242GAVL_PUBLIC void
243gavl_metadata_date_to_string(int year,
244 int month,
245 int day, char * ret);
246
260GAVL_PUBLIC void
261gavl_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
279GAVL_PUBLIC
280 void gavl_metadata_merge(gavl_metadata_t * dst,
281 const gavl_metadata_t * src1,
282 const gavl_metadata_t * src2);
283
292GAVL_PUBLIC
293 void gavl_metadata_merge2(gavl_metadata_t * dst,
294 const gavl_metadata_t * src);
295
303GAVL_PUBLIC void
304gavl_metadata_copy(gavl_metadata_t * dst,
305 const gavl_metadata_t * src);
306
312GAVL_PUBLIC void
313gavl_metadata_dump(const gavl_metadata_t * m, int indent);
314
321GAVL_PUBLIC int
322gavl_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_set_int
GAVL_PUBLIC void gavl_metadata_set_int(gavl_metadata_t *m, const char *key, int val)
Set an integer tag.
gavl_metadata_dump
GAVL_PUBLIC void gavl_metadata_dump(const gavl_metadata_t *m, int indent)
Dump metadata structure to stderr.
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_set_nocpy
GAVL_PUBLIC void gavl_metadata_set_nocpy(gavl_metadata_t *m, const char *key, char *val)
Set a 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_init
GAVL_PUBLIC void gavl_metadata_init(gavl_metadata_t *m)
Initialize structre.
gavl_metadata_copy
GAVL_PUBLIC void gavl_metadata_copy(gavl_metadata_t *dst, const gavl_metadata_t *src)
Copy metadata structure.
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_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_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
GAVL_PUBLIC void gavl_metadata_set(gavl_metadata_t *m, const char *key, const char *val)
Set a tag.
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_free
GAVL_PUBLIC void gavl_metadata_free(gavl_metadata_t *m)
Free all metadata tags.
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_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_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_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.
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_t
Single metadata structure.
Definition metadata.h:75
gavl_metadata_t::tags_alloc
int tags_alloc
Number of allocated tags (never touch this)
Definition metadata.h:77
gavl_metadata_t::tags
gavl_metadata_tag_t * tags
Array of tags.
Definition metadata.h:76
gavl_metadata_t::num_tags
int num_tags
Number of valid tags.
Definition metadata.h:78
gavl_metadata_tag_t
Single metadata tag.
Definition metadata.h:65
gavl_metadata_tag_t::val
char * val
Value.
Definition metadata.h:67
gavl_metadata_tag_t::key
char * key
Key.
Definition metadata.h:66