-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.GstTag.Functions
    ( 

 -- * Methods


-- ** tagCheckLanguageCode #method:tagCheckLanguageCode#

    tagCheckLanguageCode                    ,


-- ** tagFreeformStringToUtf8 #method:tagFreeformStringToUtf8#

    tagFreeformStringToUtf8                 ,


-- ** tagFromId3Tag #method:tagFromId3Tag#

    tagFromId3Tag                           ,


-- ** tagFromId3UserTag #method:tagFromId3UserTag#

    tagFromId3UserTag                       ,


-- ** tagFromVorbisTag #method:tagFromVorbisTag#

    tagFromVorbisTag                        ,


-- ** tagGetId3v2TagSize #method:tagGetId3v2TagSize#

    tagGetId3v2TagSize                      ,


-- ** tagGetLanguageCodeIso6391 #method:tagGetLanguageCodeIso6391#

    tagGetLanguageCodeIso6391               ,


-- ** tagGetLanguageCodeIso6392B #method:tagGetLanguageCodeIso6392B#

    tagGetLanguageCodeIso6392B              ,


-- ** tagGetLanguageCodeIso6392T #method:tagGetLanguageCodeIso6392T#

    tagGetLanguageCodeIso6392T              ,


-- ** tagGetLanguageCodes #method:tagGetLanguageCodes#

    tagGetLanguageCodes                     ,


-- ** tagGetLanguageName #method:tagGetLanguageName#

    tagGetLanguageName                      ,


-- ** tagGetLicenseDescription #method:tagGetLicenseDescription#

    tagGetLicenseDescription                ,


-- ** tagGetLicenseFlags #method:tagGetLicenseFlags#

    tagGetLicenseFlags                      ,


-- ** tagGetLicenseJurisdiction #method:tagGetLicenseJurisdiction#

    tagGetLicenseJurisdiction               ,


-- ** tagGetLicenseNick #method:tagGetLicenseNick#

    tagGetLicenseNick                       ,


-- ** tagGetLicenseTitle #method:tagGetLicenseTitle#

    tagGetLicenseTitle                      ,


-- ** tagGetLicenseVersion #method:tagGetLicenseVersion#

    tagGetLicenseVersion                    ,


-- ** tagGetLicenses #method:tagGetLicenses#

    tagGetLicenses                          ,


-- ** tagId3GenreCount #method:tagId3GenreCount#

    tagId3GenreCount                        ,


-- ** tagId3GenreGet #method:tagId3GenreGet#

    tagId3GenreGet                          ,


-- ** tagImageDataToImageSample #method:tagImageDataToImageSample#

    tagImageDataToImageSample               ,


-- ** tagListAddId3Image #method:tagListAddId3Image#

    tagListAddId3Image                      ,


-- ** tagListFromExifBuffer #method:tagListFromExifBuffer#

    tagListFromExifBuffer                   ,


-- ** tagListFromExifBufferWithTiffHeader #method:tagListFromExifBufferWithTiffHeader#

    tagListFromExifBufferWithTiffHeader     ,


-- ** tagListFromId3v2Tag #method:tagListFromId3v2Tag#

    tagListFromId3v2Tag                     ,


-- ** tagListFromVorbiscomment #method:tagListFromVorbiscomment#

    tagListFromVorbiscomment                ,


-- ** tagListFromVorbiscommentBuffer #method:tagListFromVorbiscommentBuffer#

    tagListFromVorbiscommentBuffer          ,


-- ** tagListFromXmpBuffer #method:tagListFromXmpBuffer#

    tagListFromXmpBuffer                    ,


-- ** tagListNewFromId3v1 #method:tagListNewFromId3v1#

    tagListNewFromId3v1                     ,


-- ** tagListToExifBuffer #method:tagListToExifBuffer#

    tagListToExifBuffer                     ,


-- ** tagListToExifBufferWithTiffHeader #method:tagListToExifBufferWithTiffHeader#

    tagListToExifBufferWithTiffHeader       ,


-- ** tagListToVorbiscommentBuffer #method:tagListToVorbiscommentBuffer#

    tagListToVorbiscommentBuffer            ,


-- ** tagListToXmpBuffer #method:tagListToXmpBuffer#

    tagListToXmpBuffer                      ,


-- ** tagParseExtendedComment #method:tagParseExtendedComment#

    tagParseExtendedComment                 ,


-- ** tagRegisterMusicbrainzTags #method:tagRegisterMusicbrainzTags#

    tagRegisterMusicbrainzTags              ,


-- ** tagToId3Tag #method:tagToId3Tag#

    tagToId3Tag                             ,


-- ** tagToVorbisComments #method:tagToVorbisComments#

    tagToVorbisComments                     ,


-- ** tagToVorbisTag #method:tagToVorbisTag#

    tagToVorbisTag                          ,


-- ** tagXmpListSchemas #method:tagXmpListSchemas#

    tagXmpListSchemas                       ,


-- ** vorbisTagAdd #method:vorbisTagAdd#

    vorbisTagAdd                            ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.Gst.Structs.Buffer as Gst.Buffer
import qualified GI.Gst.Structs.Sample as Gst.Sample
import qualified GI.Gst.Structs.TagList as Gst.TagList
import {-# SOURCE #-} qualified GI.GstTag.Enums as GstTag.Enums
import {-# SOURCE #-} qualified GI.GstTag.Flags as GstTag.Flags

-- function vorbis_tag_add
-- Args: [ Arg
--           { argCName = "list"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstTagList" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a vorbiscomment tag string (key in key=value), must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a vorbiscomment value string (value in key=value), must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_vorbis_tag_add" gst_vorbis_tag_add :: 
    Ptr Gst.TagList.TagList ->              -- list : TInterface (Name {namespace = "Gst", name = "TagList"})
    CString ->                              -- tag : TBasicType TUTF8
    CString ->                              -- value : TBasicType TUTF8
    IO ()

-- | Convenience function using 'GI.GstTag.Functions.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 'GI.Gst.Constants.TAG_EXTENDED_COMMENT'.
vorbisTagAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@list@/: a t'GI.Gst.Structs.TagList.TagList'
    -> T.Text
    -- ^ /@tag@/: a vorbiscomment tag string (key in key=value), must be valid UTF-8
    -> T.Text
    -- ^ /@value@/: a vorbiscomment value string (value in key=value), must be valid UTF-8
    -> m ()
vorbisTagAdd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> Text -> Text -> m ()
vorbisTagAdd TagList
list Text
tag Text
value = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TagList
list' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
list
    CString
tag' <- Text -> IO CString
textToCString Text
tag
    CString
value' <- Text -> IO CString
textToCString Text
value
    Ptr TagList -> CString -> CString -> IO ()
gst_vorbis_tag_add Ptr TagList
list' CString
tag' CString
value'
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
list
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
tag'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function tag_xmp_list_schemas
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_xmp_list_schemas" gst_tag_xmp_list_schemas :: 
    IO (Ptr CString)

-- | Gets the list of supported schemas in the xmp lib
tagXmpListSchemas ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ a 'P.Nothing' terminated array of strings with the
    --     schema names
tagXmpListSchemas :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
tagXmpListSchemas  = IO [Text] -> m [Text]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
result <- IO (Ptr CString)
gst_tag_xmp_list_schemas
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagXmpListSchemas" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function tag_to_vorbis_tag
-- Args: [ Arg
--           { argCName = "gst_tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GStreamer tag to convert to vorbiscomment tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_to_vorbis_tag" gst_tag_to_vorbis_tag :: 
    CString ->                              -- gst_tag : TBasicType TUTF8
    IO CString

-- | Looks up the vorbiscomment tag for a GStreamer tag.
tagToVorbisTag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@gstTag@/: GStreamer tag to convert to vorbiscomment tag
    -> m T.Text
    -- ^ __Returns:__ The corresponding vorbiscomment tag or NULL if none exists.
tagToVorbisTag :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagToVorbisTag Text
gstTag = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
gstTag' <- Text -> IO CString
textToCString Text
gstTag
    CString
result <- CString -> IO CString
gst_tag_to_vorbis_tag CString
gstTag'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagToVorbisTag" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
gstTag'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_to_vorbis_comments
-- Args: [ Arg
--           { argCName = "list"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstTagList" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a GStreamer tag identifier, such as #GST_TAG_ARTIST"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TGList (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_to_vorbis_comments" gst_tag_to_vorbis_comments :: 
    Ptr Gst.TagList.TagList ->              -- list : TInterface (Name {namespace = "Gst", name = "TagList"})
    CString ->                              -- tag : TBasicType TUTF8
    IO (Ptr (GList CString))

-- | Creates a new tag list that contains the information parsed out of a
-- vorbiscomment packet.
tagToVorbisComments ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@list@/: a t'GI.Gst.Structs.TagList.TagList'
    -> T.Text
    -- ^ /@tag@/: a GStreamer tag identifier, such as 'GI.Gst.Constants.TAG_ARTIST'
    -> m [T.Text]
    -- ^ __Returns:__ A t'GI.GLib.Structs.List.List' of newly-allocated
    --     key=value strings. Free with g_list_foreach (list, (GFunc) g_free, NULL)
    --     plus g_list_free (list)
tagToVorbisComments :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> Text -> m [Text]
tagToVorbisComments TagList
list Text
tag = IO [Text] -> m [Text]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr TagList
list' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
list
    CString
tag' <- Text -> IO CString
textToCString Text
tag
    Ptr (GList CString)
result <- Ptr TagList -> CString -> IO (Ptr (GList CString))
gst_tag_to_vorbis_comments Ptr TagList
list' CString
tag'
    [CString]
result' <- Ptr (GList CString) -> IO [CString]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList CString)
result
    [Text]
result'' <- (CString -> IO Text) -> [CString] -> IO [Text]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [CString]
result'
    (CString -> IO ()) -> Ptr (GList CString) -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (GList (Ptr a)) -> IO ()
mapGList CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (GList CString)
result
    Ptr (GList CString) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList CString)
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
list
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
tag'
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result''


-- function tag_to_id3_tag
-- Args: [ Arg
--           { argCName = "gst_tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GStreamer tag to convert to vorbiscomment tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_to_id3_tag" gst_tag_to_id3_tag :: 
    CString ->                              -- gst_tag : TBasicType TUTF8
    IO CString

-- | Looks up the ID3v2 tag for a GStreamer tag.
tagToId3Tag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@gstTag@/: GStreamer tag to convert to vorbiscomment tag
    -> m T.Text
    -- ^ __Returns:__ The corresponding ID3v2 tag or NULL if none exists.
tagToId3Tag :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagToId3Tag Text
gstTag = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
gstTag' <- Text -> IO CString
textToCString Text
gstTag
    CString
result <- CString -> IO CString
gst_tag_to_id3_tag CString
gstTag'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagToId3Tag" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
gstTag'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_register_musicbrainz_tags
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_register_musicbrainz_tags" gst_tag_register_musicbrainz_tags :: 
    IO ()

-- | 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.
tagRegisterMusicbrainzTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
tagRegisterMusicbrainzTags :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
tagRegisterMusicbrainzTags  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
gst_tag_register_musicbrainz_tags
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function tag_parse_extended_comment
-- Args: [ Arg
--           { argCName = "ext_comment"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an extended comment string, see #GST_TAG_EXTENDED_COMMENT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    return location for the comment description key, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "lang"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    return location for the comment ISO-639 language code, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the actual comment string, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "fail_if_no_key"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "whether to fail if strings are not in key=value form"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_parse_extended_comment" gst_tag_parse_extended_comment :: 
    CString ->                              -- ext_comment : TBasicType TUTF8
    Ptr CString ->                          -- key : TBasicType TUTF8
    Ptr CString ->                          -- lang : TBasicType TUTF8
    Ptr CString ->                          -- value : TBasicType TUTF8
    CInt ->                                 -- fail_if_no_key : TBasicType TBoolean
    IO CInt

-- | 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 'GI.GLib.Functions.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.
tagParseExtendedComment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@extComment@/: an extended comment string, see 'GI.Gst.Constants.TAG_EXTENDED_COMMENT'
    -> Bool
    -- ^ /@failIfNoKey@/: whether to fail if strings are not in key=value form
    -> m ((Bool, Maybe T.Text, Maybe T.Text, T.Text))
    -- ^ __Returns:__ TRUE if the string could be parsed, otherwise FALSE
tagParseExtendedComment :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Bool -> m (Bool, Maybe Text, Maybe Text, Text)
tagParseExtendedComment Text
extComment Bool
failIfNoKey = IO (Bool, Maybe Text, Maybe Text, Text)
-> m (Bool, Maybe Text, Maybe Text, Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Maybe Text, Maybe Text, Text)
 -> m (Bool, Maybe Text, Maybe Text, Text))
-> IO (Bool, Maybe Text, Maybe Text, Text)
-> m (Bool, Maybe Text, Maybe Text, Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
extComment' <- Text -> IO CString
textToCString Text
extComment
    Ptr CString
key <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CString
lang <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CString
value <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    let failIfNoKey' :: CInt
failIfNoKey' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
failIfNoKey
    CInt
result <- CString
-> Ptr CString -> Ptr CString -> Ptr CString -> CInt -> IO CInt
gst_tag_parse_extended_comment CString
extComment' Ptr CString
key Ptr CString
lang Ptr CString
value CInt
failIfNoKey'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
key' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
key
    Maybe Text
maybeKey' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
key' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
key'' -> do
        Text
key''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
key''
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
key'''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
key'
    CString
lang' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
lang
    Maybe Text
maybeLang' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
lang' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
lang'' -> do
        Text
lang''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
lang''
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
lang'''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
lang'
    CString
value' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
value
    Text
value'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
value'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
value'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
extComment'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
key
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
lang
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
value
    (Bool, Maybe Text, Maybe Text, Text)
-> IO (Bool, Maybe Text, Maybe Text, Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Maybe Text
maybeKey', Maybe Text
maybeLang', Text
value'')


-- function tag_list_to_xmp_buffer
-- Args: [ Arg
--           { argCName = "list"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "tags" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "read_only"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "does the container forbid inplace editing"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "schemas"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    %NULL terminated array of schemas to be used on serialization"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Buffer" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_to_xmp_buffer" gst_tag_list_to_xmp_buffer :: 
    Ptr Gst.TagList.TagList ->              -- list : TInterface (Name {namespace = "Gst", name = "TagList"})
    CInt ->                                 -- read_only : TBasicType TBoolean
    Ptr CString ->                          -- schemas : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO (Ptr Gst.Buffer.Buffer)

-- | Formats a taglist as a xmp packet using only the selected
-- schemas. An empty list ('P.Nothing') means that all schemas should
-- be used
tagListToXmpBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@list@/: tags
    -> Bool
    -- ^ /@readOnly@/: does the container forbid inplace editing
    -> [T.Text]
    -- ^ /@schemas@/: 
    --     'P.Nothing' terminated array of schemas to be used on serialization
    -> m Gst.Buffer.Buffer
    -- ^ __Returns:__ new buffer or 'P.Nothing', unref the buffer when done
tagListToXmpBuffer :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> Bool -> [Text] -> m Buffer
tagListToXmpBuffer TagList
list Bool
readOnly [Text]
schemas = IO Buffer -> m Buffer
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Buffer -> m Buffer) -> IO Buffer -> m Buffer
forall a b. (a -> b) -> a -> b
$ do
    Ptr TagList
list' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
list
    let readOnly' :: CInt
readOnly' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
readOnly
    Ptr CString
schemas' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
schemas
    Ptr Buffer
result <- Ptr TagList -> CInt -> Ptr CString -> IO (Ptr Buffer)
gst_tag_list_to_xmp_buffer Ptr TagList
list' CInt
readOnly' Ptr CString
schemas'
    Text -> Ptr Buffer -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListToXmpBuffer" Ptr Buffer
result
    Buffer
result' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
list
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
schemas'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
schemas'
    Buffer -> IO Buffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Buffer
result'


-- function tag_list_to_vorbiscomment_buffer
-- Args: [ Arg
--           { argCName = "list"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "tag list to convert"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id_data"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "identification data at start of stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id_data_length"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of identification data, may be 0 if @id_data is NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "vendor_string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "string that describes the vendor string or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "id_data_length"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of identification data, may be 0 if @id_data is NULL"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Buffer" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_to_vorbiscomment_buffer" gst_tag_list_to_vorbiscomment_buffer :: 
    Ptr Gst.TagList.TagList ->              -- list : TInterface (Name {namespace = "Gst", name = "TagList"})
    Ptr Word8 ->                            -- id_data : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- id_data_length : TBasicType TUInt
    CString ->                              -- vendor_string : TBasicType TUTF8
    IO (Ptr Gst.Buffer.Buffer)

-- | Creates a new vorbiscomment buffer from a tag list.
tagListToVorbiscommentBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@list@/: tag list to convert
    -> ByteString
    -- ^ /@idData@/: identification data at start of stream
    -> Maybe (T.Text)
    -- ^ /@vendorString@/: string that describes the vendor string or NULL
    -> m Gst.Buffer.Buffer
    -- ^ __Returns:__ A new t'GI.Gst.Structs.Buffer.Buffer' containing a vorbiscomment buffer with all tags
    --          that could be converted from the given tag list.
tagListToVorbiscommentBuffer :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> ByteString -> Maybe Text -> m Buffer
tagListToVorbiscommentBuffer TagList
list ByteString
idData Maybe Text
vendorString = IO Buffer -> m Buffer
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Buffer -> m Buffer) -> IO Buffer -> m Buffer
forall a b. (a -> b) -> a -> b
$ do
    let idDataLength :: Word32
idDataLength = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
idData
    Ptr TagList
list' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
list
    Ptr Word8
idData' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
idData
    CString
maybeVendorString <- case Maybe Text
vendorString of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jVendorString -> do
            CString
jVendorString' <- Text -> IO CString
textToCString Text
jVendorString
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jVendorString'
    Ptr Buffer
result <- Ptr TagList -> Ptr Word8 -> Word32 -> CString -> IO (Ptr Buffer)
gst_tag_list_to_vorbiscomment_buffer Ptr TagList
list' Ptr Word8
idData' Word32
idDataLength CString
maybeVendorString
    Text -> Ptr Buffer -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListToVorbiscommentBuffer" Ptr Buffer
result
    Buffer
result' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
list
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
idData'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeVendorString
    Buffer -> IO Buffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Buffer
result'


-- function tag_list_to_exif_buffer_with_tiff_header
-- Args: [ Arg
--           { argCName = "taglist"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The taglist" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Buffer" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_to_exif_buffer_with_tiff_header" gst_tag_list_to_exif_buffer_with_tiff_header :: 
    Ptr Gst.TagList.TagList ->              -- taglist : TInterface (Name {namespace = "Gst", name = "TagList"})
    IO (Ptr Gst.Buffer.Buffer)

-- | Formats the tags in taglist into exif structure, a tiff header
-- is put in the beginning of the buffer.
tagListToExifBufferWithTiffHeader ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@taglist@/: The taglist
    -> m Gst.Buffer.Buffer
    -- ^ __Returns:__ A GstBuffer containing the data
tagListToExifBufferWithTiffHeader :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> m Buffer
tagListToExifBufferWithTiffHeader TagList
taglist = IO Buffer -> m Buffer
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Buffer -> m Buffer) -> IO Buffer -> m Buffer
forall a b. (a -> b) -> a -> b
$ do
    Ptr TagList
taglist' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
taglist
    Ptr Buffer
result <- Ptr TagList -> IO (Ptr Buffer)
gst_tag_list_to_exif_buffer_with_tiff_header Ptr TagList
taglist'
    Text -> Ptr Buffer -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListToExifBufferWithTiffHeader" Ptr Buffer
result
    Buffer
result' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
taglist
    Buffer -> IO Buffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Buffer
result'


-- function tag_list_to_exif_buffer
-- Args: [ Arg
--           { argCName = "taglist"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The taglist" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "byte_order"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "byte order used in writing (G_LITTLE_ENDIAN or G_BIG_ENDIAN)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "base_offset"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Offset from the tiff header first byte"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Buffer" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_to_exif_buffer" gst_tag_list_to_exif_buffer :: 
    Ptr Gst.TagList.TagList ->              -- taglist : TInterface (Name {namespace = "Gst", name = "TagList"})
    Int32 ->                                -- byte_order : TBasicType TInt
    Word32 ->                               -- base_offset : TBasicType TUInt32
    IO (Ptr Gst.Buffer.Buffer)

-- | 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.
tagListToExifBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@taglist@/: The taglist
    -> Int32
    -- ^ /@byteOrder@/: byte order used in writing (G_LITTLE_ENDIAN or G_BIG_ENDIAN)
    -> Word32
    -- ^ /@baseOffset@/: Offset from the tiff header first byte
    -> m Gst.Buffer.Buffer
    -- ^ __Returns:__ A GstBuffer containing the tag entries followed by the tag data
tagListToExifBuffer :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> Int32 -> Word32 -> m Buffer
tagListToExifBuffer TagList
taglist Int32
byteOrder Word32
baseOffset = IO Buffer -> m Buffer
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Buffer -> m Buffer) -> IO Buffer -> m Buffer
forall a b. (a -> b) -> a -> b
$ do
    Ptr TagList
taglist' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
taglist
    Ptr Buffer
result <- Ptr TagList -> Int32 -> Word32 -> IO (Ptr Buffer)
gst_tag_list_to_exif_buffer Ptr TagList
taglist' Int32
byteOrder Word32
baseOffset
    Text -> Ptr Buffer -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListToExifBuffer" Ptr Buffer
result
    Buffer
result' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
taglist
    Buffer -> IO Buffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Buffer
result'


-- function tag_list_new_from_id3v1
-- Args: [ Arg
--           { argCName = "data"
--           , argType = TCArray False 128 (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "128 bytes of data containing the ID3v1 tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_new_from_id3v1" gst_tag_list_new_from_id3v1 :: 
    Ptr Word8 ->                            -- data : TCArray False 128 (-1) (TBasicType TUInt8)
    IO (Ptr Gst.TagList.TagList)

-- | Parses the data containing an ID3v1 tag and returns a t'GI.Gst.Structs.TagList.TagList' from the
-- parsed data.
tagListNewFromId3v1 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@data@/: 128 bytes of data containing the ID3v1 tag
    -> m Gst.TagList.TagList
    -- ^ __Returns:__ A new tag list or NULL if the data was not an ID3v1 tag.
tagListNewFromId3v1 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m TagList
tagListNewFromId3v1 ByteString
data_ = IO TagList -> m TagList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TagList -> m TagList) -> IO TagList -> m TagList
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word8
data_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
data_
    Ptr TagList
result <- Ptr Word8 -> IO (Ptr TagList)
gst_tag_list_new_from_id3v1 Ptr Word8
data_'
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListNewFromId3v1" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
    TagList -> IO TagList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return TagList
result'


-- function tag_list_from_xmp_buffer
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_from_xmp_buffer" gst_tag_list_from_xmp_buffer :: 
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO (Ptr Gst.TagList.TagList)

-- | Parse a xmp packet into a taglist.
tagListFromXmpBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@buffer@/: buffer
    -> m Gst.TagList.TagList
    -- ^ __Returns:__ new taglist or 'P.Nothing', free the list when done
tagListFromXmpBuffer :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> m TagList
tagListFromXmpBuffer Buffer
buffer = IO TagList -> m TagList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TagList -> m TagList) -> IO TagList -> m TagList
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buffer
    Ptr TagList
result <- Ptr Buffer -> IO (Ptr TagList)
gst_tag_list_from_xmp_buffer Ptr Buffer
buffer'
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListFromXmpBuffer" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    TagList -> IO TagList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return TagList
result'


-- function tag_list_from_vorbiscomment_buffer
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer to convert" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id_data"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "identification data at start of stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id_data_length"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of identification data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "vendor_string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "pointer to a string that should take the\n    vendor string of this vorbis comment or NULL if you don't need it."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "id_data_length"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "length of identification data"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_from_vorbiscomment_buffer" gst_tag_list_from_vorbiscomment_buffer :: 
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    Ptr Word8 ->                            -- id_data : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- id_data_length : TBasicType TUInt
    Ptr CString ->                          -- vendor_string : TBasicType TUTF8
    IO (Ptr Gst.TagList.TagList)

-- | Creates a new tag list that contains the information parsed out of a
-- vorbiscomment packet.
tagListFromVorbiscommentBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@buffer@/: buffer to convert
    -> ByteString
    -- ^ /@idData@/: identification data at start of stream
    -> m ((Gst.TagList.TagList, T.Text))
    -- ^ __Returns:__ A new t'GI.Gst.Structs.TagList.TagList' with all tags that could be extracted from the
    --          given vorbiscomment buffer or NULL on error.
tagListFromVorbiscommentBuffer :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> ByteString -> m (TagList, Text)
tagListFromVorbiscommentBuffer Buffer
buffer ByteString
idData = IO (TagList, Text) -> m (TagList, Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (TagList, Text) -> m (TagList, Text))
-> IO (TagList, Text) -> m (TagList, Text)
forall a b. (a -> b) -> a -> b
$ do
    let idDataLength :: Word32
idDataLength = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
idData
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buffer
    Ptr Word8
idData' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
idData
    Ptr CString
vendorString <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr TagList
result <- Ptr Buffer
-> Ptr Word8 -> Word32 -> Ptr CString -> IO (Ptr TagList)
gst_tag_list_from_vorbiscomment_buffer Ptr Buffer
buffer' Ptr Word8
idData' Word32
idDataLength Ptr CString
vendorString
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListFromVorbiscommentBuffer" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    CString
vendorString' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
vendorString
    Text
vendorString'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
vendorString'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
vendorString'
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
idData'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
vendorString
    (TagList, Text) -> IO (TagList, Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TagList
result', Text
vendorString'')


-- function tag_list_from_vorbiscomment
-- Args: [ Arg
--           { argCName = "data"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to convert" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "size of @data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id_data"
--           , argType = TCArray False (-1) 3 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "identification data at start of stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id_data_length"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of identification data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "vendor_string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "pointer to a string that should take the\n    vendor string of this vorbis comment or NULL if you don't need it."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "id_data_length"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "length of identification data"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          , Arg
--              { argCName = "size"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "size of @data" , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_from_vorbiscomment" gst_tag_list_from_vorbiscomment :: 
    Ptr Word8 ->                            -- data : TCArray False (-1) 1 (TBasicType TUInt8)
    Word64 ->                               -- size : TBasicType TUInt64
    Ptr Word8 ->                            -- id_data : TCArray False (-1) 3 (TBasicType TUInt8)
    Word32 ->                               -- id_data_length : TBasicType TUInt
    Ptr CString ->                          -- vendor_string : TBasicType TUTF8
    IO (Ptr Gst.TagList.TagList)

-- | Creates a new tag list that contains the information parsed out of a
-- vorbiscomment packet.
tagListFromVorbiscomment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@data@/: data to convert
    -> ByteString
    -- ^ /@idData@/: identification data at start of stream
    -> m ((Gst.TagList.TagList, T.Text))
    -- ^ __Returns:__ A new t'GI.Gst.Structs.TagList.TagList' with all tags that could be extracted from the
    --          given vorbiscomment buffer or NULL on error.
tagListFromVorbiscomment :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> ByteString -> m (TagList, Text)
tagListFromVorbiscomment ByteString
data_ ByteString
idData = IO (TagList, Text) -> m (TagList, Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (TagList, Text) -> m (TagList, Text))
-> IO (TagList, Text) -> m (TagList, Text)
forall a b. (a -> b) -> a -> b
$ do
    let idDataLength :: Word32
idDataLength = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
idData
    let size :: Word64
size = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
data_
    Ptr Word8
data_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
data_
    Ptr Word8
idData' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
idData
    Ptr CString
vendorString <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr TagList
result <- Ptr Word8
-> Word64 -> Ptr Word8 -> Word32 -> Ptr CString -> IO (Ptr TagList)
gst_tag_list_from_vorbiscomment Ptr Word8
data_' Word64
size Ptr Word8
idData' Word32
idDataLength Ptr CString
vendorString
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListFromVorbiscomment" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    CString
vendorString' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
vendorString
    Text
vendorString'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
vendorString'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
vendorString'
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
idData'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
vendorString
    (TagList, Text) -> IO (TagList, Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (TagList
result', Text
vendorString'')


-- function tag_list_from_id3v2_tag
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "buffer to convert" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_from_id3v2_tag" gst_tag_list_from_id3v2_tag :: 
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO (Ptr Gst.TagList.TagList)

-- | Creates a new tag list that contains the information parsed out of a
-- ID3 tag.
tagListFromId3v2Tag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@buffer@/: buffer to convert
    -> m Gst.TagList.TagList
    -- ^ __Returns:__ A new t'GI.Gst.Structs.TagList.TagList' with all tags that could be extracted from the
    --          given vorbiscomment buffer or NULL on error.
tagListFromId3v2Tag :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> m TagList
tagListFromId3v2Tag Buffer
buffer = IO TagList -> m TagList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TagList -> m TagList) -> IO TagList -> m TagList
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buffer
    Ptr TagList
result <- Ptr Buffer -> IO (Ptr TagList)
gst_tag_list_from_id3v2_tag Ptr Buffer
buffer'
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListFromId3v2Tag" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    TagList -> IO TagList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return TagList
result'


-- function tag_list_from_exif_buffer_with_tiff_header
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The exif buffer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_from_exif_buffer_with_tiff_header" gst_tag_list_from_exif_buffer_with_tiff_header :: 
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO (Ptr Gst.TagList.TagList)

-- | Parses the exif tags starting with a tiff header structure.
tagListFromExifBufferWithTiffHeader ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@buffer@/: The exif buffer
    -> m Gst.TagList.TagList
    -- ^ __Returns:__ The taglist
tagListFromExifBufferWithTiffHeader :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> m TagList
tagListFromExifBufferWithTiffHeader Buffer
buffer = IO TagList -> m TagList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TagList -> m TagList) -> IO TagList -> m TagList
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buffer
    Ptr TagList
result <- Ptr Buffer -> IO (Ptr TagList)
gst_tag_list_from_exif_buffer_with_tiff_header Ptr Buffer
buffer'
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListFromExifBufferWithTiffHeader" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    TagList -> IO TagList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return TagList
result'


-- function tag_list_from_exif_buffer
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The exif buffer" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "byte_order"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "byte order of the data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "base_offset"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Offset from the tiff header to this buffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "TagList" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_from_exif_buffer" gst_tag_list_from_exif_buffer :: 
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    Int32 ->                                -- byte_order : TBasicType TInt
    Word32 ->                               -- base_offset : TBasicType TUInt32
    IO (Ptr Gst.TagList.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
tagListFromExifBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@buffer@/: The exif buffer
    -> Int32
    -- ^ /@byteOrder@/: byte order of the data
    -> Word32
    -- ^ /@baseOffset@/: Offset from the tiff header to this buffer
    -> m Gst.TagList.TagList
    -- ^ __Returns:__ The parsed taglist
tagListFromExifBuffer :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> Int32 -> Word32 -> m TagList
tagListFromExifBuffer Buffer
buffer Int32
byteOrder Word32
baseOffset = IO TagList -> m TagList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TagList -> m TagList) -> IO TagList -> m TagList
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buffer
    Ptr TagList
result <- Ptr Buffer -> Int32 -> Word32 -> IO (Ptr TagList)
gst_tag_list_from_exif_buffer Ptr Buffer
buffer' Int32
byteOrder Word32
baseOffset
    Text -> Ptr TagList -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagListFromExifBuffer" Ptr TagList
result
    TagList
result' <- ((ManagedPtr TagList -> TagList) -> Ptr TagList -> IO TagList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TagList -> TagList
Gst.TagList.TagList) Ptr TagList
result
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    TagList -> IO TagList
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return TagList
result'


-- function tag_list_add_id3_image
-- Args: [ Arg
--           { argCName = "tag_list"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a tag list" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "image_data"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the (encoded) image"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "image_data_len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the length of the encoded image data at @image_data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id3_picture_type"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "picture type as per the ID3 (v2.4.0) specification for\n   the APIC frame (0 = unknown/other)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "image_data_len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the length of the encoded image data at @image_data"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_list_add_id3_image" gst_tag_list_add_id3_image :: 
    Ptr Gst.TagList.TagList ->              -- tag_list : TInterface (Name {namespace = "Gst", name = "TagList"})
    Ptr Word8 ->                            -- image_data : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- image_data_len : TBasicType TUInt
    Word32 ->                               -- id3_picture_type : TBasicType TUInt
    IO CInt

-- | Adds an image from an ID3 APIC frame (or similar, such as used in FLAC)
-- to the given tag list. Also see 'GI.GstTag.Functions.tagImageDataToImageSample' for
-- more information on image tags in GStreamer.
tagListAddId3Image ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@tagList@/: a tag list
    -> ByteString
    -- ^ /@imageData@/: the (encoded) image
    -> Word32
    -- ^ /@id3PictureType@/: picture type as per the ID3 (v2.4.0) specification for
    --    the APIC frame (0 = unknown\/other)
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the image was processed, otherwise 'P.False'
tagListAddId3Image :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> ByteString -> Word32 -> m Bool
tagListAddId3Image TagList
tagList ByteString
imageData Word32
id3PictureType = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let imageDataLen :: Word32
imageDataLen = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
imageData
    Ptr TagList
tagList' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
tagList
    Ptr Word8
imageData' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
imageData
    CInt
result <- Ptr TagList -> Ptr Word8 -> Word32 -> Word32 -> IO CInt
gst_tag_list_add_id3_image Ptr TagList
tagList' Ptr Word8
imageData' Word32
imageDataLen Word32
id3PictureType
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
tagList
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
imageData'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function tag_image_data_to_image_sample
-- Args: [ Arg
--           { argCName = "image_data"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the (encoded) image"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "image_data_len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the length of the encoded image data at @image_data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "image_type"
--           , argType =
--               TInterface Name { namespace = "GstTag" , name = "TagImageType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "type of the image, or #GST_TAG_IMAGE_TYPE_UNDEFINED. Pass\n    #GST_TAG_IMAGE_TYPE_NONE if no image type should be set at all (e.g.\n    for preview images)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "image_data_len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the length of the encoded image data at @image_data"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Sample" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_image_data_to_image_sample" gst_tag_image_data_to_image_sample :: 
    Ptr Word8 ->                            -- image_data : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- image_data_len : TBasicType TUInt
    CInt ->                                 -- image_type : TInterface (Name {namespace = "GstTag", name = "TagImageType"})
    IO (Ptr Gst.Sample.Sample)

-- | Helper function for tag-reading plugins to create a t'GI.Gst.Structs.Sample.Sample' suitable to
-- add to a t'GI.Gst.Structs.TagList.TagList' as an image tag (such as 'GI.Gst.Constants.TAG_IMAGE' or
-- 'GI.Gst.Constants.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 t'GI.Gst.Structs.Sample.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 t'GI.GstTag.Enums.TagImageType' to describe
-- the type of image (front cover, back cover etc.). 'GI.Gst.Constants.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).
tagImageDataToImageSample ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@imageData@/: the (encoded) image
    -> GstTag.Enums.TagImageType
    -- ^ /@imageType@/: 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)
    -> m Gst.Sample.Sample
    -- ^ __Returns:__ a newly-allocated image sample for use in tag lists, or NULL
tagImageDataToImageSample :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> TagImageType -> m Sample
tagImageDataToImageSample ByteString
imageData TagImageType
imageType = IO Sample -> m Sample
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sample -> m Sample) -> IO Sample -> m Sample
forall a b. (a -> b) -> a -> b
$ do
    let imageDataLen :: Word32
imageDataLen = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
imageData
    Ptr Word8
imageData' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
imageData
    let imageType' :: CInt
imageType' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (TagImageType -> Int) -> TagImageType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TagImageType -> Int
forall a. Enum a => a -> Int
fromEnum) TagImageType
imageType
    Ptr Sample
result <- Ptr Word8 -> Word32 -> CInt -> IO (Ptr Sample)
gst_tag_image_data_to_image_sample Ptr Word8
imageData' Word32
imageDataLen CInt
imageType'
    Text -> Ptr Sample -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagImageDataToImageSample" Ptr Sample
result
    Sample
result' <- ((ManagedPtr Sample -> Sample) -> Ptr Sample -> IO Sample
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Sample -> Sample
Gst.Sample.Sample) Ptr Sample
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
imageData'
    Sample -> IO Sample
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Sample
result'


-- function tag_id3_genre_get
-- Args: [ Arg
--           { argCName = "id"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "ID of genre to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_id3_genre_get" gst_tag_id3_genre_get :: 
    Word32 ->                               -- id : TBasicType TUInt
    IO CString

-- | Gets the ID3v1 genre name for a given ID.
tagId3GenreGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@id@/: ID of genre to query
    -> m T.Text
    -- ^ __Returns:__ the genre or NULL if no genre is associated with that ID.
tagId3GenreGet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m Text
tagId3GenreGet Word32
id = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- Word32 -> IO CString
gst_tag_id3_genre_get Word32
id
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagId3GenreGet" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_id3_genre_count
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_id3_genre_count" gst_tag_id3_genre_count :: 
    IO Word32

-- | Gets the number of ID3v1 genres that can be identified. Winamp genres are
-- included.
tagId3GenreCount ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    -- ^ __Returns:__ the number of ID3v1 genres that can be identified
tagId3GenreCount :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
tagId3GenreCount  = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- IO Word32
gst_tag_id3_genre_count
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function tag_get_licenses
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_licenses" gst_tag_get_licenses :: 
    IO (Ptr CString)

-- | 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).
tagGetLicenses ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ NULL-terminated array of license strings. Free
    --     with 'GI.GLib.Functions.strfreev' when no longer needed.
tagGetLicenses :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
tagGetLicenses  = IO [Text] -> m [Text]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
result <- IO (Ptr CString)
gst_tag_get_licenses
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLicenses" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function tag_get_license_version
-- Args: [ Arg
--           { argCName = "license_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a license reference string in form of a URI,\n    e.g. \"http://creativecommons.org/licenses/by-nc-nd/2.0/\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_license_version" gst_tag_get_license_version :: 
    CString ->                              -- license_ref : TBasicType TUTF8
    IO CString

-- | Get the version of a license.
tagGetLicenseVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@licenseRef@/: a license reference string in form of a URI,
    --     e.g. \"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/2.0\/\"
    -> m T.Text
    -- ^ __Returns:__ the version of the license, or NULL if the license is not known or
    --    has no version
tagGetLicenseVersion :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLicenseVersion Text
licenseRef = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
licenseRef' <- Text -> IO CString
textToCString Text
licenseRef
    CString
result <- CString -> IO CString
gst_tag_get_license_version CString
licenseRef'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLicenseVersion" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
licenseRef'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_license_title
-- Args: [ Arg
--           { argCName = "license_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a license reference string in form of a URI,\n    e.g. \"http://creativecommons.org/licenses/by-nc-nd/2.0/\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_license_title" gst_tag_get_license_title :: 
    CString ->                              -- license_ref : TBasicType TUTF8
    IO CString

-- | Get the title of a license, which is a short translated description
-- of the license\'s features (generally not very pretty though).
tagGetLicenseTitle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@licenseRef@/: a license reference string in form of a URI,
    --     e.g. \"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/2.0\/\"
    -> m T.Text
    -- ^ __Returns:__ the title of the license, or NULL if the license is unknown or
    --    no title is available.
tagGetLicenseTitle :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLicenseTitle Text
licenseRef = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
licenseRef' <- Text -> IO CString
textToCString Text
licenseRef
    CString
result <- CString -> IO CString
gst_tag_get_license_title CString
licenseRef'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLicenseTitle" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
licenseRef'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_license_nick
-- Args: [ Arg
--           { argCName = "license_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a license reference string in form of a URI,\n    e.g. \"http://creativecommons.org/licenses/by-nc-nd/2.0/\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_license_nick" gst_tag_get_license_nick :: 
    CString ->                              -- license_ref : TBasicType TUTF8
    IO CString

-- | Get the nick name of a license, which is a short (untranslated) string
-- such as e.g. \"CC BY-NC-ND 2.0 UK\".
tagGetLicenseNick ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@licenseRef@/: a license reference string in form of a URI,
    --     e.g. \"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/2.0\/\"
    -> m T.Text
    -- ^ __Returns:__ the nick name of the license, or NULL if the license is unknown
tagGetLicenseNick :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLicenseNick Text
licenseRef = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
licenseRef' <- Text -> IO CString
textToCString Text
licenseRef
    CString
result <- CString -> IO CString
gst_tag_get_license_nick CString
licenseRef'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLicenseNick" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
licenseRef'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_license_jurisdiction
-- Args: [ Arg
--           { argCName = "license_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a license reference string in form of a URI,\n    e.g. \"http://creativecommons.org/licenses/by-nc-nd/2.0/\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_license_jurisdiction" gst_tag_get_license_jurisdiction :: 
    CString ->                              -- license_ref : TBasicType TUTF8
    IO CString

-- | 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.
tagGetLicenseJurisdiction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@licenseRef@/: a license reference string in form of a URI,
    --     e.g. \"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/2.0\/\"
    -> m T.Text
    -- ^ __Returns:__ the jurisdiction code of the license, or NULL if the license is
    --    unknown or is not specific to a particular jurisdiction.
tagGetLicenseJurisdiction :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLicenseJurisdiction Text
licenseRef = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
licenseRef' <- Text -> IO CString
textToCString Text
licenseRef
    CString
result <- CString -> IO CString
gst_tag_get_license_jurisdiction CString
licenseRef'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLicenseJurisdiction" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
licenseRef'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_license_flags
-- Args: [ Arg
--           { argCName = "license_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a license reference string in form of a URI,\n    e.g. \"http://creativecommons.org/licenses/by-nc-nd/2.0/\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GstTag" , name = "TagLicenseFlags" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_license_flags" gst_tag_get_license_flags :: 
    CString ->                              -- license_ref : TBasicType TUTF8
    IO CUInt

-- | Get the flags of a license, which describe most of the features of
-- a license in their most general form.
tagGetLicenseFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@licenseRef@/: a license reference string in form of a URI,
    --     e.g. \"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/2.0\/\"
    -> m [GstTag.Flags.TagLicenseFlags]
    -- ^ __Returns:__ the flags of the license, or 0 if the license is unknown
tagGetLicenseFlags :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m [TagLicenseFlags]
tagGetLicenseFlags Text
licenseRef = IO [TagLicenseFlags] -> m [TagLicenseFlags]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [TagLicenseFlags] -> m [TagLicenseFlags])
-> IO [TagLicenseFlags] -> m [TagLicenseFlags]
forall a b. (a -> b) -> a -> b
$ do
    CString
licenseRef' <- Text -> IO CString
textToCString Text
licenseRef
    CUInt
result <- CString -> IO CUInt
gst_tag_get_license_flags CString
licenseRef'
    let result' :: [TagLicenseFlags]
result' = CUInt -> [TagLicenseFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
licenseRef'
    [TagLicenseFlags] -> IO [TagLicenseFlags]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [TagLicenseFlags]
result'


-- function tag_get_license_description
-- Args: [ Arg
--           { argCName = "license_ref"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a license reference string in form of a URI,\n    e.g. \"http://creativecommons.org/licenses/by-nc-nd/2.0/\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_license_description" gst_tag_get_license_description :: 
    CString ->                              -- license_ref : TBasicType TUTF8
    IO CString

-- | Get the description of a license, which is a translated description
-- of the license\'s main features.
tagGetLicenseDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@licenseRef@/: a license reference string in form of a URI,
    --     e.g. \"http:\/\/creativecommons.org\/licenses\/by-nc-nd\/2.0\/\"
    -> m T.Text
    -- ^ __Returns:__ the description of the license, or NULL if the license is unknown
    --    or a description is not available.
tagGetLicenseDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLicenseDescription Text
licenseRef = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
licenseRef' <- Text -> IO CString
textToCString Text
licenseRef
    CString
result <- CString -> IO CString
gst_tag_get_license_description CString
licenseRef'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLicenseDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
licenseRef'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_language_name
-- Args: [ Arg
--           { argCName = "language_code"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "two or three-letter ISO-639 language code"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_language_name" gst_tag_get_language_name :: 
    CString ->                              -- language_code : TBasicType TUTF8
    IO CString

-- | 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.
tagGetLanguageName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@languageCode@/: two or three-letter ISO-639 language code
    -> m T.Text
    -- ^ __Returns:__ language name in UTF-8 format, or NULL if /@languageCode@/ could
    --     not be mapped to a language name. The returned string must not be
    --     modified and does not need to freed; it will stay valid until the
    --     application is terminated.
tagGetLanguageName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLanguageName Text
languageCode = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
languageCode' <- Text -> IO CString
textToCString Text
languageCode
    CString
result <- CString -> IO CString
gst_tag_get_language_name CString
languageCode'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLanguageName" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
languageCode'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_language_codes
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_language_codes" gst_tag_get_language_codes :: 
    IO (Ptr CString)

-- | 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).
tagGetLanguageCodes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ NULL-terminated string array with two-letter
    --     language codes. Free with 'GI.GLib.Functions.strfreev' when no longer needed.
tagGetLanguageCodes :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
tagGetLanguageCodes  = IO [Text] -> m [Text]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
result <- IO (Ptr CString)
gst_tag_get_language_codes
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLanguageCodes" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function tag_get_language_code_iso_639_2T
-- Args: [ Arg
--           { argCName = "lang_code"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_language_code_iso_639_2T" gst_tag_get_language_code_iso_639_2T :: 
    CString ->                              -- lang_code : TBasicType TUTF8
    IO CString

-- | 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.
tagGetLanguageCodeIso6392T ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@langCode@/: ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")
    -> m T.Text
    -- ^ __Returns:__ three-letter ISO-639-2 language code string that maps to /@langCode@/,
    --     or NULL if no mapping is known. The returned string must not be
    --     modified or freed.
tagGetLanguageCodeIso6392T :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLanguageCodeIso6392T Text
langCode = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
langCode' <- Text -> IO CString
textToCString Text
langCode
    CString
result <- CString -> IO CString
gst_tag_get_language_code_iso_639_2T CString
langCode'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLanguageCodeIso6392T" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
langCode'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_language_code_iso_639_2B
-- Args: [ Arg
--           { argCName = "lang_code"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_language_code_iso_639_2B" gst_tag_get_language_code_iso_639_2B :: 
    CString ->                              -- lang_code : TBasicType TUTF8
    IO CString

-- | 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.
tagGetLanguageCodeIso6392B ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@langCode@/: ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")
    -> m T.Text
    -- ^ __Returns:__ three-letter ISO-639-2 language code string that maps to /@langCode@/,
    --     or NULL if no mapping is known. The returned string must not be
    --     modified or freed.
tagGetLanguageCodeIso6392B :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLanguageCodeIso6392B Text
langCode = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
langCode' <- Text -> IO CString
textToCString Text
langCode
    CString
result <- CString -> IO CString
gst_tag_get_language_code_iso_639_2B CString
langCode'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLanguageCodeIso6392B" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
langCode'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_language_code_iso_639_1
-- Args: [ Arg
--           { argCName = "lang_code"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_language_code_iso_639_1" gst_tag_get_language_code_iso_639_1 :: 
    CString ->                              -- lang_code : TBasicType TUTF8
    IO CString

-- | 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.
tagGetLanguageCodeIso6391 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@langCode@/: ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")
    -> m T.Text
    -- ^ __Returns:__ two-letter ISO-639-1 language code string that maps to /@langCode@/,
    --     or NULL if no mapping is known. The returned string must not be
    --     modified or freed.
tagGetLanguageCodeIso6391 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagGetLanguageCodeIso6391 Text
langCode = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
langCode' <- Text -> IO CString
textToCString Text
langCode
    CString
result <- CString -> IO CString
gst_tag_get_language_code_iso_639_1 CString
langCode'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagGetLanguageCodeIso6391" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
langCode'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_get_id3v2_tag_size
-- Args: [ Arg
--           { argCName = "buffer"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "buffer holding ID3v2 tag (or at least the start of one)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_id3v2_tag_size" gst_tag_get_id3v2_tag_size :: 
    Ptr Gst.Buffer.Buffer ->                -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO Word32

-- | Determines size of an ID3v2 tag on buffer containing at least ID3v2 header,
-- i.e. at least 'GI.GstTag.Constants.TAG_ID3V2_HEADER_SIZE' (10) bytes;
tagGetId3v2TagSize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@buffer@/: buffer holding ID3v2 tag (or at least the start of one)
    -> m Word32
    -- ^ __Returns:__ Size of tag, or 0 if header is invalid or too small.
tagGetId3v2TagSize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> m Word32
tagGetId3v2TagSize Buffer
buffer = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
buffer' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
buffer
    Word32
result <- Ptr Buffer -> IO Word32
gst_tag_get_id3v2_tag_size Ptr Buffer
buffer'
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
buffer
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function tag_from_vorbis_tag
-- Args: [ Arg
--           { argCName = "vorbis_tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "vorbiscomment tag to convert to GStreamer tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_from_vorbis_tag" gst_tag_from_vorbis_tag :: 
    CString ->                              -- vorbis_tag : TBasicType TUTF8
    IO CString

-- | Looks up the GStreamer tag for a vorbiscomment tag.
tagFromVorbisTag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@vorbisTag@/: vorbiscomment tag to convert to GStreamer tag
    -> m T.Text
    -- ^ __Returns:__ The corresponding GStreamer tag or NULL if none exists.
tagFromVorbisTag :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagFromVorbisTag Text
vorbisTag = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
vorbisTag' <- Text -> IO CString
textToCString Text
vorbisTag
    CString
result <- CString -> IO CString
gst_tag_from_vorbis_tag CString
vorbisTag'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagFromVorbisTag" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
vorbisTag'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_from_id3_user_tag
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the type of ID3v2 user tag (e.g. \"TXXX\" or \"UDIF\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "id3_user_tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "ID3v2 user tag to convert to GStreamer tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_from_id3_user_tag" gst_tag_from_id3_user_tag :: 
    CString ->                              -- type : TBasicType TUTF8
    CString ->                              -- id3_user_tag : TBasicType TUTF8
    IO CString

-- | Looks up the GStreamer tag for an ID3v2 user tag (e.g. description in
-- TXXX frame or owner in UFID frame).
tagFromId3UserTag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: the type of ID3v2 user tag (e.g. \"TXXX\" or \"UDIF\")
    -> T.Text
    -- ^ /@id3UserTag@/: ID3v2 user tag to convert to GStreamer tag
    -> m T.Text
    -- ^ __Returns:__ The corresponding GStreamer tag or NULL if none exists.
tagFromId3UserTag :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Text
tagFromId3UserTag Text
type_ Text
id3UserTag = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CString
id3UserTag' <- Text -> IO CString
textToCString Text
id3UserTag
    CString
result <- CString -> CString -> IO CString
gst_tag_from_id3_user_tag CString
type_' CString
id3UserTag'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagFromId3UserTag" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
id3UserTag'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_from_id3_tag
-- Args: [ Arg
--           { argCName = "id3_tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "ID3v2 tag to convert to GStreamer tag"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_from_id3_tag" gst_tag_from_id3_tag :: 
    CString ->                              -- id3_tag : TBasicType TUTF8
    IO CString

-- | Looks up the GStreamer tag for a ID3v2 tag.
tagFromId3Tag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@id3Tag@/: ID3v2 tag to convert to GStreamer tag
    -> m T.Text
    -- ^ __Returns:__ The corresponding GStreamer tag or NULL if none exists.
tagFromId3Tag :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
tagFromId3Tag Text
id3Tag = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
id3Tag' <- Text -> IO CString
textToCString Text
id3Tag
    CString
result <- CString -> IO CString
gst_tag_from_id3_tag CString
id3Tag'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagFromId3Tag" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
id3Tag'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_freeform_string_to_utf8
-- Args: [ Arg
--           { argCName = "data"
--           , argType = TCArray False (-1) 1 (TBasicType TInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "string data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of string data, or -1 if the string is NUL-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "env_vars"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n   a NULL-terminated string array of environment variable names, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "size"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "length of string data, or -1 if the string is NUL-terminated"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_freeform_string_to_utf8" gst_tag_freeform_string_to_utf8 :: 
    Ptr Int8 ->                             -- data : TCArray False (-1) 1 (TBasicType TInt8)
    Int32 ->                                -- size : TBasicType TInt
    Ptr CString ->                          -- env_vars : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO CString

-- | 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).
tagFreeformStringToUtf8 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Int8]
    -- ^ /@data@/: string data
    -> [T.Text]
    -- ^ /@envVars@/: 
    --    a NULL-terminated string array of environment variable names, or NULL
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated string in UTF-8 encoding, or NULL
tagFreeformStringToUtf8 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Int8] -> [Text] -> m Text
tagFreeformStringToUtf8 [Int8]
data_ [Text]
envVars = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    let size :: Int32
size = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Int8] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Int8]
data_
    Ptr Int8
data_' <- [Int8] -> IO (Ptr Int8)
forall a. Storable a => [a] -> IO (Ptr a)
packStorableArray [Int8]
data_
    Ptr CString
envVars' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
envVars
    CString
result <- Ptr Int8 -> Int32 -> Ptr CString -> IO CString
gst_tag_freeform_string_to_utf8 Ptr Int8
data_' Int32
size Ptr CString
envVars'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"tagFreeformStringToUtf8" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Ptr Int8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int8
data_'
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
envVars'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
envVars'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tag_check_language_code
-- Args: [ Arg
--           { argCName = "lang_code"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_check_language_code" gst_tag_check_language_code :: 
    CString ->                              -- lang_code : TBasicType TUTF8
    IO CInt

-- | 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 'GI.Gst.Constants.TAG_LANGUAGE_CODE'
-- tag) or a free-form language name descriptor (which should be put into a
-- 'GI.Gst.Constants.TAG_LANGUAGE_NAME' tag instead).
tagCheckLanguageCode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@langCode@/: ISO-639 language code (e.g. \"deu\" or \"ger\" or \"de\")
    -> m Bool
    -- ^ __Returns:__ TRUE if the two- or three-letter language code in /@langCode@/
    --     is a valid ISO-639 language code.
tagCheckLanguageCode :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
tagCheckLanguageCode Text
langCode = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
langCode' <- Text -> IO CString
textToCString Text
langCode
    CInt
result <- CString -> IO CInt
gst_tag_check_language_code CString
langCode'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
langCode'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'