File: option.go

package info (click to toggle)
golang-github-pion-interceptor 0.1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 764 kB
  • sloc: makefile: 8
file content (66 lines) | stat: -rw-r--r-- 1,454 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
package packetdump

import (
	"io"

	"github.com/pion/logging"
)

// PacketDumperOption can be used to configure SenderInterceptor
type PacketDumperOption func(d *PacketDumper) error

// Log sets a logger for the interceptor
func Log(log logging.LeveledLogger) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.log = log
		return nil
	}
}

// RTPWriter sets the io.Writer on which RTP packets will be dumped.
func RTPWriter(w io.Writer) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.rtpStream = w
		return nil
	}
}

// RTCPWriter sets the io.Writer on which RTCP packets will be dumped.
func RTCPWriter(w io.Writer) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.rtcpStream = w
		return nil
	}
}

// RTPFormatter sets the RTP format
func RTPFormatter(f RTPFormatCallback) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.rtpFormat = f
		return nil
	}
}

// RTCPFormatter sets the RTCP format
func RTCPFormatter(f RTCPFormatCallback) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.rtcpFormat = f
		return nil
	}
}

// RTPFilter sets the RTP filter.
func RTPFilter(callback RTPFilterCallback) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.rtpFilter = callback
		return nil
	}
}

// RTCPFilter sets the RTCP filter.
func RTCPFilter(callback RTCPFilterCallback) PacketDumperOption {
	return func(d *PacketDumper) error {
		d.rtcpFilter = callback
		return nil
	}
}