pipewire-0.1
Safe HaskellSafe-Inferred
LanguageGHC2021

Pipewire

Synopsis

High level API

data PwInstance state #

A pipewire client instance

Constructors

PwInstance 

Fields

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

data CoreError #

A pipewire error

Constructors

CoreError 

Fields

Instances

Instances details
Show CoreError # 
Instance details

Defined in Pipewire

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 #

withContext :: Loop -> (Context -> IO a) -> IO a #

withCore :: Context -> (Core -> IO a) -> IO a #

Protocol

newtype PwID #

Constructors

PwID 

Fields

Instances

Instances details
Storable PwID # 
Instance details

Defined in Pipewire.Protocol

Methods

sizeOf :: PwID -> Int #

alignment :: PwID -> Int #

peekElemOff :: Ptr PwID -> Int -> IO PwID #

pokeElemOff :: Ptr PwID -> Int -> PwID -> IO () #

peekByteOff :: Ptr b -> Int -> IO PwID #

pokeByteOff :: Ptr b -> Int -> PwID -> IO () #

peek :: Ptr PwID -> IO PwID #

poke :: Ptr PwID -> PwID -> IO () #

Num PwID # 
Instance details

Defined in Pipewire.Protocol

Methods

(+) :: PwID -> PwID -> PwID #

(-) :: PwID -> PwID -> PwID #

(*) :: PwID -> PwID -> PwID #

negate :: PwID -> PwID #

abs :: PwID -> PwID #

signum :: PwID -> PwID #

fromInteger :: Integer -> PwID #

Show PwID # 
Instance details

Defined in Pipewire.Protocol

Methods

showsPrec :: Int -> PwID -> ShowS #

show :: PwID -> String #

showList :: [PwID] -> ShowS #

Eq PwID # 
Instance details

Defined in Pipewire.Protocol

Methods

(==) :: PwID -> PwID -> Bool #

(/=) :: PwID -> PwID -> Bool #

Ord PwID # 
Instance details

Defined in Pipewire.Protocol

Methods

compare :: PwID -> PwID -> Ordering #

(<) :: PwID -> PwID -> Bool #

(<=) :: PwID -> PwID -> Bool #

(>) :: PwID -> PwID -> Bool #

(>=) :: PwID -> PwID -> Bool #

max :: PwID -> PwID -> PwID #

min :: PwID -> PwID -> PwID #

newtype PwVersion #

Constructors

PwVersion 

Fields

Instances

Instances details
Show PwVersion # 
Instance details

Defined in Pipewire.Protocol

Eq PwVersion # 
Instance details

Defined in Pipewire.Protocol

Ord PwVersion # 
Instance details

Defined in Pipewire.Protocol

newtype SeqID #

Constructors

SeqID 

Fields

Instances

Instances details
Show SeqID # 
Instance details

Defined in Pipewire.Protocol

Methods

showsPrec :: Int -> SeqID -> ShowS #

show :: SeqID -> String #

showList :: [SeqID] -> ShowS #

Eq SeqID # 
Instance details

Defined in Pipewire.Protocol

Methods

(==) :: SeqID -> SeqID -> Bool #

(/=) :: SeqID -> SeqID -> Bool #

Ord SeqID # 
Instance details

Defined in Pipewire.Protocol

Methods

compare :: SeqID -> SeqID -> Ordering #

(<) :: SeqID -> SeqID -> Bool #

(<=) :: SeqID -> SeqID -> Bool #

(>) :: SeqID -> SeqID -> Bool #

(>=) :: SeqID -> SeqID -> Bool #

max :: SeqID -> SeqID -> SeqID #

min :: SeqID -> SeqID -> SeqID #

Core API

Initialization

pw_deinit :: IO () #

pw_init :: IO () #

Main Loop

data MainLoop #

withSignalsHandler :: MainLoop -> IO a -> IO a #

Stop the loop on SIGINT or SIGKILL

Thread Loop

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

data Context #

Core

data Core #

data Registry #

data CoreInfo #

type DoneHandler = PwID -> SeqID -> IO () #

type ErrorHandler = PwID -> SeqID -> Int -> Text -> IO () #

type InfoHandler = CoreInfo -> IO () #

withCoreEvents :: InfoHandler -> DoneHandler -> ErrorHandler -> (CoreEvents -> IO b) -> IO b #

Create a local pw_core_events structure

Link

newtype Link #

A Link proxy

Constructors

Link 

Fields

data LinkProperties #

Link creation options

Constructors

LinkProperties 

Fields

setupLinkProperties :: PwProperties -> LinkProperties -> IO () #

Create the PwProperties for pw_link_create

withLink :: Core -> LinkProperties -> (Link -> IO a) -> IO a #

Setup a link (synchronously)

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

data Loop #

Node

data Node #

A Link proxy

type NodeInfoHandler = PwID -> SpaDict -> IO () #

Proxy

data PwProxy #

Registry

type GlobalHandler = PwID -> Text -> PwVersion -> SpaDict -> IO () #

withRegistryEvents :: GlobalHandler -> GlobalRemoveHandler -> (RegistryEvents -> IO b) -> IO b #

Create a local pw_registry_events structure

Utilities

Properties

pw_properties_set_linger :: PwProperties -> IO () #

Keep the object after the client disconnect

SPA

Utilities

Dictionary

data SpaDict #

spaDictRead :: SpaDict -> IO (Vector (Text, Text)) #

Read SpaDict keys/values

withSpaDict :: (SpaDict -> IO a) -> IO a #

Create a local spa_hook structure

Hooks

data SpaHook #

withSpaHook :: (SpaHook -> IO a) -> IO a #

Create a local spa_hook structure

SPA

Helpers