Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
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 DiscovererDiscoveredCallback = DiscovererInfo -> Maybe GError -> IO ()
- afterDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererDiscoveredCallback) -> m SignalHandlerId
- onDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererDiscoveredCallback) -> m SignalHandlerId
- type DiscovererFinishedCallback = IO ()
- afterDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererFinishedCallback) -> m SignalHandlerId
- onDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererFinishedCallback) -> m SignalHandlerId
- type DiscovererLoadSerializedInfoCallback = Text -> IO (Maybe DiscovererInfo)
- afterDiscovererLoadSerializedInfo :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererLoadSerializedInfoCallback) -> m SignalHandlerId
- onDiscovererLoadSerializedInfo :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererLoadSerializedInfoCallback) -> m SignalHandlerId
- type DiscovererSourceSetupCallback = Element -> IO ()
- afterDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererSourceSetupCallback) -> m SignalHandlerId
- onDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererSourceSetupCallback) -> m SignalHandlerId
- type DiscovererStartingCallback = IO ()
- afterDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererStartingCallback) -> m SignalHandlerId
- onDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererStartingCallback) -> m SignalHandlerId
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 type ParentTypes Discoverer = '[Object] |
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 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 -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onDiscovererDiscovered :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: 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
finished
type DiscovererFinishedCallback = IO () Source #
Will be emitted in async mode when all pending URIs have been processed.
afterDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onDiscovererFinished :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: 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
loadSerializedInfo
type DiscovererLoadSerializedInfoCallback Source #
= Text |
|
-> IO (Maybe DiscovererInfo) | Returns: The |
Retrieves information about a URI from and external source of information, like a cache file. This is used by the discoverer to speed up the discovery.
Since: 1.24
afterDiscovererLoadSerializedInfo :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererLoadSerializedInfoCallback) -> m SignalHandlerId Source #
Connect a signal handler for the loadSerializedInfo signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
discoverer #loadSerializedInfo callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onDiscovererLoadSerializedInfo :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: a) => DiscovererLoadSerializedInfoCallback) -> m SignalHandlerId Source #
Connect a signal handler for the loadSerializedInfo signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
discoverer #loadSerializedInfo callback
sourceSetup
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 -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onDiscovererSourceSetup :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: 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
starting
type DiscovererStartingCallback = IO () Source #
Will be emitted when the discover starts analyzing the pending URIs
afterDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: 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
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onDiscovererStarting :: (IsDiscoverer a, MonadIO m) => a -> ((?self :: 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