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
27extern "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
65
66GAVL_PUBLIC int
67gavl_metadata_set_from_string(gavl_dictionary_t * m,
68 const char * key,
69 const char * val);
70
79
80GAVL_PUBLIC void
81gavl_metadata_append(gavl_dictionary_t * m,
82 const char * key,
83 const char * val);
84
93
94GAVL_PUBLIC void
95gavl_metadata_append_nocpy(gavl_dictionary_t * m,
96 const char * key,
97 char * val);
98
105
106GAVL_PUBLIC const char *
107gavl_dictionary_get_arr(const gavl_dictionary_t * m,
108 const char * key,
109 int i);
110
119
120GAVL_PUBLIC const char *
121gavl_dictionary_get_arr_i(const gavl_dictionary_t * m,
122 const char * key,
123 int i);
124
131
132GAVL_PUBLIC char *
133gavl_metadata_join_arr(const gavl_dictionary_t * m,
134 const char * key, const char * glue);
135
136
142
143GAVL_PUBLIC int
144gavl_dictionary_get_arr_len(const gavl_dictionary_t * m,
145 const char * key);
146
147
153
154// GAVL_PUBLIC
155// const char * gavl_dictionary_get_string_i(const gavl_dictionary_t * m,
156// const char * key);
157
158
166
167GAVL_PUBLIC void
168gavl_dictionary_set_date(gavl_dictionary_t * m,
169 const char * key,
170 int year,
171 int month,
172 int day);
179
180GAVL_PUBLIC int
181gavl_dictionary_get_year(const gavl_dictionary_t * m,
182 const char * key);
183
184
193
194GAVL_PUBLIC int
195gavl_dictionary_get_date(const gavl_dictionary_t * m,
196 const char * key,
197 int * year,
198 int * month,
199 int * day);
200
211
212GAVL_PUBLIC void
213gavl_dictionary_set_date_time(gavl_dictionary_t * m,
214 const char * key,
215 int year,
216 int month,
217 int day,
218 int hour,
219 int minute,
220 int second);
221
233
234GAVL_PUBLIC int
235gavl_dictionary_get_date_time(const gavl_dictionary_t * m,
236 const char * key,
237 int * year,
238 int * month,
239 int * day,
240 int * hour,
241 int * minute,
242 int * second);
243
253
254GAVL_PUBLIC void
256 int month,
257 int day, char * ret);
258
271
272GAVL_PUBLIC void
274 int month,
275 int day,
276 int hour,
277 int minute,
278 int second,
279 char * ret);
280
286
287GAVL_PUBLIC int
288gavl_metadata_equal(const gavl_dictionary_t * m1,
289 const gavl_dictionary_t * m2);
290
299
300GAVL_PUBLIC void
302
308
309GAVL_PUBLIC void
311
318
319GAVL_PUBLIC void
321
326
327GAVL_PUBLIC int
328gavl_metadata_do_swap_endian(const gavl_dictionary_t * m);
329
330GAVL_PUBLIC gavl_dictionary_t *
331gavl_metadata_add_image_uri(gavl_dictionary_t * m,
332 const char * key,
333 int w, int h,
334 const char * mimetype,
335 const char * uri);
336
337GAVL_PUBLIC const char *
338gavl_dictionary_get_string_image_uri(const gavl_dictionary_t * m,
339 const char * key,
340 int i,
341 int * wp, int * hp,
342 const char ** mimetype);
343
344GAVL_PUBLIC const char *
345gavl_dictionary_get_string_image_max(const gavl_dictionary_t * m,
346 const char * key,
347 int w, int h,
348 const char * mimetype);
349
350GAVL_PUBLIC void
351gavl_metadata_add_image_embedded(gavl_dictionary_t * m,
352 const char * key,
353 int w, int h,
354 const char * mimetype,
355 const uint8_t * image_data,
356 int len);
357
358GAVL_PUBLIC const gavl_dictionary_t *
359gavl_dictionary_get_image_max(const gavl_dictionary_t * m,
360 const char * key,
361 int w, int h,
362 const char * mimetype);
363
364GAVL_PUBLIC const gavl_dictionary_t *
365gavl_dictionary_get_image_max_proto(const gavl_dictionary_t * m,
366 const char * key,
367 int w, int h,
368 const char * mimetype, const char * protocol);
369
370GAVL_PUBLIC
371gavl_dictionary_t *
372gavl_metadata_add_src(gavl_dictionary_t * m, const char * key,
373 const char * mimetype, const char * location);
374
375GAVL_PUBLIC
376const gavl_dictionary_t *
377gavl_metadata_get_src(const gavl_dictionary_t * m, const char * key, int idx,
378 const char ** mimetype, const char ** location);
379
380GAVL_PUBLIC
381gavl_dictionary_t *
382gavl_metadata_get_src_nc(gavl_dictionary_t * m, const char * key, int idx);
383
384
385GAVL_PUBLIC
386int gavl_metadata_has_src(const gavl_dictionary_t * m, const char * key,
387 const char * location);
388
389
390
394
395#ifdef __cplusplus
396}
397#endif
398
399#endif // GAVL_METADATA_H_INCLUDED
GAVL_PUBLIC void gavl_metadata_append(gavl_dictionary_t *m, const char *key, const char *val)
Append values of a tag.
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 endianness 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.