Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The 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 discovererDiscoverUri
with the URI one wishes to discover.
The non-blocking mode requires a running MainLoop
iterating a
MainContext
, where one connects to the various signals, appends the
URIs to be processed (through discovererDiscoverUriAsync
) and then
asks for the discovery to begin (through discovererStart
).
By default this will use the GLib default main context unless you have
set a custom context using mainContextPushThreadDefault
.
All the information is returned in a DiscovererInfo
structure.
Synopsis
- newtype Discoverer = Discoverer (ManagedPtr Discoverer)
- class (GObject o, IsDescendantOf Discoverer o) => IsDiscoverer o
- toDiscoverer :: (MonadIO m, IsDiscoverer o) => o -> m Discoverer
- discovererDiscoverUri :: (HasCallStack, MonadIO m, IsDiscoverer a) => a -> Text -> m DiscovererInfo
- discovererDiscoverUriAsync :: (HasCallStack, MonadIO m, IsDiscoverer a) => a -> Text -> m Bool
- discovererNew :: (HasCallStack, MonadIO m) => Word64 -> m Discoverer
- discovererStart :: (HasCallStack, MonadIO m, IsDiscoverer a) => a -> m ()
- discovererStop :: (HasCallStack, MonadIO m, IsDiscoverer a) => a -> m ()
- constructDiscovererTimeout :: (IsDiscoverer o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> m Word64
- setDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> Word64 -> m ()
- constructDiscovererUseCache :: (IsDiscoverer o, MonadIO m) => Bool -> m (GValueConstruct o)
- getDiscovererUseCache :: (MonadIO m, IsDiscoverer o) => o -> m Bool
- setDiscovererUseCache :: (MonadIO m, IsDiscoverer o) => o -> Bool -> m ()
- type C_DiscovererDiscoveredCallback = Ptr () -> Ptr DiscovererInfo -> Ptr GError -> Ptr () -> IO ()
- type DiscovererDiscoveredCallback = DiscovererInfo -> Maybe GError -> IO ()
- afterDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> DiscovererDiscoveredCallback -> m SignalHandlerId
- genClosure_DiscovererDiscovered :: MonadIO m => DiscovererDiscoveredCallback -> m (GClosure C_DiscovererDiscoveredCallback)
- mk_DiscovererDiscoveredCallback :: C_DiscovererDiscoveredCallback -> IO (FunPtr C_DiscovererDiscoveredCallback)
- noDiscovererDiscoveredCallback :: Maybe DiscovererDiscoveredCallback
- onDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> DiscovererDiscoveredCallback -> m SignalHandlerId
- wrap_DiscovererDiscoveredCallback :: DiscovererDiscoveredCallback -> C_DiscovererDiscoveredCallback
- type C_DiscovererFinishedCallback = Ptr () -> Ptr () -> IO ()
- type DiscovererFinishedCallback = IO ()
- afterDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> DiscovererFinishedCallback -> m SignalHandlerId
- genClosure_DiscovererFinished :: MonadIO m => DiscovererFinishedCallback -> m (GClosure C_DiscovererFinishedCallback)
- mk_DiscovererFinishedCallback :: C_DiscovererFinishedCallback -> IO (FunPtr C_DiscovererFinishedCallback)
- noDiscovererFinishedCallback :: Maybe DiscovererFinishedCallback
- onDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> DiscovererFinishedCallback -> m SignalHandlerId
- wrap_DiscovererFinishedCallback :: DiscovererFinishedCallback -> C_DiscovererFinishedCallback
- type C_DiscovererSourceSetupCallback = Ptr () -> Ptr Element -> Ptr () -> IO ()
- type DiscovererSourceSetupCallback = Element -> IO ()
- afterDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> DiscovererSourceSetupCallback -> m SignalHandlerId
- genClosure_DiscovererSourceSetup :: MonadIO m => DiscovererSourceSetupCallback -> m (GClosure C_DiscovererSourceSetupCallback)
- mk_DiscovererSourceSetupCallback :: C_DiscovererSourceSetupCallback -> IO (FunPtr C_DiscovererSourceSetupCallback)
- noDiscovererSourceSetupCallback :: Maybe DiscovererSourceSetupCallback
- onDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> DiscovererSourceSetupCallback -> m SignalHandlerId
- wrap_DiscovererSourceSetupCallback :: DiscovererSourceSetupCallback -> C_DiscovererSourceSetupCallback
- type C_DiscovererStartingCallback = Ptr () -> Ptr () -> IO ()
- type DiscovererStartingCallback = IO ()
- afterDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> DiscovererStartingCallback -> m SignalHandlerId
- genClosure_DiscovererStarting :: MonadIO m => DiscovererStartingCallback -> m (GClosure C_DiscovererStartingCallback)
- mk_DiscovererStartingCallback :: C_DiscovererStartingCallback -> IO (FunPtr C_DiscovererStartingCallback)
- noDiscovererStartingCallback :: Maybe DiscovererStartingCallback
- onDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> DiscovererStartingCallback -> m SignalHandlerId
- wrap_DiscovererStartingCallback :: DiscovererStartingCallback -> C_DiscovererStartingCallback
Exported types
newtype Discoverer Source #
Memory-managed wrapper type.
Discoverer (ManagedPtr Discoverer) |
Instances
Eq Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer (==) :: Discoverer -> Discoverer -> Bool # (/=) :: Discoverer -> Discoverer -> Bool # | |
GObject Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer | |
ManagedPtrNewtype Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer toManagedPtr :: Discoverer -> ManagedPtr Discoverer | |
TypedObject Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer | |
HasParentTypes Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer | |
IsGValue (Maybe Discoverer) Source # | Convert |
Defined in GI.GstPbutils.Objects.Discoverer gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Discoverer -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Discoverer) | |
type ParentTypes Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer |
class (GObject o, IsDescendantOf Discoverer o) => IsDiscoverer o Source #
Type class for types which can be safely cast to Discoverer
, for instance with toDiscoverer
.
Instances
(GObject o, IsDescendantOf Discoverer o) => IsDiscoverer o Source # | |
Defined in GI.GstPbutils.Objects.Discoverer |
toDiscoverer :: (MonadIO m, IsDiscoverer o) => o -> m Discoverer Source #
Cast to Discoverer
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, discoverUri, discoverUriAsync, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, start, stealData, stealQdata, stop, thawNotify, unref, watchClosure.
Getters
getData, getProperty, getQdata.
Setters
discoverUri
discovererDiscoverUri Source #
:: (HasCallStack, MonadIO m, IsDiscoverer a) | |
=> a |
|
-> Text |
|
-> m DiscovererInfo | Returns: the result of the scanning. Can be |
Synchronously discovers the given uri
.
A copy of uri
will be made internally, so the caller can safely free
afterwards.
discoverUriAsync
discovererDiscoverUriAsync Source #
:: (HasCallStack, MonadIO m, IsDiscoverer a) | |
=> a |
|
-> Text |
|
-> m Bool | Returns: |
Appends the given uri
to the list of URIs to discoverer. The actual
discovery of the uri
will only take place if discovererStart
has
been called.
A copy of uri
will be made internally, so the caller can safely free
afterwards.
new
:: (HasCallStack, MonadIO m) | |
=> Word64 |
|
-> m Discoverer | Returns: The new |
Creates a new Discoverer
with the provided timeout.
start
:: (HasCallStack, MonadIO m, IsDiscoverer a) | |
=> a |
|
-> m () |
Allow asynchronous discovering of URIs to take place.
A MainLoop
must be available for Discoverer
to properly work in
asynchronous mode.
stop
:: (HasCallStack, MonadIO m, IsDiscoverer a) | |
=> a |
|
-> m () |
Stop the discovery of any pending URIs and clears the list of pending URIS (if any).
Properties
timeout
The duration (in nanoseconds) after which the discovery of an individual URI will timeout.
If the discovery of a URI times out, the DiscovererResultTimeout
will be
set on the result flags.
constructDiscovererTimeout :: (IsDiscoverer o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “timeout
” property. This is rarely needed directly, but it is used by new
.
getDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> m Word64 Source #
Get the value of the “timeout
” property.
When overloading is enabled, this is equivalent to
get
discoverer #timeout
setDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> Word64 -> m () Source #
Set the value of the “timeout
” property.
When overloading is enabled, this is equivalent to
set
discoverer [ #timeout:=
value ]
useCache
No description available in the introspection data.
constructDiscovererUseCache :: (IsDiscoverer o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-cache
” property. This is rarely needed directly, but it is used by new
.
getDiscovererUseCache :: (MonadIO m, IsDiscoverer o) => o -> m Bool Source #
Get the value of the “use-cache
” property.
When overloading is enabled, this is equivalent to
get
discoverer #useCache
setDiscovererUseCache :: (MonadIO m, IsDiscoverer o) => o -> Bool -> m () Source #
Set the value of the “use-cache
” property.
When overloading is enabled, this is equivalent to
set
discoverer [ #useCache:=
value ]
Signals
discovered
type C_DiscovererDiscoveredCallback = Ptr () -> Ptr DiscovererInfo -> Ptr GError -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type DiscovererDiscoveredCallback Source #
= DiscovererInfo |
|
-> Maybe GError |
|
-> IO () |
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.
afterDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> DiscovererDiscoveredCallback -> m SignalHandlerId Source #
Connect a signal handler for the discovered signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
discoverer #discovered callback
genClosure_DiscovererDiscovered :: MonadIO m => DiscovererDiscoveredCallback -> m (GClosure C_DiscovererDiscoveredCallback) Source #
Wrap the callback into a GClosure
.
mk_DiscovererDiscoveredCallback :: C_DiscovererDiscoveredCallback -> IO (FunPtr C_DiscovererDiscoveredCallback) Source #
Generate a function pointer callable from C code, from a C_DiscovererDiscoveredCallback
.
noDiscovererDiscoveredCallback :: Maybe DiscovererDiscoveredCallback Source #
A convenience synonym for
.Nothing
:: Maybe
DiscovererDiscoveredCallback
onDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> DiscovererDiscoveredCallback -> m SignalHandlerId Source #
Connect a signal handler for the discovered signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
discoverer #discovered callback
wrap_DiscovererDiscoveredCallback :: DiscovererDiscoveredCallback -> C_DiscovererDiscoveredCallback Source #
Wrap a DiscovererDiscoveredCallback
into a C_DiscovererDiscoveredCallback
.
finished
type C_DiscovererFinishedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type DiscovererFinishedCallback = IO () Source #
Will be emitted in async mode when all pending URIs have been processed.
afterDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> DiscovererFinishedCallback -> m SignalHandlerId Source #
Connect a signal handler for the finished signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
discoverer #finished callback
genClosure_DiscovererFinished :: MonadIO m => DiscovererFinishedCallback -> m (GClosure C_DiscovererFinishedCallback) Source #
Wrap the callback into a GClosure
.
mk_DiscovererFinishedCallback :: C_DiscovererFinishedCallback -> IO (FunPtr C_DiscovererFinishedCallback) Source #
Generate a function pointer callable from C code, from a C_DiscovererFinishedCallback
.
noDiscovererFinishedCallback :: Maybe DiscovererFinishedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
DiscovererFinishedCallback
onDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> DiscovererFinishedCallback -> m SignalHandlerId Source #
Connect a signal handler for the finished signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
discoverer #finished callback
wrap_DiscovererFinishedCallback :: DiscovererFinishedCallback -> C_DiscovererFinishedCallback Source #
Wrap a DiscovererFinishedCallback
into a C_DiscovererFinishedCallback
.
sourceSetup
type C_DiscovererSourceSetupCallback = Ptr () -> Ptr Element -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type DiscovererSourceSetupCallback Source #
= Element |
|
-> IO () |
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.
afterDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> DiscovererSourceSetupCallback -> m SignalHandlerId Source #
Connect a signal handler for the sourceSetup signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
discoverer #sourceSetup callback
genClosure_DiscovererSourceSetup :: MonadIO m => DiscovererSourceSetupCallback -> m (GClosure C_DiscovererSourceSetupCallback) Source #
Wrap the callback into a GClosure
.
mk_DiscovererSourceSetupCallback :: C_DiscovererSourceSetupCallback -> IO (FunPtr C_DiscovererSourceSetupCallback) Source #
Generate a function pointer callable from C code, from a C_DiscovererSourceSetupCallback
.
noDiscovererSourceSetupCallback :: Maybe DiscovererSourceSetupCallback Source #
A convenience synonym for
.Nothing
:: Maybe
DiscovererSourceSetupCallback
onDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> DiscovererSourceSetupCallback -> m SignalHandlerId Source #
Connect a signal handler for the sourceSetup signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
discoverer #sourceSetup callback
wrap_DiscovererSourceSetupCallback :: DiscovererSourceSetupCallback -> C_DiscovererSourceSetupCallback Source #
Wrap a DiscovererSourceSetupCallback
into a C_DiscovererSourceSetupCallback
.
starting
type C_DiscovererStartingCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type DiscovererStartingCallback = IO () Source #
Will be emitted when the discover starts analyzing the pending URIs
afterDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> DiscovererStartingCallback -> m SignalHandlerId Source #
Connect a signal handler for the starting signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
discoverer #starting callback
genClosure_DiscovererStarting :: MonadIO m => DiscovererStartingCallback -> m (GClosure C_DiscovererStartingCallback) Source #
Wrap the callback into a GClosure
.
mk_DiscovererStartingCallback :: C_DiscovererStartingCallback -> IO (FunPtr C_DiscovererStartingCallback) Source #
Generate a function pointer callable from C code, from a C_DiscovererStartingCallback
.
noDiscovererStartingCallback :: Maybe DiscovererStartingCallback Source #
A convenience synonym for
.Nothing
:: Maybe
DiscovererStartingCallback
onDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> DiscovererStartingCallback -> m SignalHandlerId Source #
Connect a signal handler for the starting signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
discoverer #starting callback