mirror of https://bitbucket.org/ausocean/av.git
stream/mts: starting to work out meta logistics in encoder.go and added incomplete AddDescriptor function in psi package
This commit is contained in:
parent
aea41fb710
commit
d107231224
|
@ -82,43 +82,6 @@ var (
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
// standardPmtTimeLocation is a standard PMT with time and location
|
||||
// descriptors, but time and location fields zeroed out.
|
||||
standardPmtTimeLocation = psi.PSI{
|
||||
Pf: 0x00,
|
||||
Tid: 0x02,
|
||||
Ssi: true,
|
||||
Sl: 0x3e,
|
||||
Tss: &psi.TSS{
|
||||
Tide: 0x01,
|
||||
V: 0,
|
||||
Cni: true,
|
||||
Sn: 0,
|
||||
Lsn: 0,
|
||||
Sd: &psi.PMT{
|
||||
Pcrpid: 0x0100,
|
||||
Pil: psi.PmtTimeLocationPil,
|
||||
Pd: []psi.Desc{
|
||||
{
|
||||
Dt: psi.TimeDescTag,
|
||||
Dl: psi.TimeDataSize,
|
||||
Dd: make([]byte, psi.TimeDataSize),
|
||||
},
|
||||
{
|
||||
Dt: psi.LocationDescTag,
|
||||
Dl: psi.LocationDataSize,
|
||||
Dd: make([]byte, psi.LocationDataSize),
|
||||
},
|
||||
},
|
||||
Essd: &psi.ESSD{
|
||||
St: 0x1b,
|
||||
Epid: 0x0100,
|
||||
Esil: 0x00,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -162,13 +125,24 @@ func (tl *timeLocation) Location() string {
|
|||
return l
|
||||
}
|
||||
|
||||
func updateMeta(b []byte) error {
|
||||
var p psi.PSIBytes
|
||||
p = b
|
||||
// TODO: get length of meta data and format appropriately
|
||||
metaLen := 0
|
||||
metaData := ""
|
||||
|
||||
p.AddDescriptor(psi.MetadataTag, metaLen, metaData)
|
||||
return nil
|
||||
}
|
||||
|
||||
// MetData will hold time and location data which may be set externally if
|
||||
// this data is available. It is then inserted into mpegts packets outputted.
|
||||
var MetaData timeLocation
|
||||
|
||||
var (
|
||||
patTable = standardPat.Bytes()
|
||||
pmtTable = standardPmtTimeLocation.Bytes()
|
||||
pmtTable = standardPmt.Bytes()
|
||||
)
|
||||
|
||||
// Time related constants.
|
||||
|
@ -283,15 +257,7 @@ func (e *Encoder) writePSI() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Update pmt table time and location.
|
||||
err = psi.UpdateTime(pmtTable, MetaData.TimeStamp())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = psi.UpdateLocation(pmtTable, MetaData.Location())
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
updateMeta(pmtTable)
|
||||
|
||||
// Create mts packet from pmt table.
|
||||
pmtPkt := Packet{
|
||||
|
|
|
@ -68,6 +68,14 @@ const (
|
|||
crcSize = 4
|
||||
)
|
||||
|
||||
const MetadataTag = 0x26
|
||||
|
||||
type PSIBytes []byte
|
||||
|
||||
func (p *PSIBytes) AddDescriptor(tag, len int, data string) {
|
||||
|
||||
}
|
||||
|
||||
// Program specific information
|
||||
type PSI struct {
|
||||
Pf byte // Point field
|
||||
|
|
Loading…
Reference in New Issue