gavl

- Main Page
- Modules
- Data Structures
- Files

Modules | Data Structures | Macros | Functions
Metadata

Metadata support. More...

## Modules
| Defined metadata keys

## Data Structures
struct | gavl_metadata_tag_t
| Single metadata tag. More...
struct | gavl_metadata_t
| Single metadata structure. More...

## Macros
#define | GAVL_METADATA_DATE_STRING_LEN 11
#define | GAVL_METADATA_DATE_TIME_STRING_LEN 20

## Functions
GAVL_PUBLIC void | gavl_metadata_free (gavl_metadata_t *m)
| Free all metadata tags. More...
GAVL_PUBLIC void | gavl_metadata_init (gavl_metadata_t *m)
| Initialize structre. More...
GAVL_PUBLIC void | gavl_metadata_set (gavl_metadata_t *m, const char *key, const char *val)
| Set a tag. More...
GAVL_PUBLIC void | gavl_metadata_set_nocpy (gavl_metadata_t *m, const char *key, char *val)
| Set a tag. More...
GAVL_PUBLIC const char * | gavl_metadata_get (const gavl_metadata_t *m, const char *key)
| Get the value of a tag. More...
GAVL_PUBLIC void | gavl_metadata_set_int (gavl_metadata_t *m, const char *key, int val)
| Set an integer tag. More...
GAVL_PUBLIC int | gavl_metadata_get_int (const gavl_metadata_t *m, const char *key, int *ret)
| Get an integer tag. More...
GAVL_PUBLIC void | gavl_metadata_set_date (gavl_metadata_t *m, const char *key, int year, int month, int day)
| Set a date tag. More...
GAVL_PUBLIC int | gavl_metadata_get_date (gavl_metadata_t *m, const char *key, int *year, int *month, int *day)
| Get a date tag. More...
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. More...
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. More...
GAVL_PUBLIC void | gavl_metadata_date_to_string (int year, int month, int day, char *ret)
| Format a date string. More...
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. More...
GAVL_PUBLIC void | gavl_metadata_merge (gavl_metadata_t *dst, const gavl_metadata_t *src1, const gavl_metadata_t *src2)
| Merge two metadata structures. More...
GAVL_PUBLIC void | gavl_metadata_merge2 (gavl_metadata_t *dst, const gavl_metadata_t *src)
| Merge two metadata structures. More...
GAVL_PUBLIC void | gavl_metadata_copy (gavl_metadata_t *dst, const gavl_metadata_t *src)
| Copy metadata structure. More...
GAVL_PUBLIC void | gavl_metadata_dump (const gavl_metadata_t *m, int indent)
| Dump metadata structure to stderr. More...
GAVL_PUBLIC int | gavl_metadata_equal (const gavl_metadata_t *m1, const gavl_metadata_t *m2)
| Check if 2 metadata structures are equal. More...

## Detailed Description

Metadata support.

This is a simple dictionary structure, which is used my gmerlin applications and libraries to associate metadata with a media file or a single media stream.

Metadata are defined as all data, which are not directly related to the decoding process, but might be of interest for the user.

The tag types are completely generic so applications can define their own tags. For compatibility it is, however recommended to use the tags defined in metatags.h

Since 1.4.0

## Macro Definition Documentation

#define GAVL_METADATA_DATE_STRING_LEN 11

Length of a date string of the format YYYY-MM-DD

#define GAVL_METADATA_DATE_TIME_STRING_LEN 20

Length of a date/time string of the format YYYY-MM-DD HH:MM:SS

## Function Documentation

GAVL_PUBLIC void gavl_metadata_free | ( | gavl_metadata_t * | m | ) |

Free all metadata tags.

- m A metadata structure

GAVL_PUBLIC void gavl_metadata_init | ( | gavl_metadata_t * | m | ) |

Initialize structre.

- m A metadata structure

Use this if you define a gavl_metadata_t structure in unintialized memory (e.g. on the stack) before using it.

GAVL_PUBLIC void gavl_metadata_set | ( | gavl_metadata_t * | m,
|  | const char * | key,
|  | const char * | val
| ) |  |

Set a tag.

- m A metadata structure
- key Key
- val Value

Set a metadata tag. The value is copied.

GAVL_PUBLIC void gavl_metadata_set_nocpy | ( | gavl_metadata_t * | m,
|  | const char * | key,
|  | char * | val
| ) |  |

Set a tag.

- m A metadata structure
- key Key
- val Value

Like gavl_metadata_set except that the value is not copied.

GAVL_PUBLIC const char* gavl_metadata_get | ( | const gavl_metadata_t * | m,
|  | const char * | key
| ) |  |

Get the value of a tag.

- m A metadata structure
- key Key
  Returns
    Value of the tag or NULL if the tag doesn't exist

GAVL_PUBLIC void gavl_metadata_set_int | ( | gavl_metadata_t * | m,
|  | const char * | key,
|  | int | val
| ) |  |

Set an integer tag.

- m A metadata structure
- key Key
- val Value

GAVL_PUBLIC int gavl_metadata_get_int | ( | const gavl_metadata_t * | m,
|  | const char * | key,
|  | int * | ret
| ) |  |

Get an integer tag.

- m A metadata structure
- key Key
- ret Returns the value
  Returns
    1 if ret contains a valid tag, 0 if the tag doesn't exist or is not numeric

GAVL_PUBLIC void gavl_metadata_set_date | ( | gavl_metadata_t * | m,
|  | const char * | key,
|  | int | year,
|  | int | month,
|  | int | day
| ) |  |

Set a date tag.

- m A metadata structure
- key Key
- year Year
- month Month
- day Day

GAVL_PUBLIC int gavl_metadata_get_date | ( | gavl_metadata_t * | m,
|  | const char * | key,
|  | int * | year,
|  | int * | month,
|  | int * | day
| ) |  |

Get a date tag.

- m A metadata structure
- key Key
- year Returns year
- month Returns month
- day Returns day
  Returns
    1 if a valid date was returned, 0 else

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.

- m A metadata structure
- key Key
- year Year
- month Month
- day Day
- hour Hour
- minute Minute
- second 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
| ) |  |

Get a date/time tag.

- m A metadata structure
- key Key
- year Returns year
- month Returns month
- day Returns day
- hour Returns hour
- minute Returns minute
- second Returns second
  Returns
    1 if a valid date/time was returned, 0 else

GAVL_PUBLIC void gavl_metadata_date_to_string | ( | int | year,
|  | int | month,
|  | int | day,
|  | char * | ret
| ) |  |

Format a date string.

- year Year
- month Month
- day Day
- ret String to be formatted

The string needs to be at least GAVL_METADATA_DATE_STRING_LEN bytes long.

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.

- year Year
- month Month
- day Day
- ret String to be formatted
- hour Hour
- minute Minute
- second Second

The string needs to be at least GAVL_METADATA_DATE_TIME_STRING_LEN bytes long.

GAVL_PUBLIC void gavl_metadata_merge | ( | gavl_metadata_t * | dst,
|  | const gavl_metadata_t * | src1,
|  | const gavl_metadata_t * | src2
| ) |  |

Merge two metadata structures.

- dst Destination
- src1 First source
- src2 Second source

Copy all tags from src1 and src2 to dst. If a tag is available in src1 and src2, the one from src1 is taken.

GAVL_PUBLIC void gavl_metadata_merge2 | ( | gavl_metadata_t * | dst,
|  | const gavl_metadata_t * | src
| ) |  |

Merge two metadata structures.

- dst Destination
- src Source

Copy tags from src to dst, which are not already contained in dst.

GAVL_PUBLIC void gavl_metadata_copy | ( | gavl_metadata_t * | dst,
|  | const gavl_metadata_t * | src
| ) |  |

Copy metadata structure.

- dst Destination
- src Source

Copy all tags from src to dst

GAVL_PUBLIC void gavl_metadata_dump | ( | const gavl_metadata_t * | m,
|  | int | indent
| ) |  |

Dump metadata structure to stderr.

- m Metadata
- indent Spaces to append to each line

GAVL_PUBLIC int gavl_metadata_equal | ( | const gavl_metadata_t * | m1,
|  | const gavl_metadata_t * | m2
| ) |  |

Check if 2 metadata structures are equal.

- m1 Metadata 1
- m2 Metadata 2
  Returns
    1 if the 2 metadata structures are identical, 0 else