Parsec

Parsec SDK Overview

The Parsec SDK allows your application to make interactive, low–latency peer–to–peer connections for the purpose of game streaming. The SDK handles the low level internals of peer–to–peer connectivity, networking, and hardware accelerated video/audio processing. It is lightweight, consisting of a single header file and a shared object < 5MB.

Instance Functions

Instance functions operate either globally or on the top–level Parsec instance.

NameDescription
ParsecInitInitialize Parsec instance.
ParsecDestroyDestroy Parsec instance.
ParsecGetConfigGet Parsec runtime configuration.
ParsecGetBufferGet an internal dynamically allocated buffer by 32-bit lookup key.
ParsecFreeFree a dynamically allocated buffer returned by ParsecGetBuffer.
ParsecSetLogCallbackReceive log messages accross all Parsec instances.
ParsecVersionRetrieve the Parsec SDK internal PARSEC_VER.
ParsecGetOutputsGet a list of currently available outputs. Windows and Mac only.
ParsecGetAudioOutputsGet a list of currently available audio outputs.
ParsecGetDecodersGet a list of currently available video decoders.
ParsecJSONCommandExecute a Parsec command from a JSON string.
ParsecCanHostChecks if Parsec can host.
ParsecGetVUSBStateGets the current VUSB status.
ParsecGetVDDStateGets the current VDD status.
ParsecSetConfigUpdates the current configuration in use.

Client Functions

Client functions deal with making a connection to a host, sending input, rendering frames, and playing audio.

NameDescription
ParsecClientNewAttemptBegin connecting to a remote Parsec host.
ParsecClientDisconnectDisconnect client.
ParsecClientGetStatusGet client connection health and status information.
ParsecClientGetGuestsGet a list of all guests currently connected to the host.
ParsecClientSetConfigSet client configuration.
ParsecClientSetDimensionsSet client window dimensions and screen scale.
ParsecClientPollFramePoll for a new video frame from the host and make it available in system memory.
ParsecClientPollAudioPoll for new audio from the host.
ParsecClientPollEventsPoll client events.
ParsecClientGLDestroyCleanup internal OpenGL/GLES state.
ParsecClientSendMessageSend an input message to the host.
ParsecClientPausePause video and/or audio output from the host.
ParsecClientEnableStreamEnable or disable video streams.
ParsecClientSendUserDataSend a user-defined string to the host.
ParsecClientSendExtraDataSend extra binary data to the host.
ParsecClientScalePenMessageScale a pen message to the client viewport.
ParsecClientSendVirtualUSBSend virtual USB binary data to the host.
ParsecClientAddCandidateGive a possible candidate to connect to.
ParsecClientBeginP2PAfter approving of the guest, start the peer 2 peer frame.
ParsecClientEndConnectionUse to disconnect the client connection. Should use ParsecClientDisconnect for normal disconnects.

Host Functions

Host functions deal with accepting guest connections, polling host/guest events, and in HOST_GAME submitting video/audio.

NameDescription
ParsecHostStartStart accepting guests.
ParsecHostStopDisconnect all guests and stop hosting.
ParsecHostGetStatusGet current hosting status.
ParsecHostSetConfigSet host configuration.
ParsecHostGetGuestsGet a list of all connected and/or waiting guests.
ParsecHostKickGuestKick guest.
ParsecHostSendUserDataSend a user-defined message to a guest.
ParsecHostPollEventsPoll host events.
ParsecHostBeginP2PAllow or reject a pending guest. HOST_DESKTOP only.
ParsecHostSetPermissionsChange guest input permissions. HOST_DESKTOP only.
ParsecHostPollInputPoll input messages from connected guests. HOST_GAME only.
ParsecHostSubmitAudioSubmit PCM audio to connected guests. HOST_GAME only.
ParsecHostSubmitCursorSubmit a cursor mode and/or image update to connected guests. HOST_GAME only.
ParsecHostSubmitRumbleSubmit gamepad rumble data to a connected guests. HOST_GAME only.
ParsecHostGLSubmitFrameSubmit rendered OpenGL frame to connected guests. HOST_GAME only.
ParsecHostD3D9SubmitFrameSubmit rendered D3D9 frame to connected guests. HOST_GAME only. Windows only.
ParsecHostD3D11SubmitFrameSubmit rendered D3D11 frame to connected guests. HOST_GAME only. Windows only.
ParsecHostD3D12SubmitFrameSubmit rendered D3D12 frame to connected guests. HOST_GAME only. Windows only.
ParsecHostVulkanSubmitFrameSubmit rendered Vulkan frame to connected guests. HOST_GAME only. Windows only.
ParsecHostHookStartHook video, audio, or both in the current process. Windows only.
ParsecHostHookStopDetach Parsec from the current process. This function takes longer than 2 seconds to complete, since we need to make sure nothing is left behind. Windows only.
ParsecHostResetGamepadsReset all ViGem controllers in case of issues.
ParsecHostSetWhitelistSet the whitelist of approved applications.
ParsecHostAddCandidateGive a possible candidate to connect to.
ParsecHostNewAttemptStart a new NAT attempt.
ParsecHostEndConnectionEnd a connection.

Structures

NameDescription
ParsecConfigParsec instance configuration.
ParsecFrameVideo frame properties.
ParsecRectRectangle defined by the coordinates of its upper-left and lower-right corners.
ParsecOutputOutput (monitor) properties.
ParsecAudioOutputAudioOutput properties.
ParsecCursorCursor properties.
ParsecPermissionsGuest input permissions.
ParsecMetricsLatency performance metrics.
ParsecGuestGuest properties.
ParsecCandidateThe NAT candidates.
ParsecCredentialsCredentials for the STUN phase.
ParsecKeyboardMessageKeyboard message.
ParsecMouseButtonMessageMouse button message.
ParsecMouseWheelMessageMouse wheel message.
ParsecMouseMotionMessageMouse motion message.
ParsecGamepadButtonMessageGamepad button message.
ParsecGamepadAxisMessageGamepad axis message.
ParsecGamepadUnplugMessageGamepad unplug message.
ParsecGamepadStateMessageGamepad state message.
ParsecPenMessagePen state message.
ParsecMessageGeneric input message that can represent any message type.
ParsecClientVideoConfigClient video configuration.
ParsecClientConfigClient configuration.
ParsecDecoderDecoder description.
ParsecClientStatusClient connection health and status information.
ParsecClientCursorEventCursor mode/image update event.
ParsecClientRumbleEventGamepad rumble data event.
ParsecClientStreamEventVideo stream status change event.
ParsecClientUserDataEventUser-defined host message event.
ParsecClientConnectionEventConnection event from Client.
ParsecClientEventGeneric client event that can represent any event type.
ParsecHostVideoConfigHost video configuration.
ParsecHostConfigHost configuration.
ParsecHostStatusHost runtime status.
ParsecGuestStateChangeEventGuest connection state change event.
ParsecUserDataEventUser-defined guest message event.
ParsecHostEventGeneric host event that can represent any event type.
ParsecVkArgsVulkan submission info.

Enumerations

NameDescription
ParsecStatusStatus codes indicating success, warning, or error.
ParsecLogLevelLog level.
ParsecKeycodeKeyboard input.
ParsecKeymodModifier keys applied to keyboard input.
ParsecMouseButtonMouse button.
ParsecGamepadButtonGamepad button.
ParsecGamepadStateGamepad state button.
ParsecGamepadAxisGamepad axes related to thumbsticks and triggers.
ParsecMessageTypeInput message type.
ParsecColorFormatColor formats for raw image data.
ParsecChromaLayout of the chrominance values given a YUV format image.
ParsecRotationDegrees of rotation for raw image data.
ParsecProtocolNetwork protocol used for peer-to-peer connections.
ParsecContainerVideo stream container.
ParsecPCMFormatPCM audio format.
ParsecGuestStateGuest connection lifecycle states.
ParsecGuestConnectionEventEvents on the clients side.
ParsecHostModeHost mode of operation.
ParsecGamepadModeVirtual gamepad type.
ParsecGamepadTypeVirtual gamepad type.
ParsecHostEventTypeHost event type.
ParsecClientConnectionStateClient connection lifecycle states.
ParsecClientEventTypeClient event type.
ParsecRendererGraphics renderer.
ParsecVDDStateVDD State.
ParsecHookModeHook Mode Flags.
ParsecAudioCancelModeAudio Echo Cancel Type.
ParsecCGLevelCongestion Control level.
ParsecPenFlagsDifferent pen flags.
ParsecForceRelayForce the use of the relay server.
ParsecQualityFlagsThe encoding quality.
ParsecVirtualDeviceTypeThe virtual device type to be used.
ParsecVirtualDeviceStatusThe virtual device state.

Typedefs

TypeName (Params)
ParsecParsec instance.
ParsecGLuintOpenGL/GLES 32-bit unsigned integer.
ParsecD3D9DeviceD3D9 IDirect3DDevice9.
ParsecD3D9SurfaceD3D9 IDirect3DSurface9.
ParsecD3D11DeviceD3D11 ID3D11Device.
ParsecD3D11DeviceContextD3D11 ID3D11DeviceContext.
ParsecD3D11Texture2DD3D11 ID3D11Texture2D.
ParsecOpaqueWindowWindows HWND.
ParsecOpaqueDeviceRenderer device.
ParsecOpaqueContextRenderer device context.
ParsecOpaqueTextureRenderer frame texture.
ParsecD3D12DeviceD3D12 ID3D12Device.
ParsecD3D12CommandQueueD3D12 ID3D12CommandQueue.
ParsecD3D12ResourceD3D12 ID3D12Resource.
ParsecVkImageVulkan VkImage.
ParsecWAVEFORMATEXThe WAVEFORMATEX structure defines the format of waveform-audio data.
ParsecLogCallbackFired when a new log message is available from the Parsec SDK.
ParsecFrameCallbackFired synchronously if a new host video frame is available.
ParsecPreRenderCallbackFired synchronously just before a new host video frame is rendered.
ParsecAudioCallbackFired synchronously if new audio is available from the host.
ParsecHookStatusCallbackThe return status of the hook that happened on the graphios layer ParsecHostHookStart.
ParsecHookVideoCallbackFired on each frame from a hooked renderer.
ParsecHookAudioCallbackFired on new hooked audio data.
ParsecAudioInjectFuncFired when a new process needs to be injected for audio cancellation.

Defines

NameDescription
GUEST_NAME_LEN(32) Maximum length of a guest's name. Used in ParsecGuest.
ATTEMPT_ID_LEN(56) Maximum length of an attempt id. Used in ParsecGuest and ParsecClientConnectionEvent.
OUTPUT_ID_LEN(64) Maximum length of a host output identifier.
OUTPUT_NAME_LEN(256) Maximum length of an output's name in ParsecOutput.
ADAPTER_NAME_LEN(256) Maximum length of an adapter's name in ParsecOutput.
DECODER_NAME_LEN(16) Maximum length of a decoder name. Used in ParsecDecoder.
ICE_SAFE_LEN(256) Maximum length regarding a Interactive Connectivity Establishment.
ADDR_LEN(72) Maximum length of an addresses.
STUN_ADDR_LEN(256) Maximum length of the possible stun addresses.
ECHO_EXEC_LEN(256) Maximum length of an application name to have audio cancelation
FINGERPRINT_LEN(112) Maximum length of the DTLS Fingerprint.
NUM_VSTREAMS(3) Maximum number of video streams per client connection.
DEFAULT_STREAM(0) The default video stream, enabled automatically on client connection to the host.
MAX_OUTPUTS(30) Maximum number of Audio or Video outputs to try / return.
MAX_RES_W(3840) Maximum width resolution increasing this, will increase memory size.
MAX_RES_H(2160) Maximum height resolution increasing this, will increase maximum size.
MAX_DECODERS(5) Maxmimum number of decoders a system can have.
MAX_CLIENTS(64) Maximum number of connected clients a host can have.
KEEP_HOST_RES(65535) Magic number to indicate we want to keep using the host resolution.
STUN_ADDRESSstun.parsec.app Currently the IP is statically coded for team/enterprise environments.
STUN_PORT(3478) The default stun port to communicate on.
PARSEC_VER_MAJOR(6) Parsec SDK breaking API/ABI change.
PARSEC_VER_MINOR(0) Parsec SDK internal implementation detail or additional functionality.
PARSEC_VER32-bit concatenated major/minor version.
PARSEC_DEFAULTSDefault Parsec instance configuration passed to ParsecInit.
PARSEC_HV_DEFAULTSDefault host video configuration, one per stream, member of ParsecHostConfig.
PARSEC_HOST_DEFAULTSDefault host configuration passed to ParsecHostStart and ParsecHostSetConfig.
PARSEC_CV_DEFAULTSDefault client video configuration, one per stream, member of ParsecClientConfig.
PARSEC_CLIENT_DEFAULTSDefault client configuration passed to ParsecClientNewAttempt and ParsecClientSetConfig.