-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstub_codec.go
More file actions
46 lines (34 loc) · 1.33 KB
/
stub_codec.go
File metadata and controls
46 lines (34 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//go:build !cgo || !openh264
package codec
import (
"errors"
"log/slog"
)
var errOpenH264Disabled = errors.New("OpenH264 codec unavailable: built without openh264 build tag (use -tags openh264)")
func init() {
slog.Debug("codec: OpenH264 not available (built without openh264 tag)")
}
// OpenH264Decoder is a stub for builds without the openh264 build tag.
type OpenH264Decoder struct{}
// NewOpenH264Decoder returns an error when the openh264 build tag is not set.
func NewOpenH264Decoder() (*OpenH264Decoder, error) {
return nil, errOpenH264Disabled
}
// Decode is a stub that always returns an error.
func (d *OpenH264Decoder) Decode(data []byte) ([]byte, int, int, error) {
return nil, 0, 0, errOpenH264Disabled
}
// Close is a no-op stub.
func (d *OpenH264Decoder) Close() {}
// OpenH264Encoder is a stub for builds without the openh264 build tag.
type OpenH264Encoder struct{}
// NewOpenH264Encoder returns an error when the openh264 build tag is not set.
func NewOpenH264Encoder(width, height, bitrate, fpsNum, fpsDen int) (*OpenH264Encoder, error) {
return nil, errOpenH264Disabled
}
// Encode is a stub that always returns an error.
func (e *OpenH264Encoder) Encode(yuv []byte, pts int64, forceIDR bool) ([]byte, bool, error) {
return nil, false, errOpenH264Disabled
}
// Close is a no-op stub.
func (e *OpenH264Encoder) Close() {}