mirror of https://bitbucket.org/ausocean/av.git
psi: wrote bytes() for pat
This commit is contained in:
parent
1fd9bed1e4
commit
fa0498bc52
|
@ -1,9 +1,10 @@
|
|||
package psi
|
||||
|
||||
const (
|
||||
ESSDHeadLen = 5
|
||||
DescHeadLen = 2
|
||||
PMTHeadLen = 2
|
||||
ESSDDefLen = 5
|
||||
DescDefLen = 2
|
||||
PMTDefLen = 4
|
||||
PATLen = 4
|
||||
)
|
||||
|
||||
// Program specific information
|
||||
|
@ -73,11 +74,17 @@ func (p *PSI) Bytes() (out []byte) {
|
|||
func (t *TSS) Fill(s []byte) {
|
||||
}
|
||||
|
||||
func (p *PAT) Fill(s []byte) {
|
||||
func (p *PAT) Bytes() []byte {
|
||||
out := make([]byte, PATLen)
|
||||
out[0] = byte(p.pn >> 8)
|
||||
out[1] = byte(p.pn)
|
||||
out[2] = 0xe0 | (0x1f & byte(p.pmpid>>8))
|
||||
out[3] = byte(p.pmpid)
|
||||
return out
|
||||
}
|
||||
|
||||
func (p *PMT) Bytes() []byte {
|
||||
out := make([]byte, PMTHeadLen)
|
||||
out := make([]byte, PMTDefLen)
|
||||
out[0] = 0xe0 | (0x1f & byte(p.pcrpid>>8))
|
||||
out[1] = byte(p.pcrpid)
|
||||
out[2] = 0xf0 | (0x03 & byte(p.pil>>8))
|
||||
|
@ -92,7 +99,7 @@ func (p *PMT) Bytes() []byte {
|
|||
}
|
||||
|
||||
func (d *Desc) Bytes() []byte {
|
||||
out := make([]byte, DescHeadLen)
|
||||
out := make([]byte, DescDefLen)
|
||||
out[0] = d.dt
|
||||
out[1] = d.dl
|
||||
out = append(out, d.dd...)
|
||||
|
@ -100,7 +107,7 @@ func (d *Desc) Bytes() []byte {
|
|||
}
|
||||
|
||||
func (e *ESSD) Bytes() []byte {
|
||||
out := make([]byte, ESSDHeadLen)
|
||||
out := make([]byte, ESSDDefLen)
|
||||
out[0] = e.st
|
||||
out[1] = 0xe0 | (0x1f & byte(e.epid>>8))
|
||||
out[2] = byte(e.epid)
|
||||
|
|
Loading…
Reference in New Issue