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

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'.
-}

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

module GI.GstPbutils.Objects.EncodingTarget
    (

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


 -- * Methods
-- ** addProfile #method:addProfile#

#if ENABLE_OVERLOADING
    EncodingTargetAddProfileMethodInfo      ,
#endif
    encodingTargetAddProfile                ,


-- ** getCategory #method:getCategory#

#if ENABLE_OVERLOADING
    EncodingTargetGetCategoryMethodInfo     ,
#endif
    encodingTargetGetCategory               ,


-- ** getDescription #method:getDescription#

#if ENABLE_OVERLOADING
    EncodingTargetGetDescriptionMethodInfo  ,
#endif
    encodingTargetGetDescription            ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    EncodingTargetGetNameMethodInfo         ,
#endif
    encodingTargetGetName                   ,


-- ** getProfile #method:getProfile#

#if ENABLE_OVERLOADING
    EncodingTargetGetProfileMethodInfo      ,
#endif
    encodingTargetGetProfile                ,


-- ** getProfiles #method:getProfiles#

#if ENABLE_OVERLOADING
    EncodingTargetGetProfilesMethodInfo     ,
#endif
    encodingTargetGetProfiles               ,


-- ** load #method:load#

    encodingTargetLoad                      ,


-- ** loadFromFile #method:loadFromFile#

    encodingTargetLoadFromFile              ,


-- ** new #method:new#

    encodingTargetNew                       ,


-- ** save #method:save#

#if ENABLE_OVERLOADING
    EncodingTargetSaveMethodInfo            ,
#endif
    encodingTargetSave                      ,


-- ** saveToFile #method:saveToFile#

#if ENABLE_OVERLOADING
    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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.GstPbutils.Objects.EncodingProfile as GstPbutils.EncodingProfile

-- | Memory-managed wrapper type.
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


-- | Type class for types which can be safely cast to `EncodingTarget`, for instance with `toEncodingTarget`.
class (GObject o, O.IsDescendantOf EncodingTarget o) => IsEncodingTarget o
instance (GObject o, O.IsDescendantOf EncodingTarget o) => IsEncodingTarget o

instance O.HasParentTypes EncodingTarget
type instance O.ParentTypes EncodingTarget = '[GObject.Object.Object]

-- | Cast to `EncodingTarget`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toEncodingTarget :: (MonadIO m, IsEncodingTarget o) => o -> m EncodingTarget
toEncodingTarget = liftIO . unsafeCastTo EncodingTarget

-- | A convenience alias for `Nothing` :: `Maybe` `EncodingTarget`.
noEncodingTarget :: Maybe EncodingTarget
noEncodingTarget = Nothing

#if ENABLE_OVERLOADING
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 "getv" o = GObject.Object.ObjectGetvMethodInfo
    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 "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) => OL.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

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

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
#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 ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
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 ENABLE_OVERLOADING
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 TFileName, 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 TFileName
    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' -}
    -> [Char]
    {- ^ /@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' <- stringToCString filepath
    onException (do
        _ <- propagateGError $ gst_encoding_target_save_to_file target' filepath'
        touchManagedPtr target
        freeMem filepath'
        return ()
     ) (do
        freeMem filepath'
     )

#if ENABLE_OVERLOADING
data EncodingTargetSaveToFileMethodInfo
instance (signature ~ ([Char] -> 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 ENABLE_OVERLOADING
#endif

-- method EncodingTarget::load_from_file
-- method type : MemberFunction
-- Args : [Arg {argCName = "filepath", argType = TBasicType TFileName, 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 TFileName
    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) =>
    [Char]
    {- ^ /@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' <- stringToCString 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 ENABLE_OVERLOADING
#endif