gavl

metadata.h
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2024 Members of the Gmerlin project
5 * http://github.com/bplaum
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21
22
23#ifndef GAVL_METADATA_H_INCLUDED
24#define GAVL_METADATA_H_INCLUDED
25
26#ifdef __cplusplus
27 extern "C" {
28#endif
29
30#include <inttypes.h>
31
32#include <gavl/gavldefs.h>
33#include <gavl/value.h>
34
55
58#define GAVL_METADATA_DATE_STRING_LEN 11
59
62
63#define GAVL_METADATA_DATE_TIME_STRING_LEN 20
64
68
69// GAVL_PUBLIC void
70// gavl_dictionary_free(gavl_dictionary_t * m);
71
79
80// GAVL_PUBLIC void
81// gavl_dictionary_init(gavl_dictionary_t * m);
82
90
91// GAVL_PUBLIC void
92//gavl_dictionary_set_string(gavl_dictionary_t * m,
93// const char * key,
94// const char * val);
95
104
105//GAVL_PUBLIC void
106//gavl_dictionary_set_string_nocpy(gavl_dictionary_t * m,
107// const char * key,
108// char * val);
109
118
119GAVL_PUBLIC void
120 gavl_metadata_append(gavl_dictionary_t * m,
121 const char * key,
122 const char * val);
123
132
133GAVL_PUBLIC void
134 gavl_metadata_append_nocpy(gavl_dictionary_t * m,
135 const char * key,
136 char * val);
137
144
145GAVL_PUBLIC const char *
146 gavl_dictionary_get_arr(const gavl_dictionary_t * m,
147 const char * key,
148 int i);
149
158
159GAVL_PUBLIC const char *
160 gavl_dictionary_get_arr_i(const gavl_dictionary_t * m,
161 const char * key,
162 int i);
163
170
171GAVL_PUBLIC char *
172 gavl_metadata_join_arr(const gavl_dictionary_t * m,
173 const char * key, const char * glue);
174
175
181
182GAVL_PUBLIC int
183 gavl_dictionary_get_arr_len(const gavl_dictionary_t * m,
184 const char * key);
185
186
192
193// GAVL_PUBLIC
194// const char * gavl_dictionary_get_string_i(const gavl_dictionary_t * m,
195// const char * key);
196
197
205
206GAVL_PUBLIC void
207 gavl_dictionary_set_date(gavl_dictionary_t * m,
208 const char * key,
209 int year,
210 int month,
211 int day);
218
219GAVL_PUBLIC int
220 gavl_dictionary_get_year(const gavl_dictionary_t * m,
221 const char * key);
222
223
232
233GAVL_PUBLIC int
234 gavl_dictionary_get_date(const gavl_dictionary_t * m,
235 const char * key,
236 int * year,
237 int * month,
238 int * day);
239
250
251GAVL_PUBLIC void
252 gavl_dictionary_set_date_time(gavl_dictionary_t * m,
253 const char * key,
254 int year,
255 int month,
256 int day,
257 int hour,
258 int minute,
259 int second);
260
272
273GAVL_PUBLIC int
274 gavl_dictionary_get_date_time(const gavl_dictionary_t * m,
275 const char * key,
276 int * year,
277 int * month,
278 int * day,
279 int * hour,
280 int * minute,
281 int * second);
282
292
293GAVL_PUBLIC void
294 gavl_metadata_date_to_string(int year,
295 int month,
296 int day, char * ret);
297
310
311GAVL_PUBLIC void
312 gavl_metadata_date_time_to_string(int year,
313 int month,
314 int day,
315 int hour,
316 int minute,
317 int second,
318 char * ret);
319
325
326GAVL_PUBLIC int
327 gavl_metadata_equal(const gavl_dictionary_t * m1,
328 const gavl_dictionary_t * m2);
329
338
339GAVL_PUBLIC void
340 gavl_metadata_delete_compression_fields(gavl_dictionary_t * m);
341
347
348GAVL_PUBLIC void
349 gavl_metadata_delete_implicit_fields(gavl_dictionary_t * m);
350
357
358GAVL_PUBLIC void
359 gavl_dictionary_set_string_endian(gavl_dictionary_t * m);
360
365
366GAVL_PUBLIC int
367 gavl_metadata_do_swap_endian(const gavl_dictionary_t * m);
368
369GAVL_PUBLIC gavl_dictionary_t *
370gavl_metadata_add_image_uri(gavl_dictionary_t * m,
371 const char * key,
372 int w, int h,
373 const char * mimetype,
374 const char * uri);
375
376GAVL_PUBLIC const char *
377gavl_dictionary_get_string_image_uri(const gavl_dictionary_t * m,
378 const char * key,
379 int i,
380 int * wp, int * hp,
381 const char ** mimetype);
382
383GAVL_PUBLIC const char *
384gavl_dictionary_get_string_image_max(const gavl_dictionary_t * m,
385 const char * key,
386 int w, int h,
387 const char * mimetype);
388
389GAVL_PUBLIC void
390gavl_metadata_add_image_embedded(gavl_dictionary_t * m,
391 const char * key,
392 int w, int h,
393 const char * mimetype,
394 const uint8_t * image_data,
395 int len);
396
397GAVL_PUBLIC const gavl_dictionary_t *
398gavl_dictionary_get_image_max(const gavl_dictionary_t * m,
399 const char * key,
400 int w, int h,
401 const char * mimetype);
402
403GAVL_PUBLIC const gavl_dictionary_t *
404gavl_dictionary_get_image_max_proto(const gavl_dictionary_t * m,
405 const char * key,
406 int w, int h,
407 const char * mimetype, const char * protocol);
408
409GAVL_PUBLIC
410gavl_dictionary_t *
411gavl_metadata_add_src(gavl_dictionary_t * m, const char * key,
412 const char * mimetype, const char * location);
413
414GAVL_PUBLIC
415 const gavl_dictionary_t *
416gavl_metadata_get_src(const gavl_dictionary_t * m, const char * key, int idx,
417 const char ** mimetype, const char ** location);
418
419GAVL_PUBLIC
420gavl_dictionary_t *
421gavl_metadata_get_src_nc(gavl_dictionary_t * m, const char * key, int idx);
422
423
424GAVL_PUBLIC
425 int gavl_metadata_has_src(const gavl_dictionary_t * m, const char * key,
426 const char * location);
427
428
429
433
434#ifdef __cplusplus
435}
436#endif
437
438#endif // GAVL_METADATA_H_INCLUDED
gavl_metadata_append
GAVL_PUBLIC void gavl_metadata_append(gavl_dictionary_t *m, const char *key, const char *val)
Free all metadata tags.
gavl_dictionary_get_arr_i
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_metadata_do_swap_endian
GAVL_PUBLIC int gavl_metadata_do_swap_endian(const gavl_dictionary_t *m)
Check if endianness needs to be swapped.
gavl_dictionary_get_date_time
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_metadata_join_arr
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_dictionary_get_year
GAVL_PUBLIC int gavl_dictionary_get_year(const gavl_dictionary_t *m, const char *key)
Get the year from 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_dictionary_set_date_time
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_metadata_append_nocpy
GAVL_PUBLIC void gavl_metadata_append_nocpy(gavl_dictionary_t *m, const char *key, char *val)
Append values of a tag without copying.
gavl_dictionary_set_date
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_dictionary_get_date
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_dictionary_get_arr
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_metadata_delete_compression_fields
GAVL_PUBLIC void gavl_metadata_delete_compression_fields(gavl_dictionary_t *m)
Clear fields, which are related to the compression.
gavl_dictionary_set_string_endian
GAVL_PUBLIC void gavl_dictionary_set_string_endian(gavl_dictionary_t *m)
Set the enddian tag.
gavl_metadata_delete_implicit_fields
GAVL_PUBLIC void gavl_metadata_delete_implicit_fields(gavl_dictionary_t *m)
Clear fields, which are obtained implicitly.
gavl_dictionary_get_arr_len
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_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_equal
GAVL_PUBLIC int gavl_metadata_equal(const gavl_dictionary_t *m1, const gavl_dictionary_t *m2)
Check if 2 metadata structures are equal.