-
Notifications
You must be signed in to change notification settings - Fork 180
/
mjpeg.go
53 lines (42 loc) · 1.12 KB
/
mjpeg.go
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
47
48
49
50
51
52
53
package format
import (
"github.com/pion/rtp"
"github.com/aler9/gortsplib/v2/pkg/formatdecenc/rtpmjpeg"
)
// MJPEG is a format that uses the Motion-JPEG codec.
type MJPEG struct{}
// String implements Format.
func (t *MJPEG) String() string {
return "M-JPEG"
}
// ClockRate implements Format.
func (t *MJPEG) ClockRate() int {
return 90000
}
// PayloadType implements Format.
func (t *MJPEG) PayloadType() uint8 {
return 26
}
func (t *MJPEG) unmarshal(payloadType uint8, clock string, codec string, rtpmap string, fmtp map[string]string) error {
return nil
}
// Marshal implements Format.
func (t *MJPEG) Marshal() (string, map[string]string) {
return "JPEG/90000", nil
}
// PTSEqualsDTS implements Format.
func (t *MJPEG) PTSEqualsDTS(*rtp.Packet) bool {
return true
}
// CreateDecoder creates a decoder able to decode the content of the format.
func (t *MJPEG) CreateDecoder() *rtpmjpeg.Decoder {
d := &rtpmjpeg.Decoder{}
d.Init()
return d
}
// CreateEncoder creates an encoder able to encode the content of the format.
func (t *MJPEG) CreateEncoder() *rtpmjpeg.Encoder {
e := &rtpmjpeg.Encoder{}
e.Init()
return e
}