Files
monibuca/plugin/hls/pkg/ts-in-file.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

35 lines
491 B
Go

package hls
import (
"os"
"path/filepath"
)
type TsInFile struct {
TsInMemory
file *os.File
path string
closed bool
}
func (ts *TsInFile) Open(path string) (err error) {
dir := filepath.Dir(path)
if err = os.MkdirAll(dir, 0755); err != nil {
return
}
ts.file, err = os.Create(path)
if err != nil {
return err
}
ts.path = path
return
}
func (ts *TsInFile) Close() error {
if ts.closed || ts.file == nil {
return nil
}
ts.closed = true
return ts.file.Close()
}