forked from futzu/cuei
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pids.go
49 lines (41 loc) · 965 Bytes
/
pids.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
package cuei
// Pids holds collections of pids by type for cuei.Stream.
type Pids struct {
PmtPids []uint16
PcrPids []uint16
Scte35Pids []uint16
}
func (pids *Pids) isPmtPid(pid uint16) bool {
return isIn(pids.PmtPids, pid)
}
func (pids *Pids) addPmtPid(pid uint16) {
if !pids.isPmtPid(pid) {
pids.PmtPids = append(pids.PmtPids, pid)
}
}
func (pids *Pids) isPcrPid(pid uint16) bool {
return isIn(pids.PcrPids, pid)
}
func (pids *Pids) addPcrPid(pid uint16) {
if !pids.isPcrPid(pid) {
pids.PcrPids = append(pids.PcrPids, pid)
}
}
func (pids *Pids) isScte35Pid(pid uint16) bool {
return isIn(pids.Scte35Pids, pid)
}
func (pids *Pids) addScte35Pid(pid uint16) {
if !(pids.isScte35Pid(pid)) {
pids.Scte35Pids = append(pids.Scte35Pids, pid)
}
}
func (pids *Pids) delScte35Pid(pid uint16) {
n := 0
for _, val := range pids.Scte35Pids {
if val != pid {
pids.Scte35Pids[n] = val
n++
}
}
pids.Scte35Pids = pids.Scte35Pids[:n]
}