Files
monibuca/plugin/hls/pkg/ts-in-memory.go
langhuihui 8a9fffb987 refactor: frame converter and mp4 track improvements
- Refactor frame converter implementation
- Update mp4 track to use ICodex
- General refactoring and code improvements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 19:55:37 +08:00

26 lines
468 B
Go

package hls
import (
"io"
"m7s.live/v5/pkg/codec"
mpegts "m7s.live/v5/pkg/format/ts"
"m7s.live/v5/pkg/util"
)
type TsInMemory struct {
PMT util.Buffer
util.RecyclableMemory
}
func (ts *TsInMemory) WritePMTPacket(audio, video codec.FourCC) {
ts.PMT.Reset()
mpegts.WritePMTPacket(&ts.PMT, video, audio)
}
func (ts *TsInMemory) WriteTo(w io.Writer) (int64, error) {
w.Write(mpegts.DefaultPATPacket)
w.Write(ts.PMT)
return ts.RecyclableMemory.WriteTo(w)
}