Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- Methods
- tagCheckLanguageCode
- tagFreeformStringToUtf8
- tagFromId3Tag
- tagFromId3UserTag
- tagFromVorbisTag
- tagGetId3v2TagSize
- tagGetLanguageCodeIso6391
- tagGetLanguageCodeIso6392B
- tagGetLanguageCodeIso6392T
- tagGetLanguageCodes
- tagGetLanguageName
- tagGetLicenseDescription
- tagGetLicenseFlags
- tagGetLicenseJurisdiction
- tagGetLicenseNick
- tagGetLicenseTitle
- tagGetLicenseVersion
- tagGetLicenses
- tagId3GenreCount
- tagId3GenreGet
- tagImageDataToImageSample
- tagListAddId3Image
- tagListFromExifBuffer
- tagListFromExifBufferWithTiffHeader
- tagListFromId3v2Tag
- tagListFromVorbiscomment
- tagListFromVorbiscommentBuffer
- tagListFromXmpBuffer
- tagListNewFromId3v1
- tagListToExifBuffer
- tagListToExifBufferWithTiffHeader
- tagListToVorbiscommentBuffer
- tagListToXmpBuffer
- tagParseExtendedComment
- tagRegisterMusicbrainzTags
- tagToId3Tag
- tagToVorbisComments
- tagToVorbisTag
- tagXmpListSchemas
- vorbisTagAdd
Synopsis
- tagCheckLanguageCode :: (HasCallStack, MonadIO m) => Text -> m Bool
- tagFreeformStringToUtf8 :: (HasCallStack, MonadIO m) => [Int8] -> [Text] -> m (Maybe Text)
- tagFromId3Tag :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagFromId3UserTag :: (HasCallStack, MonadIO m) => Text -> Text -> m (Maybe Text)
- tagFromVorbisTag :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetId3v2TagSize :: (HasCallStack, MonadIO m) => Buffer -> m Word32
- tagGetLanguageCodeIso6391 :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLanguageCodeIso6392B :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLanguageCodeIso6392T :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLanguageCodes :: (HasCallStack, MonadIO m) => m [Text]
- tagGetLanguageName :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLicenseDescription :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLicenseFlags :: (HasCallStack, MonadIO m) => Text -> m [TagLicenseFlags]
- tagGetLicenseJurisdiction :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLicenseNick :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLicenseTitle :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLicenseVersion :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagGetLicenses :: (HasCallStack, MonadIO m) => m [Text]
- tagId3GenreCount :: (HasCallStack, MonadIO m) => m Word32
- tagId3GenreGet :: (HasCallStack, MonadIO m) => Word32 -> m (Maybe Text)
- tagImageDataToImageSample :: (HasCallStack, MonadIO m) => ByteString -> TagImageType -> m (Maybe Sample)
- tagListAddId3Image :: (HasCallStack, MonadIO m) => TagList -> ByteString -> Word32 -> m Bool
- tagListFromExifBuffer :: (HasCallStack, MonadIO m) => Buffer -> Int32 -> Word32 -> m TagList
- tagListFromExifBufferWithTiffHeader :: (HasCallStack, MonadIO m) => Buffer -> m TagList
- tagListFromId3v2Tag :: (HasCallStack, MonadIO m) => Buffer -> m (Maybe TagList)
- tagListFromVorbiscomment :: (HasCallStack, MonadIO m) => ByteString -> ByteString -> m (Maybe TagList, Text)
- tagListFromVorbiscommentBuffer :: (HasCallStack, MonadIO m) => Buffer -> ByteString -> m (Maybe TagList, Text)
- tagListFromXmpBuffer :: (HasCallStack, MonadIO m) => Buffer -> m (Maybe TagList)
- tagListNewFromId3v1 :: (HasCallStack, MonadIO m) => ByteString -> m (Maybe TagList)
- tagListToExifBuffer :: (HasCallStack, MonadIO m) => TagList -> Int32 -> Word32 -> m Buffer
- tagListToExifBufferWithTiffHeader :: (HasCallStack, MonadIO m) => TagList -> m Buffer
- tagListToVorbiscommentBuffer :: (HasCallStack, MonadIO m) => TagList -> ByteString -> Maybe Text -> m Buffer
- tagListToXmpBuffer :: (HasCallStack, MonadIO m) => TagList -> Bool -> [Text] -> m (Maybe Buffer)
- tagParseExtendedComment :: (HasCallStack, MonadIO m) => Text -> Bool -> m (Bool, Maybe Text, Maybe Text, Text)
- tagRegisterMusicbrainzTags :: (HasCallStack, MonadIO m) => m ()
- tagToId3Tag :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagToVorbisComments :: (HasCallStack, MonadIO m) => TagList -> Text -> m [Text]
- tagToVorbisTag :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- tagXmpListSchemas :: (HasCallStack, MonadIO m) => m [Text]
- vorbisTagAdd :: (HasCallStack, MonadIO m) => TagList -> Text -> Text -> m ()
Methods
tagCheckLanguageCode
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: TRUE if the two- or three-letter language code in |
Check if a given string contains a known ISO 639 language code.
This is useful in situations where it's not clear whether a given
string is a language code (which should be put into a TAG_LANGUAGE_CODE
tag) or a free-form language name descriptor (which should be put into a
TAG_LANGUAGE_NAME
tag instead).
tagFreeformStringToUtf8
tagFreeformStringToUtf8 Source #
:: (HasCallStack, MonadIO m) | |
=> [Int8] |
|
-> [Text] |
|
-> m (Maybe Text) | Returns: a newly-allocated string in UTF-8 encoding, or NULL |
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
envVars
) 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).
tagFromId3Tag
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: The corresponding GStreamer tag or NULL if none exists. |
Looks up the GStreamer tag for a ID3v2 tag.
tagFromId3UserTag
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m (Maybe Text) | Returns: The corresponding GStreamer tag or NULL if none exists. |
Looks up the GStreamer tag for an ID3v2 user tag (e.g. description in TXXX frame or owner in UFID frame).
tagFromVorbisTag
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: The corresponding GStreamer tag or NULL if none exists. |
Looks up the GStreamer tag for a vorbiscomment tag.
tagGetId3v2TagSize
:: (HasCallStack, MonadIO m) | |
=> Buffer |
|
-> m Word32 | Returns: Size of tag, or 0 if header is invalid or too small. |
Determines size of an ID3v2 tag on buffer containing at least ID3v2 header,
i.e. at least TAG_ID3V2_HEADER_SIZE
(10) bytes;
tagGetLanguageCodeIso6391
tagGetLanguageCodeIso6391 Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: two-letter ISO-639-1 language code string that maps to |
Returns two-letter ISO-639-1 language code given a three-letter ISO-639-2 language code or two-letter ISO-639-1 language code (both are accepted for convenience).
Language codes are case-sensitive and expected to be lower case.
tagGetLanguageCodeIso6392B
tagGetLanguageCodeIso6392B Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: three-letter ISO-639-2 language code string that maps to |
Returns three-letter ISO-639-2 "bibliographic" language code given a two-letter ISO-639-1 language code or a three-letter ISO-639-2 language code (both are accepted for convenience).
The "bibliographic" code is derived from the English name of the language (e.g. "ger" for German instead of "de" or "deu"). In most scenarios, the "terminological" codes are preferred.
Language codes are case-sensitive and expected to be lower case.
tagGetLanguageCodeIso6392T
tagGetLanguageCodeIso6392T Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: three-letter ISO-639-2 language code string that maps to |
Returns three-letter ISO-639-2 "terminological" language code given a two-letter ISO-639-1 language code or a three-letter ISO-639-2 language code (both are accepted for convenience).
The "terminological" code is derived from the local name of the language (e.g. "deu" for German instead of "ger"). In most scenarios, the "terminological" codes are preferred over the "bibliographic" ones.
Language codes are case-sensitive and expected to be lower case.
tagGetLanguageCodes
:: (HasCallStack, MonadIO m) | |
=> m [Text] | Returns: NULL-terminated string array with two-letter
language codes. Free with |
Returns a list of known language codes (in form of two-letter ISO-639-1 codes). This is useful for UIs to build a list of available languages for tagging purposes (e.g. to tag an audio track appropriately in a video or audio editor).
tagGetLanguageName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: language name in UTF-8 format, or NULL if |
Returns the name of the language given an ISO-639 language code as found in a GST_TAG_LANGUAGE_CODE tag. The name will be translated according to the current locale (if the library was built against the iso-codes package, otherwise the English name will be returned).
Language codes are case-sensitive and expected to be lower case.
tagGetLicenseDescription
tagGetLicenseDescription Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the description of the license, or NULL if the license is unknown or a description is not available. |
Get the description of a license, which is a translated description of the license's main features.
tagGetLicenseFlags
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m [TagLicenseFlags] | Returns: the flags of the license, or 0 if the license is unknown |
Get the flags of a license, which describe most of the features of a license in their most general form.
tagGetLicenseJurisdiction
tagGetLicenseJurisdiction Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the jurisdiction code of the license, or NULL if the license is unknown or is not specific to a particular jurisdiction. |
Get the jurisdiction code of a license. This is usually a two-letter ISO 3166-1 alpha-2 code, but there is also the special case of Scotland, for which no code exists and which is thus represented as "scotland".
Known jurisdictions: ar, at, au, be, bg, br, ca, ch, cl, cn, co, de, dk, es, fi, fr, hr, hu, il, in, it, jp, kr, mk, mt, mx, my, nl, pe, pl, pt, scotland, se, si, tw, uk, us, za.
tagGetLicenseNick
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the nick name of the license, or NULL if the license is unknown |
Get the nick name of a license, which is a short (untranslated) string such as e.g. "CC BY-NC-ND 2.0 UK".
tagGetLicenseTitle
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the title of the license, or NULL if the license is unknown or no title is available. |
Get the title of a license, which is a short translated description of the license's features (generally not very pretty though).
tagGetLicenseVersion
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the version of the license, or NULL if the license is not known or has no version |
Get the version of a license.
tagGetLicenses
:: (HasCallStack, MonadIO m) | |
=> m [Text] | Returns: NULL-terminated array of license strings. Free
with |
Returns a list of known license references (in form of URIs). This is useful for UIs to build a list of available licenses for tagging purposes (e.g. to tag an audio track appropriately in a video or audio editor, or an image in a camera application).
tagId3GenreCount
:: (HasCallStack, MonadIO m) | |
=> m Word32 | Returns: the number of ID3v1 genres that can be identified |
Gets the number of ID3v1 genres that can be identified. Winamp genres are included.
tagId3GenreGet
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m (Maybe Text) | Returns: the genre or NULL if no genre is associated with that ID. |
Gets the ID3v1 genre name for a given ID.
tagImageDataToImageSample
tagImageDataToImageSample Source #
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> TagImageType |
|
-> m (Maybe Sample) | Returns: a newly-allocated image sample for use in tag lists, or NULL |
Helper function for tag-reading plugins to create a Sample
suitable to
add to a TagList
as an image tag (such as TAG_IMAGE
or
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 Sample
s 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 TagImageType
to describe
the type of image (front cover, back cover etc.). 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).
tagListAddId3Image
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> ByteString |
|
-> Word32 |
|
-> m Bool |
Adds an image from an ID3 APIC frame (or similar, such as used in FLAC)
to the given tag list. Also see tagImageDataToImageSample
for
more information on image tags in GStreamer.
tagListFromExifBuffer
tagListFromExifBuffer Source #
:: (HasCallStack, MonadIO m) | |
=> Buffer |
|
-> Int32 |
|
-> Word32 |
|
-> m TagList | Returns: The parsed taglist |
Parses the IFD and IFD tags data contained in the buffer and puts it on a taglist. The base_offset is used to subtract from the offset in the tag entries and be able to get the offset relative to the buffer start
tagListFromExifBufferWithTiffHeader
tagListFromExifBufferWithTiffHeader Source #
:: (HasCallStack, MonadIO m) | |
=> Buffer |
|
-> m TagList | Returns: The taglist |
Parses the exif tags starting with a tiff header structure.
tagListFromId3v2Tag
:: (HasCallStack, MonadIO m) | |
=> Buffer |
|
-> m (Maybe TagList) | Returns: A new |
Creates a new tag list that contains the information parsed out of a ID3 tag.
tagListFromVorbiscomment
tagListFromVorbiscomment Source #
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> ByteString |
|
-> m (Maybe TagList, Text) | Returns: A new |
Creates a new tag list that contains the information parsed out of a vorbiscomment packet.
tagListFromVorbiscommentBuffer
tagListFromVorbiscommentBuffer Source #
:: (HasCallStack, MonadIO m) | |
=> Buffer |
|
-> ByteString |
|
-> m (Maybe TagList, Text) | Returns: A new |
Creates a new tag list that contains the information parsed out of a vorbiscomment packet.
tagListFromXmpBuffer
:: (HasCallStack, MonadIO m) | |
=> Buffer |
|
-> m (Maybe TagList) | Returns: new taglist or |
Parse a xmp packet into a taglist.
tagListNewFromId3v1
:: (HasCallStack, MonadIO m) | |
=> ByteString |
|
-> m (Maybe TagList) | Returns: A new tag list or NULL if the data was not an ID3v1 tag. |
Parses the data containing an ID3v1 tag and returns a TagList
from the
parsed data.
tagListToExifBuffer
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> Int32 |
|
-> Word32 |
|
-> m Buffer | Returns: A GstBuffer containing the tag entries followed by the tag data |
Formats the tags in taglist on exif format. The resulting buffer contains the tags IFD and is followed by the data pointed by the tag entries.
tagListToExifBufferWithTiffHeader
tagListToExifBufferWithTiffHeader Source #
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> m Buffer | Returns: A GstBuffer containing the data |
Formats the tags in taglist into exif structure, a tiff header is put in the beginning of the buffer.
tagListToVorbiscommentBuffer
tagListToVorbiscommentBuffer Source #
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> ByteString |
|
-> Maybe Text |
|
-> m Buffer | Returns: A new |
Creates a new vorbiscomment buffer from a tag list.
tagListToXmpBuffer
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> Bool |
|
-> [Text] |
|
-> m (Maybe Buffer) | Returns: new buffer or |
Formats a taglist as a xmp packet using only the selected
schemas. An empty list (Nothing
) means that all schemas should
be used
tagParseExtendedComment
tagParseExtendedComment Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m (Bool, Maybe Text, Maybe Text, Text) | Returns: TRUE if the string could be parsed, otherwise FALSE |
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 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.
tagRegisterMusicbrainzTags
tagRegisterMusicbrainzTags :: (HasCallStack, MonadIO m) => m () Source #
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.
tagToId3Tag
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: The corresponding ID3v2 tag or NULL if none exists. |
Looks up the ID3v2 tag for a GStreamer tag.
tagToVorbisComments
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> Text |
|
-> m [Text] | Returns: A |
Creates a new tag list that contains the information parsed out of a vorbiscomment packet.
tagToVorbisTag
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: The corresponding vorbiscomment tag or NULL if none exists. |
Looks up the vorbiscomment tag for a GStreamer tag.
tagXmpListSchemas
:: (HasCallStack, MonadIO m) | |
=> m [Text] | Returns: a |
Gets the list of supported schemas in the xmp lib
vorbisTagAdd
:: (HasCallStack, MonadIO m) | |
=> TagList |
|
-> Text |
|
-> Text |
|
-> m () |
Convenience function using tagFromVorbisTag
, parsing
a vorbis comment string into the right type and adding it to the
given taglist list
.
Unknown vorbiscomment tags will be added to the tag list in form
of a TAG_EXTENDED_COMMENT
.