Metadata

Metadata support. More...

## Topics

| Defined metadata keys

## Macros

#define | GAVL_METADATA_DATE_STRING_LEN 11
#define | GAVL_METADATA_DATE_TIME_STRING_LEN 20

## Functions

GAVL_PUBLIC void | gavl_metadata_append (gavl_dictionary_t *m, const char *key, const char *val)
| Free all metadata tags.
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 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 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 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_arr_len (const gavl_dictionary_t *m, const char *key)
| Get the length of an array value of a tag.
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_year (const gavl_dictionary_t *m, const char *key)
| Get the year from a tag.
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_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 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 void | gavl_metadata_date_to_string (int year, int month, int day, char *ret)
| Format a date 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_PUBLIC int | gavl_metadata_equal (const gavl_dictionary_t *m1, const gavl_dictionary_t *m2)
| Check if 2 metadata structures are equal.
GAVL_PUBLIC void | gavl_metadata_delete_compression_fields (gavl_dictionary_t *m)
| Clear fields, which are related to the compression.
GAVL_PUBLIC void | gavl_metadata_delete_implicit_fields (gavl_dictionary_t *m)
| Clear fields, which are obtained implicitly.
GAVL_PUBLIC void | gavl_dictionary_set_string_endian (gavl_dictionary_t *m)
| Set the enddian tag.
GAVL_PUBLIC int | gavl_metadata_do_swap_endian (const gavl_dictionary_t *m)
| Check if endianness needs to be swapped.
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)

## 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

## GAVL_METADATA_DATE_STRING_LEN

#define GAVL_METADATA_DATE_STRING_LEN 11

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

## GAVL_METADATA_DATE_TIME_STRING_LEN

#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_metadata_append()

GAVL_PUBLIC void gavl_metadata_append | ( | gavl_dictionary_t * | m,
|  | const char * | key,
|  | const char * | val )

Free all metadata tags.

- m A metadata structure

Initialize structure

- m A metadata structure

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

Set a tag

- m A metadata structure
- key Key
- val Value

Set a metadata tag. The value is copied.

Set a tag

- m A metadata structure
- key Key
- val Value

Like gavl_dictionary_set_string except that the value is not copied.

Append values of a tag

- m A metadata structure
- key Key
- val Value

Appends a value to a tag, making it implicitly an array type. The tag is created if not already existent. The value is copied.

## 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.

- m A metadata structure
- key Key
- val Value

Like gavl_metadata_append except that the value is not copied.

## 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.

- m A metadata structure
- key Key
- i Index (starting with zero).
  Returns
    Array element if i > 0, else val

## 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.

- m A metadata structure
- key Key
- i Index (starting with zero).
  Returns
    Array element if i > 0, else val
  Like gavl_dictionary_get_arr but ignoring the case of key

## 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.

- m A metadata structure
- key Key
- glue Glue string (e.g. ", ")
  Returns
    Array elements concatenated with the glue string between them

## 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.

- m A metadata structure
- key Key
  Returns
    The length

## 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.

- m A metadata structure
- key Key
  Returns
    Value of the tag or NULL if the tag doesn't exist
  Set a date tag
- m A metadata structure
- key Key
- year Year
- month Month
- day Day

## 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.

- m A metadata structure
- key Key
  Returns
    The year or 0

## 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.

- 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_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.

- m A metadata structure
- key Key
- year Year
- month Month
- day Day
- hour Hour
- minute Minute
- second Second

## 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.

- 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_metadata_date_to_string()

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_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.

- 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_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.

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

## 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.

- m Metadata

This deletes fields, which are related to the compression of the stream (e.g. bitrate, codec etc.). Use this before transcoding the stream in another format to suppress bogus values in the output stream

## gavl_metadata_delete_implicit_fields()

GAVL_PUBLIC void gavl_metadata_delete_implicit_fields | ( | gavl_dictionary_t * | m | ) |

Clear fields, which are obtained implicitly.

- m Metadata

This deletes fields, which can implicitly obtainecd from the file

## gavl_dictionary_set_string_endian()

GAVL_PUBLIC void gavl_dictionary_set_string_endian | ( | gavl_dictionary_t * | m | ) |

Set the enddian tag.

- m Metadata

This sets the "Endian" field to 1 on big endian architectures 0 else

## 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.

- m Metadata
  Returns
    1 if the stream was generated on a machine with different endianness, 0 else.