Documentation
¶
Index ¶
- type Camera
- type Mode
- type Option
- func WithBitrates(bestKbps, previewKbps int) Option
- func WithEncoder(name string, args ...string) Option
- func WithH264Profile(profile string) Option
- func WithInputArgs(args ...string) Option
- func WithInputCodec(codec string) Option
- func WithInputFormat(format string) Option
- func WithLogger(l gwebrtp.Logger) Option
- func WithPreviewHeight(height int) Option
- func WithStreamBuffer(size int) Option
- func WithTargetFPS(fps float64) Option
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera owns a single FFmpeg process that exposes the best stream and a preview stream.
func Open ¶
Open probes the device, selects the best source mode automatically, and starts one split pipeline.
func (*Camera) Done ¶
func (c *Camera) Done() <-chan struct{}
Done closes when the FFmpeg process exits or the camera is closed.
func (*Camera) SourceMode ¶
SourceMode returns the selected camera input mode.
type Mode ¶
type Mode struct {
Width int `json:"width"`
Height int `json:"height"`
FrameRate float64 `json:"frameRate"`
}
Mode is the selected source mode for the camera.
type Option ¶
type Option func(*options)
Option customizes how usbauto selects and publishes streams.
func WithBitrates ¶
WithBitrates sets optional encoder bitrates in Kbps for the best and preview branches.
func WithEncoder ¶
WithEncoder sets the FFmpeg H264 encoder for both branches.
func WithH264Profile ¶
WithH264Profile sets the output H264 profile for both branches.
func WithInputArgs ¶
WithInputArgs appends extra arguments before FFmpeg's -i.
func WithInputCodec ¶
WithInputCodec sets the preferred camera-side codec or pixel format before FFmpeg decodes it. Examples: "mjpeg", "h264", "yuyv422".
func WithInputFormat ¶
WithInputFormat overrides the inferred FFmpeg input format.
func WithPreviewHeight ¶
WithPreviewHeight sets the scaled preview height. Aspect ratio is preserved automatically.
func WithStreamBuffer ¶
WithStreamBuffer changes the per-stream access-unit channel depth.
func WithTargetFPS ¶
WithTargetFPS sets the preferred source FPS when choosing the best input mode.
type Stream ¶
type Stream struct {
Name string
Width int
Height int
FrameRate float64
AccessUnits <-chan gwebrtp.H264AccessUnit
Keyframes <-chan gwebrtp.H264AccessUnit
}
Stream is one branch of the USB camera pipeline.