metadata.h
/*****************************************************************
* gavl - a general purpose audio/video processing library
*
* Copyright (c) 2001 - 2024 Members of the Gmerlin project
* http://github.com/bplaum
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#ifndef GAVL_METADATA_H_INCLUDED
#define GAVL_METADATA_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h>
#include <gavl/gavldefs.h>
#include <gavl/value.h>
#define GAVL_METADATA_DATE_STRING_LEN 11
#define GAVL_METADATA_DATE_TIME_STRING_LEN 20
// GAVL_PUBLIC void
// gavl_dictionary_free(gavl_dictionary_t * m);
// GAVL_PUBLIC void
// gavl_dictionary_init(gavl_dictionary_t * m);
// GAVL_PUBLIC void
//gavl_dictionary_set_string(gavl_dictionary_t * m,
// const char * key,
// const char * val);
//GAVL_PUBLIC void
//gavl_dictionary_set_string_nocpy(gavl_dictionary_t * m,
// const char * key,
// char * val);
GAVL_PUBLIC void
gavl_metadata_append(gavl_dictionary_t * m,
const char * key,
const char * val);
GAVL_PUBLIC void
gavl_metadata_append_nocpy(gavl_dictionary_t * m,
const char * key,
char * val);
GAVL_PUBLIC const char *
gavl_dictionary_get_arr(const gavl_dictionary_t * m,
const char * key,
int i);
GAVL_PUBLIC const char *
gavl_dictionary_get_arr_i(const gavl_dictionary_t * m,
const char * key,
int i);
GAVL_PUBLIC char *
gavl_metadata_join_arr(const gavl_dictionary_t * m,
const char * key, const char * glue);
GAVL_PUBLIC int
gavl_dictionary_get_arr_len(const gavl_dictionary_t * m,
const char * key);
// GAVL_PUBLIC
// const char * gavl_dictionary_get_string_i(const gavl_dictionary_t * m,
// const char * key);
GAVL_PUBLIC void
gavl_dictionary_set_date(gavl_dictionary_t * m,
const char * key,
int year,
int month,
int day);
GAVL_PUBLIC int
gavl_dictionary_get_year(const gavl_dictionary_t * m,
const char * key);
GAVL_PUBLIC int
gavl_dictionary_get_date(const gavl_dictionary_t * m,
const char * key,
int * year,
int * month,
int * day);
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);
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);
GAVL_PUBLIC void
gavl_metadata_date_to_string(int year,
int month,
int day, char * ret);
GAVL_PUBLIC void
gavl_metadata_date_time_to_string(int year,
int month,
int day,
int hour,
int minute,
int second,
char * ret);
GAVL_PUBLIC int
gavl_metadata_equal(const gavl_dictionary_t * m1,
const gavl_dictionary_t * m2);
GAVL_PUBLIC void
gavl_metadata_delete_compression_fields(gavl_dictionary_t * m);
GAVL_PUBLIC void
gavl_metadata_delete_implicit_fields(gavl_dictionary_t * m);
GAVL_PUBLIC void
gavl_dictionary_set_string_endian(gavl_dictionary_t * m);
GAVL_PUBLIC int
gavl_metadata_do_swap_endian(const gavl_dictionary_t * m);
GAVL_PUBLIC gavl_dictionary_t *
gavl_metadata_add_image_uri(gavl_dictionary_t * m,
const char * key,
int w, int h,
const char * mimetype,
const char * uri);
GAVL_PUBLIC const char *
gavl_dictionary_get_string_image_uri(const gavl_dictionary_t * m,
const char * key,
int i,
int * wp, int * hp,
const char ** mimetype);
GAVL_PUBLIC const char *
gavl_dictionary_get_string_image_max(const gavl_dictionary_t * m,
const char * key,
int w, int h,
const char * mimetype);
GAVL_PUBLIC void
gavl_metadata_add_image_embedded(gavl_dictionary_t * m,
const char * key,
int w, int h,
const char * mimetype,
const uint8_t * image_data,
int len);
GAVL_PUBLIC const gavl_dictionary_t *
gavl_dictionary_get_image_max(const gavl_dictionary_t * m,
const char * key,
int w, int h,
const char * mimetype);
GAVL_PUBLIC const gavl_dictionary_t *
gavl_dictionary_get_image_max_proto(const gavl_dictionary_t * m,
const char * key,
int w, int h,
const char * mimetype, const char * protocol);
GAVL_PUBLIC
gavl_dictionary_t *
gavl_metadata_add_src(gavl_dictionary_t * m, const char * key,
const char * mimetype, const char * location);
GAVL_PUBLIC
const gavl_dictionary_t *
gavl_metadata_get_src(const gavl_dictionary_t * m, const char * key, int idx,
const char ** mimetype, const char ** location);
GAVL_PUBLIC
gavl_dictionary_t *
gavl_metadata_get_src_nc(gavl_dictionary_t * m, const char * key, int idx);
GAVL_PUBLIC
int gavl_metadata_has_src(const gavl_dictionary_t * m, const char * key,
const char * location);
#ifdef __cplusplus
}
#endif
#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.