gavl
metadata.h
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2012 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 <inttypes.h>
30
31#include <gavl/gavldefs.h>
32#include <gavl/value.h>
33
57#define GAVL_METADATA_DATE_STRING_LEN 11
58
62#define GAVL_METADATA_DATE_TIME_STRING_LEN 20
63
68// GAVL_PUBLIC void
69// gavl_dictionary_free(gavl_dictionary_t * m);
70
79// GAVL_PUBLIC void
80// gavl_dictionary_init(gavl_dictionary_t * m);
81
90// GAVL_PUBLIC void
91//gavl_dictionary_set_string(gavl_dictionary_t * m,
92// const char * key,
93// const char * val);
94
104//GAVL_PUBLIC void
105//gavl_dictionary_set_string_nocpy(gavl_dictionary_t * m,
106// const char * key,
107// char * val);
108
118GAVL_PUBLIC void
119gavl_metadata_append(gavl_dictionary_t * m,
120 const char * key,
121 const char * val);
122
132GAVL_PUBLIC void
133gavl_metadata_append_nocpy(gavl_dictionary_t * m,
134 const char * key,
135 char * val);
136
144GAVL_PUBLIC const char *
145gavl_dictionary_get_arr(const gavl_dictionary_t * m,
146 const char * key,
147 int i);
148
158GAVL_PUBLIC const char *
159gavl_dictionary_get_arr_i(const gavl_dictionary_t * m,
160 const char * key,
161 int i);
162
170GAVL_PUBLIC char *
171gavl_metadata_join_arr(const gavl_dictionary_t * m,
172 const char * key, const char * glue);
173
174
181GAVL_PUBLIC int
182gavl_dictionary_get_arr_len(const gavl_dictionary_t * m,
183 const char * key);
184
185
192// GAVL_PUBLIC
193// const char * gavl_dictionary_get_string_i(const gavl_dictionary_t * m,
194// const char * key);
195
196
205GAVL_PUBLIC void
206gavl_dictionary_set_date(gavl_dictionary_t * m,
207 const char * key,
208 int year,
209 int month,
210 int day);
218GAVL_PUBLIC int
219gavl_dictionary_get_year(const gavl_dictionary_t * m,
220 const char * key);
221
222
232GAVL_PUBLIC int
233gavl_dictionary_get_date(const gavl_dictionary_t * m,
234 const char * key,
235 int * year,
236 int * month,
237 int * day);
238
250GAVL_PUBLIC void
251gavl_dictionary_set_date_time(gavl_dictionary_t * m,
252 const char * key,
253 int year,
254 int month,
255 int day,
256 int hour,
257 int minute,
258 int second);
259
272GAVL_PUBLIC int
273gavl_dictionary_get_date_time(const gavl_dictionary_t * m,
274 const char * key,
275 int * year,
276 int * month,
277 int * day,
278 int * hour,
279 int * minute,
280 int * second);
281
292GAVL_PUBLIC void
294 int month,
295 int day, char * ret);
296
310GAVL_PUBLIC void
312 int month,
313 int day,
314 int hour,
315 int minute,
316 int second,
317 char * ret);
318
325GAVL_PUBLIC int
326gavl_metadata_equal(const gavl_dictionary_t * m1,
327 const gavl_dictionary_t * m2);
328
338GAVL_PUBLIC void
340
347GAVL_PUBLIC void
349
357GAVL_PUBLIC void
359
365GAVL_PUBLIC int
366gavl_metadata_do_swap_endian(const gavl_dictionary_t * m);
367
368GAVL_PUBLIC gavl_dictionary_t *
369gavl_metadata_add_image_uri(gavl_dictionary_t * m,
370 const char * key,
371 int w, int h,
372 const char * mimetype,
373 const char * uri);
374
375GAVL_PUBLIC const char *
376gavl_dictionary_get_string_image_uri(const gavl_dictionary_t * m,
377 const char * key,
378 int i,
379 int * wp, int * hp,
380 const char ** mimetype);
381
382GAVL_PUBLIC const char *
383gavl_dictionary_get_string_image_max(const gavl_dictionary_t * m,
384 const char * key,
385 int w, int h,
386 const char * mimetype);
387
388GAVL_PUBLIC void
389gavl_metadata_add_image_embedded(gavl_dictionary_t * m,
390 const char * key,
391 int w, int h,
392 const char * mimetype,
393 int64_t offset,
394 int64_t size);
395
396GAVL_PUBLIC const gavl_dictionary_t *
397gavl_dictionary_get_image_max(const gavl_dictionary_t * m,
398 const char * key,
399 int w, int h,
400 const char * mimetype);
401
402GAVL_PUBLIC const gavl_dictionary_t *
403gavl_dictionary_get_image_max_proto(const gavl_dictionary_t * m,
404 const char * key,
405 int w, int h,
406 const char * mimetype, const char * protocol);
407
408GAVL_PUBLIC
409gavl_dictionary_t *
410gavl_metadata_add_src(gavl_dictionary_t * m, const char * key,
411 const char * mimetype, const char * location);
412
413GAVL_PUBLIC
414const gavl_dictionary_t *
415gavl_dictionary_get_src(const gavl_dictionary_t * m, const char * key, int idx,
416 const char ** mimetype, const char ** location);
417
418GAVL_PUBLIC
419gavl_dictionary_t *
420gavl_dictionary_get_src_nc(gavl_dictionary_t * m, const char * key, int idx);
421
422
423GAVL_PUBLIC
424int gavl_metadata_has_src(const gavl_dictionary_t * m, const char * key,
425 const char * location);
426
427
428
433#ifdef __cplusplus
434}
435#endif
436
437#endif // GAVL_METADATA_H_INCLUDED
GAVL_PUBLIC void gavl_metadata_append(gavl_dictionary_t *m, const char *key, const char *val)
Free all metadata tags.
GAVL_PUBLIC const char * gavl_dictionary_get_arr_i(const gavl_dictionary_t *m, const char *key, int i)
Get the array value of a tag.
GAVL_PUBLIC int gavl_metadata_do_swap_endian(const gavl_dictionary_t *m)
Check if endianess needs to be swapped.
GAVL_PUBLIC int gavl_dictionary_get_date_time(const gavl_dictionary_t *m, const char *key, int *year, int *month, int *day, int *hour, int *minute, int *second)
Get a date/time tag.
GAVL_PUBLIC char * gavl_metadata_join_arr(const gavl_dictionary_t *m, const char *key, const char *glue)
Get the array value of a tag.
GAVL_PUBLIC int gavl_dictionary_get_year(const gavl_dictionary_t *m, const char *key)
Get the year from a tag.
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_PUBLIC void gavl_dictionary_set_date_time(gavl_dictionary_t *m, const char *key, int year, int month, int day, int hour, int minute, int second)
Set a date/time tag.
GAVL_PUBLIC void gavl_metadata_append_nocpy(gavl_dictionary_t *m, const char *key, char *val)
Append values of a tag without copying.
GAVL_PUBLIC void gavl_dictionary_set_date(gavl_dictionary_t *m, const char *key, int year, int month, int day)
Get the value of a tag ignrong case.
GAVL_PUBLIC int gavl_dictionary_get_date(const gavl_dictionary_t *m, const char *key, int *year, int *month, int *day)
Get a date tag.
GAVL_PUBLIC const char * gavl_dictionary_get_arr(const gavl_dictionary_t *m, const char *key, int i)
Get the array value of a tag.
GAVL_PUBLIC void gavl_metadata_delete_compression_fields(gavl_dictionary_t *m)
Clear fields, which are related to the compression.
GAVL_PUBLIC void gavl_dictionary_set_string_endian(gavl_dictionary_t *m)
Set the enddian tag.
GAVL_PUBLIC void gavl_metadata_delete_implicit_fields(gavl_dictionary_t *m)
Clear fields, which are obtained implicitly.
GAVL_PUBLIC int gavl_dictionary_get_arr_len(const gavl_dictionary_t *m, const char *key)
Get the length of an array value of a tag.
GAVL_PUBLIC void gavl_metadata_date_to_string(int year, int month, int day, char *ret)
Format a date string.
GAVL_PUBLIC int gavl_metadata_equal(const gavl_dictionary_t *m1, const gavl_dictionary_t *m2)
Check if 2 metadata structures are equal.