Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
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 => IsDiscoverer o
- toDiscoverer :: (MonadIO m, IsDiscoverer o) => o -> m Discoverer
- noDiscoverer :: Maybe 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 => Word64 -> IO (GValueConstruct o)
- getDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> m Word64
- setDiscovererTimeout :: (MonadIO m, IsDiscoverer o) => o -> Word64 -> 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 :: DiscovererDiscoveredCallback -> IO Closure
- 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 :: DiscovererFinishedCallback -> IO Closure
- 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 :: DiscovererSourceSetupCallback -> IO Closure
- 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 :: DiscovererStartingCallback -> IO Closure
- 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.
Instances
GObject Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer gobjectType :: Discoverer -> IO GType # | |
IsObject Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer | |
IsDiscoverer Discoverer Source # | |
Defined in GI.GstPbutils.Objects.Discoverer |
class GObject o => IsDiscoverer o Source #
Type class for types which can be safely cast to Discoverer
, for instance with toDiscoverer
.
Instances
(GObject a, (UnknownAncestorError Discoverer a :: Constraint)) => IsDiscoverer a Source # | |
Defined in GI.GstPbutils.Objects.Discoverer | |
IsDiscoverer Discoverer 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
.
noDiscoverer :: Maybe Discoverer Source #
A convenience alias for Nothing
:: Maybe
Discoverer
.
Methods
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 => Word64 -> IO (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 ]
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 :: DiscovererDiscoveredCallback -> IO Closure Source #
Wrap the callback into a Closure
.
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 :: DiscovererFinishedCallback -> IO Closure Source #
Wrap the callback into a Closure
.
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 #
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 “source-setup
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
discoverer #sourceSetup callback
genClosure_DiscovererSourceSetup :: DiscovererSourceSetupCallback -> IO Closure Source #
Wrap the callback into a Closure
.
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 “source-setup
” 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 :: DiscovererStartingCallback -> IO Closure Source #
Wrap the callback into a Closure
.
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