{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

Collection of 'GI.GstPbutils.Objects.EncodingProfile.EncodingProfile' for a specific target or use-case.

When being stored\/loaded, targets come from a specific category, like
'GI.GstPbutils.Constants.ENCODING_CATEGORY_DEVICE'.
-}

module GI.GstPbutils.Objects.EncodingTarget
    ( 

-- * Exported types
    EncodingTarget(..)                      ,
    IsEncodingTarget                        ,
    toEncodingTarget                        ,
    noEncodingTarget                        ,


 -- * Methods
-- ** addProfile #method:addProfile#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetAddProfileMethodInfo      ,
#endif
    encodingTargetAddProfile                ,


-- ** getCategory #method:getCategory#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetGetCategoryMethodInfo     ,
#endif
    encodingTargetGetCategory               ,


-- ** getDescription #method:getDescription#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetGetDescriptionMethodInfo  ,
#endif
    encodingTargetGetDescription            ,


-- ** getName #method:getName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetGetNameMethodInfo         ,
#endif
    encodingTargetGetName                   ,


-- ** getProfile #method:getProfile#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetGetProfileMethodInfo      ,
#endif
    encodingTargetGetProfile                ,


-- ** getProfiles #method:getProfiles#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetGetProfilesMethodInfo     ,
#endif
    encodingTargetGetProfiles               ,


-- ** load #method:load#
    encodingTargetLoad                      ,


-- ** loadFromFile #method:loadFromFile#
    encodingTargetLoadFromFile              ,


-- ** new #method:new#
    encodingTargetNew                       ,


-- ** save #method:save#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetSaveMethodInfo            ,
#endif
    encodingTargetSave                      ,


-- ** saveToFile #method:saveToFile#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    EncodingTargetSaveToFileMethodInfo      ,
#endif
    encodingTargetSaveToFile                ,




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.GstPbutils.Objects.EncodingProfile as GstPbutils.EncodingProfile

newtype EncodingTarget = EncodingTarget (ManagedPtr EncodingTarget)
foreign import ccall "gst_encoding_target_get_type"
    c_gst_encoding_target_get_type :: IO GType

instance GObject EncodingTarget where
    gobjectType _ = c_gst_encoding_target_get_type
    

class GObject o => IsEncodingTarget o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError EncodingTarget a) =>
    IsEncodingTarget a
#endif
instance IsEncodingTarget EncodingTarget
instance GObject.Object.IsObject EncodingTarget

toEncodingTarget :: (MonadIO m, IsEncodingTarget o) => o -> m EncodingTarget
toEncodingTarget = liftIO . unsafeCastTo EncodingTarget

noEncodingTarget :: Maybe EncodingTarget
noEncodingTarget = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveEncodingTargetMethod (t :: Symbol) (o :: *) :: * where
    ResolveEncodingTargetMethod "addProfile" o = EncodingTargetAddProfileMethodInfo
    ResolveEncodingTargetMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveEncodingTargetMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveEncodingTargetMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveEncodingTargetMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveEncodingTargetMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveEncodingTargetMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveEncodingTargetMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveEncodingTargetMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveEncodingTargetMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveEncodingTargetMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveEncodingTargetMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveEncodingTargetMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveEncodingTargetMethod "save" o = EncodingTargetSaveMethodInfo
    ResolveEncodingTargetMethod "saveToFile" o = EncodingTargetSaveToFileMethodInfo
    ResolveEncodingTargetMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveEncodingTargetMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveEncodingTargetMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveEncodingTargetMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveEncodingTargetMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveEncodingTargetMethod "getCategory" o = EncodingTargetGetCategoryMethodInfo
    ResolveEncodingTargetMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveEncodingTargetMethod "getDescription" o = EncodingTargetGetDescriptionMethodInfo
    ResolveEncodingTargetMethod "getName" o = EncodingTargetGetNameMethodInfo
    ResolveEncodingTargetMethod "getProfile" o = EncodingTargetGetProfileMethodInfo
    ResolveEncodingTargetMethod "getProfiles" o = EncodingTargetGetProfilesMethodInfo
    ResolveEncodingTargetMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveEncodingTargetMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveEncodingTargetMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveEncodingTargetMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveEncodingTargetMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveEncodingTargetMethod t EncodingTarget, O.MethodInfo info EncodingTarget p) => O.IsLabelProxy t (EncodingTarget -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveEncodingTargetMethod t EncodingTarget, O.MethodInfo info EncodingTarget p) => O.IsLabel t (EncodingTarget -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList EncodingTarget
type instance O.AttributeList EncodingTarget = EncodingTargetAttributeList
type EncodingTargetAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type instance O.SignalList EncodingTarget = EncodingTargetSignalList
type EncodingTargetSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method EncodingTarget::new
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The name of the target.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The name of the category to which this @target\nbelongs. For example: #GST_ENCODING_CATEGORY_DEVICE.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A description of #GstEncodingTarget in the\ncurrent locale.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "profiles", argType = TGList (TInterface (Name {namespace = "GstPbutils", name = "EncodingProfile"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GList of\n#GstEncodingProfile.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_encoding_target_new" gst_encoding_target_new :: 
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- category : TBasicType TUTF8
    CString ->                              -- description : TBasicType TUTF8
    Ptr (GList (Ptr GstPbutils.EncodingProfile.EncodingProfile)) -> -- profiles : TGList (TInterface (Name {namespace = "GstPbutils", name = "EncodingProfile"}))
    IO (Ptr EncodingTarget)

{- |
Creates a new 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget'.

The name and category can only consist of lowercase ASCII letters for the
first character, followed by either lowercase ASCII letters, digits or
hyphens (\'-\').

The /@category@/ \<emphasis>should\<\/emphasis> be one of the existing
well-defined categories, like 'GI.GstPbutils.Constants.ENCODING_CATEGORY_DEVICE', but it
\<emphasis>can\<\/emphasis> be a application or user specific category if
needed.
-}
encodingTargetNew ::
    (B.CallStack.HasCallStack, MonadIO m, GstPbutils.EncodingProfile.IsEncodingProfile a) =>
    T.Text
    {- ^ /@name@/: The name of the target. -}
    -> T.Text
    {- ^ /@category@/: The name of the category to which this /@target@/
belongs. For example: 'GI.GstPbutils.Constants.ENCODING_CATEGORY_DEVICE'. -}
    -> T.Text
    {- ^ /@description@/: A description of 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' in the
current locale. -}
    -> [a]
    {- ^ /@profiles@/: A 'GI.GLib.Structs.List.List' of
'GI.GstPbutils.Objects.EncodingProfile.EncodingProfile'. -}
    -> m EncodingTarget
    {- ^ __Returns:__ The newly created 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' or 'Nothing' if
there was an error. -}
encodingTargetNew name category description profiles = liftIO $ do
    name' <- textToCString name
    category' <- textToCString category
    description' <- textToCString description
    profiles' <- mapM unsafeManagedPtrCastPtr profiles
    profiles'' <- packGList profiles'
    result <- gst_encoding_target_new name' category' description' profiles''
    checkUnexpectedReturnNULL "encodingTargetNew" result
    result' <- (wrapObject EncodingTarget) result
    mapM_ touchManagedPtr profiles
    freeMem name'
    freeMem category'
    freeMem description'
    g_list_free profiles''
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method EncodingTarget::add_profile
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEncodingTarget to add a profile to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "profile", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingProfile"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstEncodingProfile to add", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_encoding_target_add_profile" gst_encoding_target_add_profile :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    Ptr GstPbutils.EncodingProfile.EncodingProfile -> -- profile : TInterface (Name {namespace = "GstPbutils", name = "EncodingProfile"})
    IO CInt

{- |
Adds the given /@profile@/ to the /@target@/. Each added profile must have
a unique name within the profile.

The /@target@/ will steal a reference to the /@profile@/. If you wish to use
the profile after calling this method, you should increase its reference
count.
-}
encodingTargetAddProfile ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a, GstPbutils.EncodingProfile.IsEncodingProfile b) =>
    a
    {- ^ /@target@/: the 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' to add a profile to -}
    -> b
    {- ^ /@profile@/: the 'GI.GstPbutils.Objects.EncodingProfile.EncodingProfile' to add -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the profile was added, else 'False'. -}
encodingTargetAddProfile target profile = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    profile' <- B.ManagedPtr.disownObject profile
    result <- gst_encoding_target_add_profile target' profile'
    let result' = (/= 0) result
    touchManagedPtr target
    touchManagedPtr profile
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetAddProfileMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsEncodingTarget a, GstPbutils.EncodingProfile.IsEncodingProfile b) => O.MethodInfo EncodingTargetAddProfileMethodInfo a signature where
    overloadedMethod _ = encodingTargetAddProfile

#endif

-- method EncodingTarget::get_category
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", 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_encoding_target_get_category" gst_encoding_target_get_category :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    IO CString

{- |
/No description available in the introspection data./
-}
encodingTargetGetCategory ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> m T.Text
    {- ^ __Returns:__ The category of the /@target@/. For example:
'GI.GstPbutils.Constants.ENCODING_CATEGORY_DEVICE'. -}
encodingTargetGetCategory target = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    result <- gst_encoding_target_get_category target'
    checkUnexpectedReturnNULL "encodingTargetGetCategory" result
    result' <- cstringToText result
    touchManagedPtr target
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetGetCategoryMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetGetCategoryMethodInfo a signature where
    overloadedMethod _ = encodingTargetGetCategory

#endif

-- method EncodingTarget::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", 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_encoding_target_get_description" gst_encoding_target_get_description :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    IO CString

{- |
/No description available in the introspection data./
-}
encodingTargetGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> m T.Text
    {- ^ __Returns:__ The description of the /@target@/. -}
encodingTargetGetDescription target = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    result <- gst_encoding_target_get_description target'
    checkUnexpectedReturnNULL "encodingTargetGetDescription" result
    result' <- cstringToText result
    touchManagedPtr target
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetGetDescriptionMethodInfo a signature where
    overloadedMethod _ = encodingTargetGetDescription

#endif

-- method EncodingTarget::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", 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_encoding_target_get_name" gst_encoding_target_get_name :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    IO CString

{- |
/No description available in the introspection data./
-}
encodingTargetGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> m T.Text
    {- ^ __Returns:__ The name of the /@target@/. -}
encodingTargetGetName target = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    result <- gst_encoding_target_get_name target'
    checkUnexpectedReturnNULL "encodingTargetGetName" result
    result' <- cstringToText result
    touchManagedPtr target
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetGetNameMethodInfo a signature where
    overloadedMethod _ = encodingTargetGetName

#endif

-- method EncodingTarget::get_profile
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the profile to retrieve", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "EncodingProfile"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_encoding_target_get_profile" gst_encoding_target_get_profile :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr GstPbutils.EncodingProfile.EncodingProfile)

{- |
/No description available in the introspection data./
-}
encodingTargetGetProfile ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> T.Text
    {- ^ /@name@/: the name of the profile to retrieve -}
    -> m GstPbutils.EncodingProfile.EncodingProfile
    {- ^ __Returns:__ The matching 'GI.GstPbutils.Objects.EncodingProfile.EncodingProfile', or 'Nothing'. -}
encodingTargetGetProfile target name = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    name' <- textToCString name
    result <- gst_encoding_target_get_profile target' name'
    checkUnexpectedReturnNULL "encodingTargetGetProfile" result
    result' <- (wrapObject GstPbutils.EncodingProfile.EncodingProfile) result
    touchManagedPtr target
    freeMem name'
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetGetProfileMethodInfo
instance (signature ~ (T.Text -> m GstPbutils.EncodingProfile.EncodingProfile), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetGetProfileMethodInfo a signature where
    overloadedMethod _ = encodingTargetGetProfile

#endif

-- method EncodingTarget::get_profiles
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "GstPbutils", name = "EncodingProfile"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_encoding_target_get_profiles" gst_encoding_target_get_profiles :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    IO (Ptr (GList (Ptr GstPbutils.EncodingProfile.EncodingProfile)))

{- |
/No description available in the introspection data./
-}
encodingTargetGetProfiles ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> m [GstPbutils.EncodingProfile.EncodingProfile]
    {- ^ __Returns:__ A list of
'GI.GstPbutils.Objects.EncodingProfile.EncodingProfile'(s) this /@target@/ handles. -}
encodingTargetGetProfiles target = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    result <- gst_encoding_target_get_profiles target'
    result' <- unpackGList result
    result'' <- mapM (newObject GstPbutils.EncodingProfile.EncodingProfile) result'
    touchManagedPtr target
    return result''

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetGetProfilesMethodInfo
instance (signature ~ (m [GstPbutils.EncodingProfile.EncodingProfile]), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetGetProfilesMethodInfo a signature where
    overloadedMethod _ = encodingTargetGetProfiles

#endif

-- method EncodingTarget::save
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gst_encoding_target_save" gst_encoding_target_save :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Saves the /@target@/ to a default user-local directory.
-}
encodingTargetSave ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
encodingTargetSave target = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    onException (do
        _ <- propagateGError $ gst_encoding_target_save target'
        touchManagedPtr target
        return ()
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetSaveMethodInfo
instance (signature ~ (m ()), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetSaveMethodInfo a signature where
    overloadedMethod _ = encodingTargetSave

#endif

-- method EncodingTarget::save_to_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "target", argType = TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstEncodingTarget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filepath", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the location to store the @target at.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gst_encoding_target_save_to_file" gst_encoding_target_save_to_file :: 
    Ptr EncodingTarget ->                   -- target : TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"})
    CString ->                              -- filepath : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Saves the /@target@/ to the provided file location.
-}
encodingTargetSaveToFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsEncodingTarget a) =>
    a
    {- ^ /@target@/: a 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' -}
    -> T.Text
    {- ^ /@filepath@/: the location to store the /@target@/ at. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
encodingTargetSaveToFile target filepath = liftIO $ do
    target' <- unsafeManagedPtrCastPtr target
    filepath' <- textToCString filepath
    onException (do
        _ <- propagateGError $ gst_encoding_target_save_to_file target' filepath'
        touchManagedPtr target
        freeMem filepath'
        return ()
     ) (do
        freeMem filepath'
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data EncodingTargetSaveToFileMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsEncodingTarget a) => O.MethodInfo EncodingTargetSaveToFileMethodInfo a signature where
    overloadedMethod _ = encodingTargetSaveToFile

#endif

-- method EncodingTarget::load
-- method type : MemberFunction
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the #GstEncodingTarget to load (automatically\nconverted to lower case internally as capital letters are not\nvalid for target names).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the name of the target category, like\n#GST_ENCODING_CATEGORY_DEVICE. Can be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_encoding_target_load" gst_encoding_target_load :: 
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- category : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr EncodingTarget)

{- |
Searches for the 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' with the given name, loads it
and returns it.

If the category name is specified only targets from that category will be
searched for.
-}
encodingTargetLoad ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: the name of the 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' to load (automatically
converted to lower case internally as capital letters are not
valid for target names). -}
    -> Maybe (T.Text)
    {- ^ /@category@/: the name of the target category, like
'GI.GstPbutils.Constants.ENCODING_CATEGORY_DEVICE'. Can be 'Nothing' -}
    -> m EncodingTarget
    {- ^ __Returns:__ The 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' if available, else 'Nothing'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
encodingTargetLoad name category = liftIO $ do
    name' <- textToCString name
    maybeCategory <- case category of
        Nothing -> return nullPtr
        Just jCategory -> do
            jCategory' <- textToCString jCategory
            return jCategory'
    onException (do
        result <- propagateGError $ gst_encoding_target_load name' maybeCategory
        checkUnexpectedReturnNULL "encodingTargetLoad" result
        result' <- (wrapObject EncodingTarget) result
        freeMem name'
        freeMem maybeCategory
        return result'
     ) (do
        freeMem name'
        freeMem maybeCategory
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method EncodingTarget::load_from_file
-- method type : MemberFunction
-- Args : [Arg {argCName = "filepath", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The file location to load the #GstEncodingTarget from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "EncodingTarget"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_encoding_target_load_from_file" gst_encoding_target_load_from_file :: 
    CString ->                              -- filepath : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr EncodingTarget)

{- |
Opens the provided file and returns the contained 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget'.
-}
encodingTargetLoadFromFile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@filepath@/: The file location to load the 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' from -}
    -> m EncodingTarget
    {- ^ __Returns:__ The 'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' contained in the file, else
'Nothing' /(Can throw 'Data.GI.Base.GError.GError')/ -}
encodingTargetLoadFromFile filepath = liftIO $ do
    filepath' <- textToCString filepath
    onException (do
        result <- propagateGError $ gst_encoding_target_load_from_file filepath'
        checkUnexpectedReturnNULL "encodingTargetLoadFromFile" result
        result' <- (wrapObject EncodingTarget) result
        freeMem filepath'
        return result'
     ) (do
        freeMem filepath'
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif