metadata.h
/*****************************************************************
* gavl - a general purpose audio/video processing library
*
* Copyright (c) 2001 - 2011 Members of the Gmerlin project
* gmerlin-general@lists.sourceforge.net
* http://gmerlin.sourceforge.net
*
* 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 <gavl/gavldefs.h>
#define GAVL_METADATA_DATE_STRING_LEN 11
#define GAVL_METADATA_DATE_TIME_STRING_LEN 20
typedef struct
{
char * key;
char * val;
} gavl_metadata_tag_t;
typedef struct
{
gavl_metadata_tag_t * tags;
int tags_alloc;
int num_tags;
} gavl_metadata_t;
GAVL_PUBLIC void
gavl_metadata_free(gavl_metadata_t * m);
GAVL_PUBLIC void
gavl_metadata_init(gavl_metadata_t * m);
GAVL_PUBLIC void
gavl_metadata_set(gavl_metadata_t * m,
const char * key,
const char * val);
GAVL_PUBLIC void
gavl_metadata_set_nocpy(gavl_metadata_t * m,
const char * key,
char * val);
GAVL_PUBLIC
const char * gavl_metadata_get(const gavl_metadata_t * m,
const char * key);
GAVL_PUBLIC void
gavl_metadata_set_int(gavl_metadata_t * m,
const char * key,
int val);
GAVL_PUBLIC
int gavl_metadata_get_int(const gavl_metadata_t * m,
const char * key, int * ret);
GAVL_PUBLIC void
gavl_metadata_set_date(gavl_metadata_t * m,
const char * key,
int year,
int month,
int day);
GAVL_PUBLIC int
gavl_metadata_get_date(gavl_metadata_t * m,
const char * key,
int * year,
int * month,
int * day);
GAVL_PUBLIC void
gavl_metadata_set_date_time(gavl_metadata_t * m,
const char * key,
int year,
int month,
int day,
int hour,
int minute,
int second);
GAVL_PUBLIC int
gavl_metadata_get_date_time(gavl_metadata_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
void gavl_metadata_merge(gavl_metadata_t * dst,
const gavl_metadata_t * src1,
const gavl_metadata_t * src2);
GAVL_PUBLIC
void gavl_metadata_merge2(gavl_metadata_t * dst,
const gavl_metadata_t * src);
GAVL_PUBLIC void
gavl_metadata_copy(gavl_metadata_t * dst,
const gavl_metadata_t * src);
GAVL_PUBLIC void
gavl_metadata_dump(const gavl_metadata_t * m, int indent);
GAVL_PUBLIC int
gavl_metadata_equal(const gavl_metadata_t * m1,
const gavl_metadata_t * m2);
#ifdef __cplusplus
}
#endif
#endif // GAVL_METADATA_H_INCLUDED
gavl_metadata_set_int
GAVL_PUBLIC void gavl_metadata_set_int(gavl_metadata_t *m, const char *key, int val)
Set an integer tag.
gavl_metadata_dump
GAVL_PUBLIC void gavl_metadata_dump(const gavl_metadata_t *m, int indent)
Dump metadata structure to stderr.
gavl_metadata_get
GAVL_PUBLIC const char * gavl_metadata_get(const gavl_metadata_t *m, const char *key)
Get the value of a tag.
gavl_metadata_set_nocpy
GAVL_PUBLIC void gavl_metadata_set_nocpy(gavl_metadata_t *m, const char *key, char *val)
Set a tag.
gavl_metadata_merge2
GAVL_PUBLIC void gavl_metadata_merge2(gavl_metadata_t *dst, const gavl_metadata_t *src)
Merge two metadata structures.
gavl_metadata_init
GAVL_PUBLIC void gavl_metadata_init(gavl_metadata_t *m)
Initialize structre.
gavl_metadata_copy
GAVL_PUBLIC void gavl_metadata_copy(gavl_metadata_t *dst, const gavl_metadata_t *src)
Copy metadata structure.
gavl_metadata_get_int
GAVL_PUBLIC int gavl_metadata_get_int(const gavl_metadata_t *m, const char *key, int *ret)
Get an integer tag.
gavl_metadata_set_date
GAVL_PUBLIC void gavl_metadata_set_date(gavl_metadata_t *m, const char *key, int year, int month, int day)
Set a date tag.
gavl_metadata_get_date
GAVL_PUBLIC int gavl_metadata_get_date(gavl_metadata_t *m, const char *key, int *year, int *month, int *day)
Get a date tag.
gavl_metadata_set
GAVL_PUBLIC void gavl_metadata_set(gavl_metadata_t *m, const char *key, const char *val)
Set 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_metadata_free
GAVL_PUBLIC void gavl_metadata_free(gavl_metadata_t *m)
Free all metadata tags.
gavl_metadata_equal
GAVL_PUBLIC int gavl_metadata_equal(const gavl_metadata_t *m1, const gavl_metadata_t *m2)
Check if 2 metadata structures are equal.
gavl_metadata_merge
GAVL_PUBLIC void gavl_metadata_merge(gavl_metadata_t *dst, const gavl_metadata_t *src1, const gavl_metadata_t *src2)
Merge two metadata structures.
gavl_metadata_get_date_time
GAVL_PUBLIC int gavl_metadata_get_date_time(gavl_metadata_t *m, const char *key, int *year, int *month, int *day, int *hour, int *minute, int *second)
Get a date/time tag.
gavl_metadata_set_date_time
GAVL_PUBLIC void gavl_metadata_set_date_time(gavl_metadata_t *m, const char *key, int year, int month, int day, int hour, int minute, int second)
Set a date/time 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_t
Single metadata structure.
Definition: metadata.h:75
gavl_metadata_t::tags_alloc
int tags_alloc
Number of allocated tags (never touch this)
Definition: metadata.h:77
gavl_metadata_t::tags
gavl_metadata_tag_t * tags
Array of tags.
Definition: metadata.h:76
gavl_metadata_t::num_tags
int num_tags
Number of valid tags.
Definition: metadata.h:78
gavl_metadata_tag_t
Single metadata tag.
Definition: metadata.h:65
gavl_metadata_tag_t::val
char * val
Value.
Definition: metadata.h:67
gavl_metadata_tag_t::key
char * key
Key.
Definition: metadata.h:66