Tags: GStreamer Base Plugins 1.0 Library Reference Manual

## Tags Tags — additional tag definitions for plugins and applications |

## Functions

void | gst_tag_register_musicbrainz_tags ()
gchar * | gst_tag_freeform_string_to_utf8 ()
gboolean | gst_tag_parse_extended_comment ()
GstSample * | gst_tag_image_data_to_image_sample ()

## Types and Values

#define | GST_TAG_MUSICBRAINZ_TRACKID
#define | GST_TAG_MUSICBRAINZ_ARTISTID
#define | GST_TAG_MUSICBRAINZ_ALBUMID
#define | GST_TAG_MUSICBRAINZ_ALBUMARTISTID
#define | GST_TAG_MUSICBRAINZ_TRMID
#define | GST_TAG_CDDA_CDDB_DISCID
#define | GST_TAG_CDDA_CDDB_DISCID_FULL
#define | GST_TAG_CDDA_MUSICBRAINZ_DISCID
#define | GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL
#define | GST_TAG_CMML_CLIP
#define | GST_TAG_CMML_HEAD
#define | GST_TAG_CMML_STREAM
#define | GST_TAG_CAPTURING_SHUTTER_SPEED
#define | GST_TAG_CAPTURING_FOCAL_RATIO
#define | GST_TAG_CAPTURING_FOCAL_LENGTH
#define | GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM
#define | GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO
#define | GST_TAG_CAPTURING_ISO_SPEED
#define | GST_TAG_CAPTURING_EXPOSURE_PROGRAM
#define | GST_TAG_CAPTURING_EXPOSURE_MODE
#define | GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE
#define | GST_TAG_CAPTURING_GAIN_ADJUSTMENT
#define | GST_TAG_CAPTURING_WHITE_BALANCE
#define | GST_TAG_CAPTURING_CONTRAST
#define | GST_TAG_CAPTURING_SATURATION
#define | GST_TAG_CAPTURING_SHARPNESS
#define | GST_TAG_CAPTURING_FLASH_FIRED
#define | GST_TAG_CAPTURING_FLASH_MODE
#define | GST_TAG_CAPTURING_METERING_MODE
#define | GST_TAG_CAPTURING_SOURCE
#define | GST_TAG_CAPTURING_EXPOSURE_COMPENSATION
#define | GST_TAG_IMAGE_HORIZONTAL_PPI
#define | GST_TAG_IMAGE_VERTICAL_PPI
#define | GST_TAG_ID3V2_HEADER_SIZE
#define | GST_TAG_MUSICAL_KEY
enum | GstTagImageType

## Includes

    #include <gst/tag/tag.h>

## Description

Contains additional standardized GStreamer tag definitions for plugins and applications, and functions to register them with the GStreamer tag system.

## Functions

### gst_tag_register_musicbrainz_tags ()

    void
    gst_tag_register_musicbrainz_tags (void);

Registers additional musicbrainz-specific tags with the GStreamer tag system. Plugins and applications that use these tags should call this function before using them. Can be called multiple times.

### gst_tag_freeform_string_to_utf8 ()

    gchar *
    gst_tag_freeform_string_to_utf8 (const gchar *data,
                                     gint size,
                                     const gchar **env_vars);

Convenience function to read a string with unknown character encoding. If the string is already in UTF-8 encoding, it will be returned right away. If not it tries to detect byte-order-mark for UTF-16/32 cases and use that. Otherwise, the environment will be searched for a number of environment variables (whose names are specified in the NULL-terminated string array `env_vars` ) containing a list of character encodings to try/use. If none are specified, the current locale will be tried. If that also doesn't work, WINDOWS-1252/ISO-8859-1 is assumed (which will almost always succeed).

#### Parameters

data | string data. | [array length=size][element-type gchar]
size | length of string data, or -1 if the string is NUL-terminated |
env_vars | (array zero-terminated=1) a NULL-terminated string array of environment variable names, or NULL |

#### Returns

a newly-allocated string in UTF-8 encoding, or NULL

### gst_tag_parse_extended_comment ()

    gboolean
    gst_tag_parse_extended_comment (const gchar *ext_comment,
                                    gchar **key,
                                    gchar **lang,
                                    gchar **value,
                                    gboolean fail_if_no_key);

Convenience function to parse a GST_TAG_EXTENDED_COMMENT string and separate it into its components.

If successful, `key` , `lang` and/or `value` will be set to newly allocated strings that you need to free with `g_free()` when done. `key` and `lang` may also be set to NULL by this function if there is no key or no language code in the extended comment string.

#### Parameters

ext_comment | an extended comment string, see GST_TAG_EXTENDED_COMMENT |
key | return location for the comment description key, or NULL. | [out][nullable]
lang | return location for the comment ISO-639 language code, or NULL. | [out][nullable]
value | return location for the actual comment string, or NULL. | [out]
fail_if_no_key | whether to fail if strings are not in key=value form |

#### Returns

TRUE if the string could be parsed, otherwise FALSE

### gst_tag_image_data_to_image_sample ()

    GstSample *
    gst_tag_image_data_to_image_sample (const guint8 *image_data,
                                        guint image_data_len,
                                        GstTagImageType image_type);

Helper function for tag-reading plugins to create a GstSample suitable to add to a GstTagList as an image tag (such as GST_TAG_IMAGE or GST_TAG_PREVIEW_IMAGE) from the encoded image data and an (optional) image type.

Background: cover art and other images in tags are usually stored as a blob of binary image data, often accompanied by a MIME type or some other content type string (e.g. 'png', 'jpeg', 'jpg'). Sometimes there is also an 'image type' to indicate what kind of image this is (e.g. front cover, back cover, artist, etc.). The image data may also be an URI to the image rather than the image itself.

In GStreamer, image tags are GstSamples containing the raw image data, with the sample caps describing the content type of the image (e.g. image/jpeg, image/png, text/uri-list). The sample info may contain an additional 'image-type' field of GST_TYPE_TAG_IMAGE_TYPE to describe the type of image (front cover, back cover etc.). GST_TAG_PREVIEW_IMAGE tags should not carry an image type, their type is already indicated via the special tag name.

This function will do various checks and typefind the encoded image data (we can't trust the declared mime type).

#### Parameters

image_data | the (encoded) image. | [array length=image_data_len]
image_data_len | the length of the encoded image data at `image_data` |
image_type | type of the image, or GST_TAG_IMAGE_TYPE_UNDEFINED. Pass GST_TAG_IMAGE_TYPE_NONE if no image type should be set at all (e.g. for preview images) |

#### Returns

a newly-allocated image sample for use in tag lists, or NULL

## Types and Values

### GST_TAG_MUSICBRAINZ_TRACKID

    #define GST_TAG_MUSICBRAINZ_TRACKID "musicbrainz-trackid"

MusicBrainz track ID

### GST_TAG_MUSICBRAINZ_ARTISTID

    #define GST_TAG_MUSICBRAINZ_ARTISTID "musicbrainz-artistid"

MusicBrainz artist ID

### GST_TAG_MUSICBRAINZ_ALBUMID

    #define GST_TAG_MUSICBRAINZ_ALBUMID "musicbrainz-albumid"

MusicBrainz album ID

### GST_TAG_MUSICBRAINZ_ALBUMARTISTID

    #define GST_TAG_MUSICBRAINZ_ALBUMARTISTID "musicbrainz-albumartistid"

MusicBrainz album artist ID

### GST_TAG_MUSICBRAINZ_TRMID

    #define GST_TAG_MUSICBRAINZ_TRMID "musicbrainz-trmid"

MusicBrainz track TRM ID

### GST_TAG_CDDA_CDDB_DISCID

    #define GST_TAG_CDDA_CDDB_DISCID              "discid"

CDDB disc id in its short form (e.g. 'aa063d0f')

### GST_TAG_CDDA_CDDB_DISCID_FULL

    #define GST_TAG_CDDA_CDDB_DISCID_FULL         "discid-full"

CDDB disc id including all details

### GST_TAG_CDDA_MUSICBRAINZ_DISCID

    #define GST_TAG_CDDA_MUSICBRAINZ_DISCID       "musicbrainz-discid"

Musicbrainz disc id (e.g. 'ahg7JUcfR3vCYBphSDIogOOWrr0-')

### GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL

    #define GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL  "musicbrainz-discid-full"

Musicbrainz disc id details

### GST_TAG_CMML_CLIP

    #define GST_TAG_CMML_CLIP "cmml-clip"

Annodex CMML clip element tag

### GST_TAG_CMML_HEAD

    #define GST_TAG_CMML_HEAD "cmml-head"

Annodex CMML head element tag

### GST_TAG_CMML_STREAM

    #define GST_TAG_CMML_STREAM "cmml-stream"

Annodex CMML stream element tag

### GST_TAG_CAPTURING_SHUTTER_SPEED

    #define GST_TAG_CAPTURING_SHUTTER_SPEED        "capturing-shutter-speed"

Shutter speed used when capturing an image, in seconds. (fraction)

### GST_TAG_CAPTURING_FOCAL_RATIO

    #define GST_TAG_CAPTURING_FOCAL_RATIO          "capturing-focal-ratio"

Focal ratio (f-number) used when capturing an image. (double)

The value stored is the denominator of the focal ratio (f-number). For example, if this tag value is 2, the focal ratio is f/2.

### GST_TAG_CAPTURING_FOCAL_LENGTH

    #define GST_TAG_CAPTURING_FOCAL_LENGTH         "capturing-focal-length"

Focal length used when capturing an image, in mm. (double)

### GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM

    #define GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM   "capturing-focal-length-35mm"

35 mm equivalent focal length used when capturing an image, in mm. (double)

Since: 1.10

### GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO

    #define GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO   "capturing-digital-zoom-ratio"

Digital zoom ratio used when capturing an image. (double)

### GST_TAG_CAPTURING_ISO_SPEED

    #define GST_TAG_CAPTURING_ISO_SPEED           "capturing-iso-speed"

ISO speed used when capturing an image. (integer)

### GST_TAG_CAPTURING_EXPOSURE_PROGRAM

    #define GST_TAG_CAPTURING_EXPOSURE_PROGRAM     "capturing-exposure-program"

Type of exposure control used when capturing an image. (string)

The allowed values are: "undefined" "manual" "normal" - automatically controlled "aperture-priority" - user selects aperture value "shutter-priority" - user selects shutter speed "creative" - biased towards depth of field "action" - biased towards fast shutter speed "portrait" - closeup, leaving background out of focus "landscape" - landscape photos, background in focus

### GST_TAG_CAPTURING_EXPOSURE_MODE

    #define GST_TAG_CAPTURING_EXPOSURE_MODE       "capturing-exposure-mode"

Exposure mode used when capturing an image. (string)

The allowed values are: "auto-exposure" "manual-exposure" "auto-bracket"

### GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE

    #define GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE  "capturing-scene-capture-type"

Scene mode used when capturing an image. (string)

The allowed values are: "standard" "landscape" "portrait" "night-scene"

### GST_TAG_CAPTURING_GAIN_ADJUSTMENT

    #define GST_TAG_CAPTURING_GAIN_ADJUSTMENT     "capturing-gain-adjustment"

Gain adjustment applied to an image. (string)

The allowed values are: "none" "low-gain-up" "high-gain-up" "low-gain-down" "high-gain-down"

### GST_TAG_CAPTURING_WHITE_BALANCE

    #define GST_TAG_CAPTURING_WHITE_BALANCE       "capturing-white-balance"

White balance mode used when capturing an image. (string)

The allowed values are: "auto" "manual" "daylight" "cloudy" "tungsten" "fluorescent" "fluorescent h" (newer daylight-calibrated fluorescents) "flash"

### GST_TAG_CAPTURING_CONTRAST

    #define GST_TAG_CAPTURING_CONTRAST            "capturing-contrast"

Direction of contrast processing applied when capturing an image. (string)

The allowed values are: "normal" "soft" "hard"

### GST_TAG_CAPTURING_SATURATION

    #define GST_TAG_CAPTURING_SATURATION          "capturing-saturation"

Direction of saturation processing applied when capturing an image. (string)

The allowed values are: "normal" "low-saturation" "high-saturation"

### GST_TAG_CAPTURING_SHARPNESS

    #define GST_TAG_CAPTURING_SHARPNESS          "capturing-sharpness"

Direction of sharpness processing applied when capturing an image. (string)

The allowed values are: "normal" "soft" "hard"

### GST_TAG_CAPTURING_FLASH_FIRED

    #define GST_TAG_CAPTURING_FLASH_FIRED         "capturing-flash-fired"

If flash was fired during the capture of an image. (boolean)

Note that if this tag isn't present, it should not be assumed that the flash did not fire. It should be treated as unknown.

### GST_TAG_CAPTURING_FLASH_MODE

    #define GST_TAG_CAPTURING_FLASH_MODE         "capturing-flash-mode"

The flash mode selected during the capture of an image. (string)

The allowed values are: "auto" "always" "never"

### GST_TAG_CAPTURING_METERING_MODE

    #define GST_TAG_CAPTURING_METERING_MODE      "capturing-metering-mode"

Defines the way a camera determines the exposure. (string)

The allowed values are: "unknown" "average" "center-weighted-average" "spot" "multi-spot" "pattern" "partial" "other"

### GST_TAG_CAPTURING_SOURCE

    #define GST_TAG_CAPTURING_SOURCE             "capturing-source"

Indicates the source of capture. The device/medium used to do the capture. (string)

Allowed values are: "dsc" (= digital still camera) "transparent-scanner" "reflex-scanner" "other"

### GST_TAG_CAPTURING_EXPOSURE_COMPENSATION

    #define GST_TAG_CAPTURING_EXPOSURE_COMPENSATION "capturing-exposure-compensation"

Exposure compensation using when capturing an image in EV. (double)

### GST_TAG_IMAGE_HORIZONTAL_PPI

    #define GST_TAG_IMAGE_HORIZONTAL_PPI         "image-horizontal-ppi"

Media (image/video) intended horizontal pixel density in ppi. (double)

### GST_TAG_IMAGE_VERTICAL_PPI

    #define GST_TAG_IMAGE_VERTICAL_PPI           "image-vertical-ppi"

Media (image/video) intended vertical pixel density in ppi. (double)

### GST_TAG_ID3V2_HEADER_SIZE

    #define GST_TAG_ID3V2_HEADER_SIZE            10

ID3V2 header size considered minimum input for some functions such as `gst_tag_list_from_id3v2_tag()` and `gst_tag_get_id3v2_tag_size()` for example.

### GST_TAG_MUSICAL_KEY

    #define GST_TAG_MUSICAL_KEY                   "musical-key"

Musical key in which the sound starts. It is represented as a string with a maximum length of three characters. The ground keys are represented with "A","B","C","D","E", "F" and "G" and halfkeys represented with "b" and "#". Minor is represented as "m" (e.g. "Dbm"). Off key is represented with an "o" only. This notation might be extended in the future to support non-minor/major keys.

Since: 1.2

### enum GstTagImageType

Type of image contained in an image tag (specified as "image-type" field in the info structure in the image's GstSample)

#### Members

GST_TAG_IMAGE_TYPE_NONE | No image type. Can be used to tell functions such as `gst_tag_image_data_to_image_sample()` that no image type should be set. |
GST_TAG_IMAGE_TYPE_UNDEFINED | Undefined/other image type |
GST_TAG_IMAGE_TYPE_FRONT_COVER | Cover (front) |
GST_TAG_IMAGE_TYPE_BACK_COVER | Cover (back) |
GST_TAG_IMAGE_TYPE_LEAFLET_PAGE | Leaflet page |
GST_TAG_IMAGE_TYPE_MEDIUM | Medium (e.g. label side of CD) |
GST_TAG_IMAGE_TYPE_LEAD_ARTIST | Lead artist/lead performer/soloist |
GST_TAG_IMAGE_TYPE_ARTIST | Artist/performer |
GST_TAG_IMAGE_TYPE_CONDUCTOR | Conductor |
GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA | Band/orchestra |
GST_TAG_IMAGE_TYPE_COMPOSER | Composer |
GST_TAG_IMAGE_TYPE_LYRICIST | Lyricist/text writer |
GST_TAG_IMAGE_TYPE_RECORDING_LOCATION | Recording location |
GST_TAG_IMAGE_TYPE_DURING_RECORDING | During recording |
GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE | During performance |
GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE | Movie/video screen capture |
GST_TAG_IMAGE_TYPE_FISH | A fish as funny as the ID3v2 spec |
GST_TAG_IMAGE_TYPE_ILLUSTRATION | Illustration |
GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO | Band/artist logotype |
GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO | Publisher/studio logotype |

## See Also

GstTagList