rdpsnd

package
v0.4.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Overview

Package rdpsnd implements the RDPSND (Audio Output Virtual Channel Extension) protocol (MS-RDPEA) for server-to-client audio redirection.

It can operate over either a static virtual channel ("rdpsnd") or a dynamic virtual channel (AUDIO_PLAYBACK_DVC / AUDIO_PLAYBACK_LOSSY_DVC).

Index

Constants

View Source
const (
	SNDC_CLOSE       = 0x01
	SNDC_WAVE        = 0x02
	SNDC_SETVOLUME   = 0x03
	SNDC_SETPITCH    = 0x04
	SNDC_WAVECONFIRM = 0x05
	SNDC_TRAINING    = 0x06
	SNDC_FORMATS     = 0x07
	SNDC_CRYPTKEY    = 0x08
	SNDC_WAVEENCRYPT = 0x09
	SNDC_UDPWAVE     = 0x0A
	SNDC_UDPWAVELAST = 0x0B
	SNDC_QUALITYMODE = 0x0C
	SNDC_WAVE2       = 0x0D
)

RDPSND PDU types (MS-RDPEA 2.2)

View Source
const (
	TSSNDCAPS_ALIVE  = 0x00000001
	TSSNDCAPS_VOLUME = 0x00000002
	TSSNDCAPS_PITCH  = 0x00000004
)

RDPSND capabilities flags

View Source
const (
	WAVE_FORMAT_PCM   = 0x0001
	WAVE_FORMAT_ADPCM = 0x0002
	WAVE_FORMAT_ALAW  = 0x0006
	WAVE_FORMAT_MULAW = 0x0007
)

Audio format tags

View Source
const (
	RDPSND_VERSION_MAJOR = 0x06
)

RDPSND version

Variables

This section is empty.

Functions

This section is empty.

Types

type AudioFormat

type AudioFormat struct {
	Tag            uint16
	Channels       uint16
	SamplesPerSec  uint32
	AvgBytesPerSec uint32
	BlockAlign     uint16
	BitsPerSample  uint16
	ExtraData      []byte
}

AudioFormat represents a WAVEFORMATEX structure.

func (AudioFormat) IsPCM

func (f AudioFormat) IsPCM() bool

func (AudioFormat) String

func (f AudioFormat) String() string

type DvcAdapter

type DvcAdapter struct {
	// contains filtered or unexported fields
}

DvcAdapter wraps an rdpsnd Handler to work as a DVC channel handler. Each DVC channel gets its own adapter so responses go to the correct channel.

func NewDvcAdapter

func NewDvcAdapter(handler *Handler) *DvcAdapter

NewDvcAdapter creates a DVC adapter that routes audio data to the given Handler.

func (*DvcAdapter) Process

func (a *DvcAdapter) Process(data []byte)

Process implements drdynvc.DvcChannelHandler.

func (*DvcAdapter) SetSendFunc

func (a *DvcAdapter) SetSendFunc(fn func([]byte))

SetSendFunc is called by the DVC client to provide the send function.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler implements the RDPSND protocol over a static virtual channel. It also serves as the DVC audio handler via ProcessData.

func NewHandler

func NewHandler(onAudio func(AudioFormat, []byte)) *Handler

NewHandler creates a new RDPSND handler. onAudio is called with the active AudioFormat and PCM audio data for each wave.

func (*Handler) GetType

func (h *Handler) GetType() (string, uint32)

func (*Handler) Process

func (h *Handler) Process(s []byte)

Process handles data from the static virtual channel (already reassembled).

func (*Handler) ProcessData

func (h *Handler) ProcessData(data []byte)

ProcessData processes a reassembled RDPSND PDU payload. This is used by both the static VChannel path and the DVC path.

func (*Handler) Sender

func (h *Handler) Sender(s core.ChannelSender)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL