track.go 544 B

1234567891011121314151617181920212223242526
  1. package ps
  2. import (
  3. "net"
  4. "m7s.live/engine/v4/common"
  5. "m7s.live/engine/v4/track"
  6. "m7s.live/engine/v4/util"
  7. )
  8. type PSTrack struct {
  9. track.RecycleData[*util.ListItem[util.Buffer]]
  10. PSM util.Buffer `json:"-" yaml:"-"`
  11. }
  12. func (ps *PSTrack) GetPSM() (result net.Buffers) {
  13. psmLen := ps.PSM.Len()
  14. return append(net.Buffers{[]byte{0, 0, 1, 0xbc, byte(psmLen >> 8), byte(psmLen)}}, ps.PSM)
  15. }
  16. func NewPSTrack(s common.IStream) *PSTrack {
  17. result := &PSTrack{}
  18. result.Init(1000)
  19. result.SetStuff("ps", s)
  20. s.AddTrack(result)
  21. return result
  22. }