Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Pipewire
Synopsis
- data PwInstance state = PwInstance {}
- data RegistryEvent
- withInstance :: state -> (MainLoop -> PwInstance state -> IO a) -> IO a
- withThreadedInstance :: state -> (ThreadLoop -> PwInstance state -> IO a) -> IO a
- withRegistryHandler :: PwInstance state -> (RegistryEvent -> IO ()) -> IO a -> IO a
- runInstance :: PwInstance state -> IO (Maybe (NonEmpty CoreError))
- data CoreError = CoreError {}
- syncState :: PwInstance state -> IO (Either (NonEmpty CoreError) state)
- syncState_ :: PwInstance state -> IO state
- readState :: PwInstance state -> IO state
- withPipewire :: IO a -> IO a
- withMainLoop :: (MainLoop -> IO a) -> IO a
- withThreadLoop :: Text -> (ThreadLoop -> IO a) -> IO a
- withContext :: Loop -> (Context -> IO a) -> IO a
- withCore :: Context -> (Core -> IO a) -> IO a
- newtype PwID = PwID {}
- newtype PwVersion = PwVersion {
- getVersion :: Int
- newtype SeqID = SeqID {}
- module Pipewire.Enum
- pw_deinit :: IO ()
- pw_init :: IO ()
- data MainLoop
- pw_main_loop_destroy :: MainLoop -> IO ()
- pw_main_loop_get_loop :: MainLoop -> IO Loop
- pw_main_loop_new :: IO MainLoop
- pw_main_loop_quit :: MainLoop -> IO ()
- pw_main_loop_run :: MainLoop -> IO ()
- withSignalsHandler :: MainLoop -> IO a -> IO a
- data ThreadLoop
- pw_thread_loop_destroy :: ThreadLoop -> IO ()
- pw_thread_loop_get_loop :: ThreadLoop -> IO Loop
- pw_thread_loop_new :: CString -> IO ThreadLoop
- pw_thread_loop_signal :: ThreadLoop -> Bool -> IO ()
- pw_thread_loop_start :: ThreadLoop -> IO ()
- pw_thread_loop_stop :: ThreadLoop -> IO ()
- pw_thread_loop_wait :: ThreadLoop -> IO ()
- withLock :: ThreadLoop -> IO a -> IO a
- withThreadSignalsHandler :: ThreadLoop -> IO a -> IO a
- withUnlock :: ThreadLoop -> IO a -> IO a
- data Context
- pw_context_connect :: Context -> IO Core
- pw_context_destroy :: Context -> IO ()
- pw_context_new :: Loop -> IO Context
- data Core
- data Registry
- data CoreEvents
- data CoreInfo
- type DoneHandler = PwID -> SeqID -> IO ()
- type ErrorHandler = PwID -> SeqID -> Int -> Text -> IO ()
- type InfoHandler = CoreInfo -> IO ()
- pw_core_add_listener :: Core -> SpaHook -> CoreEvents -> IO ()
- pw_core_disconnect :: Core -> IO ()
- pw_core_get_registry :: Core -> IO Registry
- pw_core_sync :: Core -> PwID -> Maybe SeqID -> IO SeqID
- pw_id_core :: PwID
- withCoreEvents :: InfoHandler -> DoneHandler -> ErrorHandler -> (CoreEvents -> IO b) -> IO b
- newtype Link = Link {}
- data LinkProperties = LinkProperties {}
- pwLinkEventsFuncs :: LinkEvents -> ProxiedFuncs
- pw_link_create :: Core -> PwProperties -> IO Link
- setupLinkProperties :: PwProperties -> LinkProperties -> IO ()
- withLink :: Core -> LinkProperties -> (Link -> IO a) -> IO a
- withLinkEvents :: LinkEventInfoHandler -> (LinkEvents -> IO a) -> IO a
- waitForLink :: Link -> PwInstance state -> IO (Maybe (NonEmpty CoreError))
- waitForLinkAsync :: Link -> ThreadLoop -> IO (Maybe (Either LinkError Text))
- data Loop
- data Node
- type NodeInfoHandler = PwID -> SpaDict -> IO ()
- withNodeEvents :: (NodeEvents -> IO a) -> IO a
- withNodeInfoHandler :: NodeInfoHandler -> NodeEvents -> IO a -> IO a
- data PwProxy
- pw_proxy_add_object_listener :: PwProxy -> SpaHook -> ProxiedFuncs -> IO ()
- pw_proxy_destroy :: PwProxy -> IO ()
- withProxyEvents :: PwProxy -> ProxyDestroyHandler -> ProxyRemovedHandler -> ProxyErrorHandler -> IO a -> IO a
- type GlobalHandler = PwID -> Text -> PwVersion -> SpaDict -> IO ()
- type GlobalRemoveHandler = PwID -> IO ()
- pw_registry_add_listener :: Registry -> SpaHook -> RegistryEvents -> IO ()
- pw_registry_destroy :: Registry -> PwID -> IO ()
- withRegistryEvents :: GlobalHandler -> GlobalRemoveHandler -> (RegistryEvents -> IO b) -> IO b
- data PwProperties
- pw_properties_free :: PwProperties -> IO ()
- pw_properties_get :: PwProperties -> Text -> IO (Maybe Text)
- pw_properties_new :: IO PwProperties
- pw_properties_new_dict :: SpaDict -> IO PwProperties
- pw_properties_set :: PwProperties -> Text -> Text -> IO ()
- pw_properties_set_id :: PwProperties -> Text -> PwID -> IO ()
- pw_properties_set_linger :: PwProperties -> IO ()
- withProperties :: (PwProperties -> IO a) -> IO a
- data SpaDict
- spaDictLookup :: SpaDict -> Text -> IO (Maybe Text)
- spaDictLookupInt :: SpaDict -> Text -> IO (Maybe Int)
- spaDictRead :: SpaDict -> IO (Vector (Text, Text))
- spaDictSize :: SpaDict -> IO Word32
- withSpaDict :: (SpaDict -> IO a) -> IO a
- data SpaHook
- withSpaHook :: (SpaHook -> IO a) -> IO a
- pw_stream_get_node_id :: PwStream -> IO PwID
- getHeadersVersion :: IO Text
- getLibraryVersion :: IO Text
- cfloatVector :: Vector Float -> Vector CFloat
High level API
data PwInstance state #
A pipewire client instance
data RegistryEvent #
A registry event
withInstance :: state -> (MainLoop -> PwInstance state -> IO a) -> IO a #
Create a new PwInstance
. Use withThreadedInstance
to use the PwInstance
with multiple thread.
withThreadedInstance :: state -> (ThreadLoop -> PwInstance state -> IO a) -> IO a #
Create a new PwInstance
using a threaded loop.
Note: the loop is already locked, use withRegistryHandler
or withUnlock
to let it run.
withRegistryHandler :: PwInstance state -> (RegistryEvent -> IO ()) -> IO a -> IO a #
Setup RegistryEvents
. The loop must be already locked, as provided by withThreadedInstance
.
The closure is executed without the lock.
runInstance :: PwInstance state -> IO (Maybe (NonEmpty CoreError)) #
Run the main loop
A pipewire error
syncState :: PwInstance state -> IO (Either (NonEmpty CoreError) state) #
Ensure all the events have been processed and access the state. Do not call when the loop is runnning!
syncState_ :: PwInstance state -> IO state #
Like syncState
but throwing an error if there was any pipewire error.
readState :: PwInstance state -> IO state #
Mid level bracket API
withPipewire :: IO a -> IO a #
withMainLoop :: (MainLoop -> IO a) -> IO a #
Setup a main loop with signal handlers
withThreadLoop :: Text -> (ThreadLoop -> IO a) -> IO a #
Protocol
Constructors
PwVersion | |
Fields
|
Instances
Show PwVersion # | |
Eq PwVersion # | |
Ord PwVersion # | |
module Pipewire.Enum
Core API
Initialization
Main Loop
pw_main_loop_destroy :: MainLoop -> IO () #
pw_main_loop_get_loop :: MainLoop -> IO Loop #
pw_main_loop_quit :: MainLoop -> IO () #
pw_main_loop_run :: MainLoop -> IO () #
withSignalsHandler :: MainLoop -> IO a -> IO a #
Stop the loop on SIGINT or SIGKILL
Thread Loop
data ThreadLoop #
pw_thread_loop_destroy :: ThreadLoop -> IO () #
pw_thread_loop_get_loop :: ThreadLoop -> IO Loop #
pw_thread_loop_new :: CString -> IO ThreadLoop #
pw_thread_loop_signal :: ThreadLoop -> Bool -> IO () #
pw_thread_loop_start :: ThreadLoop -> IO () #
pw_thread_loop_stop :: ThreadLoop -> IO () #
pw_thread_loop_wait :: ThreadLoop -> IO () #
withLock :: ThreadLoop -> IO a -> IO a #
A lock must be held when using client implementation.
withThreadSignalsHandler :: ThreadLoop -> IO a -> IO a #
Stop the loop on SIGINT or SIGKILL
withUnlock :: ThreadLoop -> IO a -> IO a #
Temporarly release a lock to let the loop run.
Context
pw_context_connect :: Context -> IO Core #
pw_context_destroy :: Context -> IO () #
pw_context_new :: Loop -> IO Context #
Core
data CoreEvents #
type DoneHandler = PwID -> SeqID -> IO () #
type InfoHandler = CoreInfo -> IO () #
pw_core_add_listener :: Core -> SpaHook -> CoreEvents -> IO () #
pw_core_disconnect :: Core -> IO () #
pw_core_get_registry :: Core -> IO Registry #
pw_id_core :: PwID #
withCoreEvents :: InfoHandler -> DoneHandler -> ErrorHandler -> (CoreEvents -> IO b) -> IO b #
Create a local pw_core_events structure
Link
pwLinkEventsFuncs :: LinkEvents -> ProxiedFuncs #
Convert the LinkEvents
for pw_proxy_add_object_listener
pw_link_create :: Core -> PwProperties -> IO Link #
setupLinkProperties :: PwProperties -> LinkProperties -> IO () #
Create the PwProperties for pw_link_create
withLinkEvents :: LinkEventInfoHandler -> (LinkEvents -> IO a) -> IO a #
Setup the pw_link_events handlers
waitForLink :: Link -> PwInstance state -> IO (Maybe (NonEmpty CoreError)) #
Wait for link with a paused MainLoop
.
waitForLinkAsync :: Link -> ThreadLoop -> IO (Maybe (Either LinkError Text)) #
Wait for link with a running ThreadLoop
Loop
Node
type NodeInfoHandler = PwID -> SpaDict -> IO () #
withNodeEvents :: (NodeEvents -> IO a) -> IO a #
withNodeInfoHandler :: NodeInfoHandler -> NodeEvents -> IO a -> IO a #
Proxy
pw_proxy_add_object_listener :: PwProxy -> SpaHook -> ProxiedFuncs -> IO () #
pw_proxy_destroy :: PwProxy -> IO () #
withProxyEvents :: PwProxy -> ProxyDestroyHandler -> ProxyRemovedHandler -> ProxyErrorHandler -> IO a -> IO a #
Registry
type GlobalRemoveHandler = PwID -> IO () #
pw_registry_add_listener :: Registry -> SpaHook -> RegistryEvents -> IO () #
pw_registry_destroy :: Registry -> PwID -> IO () #
withRegistryEvents :: GlobalHandler -> GlobalRemoveHandler -> (RegistryEvents -> IO b) -> IO b #
Create a local pw_registry_events structure
Utilities
Properties
data PwProperties #
pw_properties_free :: PwProperties -> IO () #
pw_properties_get :: PwProperties -> Text -> IO (Maybe Text) #
pw_properties_set :: PwProperties -> Text -> Text -> IO () #
pw_properties_set_id :: PwProperties -> Text -> PwID -> IO () #
pw_properties_set_linger :: PwProperties -> IO () #
Keep the object after the client disconnect
withProperties :: (PwProperties -> IO a) -> IO a #
SPA
Utilities
Dictionary
spaDictSize :: SpaDict -> IO Word32 #
withSpaDict :: (SpaDict -> IO a) -> IO a #
Create a local spa_hook structure
Hooks
withSpaHook :: (SpaHook -> IO a) -> IO a #
Create a local spa_hook structure
SPA
pw_stream_get_node_id :: PwStream -> IO PwID #
Helpers
getHeadersVersion :: IO Text #
getLibraryVersion :: IO Text #