ThunderClientLibraries is a collection of lightweight, process-boundary client libraries that enable out-of-process components — such as media pipelines, browser runtimes, and application runtimes — to consume services hosted inside the WPEFramework (Thunder) plugin host. Each library exposes a stable C or C++ API to access the functionality provided by the corresponding Thunder service.

ThunderClientLibraries provides a stable abstraction for any component — whether a standalone application, an out-of-process runtime, or a plugin library — that needs to access services hosted inside the WPEFramework (Thunder) plugin host without a direct dependency on Thunder internals. The libraries are independent of one another; a component links only the libraries it needs.

Typical consumers include media pipeline processes requiring DRM session creation through OpenCDM, web runtimes needing display or device capability metadata, Bluetooth audio pipelines streaming audio to or from a paired device, and plugin libraries that need access to Thunder-hosted functionality without a direct dependency on Thunder internals.

Key Features & Responsibilities:


Internal Modules

Module / ClassDescriptionKey Files
OpenCDMAccessorSingleton that manages the COM-RPC connection to the OpenCDMImplementation plugin. Holds session key maps and provides the IAccessorOCDM interface proxy. Receives external data: DRM system metadata and key status updates from the plugin.open_cdm_impl.h, open_cdm_impl.cpp
OpenCDMSessionRepresents a single DRM session. Holds the session ID, the remote Exchange::ISession interface, and decrypt context. Created via OpenCDMAccessor. Receives external data: license responses and key status changes from the plugin.open_cdm_impl.h, open_cdm_impl.cpp
SecurityAgent ipclinkPer-call COM-RPC client that connects to the SecurityAgent plugin, calls PluginHost::IAuthenticate::CreateToken(), and releases the connection.ipclink.cpp (securityagent)
DeviceInfoSingleton wrapping RPC::SmartInterfaceType<Exchange::IDeviceInfo>. Queries video/audio capability interfaces and maps Exchange enums to the public C API enums.DeviceInfo.cpp, deviceinfo.h
DisplayInfoSingleton wrapping RPC::SmartInterfaceType<Exchange::IConnectionProperties>. Also queries IHDRProperties and IGraphicsProperties. Registers IConnectionProperties::INotification to deliver display-change events.DisplayInfo.cpp, displayinfo.h
PlayerInfoSingleton wrapping RPC::SmartInterfaceType<Exchange::IPlayerProperties>. Queries Exchange::Dolby::IOutput and registers Dolby::IOutput::INotification for Dolby mode-change events.PlayerInfo.cpp, playerinfo.h
CryptographyLinkSingleton wrapping RPC::SmartInterfaceType<PluginHost::IPlugin>. Acquires Exchange::ICryptography and Exchange::IDeviceObjects from the Svalbard plugin. Adapter classes (RPCDiffieHellmanImpl, etc.) wrap the remote interfaces and handle connection loss.Cryptography.cpp, cryptography.h
ProvisionProxy ipclinkPer-call COM-RPC client connecting to the Provisioning plugin. Implements GetDeviceId() and GetDRMId() via Exchange::IProvisioning.ipclink.cpp (provisionproxy)
AudioSinkSingleton wrapping RPC::SmartInterfaceType<Exchange::IBluetoothAudio::ISink>. Maintains a Core::SharedBuffer (SendBuffer) for frame delivery. Tracks sink connection state and delivers state-change callbacks.BluetoothAudioSink.cpp, bluetoothaudiosink.h
AudioSourceSingleton wrapping RPC::SmartInterfaceType<Exchange::IBluetoothAudio::ISource>. Contains a Receiver worker thread that reads audio frames from a Core::SharedBuffer and dispatches them to the registered frame callback.BluetoothAudioSource.cpp, bluetoothaudiosource.h
CompositorClientC++ abstraction layer (Thunder::Compositor::IDisplay, Thunder::Compositor::IDisplay::ISurface, Thunder::Compositor::IDisplay::IKeyboard, Thunder::Compositor::IDisplay::IPointer, Thunder::Compositor::IDisplay::IWheel, Thunder::Compositor::IDisplay::ITouchPanel). Implementation is selected at build time via PLUGIN_COMPOSITOR_IMPLEMENTATION and compiled from the corresponding subdirectory (e.g., Wayland, Mesa, RPI).Client.h, src/CMakeLists.txt

Component Interactions

Interaction Matrix

Target Component / LayerInteraction PurposeKey APIs / Topics
WPEFramework Plugins

OpenCDMImplementationDRM system management and content decryptionExchange::IAccessorOCDM, Exchange::IContentDecryption, Exchange::ISession
SecurityAgentSecurity token acquisition for JSON-RPC authorizationPluginHost::IAuthenticate::CreateToken()
DeviceInfoQuery device video/audio output capabilities and HDCP supportExchange::IDeviceInfo, Exchange::IDeviceVideoCapabilities, Exchange::IDeviceAudioCapabilities
DisplayInfoQuery connected display properties and receive display change eventsExchange::IConnectionProperties, Exchange::IHDRProperties, Exchange::IGraphicsProperties
PlayerInfoQuery playback capabilities and receive Dolby mode change eventsExchange::IPlayerProperties, Exchange::Dolby::IOutput
SvalbardCryptographic operations (cipher, hash, DH, vault, random)Exchange::ICryptography, Exchange::IDiffieHellman, Exchange::INetflixSecurity, Exchange::IDeviceObjects
ProvisioningDevice ID and DRM credential retrievalExchange::IProvisioning::DeviceId(), Exchange::IProvisioning (DRM ID via DRMInfo)
BluetoothAudioBluetooth audio sink/source streaming and state managementExchange::IBluetoothAudio::ISink, Exchange::IBluetoothAudio::ISource
CompositorDisplay surface creation and input event deliveryThunder::Compositor::IDisplay, Thunder::Compositor::IDisplay::ISurface, Thunder::Compositor::IDisplay::IKeyboard, Thunder::Compositor::IDisplay::IPointer, Thunder::Compositor::IDisplay::IWheel, Thunder::Compositor::IDisplay::ITouchPanel
IPC Transport

COM-RPC (UNIX domain socket / TCP)Plugin communication uses Thunder COM-RPC (UNIX domain sockets on Linux; TCP loopback endpoints are used on Windows when configured by the client / environment)RPC::CommunicatorClient, RPC::SmartInterfaceType, Core::NodeId
Shared Memory BufferBluetoothAudioSink and BluetoothAudioSource use Core::SharedBuffer for audio frame transferCore::SharedBuffer

Events Published

Event NameTrigger ConditionDelivered To
displayinfo_display_output_change_cbDisplay connection properties change (e.g. HDMI cable insert/remove), delivered via IConnectionProperties::INotification::UpdatedCallers registered with displayinfo_register_display_output_change_callback()
displayinfo_operational_state_change_cbDisplayInfo plugin goes offline or comes back onlineCallers registered with displayinfo_register_operational_state_change_callback()
playerinfo_dolby_audio_updated_cbDolby sound mode changes, delivered via Exchange::Dolby::IOutput::INotification::AudioModeChangedCallers registered with playerinfo_register_dolby_sound_mode_updated_callback()
playerinfo_operational_state_change_cbPlayerInfo plugin goes offline or comes back onlineCallers registered with playerinfo_register_operational_state_change_callback()
bluetoothaudiosink_state_changed_cbBluetooth audio sink connection state transitions (UNASSIGNED → DISCONNECTED → CONNECTING → CONNECTED / CONNECTED_BAD / CONNECTED_RESTRICTED → READY → STREAMING)Callers registered with bluetoothaudiosink_register_state_changed_callback()
bluetoothaudiosink_operational_state_update_cbBluetoothAudio plugin goes offline or comes back onlineCallers registered with bluetoothaudiosink_register_operational_state_update_callback()
bluetoothaudiosource_state_changed_cbBluetooth audio source connection state transitionsCallers registered with bluetoothaudiosource_register_state_changed_callback()
bluetoothaudiosource_frame_cbAudio frame received from connected Bluetooth sourceCaller-supplied sink struct registered via bluetoothaudiosource_set_sink()

IPC Flow Patterns

Primary Request / Response Flow:

```mermaid
sequenceDiagram
    participant App as Apps
    participant Lib as ThunderClientLibrary
    participant Thunder as WPEFramework Plugin

    App->>Lib: C API call (e.g. deviceinfo_hdcp())
    Note over Lib: Validate state, acquire lock if needed
    Lib->>Thunder: COM-RPC method call via Exchange interface
    Thunder-->>Lib: Return value / status code
    Note over Lib: Map Exchange types to public C API types
    Lib-->>App: Status + output parameter filled
```

Event Notification Flow:

```mermaid
sequenceDiagram
    participant Thunder as WPEFramework Plugin
    participant Lib as ThunderClientLibrary
    participant App1 as Subscriber 1
    participant App2 as Subscriber 2

    Thunder->>Lib: COM-RPC notification callback\n(e.g. IConnectionProperties::INotification::Updated)
    Note over Lib: Acquire lock, iterate registered callbacks
    Lib->>App1: registered_callback(user_data)
    Lib->>App2: registered_callback(user_data)
```

Implementation Details

Major HAL APIs Integration

ThunderClientLibraries operates above the HAL boundary. Each library calls into the corresponding Thunder Exchange interface, which is served by a Thunder plugin that abstracts platform-specific HAL details. The table below lists the primary Exchange interfaces and entry-point methods consumed by each client library.

Exchange InterfaceEntry-Point Methods / NotificationsConsuming Library
Exchange::IAccessorOCDMCreateSession(), IsTypeSupported(), SetServerCertificate(), key status notificationsOpenCDM
PluginHost::IAuthenticateCreateToken()SecurityAgent
Exchange::IDeviceInfo / IDeviceVideoCapabilities / IDeviceAudioCapabilitiesSupportedVideoDisplays(), SupportedResolutions(), SupportedHdcp(), AudioCapabilities()DeviceInfo
Exchange::IConnectionProperties / IHDRProperties / IGraphicsPropertiesWidth(), Height(), IsAudioPassthrough(), EDID(), HDRSetting(), TotalGpuRam()DisplayInfo
Exchange::IPlayerProperties / Dolby::IOutputVideoCodecs(), AudioCodecs(), Resolution(), SoundMode(), EnableAtmosOutput(), AudioModeChanged() notificationPlayerInfo
Exchange::ICryptography / IDiffieHellman / IVaultHash(), Cipher(), DiffieHellman(), Vault(), Random()Cryptography
Exchange::IProvisioningDeviceId(), DRMInfo()ProvisionProxy
Exchange::IBluetoothAudio::ISinkAcquire(), Relinquish(), Speed(), Time(), Latency(), state change notificationsBluetoothAudioSink
Exchange::IBluetoothAudio::ISourceAssign(), Revoke(), Frame(), state change notificationsBluetoothAudioSource
Thunder::Compositor::IDisplay / ISurfaceCreate(), Destroy(), keyboard/pointer/touch input event dispatchCompositorClient

Key Implementation Logic