mirror of https://bitbucket.org/ausocean/av.git
stream/mts/psi.go: added more to AddDescriptor and added signature for edistDesc
This commit is contained in:
parent
ecf7263bc1
commit
6f421ab706
|
@ -252,7 +252,6 @@ func (e *Encoder) ccFor(pid int) byte {
|
|||
func updateMeta(b []byte) error {
|
||||
var p psi.PSIBytes
|
||||
p = b
|
||||
// TODO: get length of meta data and format appropriately
|
||||
m := meta.Format()
|
||||
p.AddDescriptor(psi.MetadataTag, len(m), m)
|
||||
return nil
|
||||
|
|
|
@ -26,6 +26,12 @@ LICENSE
|
|||
|
||||
package psi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/Comcast/gots/psi"
|
||||
)
|
||||
|
||||
const (
|
||||
PacketSize = 184 // packet size of a psi.
|
||||
)
|
||||
|
@ -68,11 +74,39 @@ const (
|
|||
crcSize = 4
|
||||
)
|
||||
|
||||
const (
|
||||
SectionLenIdx1 = 2
|
||||
SectionLenIdx2 = 3
|
||||
)
|
||||
|
||||
const (
|
||||
SectionLenMask1 = 0x03
|
||||
)
|
||||
|
||||
const MetadataTag = 0x26
|
||||
|
||||
type PSIBytes []byte
|
||||
|
||||
func (p *PSIBytes) AddDescriptor(tag, len int, data []byte) {
|
||||
func (p *PSIBytes) AddDescriptor(tag int, data []byte) error {
|
||||
// first check that we actually have table syntax section
|
||||
// NB: if table syntax section doesn't exist (unlikely I think) then we could
|
||||
// just add it
|
||||
|
||||
// Check that this is actually a PMT
|
||||
if psi.TableID(*p) != pmtID {
|
||||
return errors.New("trying to add descriptor, but not pmt")
|
||||
}
|
||||
|
||||
if !p.editDesc(tag, data) {
|
||||
|
||||
}
|
||||
// if exists update
|
||||
// otherwise add
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PSIBytes) editDesc(tag int, data []byte) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Program specific information
|
||||
|
|
Loading…
Reference in New Issue