mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-12-24 13:48:04 +08:00
- 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>
26 lines
468 B
Go
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)
|
|
}
|