Adds the explicit Windows WGC/D3D11 hardware-only Media Foundation H.264 source, process-tree audio, direct Go/Pion fanout, source-aware UI/gate, and unique evaluation package helper. Browser VP8 remains the default. Local acceptance and bounded real-device evidence are recorded in the PR; GitHub jobs were billing-blocked before executing any step.
57 lines
1.3 KiB
Go
57 lines
1.3 KiB
Go
package windowcapture
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
var ErrUnavailable = errors.New("Windows 11 window capture is unavailable")
|
|
|
|
type Target struct {
|
|
WindowHandle uint64
|
|
PID uint32
|
|
CreationTime uint64
|
|
Title string
|
|
}
|
|
|
|
type PCMChunk struct {
|
|
Timestamp100ns uint64
|
|
Duration100ns uint64
|
|
Data []byte
|
|
}
|
|
|
|
type H264AccessUnit struct {
|
|
KeyFrame bool
|
|
Timestamp100ns uint64
|
|
Duration100ns uint64
|
|
Data []byte
|
|
}
|
|
|
|
type Status struct {
|
|
State string `json:"state"`
|
|
HardwareOnly bool `json:"hardwareOnly"`
|
|
AdapterIndex *uint `json:"adapterIndex,omitempty"`
|
|
AdapterName string `json:"adapterName,omitempty"`
|
|
AdapterLUID string `json:"adapterLuid,omitempty"`
|
|
MFTIndex *uint `json:"mftIndex,omitempty"`
|
|
MFTName string `json:"mftName,omitempty"`
|
|
MFTCLSID string `json:"mftClsid,omitempty"`
|
|
ProfileLevelID string `json:"profileLevelId,omitempty"`
|
|
Width int `json:"width,omitempty"`
|
|
Height int `json:"height,omitempty"`
|
|
FPS int `json:"fps,omitempty"`
|
|
}
|
|
|
|
type Provider interface {
|
|
List(context.Context) ([]Target, error)
|
|
CaptureAudio(context.Context, Target, func(PCMChunk) error) error
|
|
CaptureWindow(
|
|
context.Context,
|
|
Target,
|
|
<-chan struct{},
|
|
func(PCMChunk) error,
|
|
func(H264AccessUnit) error,
|
|
func(Status) error,
|
|
) error
|
|
}
|