gi-gstpbutils-1.0.17: GI/GstPbutils/Objects/Discoverer.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
The 'GI.GstPbutils.Objects.Discoverer.Discoverer' is a utility object which allows to get as much
information as possible from one or many URIs.
It provides two APIs, allowing usage in blocking or non-blocking mode.
The blocking mode just requires calling 'GI.GstPbutils.Objects.Discoverer.discovererDiscoverUri'
with the URI one wishes to discover.
The non-blocking mode requires a running 'GI.GLib.Structs.MainLoop.MainLoop' iterating a
'GI.GLib.Structs.MainContext.MainContext', where one connects to the various signals, appends the
URIs to be processed (through 'GI.GstPbutils.Objects.Discoverer.discovererDiscoverUriAsync') and then
asks for the discovery to begin (through 'GI.GstPbutils.Objects.Discoverer.discovererStart').
By default this will use the GLib default main context unless you have
set a custom context using 'GI.GLib.Structs.MainContext.mainContextPushThreadDefault'.
All the information is returned in a 'GI.GstPbutils.Objects.DiscovererInfo.DiscovererInfo' structure.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GstPbutils.Objects.Discoverer
(
-- * Exported types
Discoverer(..) ,
IsDiscoverer ,
toDiscoverer ,
noDiscoverer ,
-- * Methods
-- ** discoverUri #method:discoverUri#
#if ENABLE_OVERLOADING
DiscovererDiscoverUriMethodInfo ,
#endif
discovererDiscoverUri ,
-- ** discoverUriAsync #method:discoverUriAsync#
#if ENABLE_OVERLOADING
DiscovererDiscoverUriAsyncMethodInfo ,
#endif
discovererDiscoverUriAsync ,
-- ** new #method:new#
discovererNew ,
-- ** start #method:start#
#if ENABLE_OVERLOADING
DiscovererStartMethodInfo ,
#endif
discovererStart ,
-- ** stop #method:stop#
#if ENABLE_OVERLOADING
DiscovererStopMethodInfo ,
#endif
discovererStop ,
-- * Properties
-- ** timeout #attr:timeout#
{- | The duration (in nanoseconds) after which the discovery of an individual
URI will timeout.
If the discovery of a URI times out, the 'GI.GstPbutils.Enums.DiscovererResultTimeout' will be
set on the result flags.
-}
#if ENABLE_OVERLOADING
DiscovererTimeoutPropertyInfo ,
#endif
constructDiscovererTimeout ,
#if ENABLE_OVERLOADING
discovererTimeout ,
#endif
getDiscovererTimeout ,
setDiscovererTimeout ,
-- ** useCache #attr:useCache#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
DiscovererUseCachePropertyInfo ,
#endif
constructDiscovererUseCache ,
#if ENABLE_OVERLOADING
discovererUseCache ,
#endif
getDiscovererUseCache ,
setDiscovererUseCache ,
-- * Signals
-- ** discovered #signal:discovered#
C_DiscovererDiscoveredCallback ,
DiscovererDiscoveredCallback ,
#if ENABLE_OVERLOADING
DiscovererDiscoveredSignalInfo ,
#endif
afterDiscovererDiscovered ,
genClosure_DiscovererDiscovered ,
mk_DiscovererDiscoveredCallback ,
noDiscovererDiscoveredCallback ,
onDiscovererDiscovered ,
wrap_DiscovererDiscoveredCallback ,
-- ** finished #signal:finished#
C_DiscovererFinishedCallback ,
DiscovererFinishedCallback ,
#if ENABLE_OVERLOADING
DiscovererFinishedSignalInfo ,
#endif
afterDiscovererFinished ,
genClosure_DiscovererFinished ,
mk_DiscovererFinishedCallback ,
noDiscovererFinishedCallback ,
onDiscovererFinished ,
wrap_DiscovererFinishedCallback ,
-- ** sourceSetup #signal:sourceSetup#
C_DiscovererSourceSetupCallback ,
DiscovererSourceSetupCallback ,
#if ENABLE_OVERLOADING
DiscovererSourceSetupSignalInfo ,
#endif
afterDiscovererSourceSetup ,
genClosure_DiscovererSourceSetup ,
mk_DiscovererSourceSetupCallback ,
noDiscovererSourceSetupCallback ,
onDiscovererSourceSetup ,
wrap_DiscovererSourceSetupCallback ,
-- ** starting #signal:starting#
C_DiscovererStartingCallback ,
DiscovererStartingCallback ,
#if ENABLE_OVERLOADING
DiscovererStartingSignalInfo ,
#endif
afterDiscovererStarting ,
genClosure_DiscovererStarting ,
mk_DiscovererStartingCallback ,
noDiscovererStartingCallback ,
onDiscovererStarting ,
wrap_DiscovererStartingCallback ,
) 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 qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.GstPbutils.Objects.DiscovererInfo as GstPbutils.DiscovererInfo
-- | Memory-managed wrapper type.
newtype Discoverer = Discoverer (ManagedPtr Discoverer)
foreign import ccall "gst_discoverer_get_type"
c_gst_discoverer_get_type :: IO GType
instance GObject Discoverer where
gobjectType = c_gst_discoverer_get_type
-- | Type class for types which can be safely cast to `Discoverer`, for instance with `toDiscoverer`.
class (GObject o, O.IsDescendantOf Discoverer o) => IsDiscoverer o
instance (GObject o, O.IsDescendantOf Discoverer o) => IsDiscoverer o
instance O.HasParentTypes Discoverer
type instance O.ParentTypes Discoverer = '[GObject.Object.Object]
-- | Cast to `Discoverer`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDiscoverer :: (MonadIO m, IsDiscoverer o) => o -> m Discoverer
toDiscoverer = liftIO . unsafeCastTo Discoverer
-- | A convenience alias for `Nothing` :: `Maybe` `Discoverer`.
noDiscoverer :: Maybe Discoverer
noDiscoverer = Nothing
#if ENABLE_OVERLOADING
type family ResolveDiscovererMethod (t :: Symbol) (o :: *) :: * where
ResolveDiscovererMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDiscovererMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDiscovererMethod "discoverUri" o = DiscovererDiscoverUriMethodInfo
ResolveDiscovererMethod "discoverUriAsync" o = DiscovererDiscoverUriAsyncMethodInfo
ResolveDiscovererMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDiscovererMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDiscovererMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDiscovererMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDiscovererMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDiscovererMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDiscovererMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDiscovererMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDiscovererMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDiscovererMethod "start" o = DiscovererStartMethodInfo
ResolveDiscovererMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDiscovererMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDiscovererMethod "stop" o = DiscovererStopMethodInfo
ResolveDiscovererMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDiscovererMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDiscovererMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDiscovererMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDiscovererMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDiscovererMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDiscovererMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDiscovererMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDiscovererMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDiscovererMethod t Discoverer, O.MethodInfo info Discoverer p) => OL.IsLabel t (Discoverer -> 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
-- signal Discoverer::discovered
{- |
Will be emitted in async mode when all information on a URI could be
discovered, or an error occurred.
When an error occurs, /@info@/ might still contain some partial information,
depending on the circumstances of the error.
-}
type DiscovererDiscoveredCallback =
GstPbutils.DiscovererInfo.DiscovererInfo
{- ^ /@info@/: the results 'GI.GstPbutils.Objects.DiscovererInfo.DiscovererInfo' -}
-> Maybe GError
{- ^ /@error@/: 'GError', which will be non-NULL
if an error occurred during
discovery. You must not free
this 'GError', it will be freed by
the discoverer. -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `DiscovererDiscoveredCallback`@.
noDiscovererDiscoveredCallback :: Maybe DiscovererDiscoveredCallback
noDiscovererDiscoveredCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_DiscovererDiscoveredCallback =
Ptr () -> -- object
Ptr GstPbutils.DiscovererInfo.DiscovererInfo ->
Ptr GError ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_DiscovererDiscoveredCallback`.
foreign import ccall "wrapper"
mk_DiscovererDiscoveredCallback :: C_DiscovererDiscoveredCallback -> IO (FunPtr C_DiscovererDiscoveredCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_DiscovererDiscovered :: MonadIO m => DiscovererDiscoveredCallback -> m (GClosure C_DiscovererDiscoveredCallback)
genClosure_DiscovererDiscovered cb = liftIO $ do
let cb' = wrap_DiscovererDiscoveredCallback cb
mk_DiscovererDiscoveredCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `DiscovererDiscoveredCallback` into a `C_DiscovererDiscoveredCallback`.
wrap_DiscovererDiscoveredCallback ::
DiscovererDiscoveredCallback ->
C_DiscovererDiscoveredCallback
wrap_DiscovererDiscoveredCallback _cb _ info error_ _ = do
info' <- (newObject GstPbutils.DiscovererInfo.DiscovererInfo) info
maybeError_ <-
if error_ == nullPtr
then return Nothing
else do
error_' <- (newBoxed GError) error_
return $ Just error_'
_cb info' maybeError_
{- |
Connect a signal handler for the “@discovered@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' discoverer #discovered callback
@
-}
onDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> DiscovererDiscoveredCallback -> m SignalHandlerId
onDiscovererDiscovered obj cb = liftIO $ do
let cb' = wrap_DiscovererDiscoveredCallback cb
cb'' <- mk_DiscovererDiscoveredCallback cb'
connectSignalFunPtr obj "discovered" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@discovered@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' discoverer #discovered callback
@
-}
afterDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> DiscovererDiscoveredCallback -> m SignalHandlerId
afterDiscovererDiscovered obj cb = liftIO $ do
let cb' = wrap_DiscovererDiscoveredCallback cb
cb'' <- mk_DiscovererDiscoveredCallback cb'
connectSignalFunPtr obj "discovered" cb'' SignalConnectAfter
-- signal Discoverer::finished
{- |
Will be emitted in async mode when all pending URIs have been processed.
-}
type DiscovererFinishedCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `DiscovererFinishedCallback`@.
noDiscovererFinishedCallback :: Maybe DiscovererFinishedCallback
noDiscovererFinishedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_DiscovererFinishedCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_DiscovererFinishedCallback`.
foreign import ccall "wrapper"
mk_DiscovererFinishedCallback :: C_DiscovererFinishedCallback -> IO (FunPtr C_DiscovererFinishedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_DiscovererFinished :: MonadIO m => DiscovererFinishedCallback -> m (GClosure C_DiscovererFinishedCallback)
genClosure_DiscovererFinished cb = liftIO $ do
let cb' = wrap_DiscovererFinishedCallback cb
mk_DiscovererFinishedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `DiscovererFinishedCallback` into a `C_DiscovererFinishedCallback`.
wrap_DiscovererFinishedCallback ::
DiscovererFinishedCallback ->
C_DiscovererFinishedCallback
wrap_DiscovererFinishedCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@finished@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' discoverer #finished callback
@
-}
onDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> DiscovererFinishedCallback -> m SignalHandlerId
onDiscovererFinished obj cb = liftIO $ do
let cb' = wrap_DiscovererFinishedCallback cb
cb'' <- mk_DiscovererFinishedCallback cb'
connectSignalFunPtr obj "finished" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@finished@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' discoverer #finished callback
@
-}
afterDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> DiscovererFinishedCallback -> m SignalHandlerId
afterDiscovererFinished obj cb = liftIO $ do
let cb' = wrap_DiscovererFinishedCallback cb
cb'' <- mk_DiscovererFinishedCallback cb'
connectSignalFunPtr obj "finished" cb'' SignalConnectAfter
-- signal Discoverer::source-setup
{- |
This signal is emitted after the source element has been created for, so
the URI being discovered, so it can be configured by setting additional
properties (e.g. set a proxy server for an http source, or set the device
and read speed for an audio cd source).
This signal is usually emitted from the context of a GStreamer streaming
thread.
-}
type DiscovererSourceSetupCallback =
Gst.Element.Element
{- ^ /@source@/: source element -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `DiscovererSourceSetupCallback`@.
noDiscovererSourceSetupCallback :: Maybe DiscovererSourceSetupCallback
noDiscovererSourceSetupCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_DiscovererSourceSetupCallback =
Ptr () -> -- object
Ptr Gst.Element.Element ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_DiscovererSourceSetupCallback`.
foreign import ccall "wrapper"
mk_DiscovererSourceSetupCallback :: C_DiscovererSourceSetupCallback -> IO (FunPtr C_DiscovererSourceSetupCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_DiscovererSourceSetup :: MonadIO m => DiscovererSourceSetupCallback -> m (GClosure C_DiscovererSourceSetupCallback)
genClosure_DiscovererSourceSetup cb = liftIO $ do
let cb' = wrap_DiscovererSourceSetupCallback cb
mk_DiscovererSourceSetupCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `DiscovererSourceSetupCallback` into a `C_DiscovererSourceSetupCallback`.
wrap_DiscovererSourceSetupCallback ::
DiscovererSourceSetupCallback ->
C_DiscovererSourceSetupCallback
wrap_DiscovererSourceSetupCallback _cb _ source _ = do
source' <- (newObject Gst.Element.Element) source
_cb source'
{- |
Connect a signal handler for the “@source-setup@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' discoverer #sourceSetup callback
@
-}
onDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> DiscovererSourceSetupCallback -> m SignalHandlerId
onDiscovererSourceSetup obj cb = liftIO $ do
let cb' = wrap_DiscovererSourceSetupCallback cb
cb'' <- mk_DiscovererSourceSetupCallback cb'
connectSignalFunPtr obj "source-setup" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@source-setup@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' discoverer #sourceSetup callback
@
-}
afterDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> DiscovererSourceSetupCallback -> m SignalHandlerId
afterDiscovererSourceSetup obj cb = liftIO $ do
let cb' = wrap_DiscovererSourceSetupCallback cb
cb'' <- mk_DiscovererSourceSetupCallback cb'
connectSignalFunPtr obj "source-setup" cb'' SignalConnectAfter
-- signal Discoverer::starting
{- |
Will be emitted when the discover starts analyzing the pending URIs
-}
type DiscovererStartingCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `DiscovererStartingCallback`@.
noDiscovererStartingCallback :: Maybe DiscovererStartingCallback
noDiscovererStartingCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_DiscovererStartingCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_DiscovererStartingCallback`.
foreign import ccall "wrapper"
mk_DiscovererStartingCallback :: C_DiscovererStartingCallback -> IO (FunPtr C_DiscovererStartingCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_DiscovererStarting :: MonadIO m => DiscovererStartingCallback -> m (GClosure C_DiscovererStartingCallback)
genClosure_DiscovererStarting cb = liftIO $ do
let cb' = wrap_DiscovererStartingCallback cb
mk_DiscovererStartingCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `DiscovererStartingCallback` into a `C_DiscovererStartingCallback`.
wrap_DiscovererStartingCallback ::
DiscovererStartingCallback ->
C_DiscovererStartingCallback
wrap_DiscovererStartingCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@starting@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' discoverer #starting callback
@
-}
onDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> DiscovererStartingCallback -> m SignalHandlerId
onDiscovererStarting obj cb = liftIO $ do
let cb' = wrap_DiscovererStartingCallback cb
cb'' <- mk_DiscovererStartingCallback cb'
connectSignalFunPtr obj "starting" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@starting@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' discoverer #starting callback
@
-}
afterDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> DiscovererStartingCallback -> m SignalHandlerId
afterDiscovererStarting obj cb = liftIO $ do
let cb' = wrap_DiscovererStartingCallback cb
cb'' <- mk_DiscovererStartingCallback cb'
connectSignalFunPtr obj "starting" cb'' SignalConnectAfter
-- VVV Prop "timeout"
-- Type: TBasicType TUInt64
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' discoverer #timeout
@
-}
getDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> m Word64
getDiscovererTimeout obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "timeout"
{- |
Set the value of the “@timeout@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' discoverer [ #timeout 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> Word64 -> m ()
setDiscovererTimeout obj val = liftIO $ B.Properties.setObjectPropertyUInt64 obj "timeout" val
{- |
Construct a `GValueConstruct` with valid value for the “@timeout@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDiscovererTimeout :: (IsDiscoverer o) => Word64 -> IO (GValueConstruct o)
constructDiscovererTimeout val = B.Properties.constructObjectPropertyUInt64 "timeout" val
#if ENABLE_OVERLOADING
data DiscovererTimeoutPropertyInfo
instance AttrInfo DiscovererTimeoutPropertyInfo where
type AttrAllowedOps DiscovererTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint DiscovererTimeoutPropertyInfo = (~) Word64
type AttrBaseTypeConstraint DiscovererTimeoutPropertyInfo = IsDiscoverer
type AttrGetType DiscovererTimeoutPropertyInfo = Word64
type AttrLabel DiscovererTimeoutPropertyInfo = "timeout"
type AttrOrigin DiscovererTimeoutPropertyInfo = Discoverer
attrGet _ = getDiscovererTimeout
attrSet _ = setDiscovererTimeout
attrConstruct _ = constructDiscovererTimeout
attrClear _ = undefined
#endif
-- VVV Prop "use-cache"
-- Type: TBasicType TBoolean
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@use-cache@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' discoverer #useCache
@
-}
getDiscovererUseCache :: (MonadIO m, IsDiscoverer o) => o -> m Bool
getDiscovererUseCache obj = liftIO $ B.Properties.getObjectPropertyBool obj "use-cache"
{- |
Set the value of the “@use-cache@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' discoverer [ #useCache 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDiscovererUseCache :: (MonadIO m, IsDiscoverer o) => o -> Bool -> m ()
setDiscovererUseCache obj val = liftIO $ B.Properties.setObjectPropertyBool obj "use-cache" val
{- |
Construct a `GValueConstruct` with valid value for the “@use-cache@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDiscovererUseCache :: (IsDiscoverer o) => Bool -> IO (GValueConstruct o)
constructDiscovererUseCache val = B.Properties.constructObjectPropertyBool "use-cache" val
#if ENABLE_OVERLOADING
data DiscovererUseCachePropertyInfo
instance AttrInfo DiscovererUseCachePropertyInfo where
type AttrAllowedOps DiscovererUseCachePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint DiscovererUseCachePropertyInfo = (~) Bool
type AttrBaseTypeConstraint DiscovererUseCachePropertyInfo = IsDiscoverer
type AttrGetType DiscovererUseCachePropertyInfo = Bool
type AttrLabel DiscovererUseCachePropertyInfo = "use-cache"
type AttrOrigin DiscovererUseCachePropertyInfo = Discoverer
attrGet _ = getDiscovererUseCache
attrSet _ = setDiscovererUseCache
attrConstruct _ = constructDiscovererUseCache
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Discoverer
type instance O.AttributeList Discoverer = DiscovererAttributeList
type DiscovererAttributeList = ('[ '("timeout", DiscovererTimeoutPropertyInfo), '("useCache", DiscovererUseCachePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
discovererTimeout :: AttrLabelProxy "timeout"
discovererTimeout = AttrLabelProxy
discovererUseCache :: AttrLabelProxy "useCache"
discovererUseCache = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
data DiscovererDiscoveredSignalInfo
instance SignalInfo DiscovererDiscoveredSignalInfo where
type HaskellCallbackType DiscovererDiscoveredSignalInfo = DiscovererDiscoveredCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_DiscovererDiscoveredCallback cb
cb'' <- mk_DiscovererDiscoveredCallback cb'
connectSignalFunPtr obj "discovered" cb'' connectMode
data DiscovererFinishedSignalInfo
instance SignalInfo DiscovererFinishedSignalInfo where
type HaskellCallbackType DiscovererFinishedSignalInfo = DiscovererFinishedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_DiscovererFinishedCallback cb
cb'' <- mk_DiscovererFinishedCallback cb'
connectSignalFunPtr obj "finished" cb'' connectMode
data DiscovererSourceSetupSignalInfo
instance SignalInfo DiscovererSourceSetupSignalInfo where
type HaskellCallbackType DiscovererSourceSetupSignalInfo = DiscovererSourceSetupCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_DiscovererSourceSetupCallback cb
cb'' <- mk_DiscovererSourceSetupCallback cb'
connectSignalFunPtr obj "source-setup" cb'' connectMode
data DiscovererStartingSignalInfo
instance SignalInfo DiscovererStartingSignalInfo where
type HaskellCallbackType DiscovererStartingSignalInfo = DiscovererStartingCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_DiscovererStartingCallback cb
cb'' <- mk_DiscovererStartingCallback cb'
connectSignalFunPtr obj "starting" cb'' connectMode
type instance O.SignalList Discoverer = DiscovererSignalList
type DiscovererSignalList = ('[ '("discovered", DiscovererDiscoveredSignalInfo), '("finished", DiscovererFinishedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("sourceSetup", DiscovererSourceSetupSignalInfo), '("starting", DiscovererStartingSignalInfo)] :: [(Symbol, *)])
#endif
-- method Discoverer::new
-- method type : Constructor
-- Args : [Arg {argCName = "timeout", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timeout per file, in nanoseconds. Allowed are values between\n one second (#GST_SECOND) and one hour (3600 * #GST_SECOND)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "Discoverer"}))
-- throws : True
-- Skip return : False
foreign import ccall "gst_discoverer_new" gst_discoverer_new ::
Word64 -> -- timeout : TBasicType TUInt64
Ptr (Ptr GError) -> -- error
IO (Ptr Discoverer)
{- |
Creates a new 'GI.GstPbutils.Objects.Discoverer.Discoverer' with the provided timeout.
-}
discovererNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word64
{- ^ /@timeout@/: timeout per file, in nanoseconds. Allowed are values between
one second ('GI.Gst.Constants.SECOND') and one hour (3600 * 'GI.Gst.Constants.SECOND') -}
-> m Discoverer
{- ^ __Returns:__ The new 'GI.GstPbutils.Objects.Discoverer.Discoverer'.
If an error occurred when creating the discoverer, /@err@/ will be set
accordingly and 'Nothing' will be returned. If /@err@/ is set, the caller must
free it when no longer needed using 'GI.GLib.Structs.Error.errorFree'. /(Can throw 'Data.GI.Base.GError.GError')/ -}
discovererNew timeout = liftIO $ do
onException (do
result <- propagateGError $ gst_discoverer_new timeout
checkUnexpectedReturnNULL "discovererNew" result
result' <- (wrapObject Discoverer) result
return result'
) (do
return ()
)
#if ENABLE_OVERLOADING
#endif
-- method Discoverer::discover_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "discoverer", argType = TInterface (Name {namespace = "GstPbutils", name = "Discoverer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDiscoverer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The URI to run on.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstPbutils", name = "DiscovererInfo"}))
-- throws : True
-- Skip return : False
foreign import ccall "gst_discoverer_discover_uri" gst_discoverer_discover_uri ::
Ptr Discoverer -> -- discoverer : TInterface (Name {namespace = "GstPbutils", name = "Discoverer"})
CString -> -- uri : TBasicType TUTF8
Ptr (Ptr GError) -> -- error
IO (Ptr GstPbutils.DiscovererInfo.DiscovererInfo)
{- |
Synchronously discovers the given /@uri@/.
A copy of /@uri@/ will be made internally, so the caller can safely 'GI.GLib.Functions.free'
afterwards.
-}
discovererDiscoverUri ::
(B.CallStack.HasCallStack, MonadIO m, IsDiscoverer a) =>
a
{- ^ /@discoverer@/: A 'GI.GstPbutils.Objects.Discoverer.Discoverer' -}
-> T.Text
{- ^ /@uri@/: The URI to run on. -}
-> m GstPbutils.DiscovererInfo.DiscovererInfo
{- ^ __Returns:__ the result of the scanning. Can be 'Nothing' if an
error occurred. /(Can throw 'Data.GI.Base.GError.GError')/ -}
discovererDiscoverUri discoverer uri = liftIO $ do
discoverer' <- unsafeManagedPtrCastPtr discoverer
uri' <- textToCString uri
onException (do
result <- propagateGError $ gst_discoverer_discover_uri discoverer' uri'
checkUnexpectedReturnNULL "discovererDiscoverUri" result
result' <- (wrapObject GstPbutils.DiscovererInfo.DiscovererInfo) result
touchManagedPtr discoverer
freeMem uri'
return result'
) (do
freeMem uri'
)
#if ENABLE_OVERLOADING
data DiscovererDiscoverUriMethodInfo
instance (signature ~ (T.Text -> m GstPbutils.DiscovererInfo.DiscovererInfo), MonadIO m, IsDiscoverer a) => O.MethodInfo DiscovererDiscoverUriMethodInfo a signature where
overloadedMethod _ = discovererDiscoverUri
#endif
-- method Discoverer::discover_uri_async
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "discoverer", argType = TInterface (Name {namespace = "GstPbutils", name = "Discoverer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDiscoverer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI to add.", 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_discoverer_discover_uri_async" gst_discoverer_discover_uri_async ::
Ptr Discoverer -> -- discoverer : TInterface (Name {namespace = "GstPbutils", name = "Discoverer"})
CString -> -- uri : TBasicType TUTF8
IO CInt
{- |
Appends the given /@uri@/ to the list of URIs to discoverer. The actual
discovery of the /@uri@/ will only take place if 'GI.GstPbutils.Objects.Discoverer.discovererStart' has
been called.
A copy of /@uri@/ will be made internally, so the caller can safely 'GI.GLib.Functions.free'
afterwards.
-}
discovererDiscoverUriAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsDiscoverer a) =>
a
{- ^ /@discoverer@/: A 'GI.GstPbutils.Objects.Discoverer.Discoverer' -}
-> T.Text
{- ^ /@uri@/: the URI to add. -}
-> m Bool
{- ^ __Returns:__ 'True' if the /@uri@/ was successfully appended to the list of pending
uris, else 'False' -}
discovererDiscoverUriAsync discoverer uri = liftIO $ do
discoverer' <- unsafeManagedPtrCastPtr discoverer
uri' <- textToCString uri
result <- gst_discoverer_discover_uri_async discoverer' uri'
let result' = (/= 0) result
touchManagedPtr discoverer
freeMem uri'
return result'
#if ENABLE_OVERLOADING
data DiscovererDiscoverUriAsyncMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m, IsDiscoverer a) => O.MethodInfo DiscovererDiscoverUriAsyncMethodInfo a signature where
overloadedMethod _ = discovererDiscoverUriAsync
#endif
-- method Discoverer::start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "discoverer", argType = TInterface (Name {namespace = "GstPbutils", name = "Discoverer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDiscoverer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_discoverer_start" gst_discoverer_start ::
Ptr Discoverer -> -- discoverer : TInterface (Name {namespace = "GstPbutils", name = "Discoverer"})
IO ()
{- |
Allow asynchronous discovering of URIs to take place.
A 'GI.GLib.Structs.MainLoop.MainLoop' must be available for 'GI.GstPbutils.Objects.Discoverer.Discoverer' to properly work in
asynchronous mode.
-}
discovererStart ::
(B.CallStack.HasCallStack, MonadIO m, IsDiscoverer a) =>
a
{- ^ /@discoverer@/: A 'GI.GstPbutils.Objects.Discoverer.Discoverer' -}
-> m ()
discovererStart discoverer = liftIO $ do
discoverer' <- unsafeManagedPtrCastPtr discoverer
gst_discoverer_start discoverer'
touchManagedPtr discoverer
return ()
#if ENABLE_OVERLOADING
data DiscovererStartMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDiscoverer a) => O.MethodInfo DiscovererStartMethodInfo a signature where
overloadedMethod _ = discovererStart
#endif
-- method Discoverer::stop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "discoverer", argType = TInterface (Name {namespace = "GstPbutils", name = "Discoverer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstDiscoverer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_discoverer_stop" gst_discoverer_stop ::
Ptr Discoverer -> -- discoverer : TInterface (Name {namespace = "GstPbutils", name = "Discoverer"})
IO ()
{- |
Stop the discovery of any pending URIs and clears the list of
pending URIS (if any).
-}
discovererStop ::
(B.CallStack.HasCallStack, MonadIO m, IsDiscoverer a) =>
a
{- ^ /@discoverer@/: A 'GI.GstPbutils.Objects.Discoverer.Discoverer' -}
-> m ()
discovererStop discoverer = liftIO $ do
discoverer' <- unsafeManagedPtrCastPtr discoverer
gst_discoverer_stop discoverer'
touchManagedPtr discoverer
return ()
#if ENABLE_OVERLOADING
data DiscovererStopMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDiscoverer a) => O.MethodInfo DiscovererStopMethodInfo a signature where
overloadedMethod _ = discovererStop
#endif