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
26 extern "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 
118 GAVL_PUBLIC void
119 gavl_metadata_append(gavl_dictionary_t * m,
120  const char * key,
121  const char * val);
122 
132 GAVL_PUBLIC void
133 gavl_metadata_append_nocpy(gavl_dictionary_t * m,
134  const char * key,
135  char * val);
136 
144 GAVL_PUBLIC const char *
145 gavl_dictionary_get_arr(const gavl_dictionary_t * m,
146  const char * key,
147  int i);
148 
158 GAVL_PUBLIC const char *
159 gavl_dictionary_get_arr_i(const gavl_dictionary_t * m,
160  const char * key,
161  int i);
162 
170 GAVL_PUBLIC char *
171 gavl_metadata_join_arr(const gavl_dictionary_t * m,
172  const char * key, const char * glue);
173 
174 
181 GAVL_PUBLIC int
182 gavl_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 
205 GAVL_PUBLIC void
206 gavl_dictionary_set_date(gavl_dictionary_t * m,
207  const char * key,
208  int year,
209  int month,
210  int day);
218 GAVL_PUBLIC int
219 gavl_dictionary_get_year(const gavl_dictionary_t * m,
220  const char * key);
221 
222 
232 GAVL_PUBLIC int
233 gavl_dictionary_get_date(const gavl_dictionary_t * m,
234  const char * key,
235  int * year,
236  int * month,
237  int * day);
238 
250 GAVL_PUBLIC void
251 gavl_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 
272 GAVL_PUBLIC int
273 gavl_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 
292 GAVL_PUBLIC void
294  int month,
295  int day, char * ret);
296 
310 GAVL_PUBLIC void
312  int month,
313  int day,
314  int hour,
315  int minute,
316  int second,
317  char * ret);
318 
325 GAVL_PUBLIC int
326 gavl_metadata_equal(const gavl_dictionary_t * m1,
327  const gavl_dictionary_t * m2);
328 
338 GAVL_PUBLIC void
340 
347 GAVL_PUBLIC void
349 
357 GAVL_PUBLIC void
358 gavl_dictionary_set_string_endian(gavl_dictionary_t * m);
359 
365 GAVL_PUBLIC int
366 gavl_metadata_do_swap_endian(const gavl_dictionary_t * m);
367 
368 GAVL_PUBLIC gavl_dictionary_t *
369 gavl_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 
375 GAVL_PUBLIC const char *
376 gavl_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 
382 GAVL_PUBLIC const char *
383 gavl_dictionary_get_string_image_max(const gavl_dictionary_t * m,
384  const char * key,
385  int w, int h,
386  const char * mimetype);
387 
388 GAVL_PUBLIC void
389 gavl_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 
396 GAVL_PUBLIC const gavl_dictionary_t *
397 gavl_dictionary_get_image_max(const gavl_dictionary_t * m,
398  const char * key,
399  int w, int h,
400  const char * mimetype);
401 
402 GAVL_PUBLIC const gavl_dictionary_t *
403 gavl_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 
408 GAVL_PUBLIC
409 gavl_dictionary_t *
410 gavl_metadata_add_src(gavl_dictionary_t * m, const char * key,
411  const char * mimetype, const char * location);
412 
413 GAVL_PUBLIC
414 const gavl_dictionary_t *
415 gavl_dictionary_get_src(const gavl_dictionary_t * m, const char * key, int idx,
416  const char ** mimetype, const char ** location);
417 
418 GAVL_PUBLIC
419 gavl_dictionary_t *
420 gavl_dictionary_get_src_nc(gavl_dictionary_t * m, const char * key, int idx);
421 
422 
423 GAVL_PUBLIC
424 int 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(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 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_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 int gavl_dictionary_get_year(const gavl_dictionary_t *m, const char *key)
Get the year from a 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 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 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.