mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-11-09 17:44:43 -06:00
Use per-codec capture locks and encoder backpressure, simplify frame ownership, and follow HDMI input dimensions. Refresh prebuilt video libraries while preserving server-only builds and deployment instructions.
27 lines
459 B
Go
27 lines
459 B
Go
package common
|
|
|
|
import "sync"
|
|
|
|
type VideoFrame struct {
|
|
Data []byte
|
|
Result int
|
|
Timestamp int64
|
|
release func()
|
|
once sync.Once
|
|
}
|
|
|
|
func NewVideoFrame(data []byte, result int, timestamp int64, release func()) *VideoFrame {
|
|
return &VideoFrame{Data: data, Result: result, Timestamp: timestamp, release: release}
|
|
}
|
|
|
|
func (f *VideoFrame) Release() {
|
|
if f == nil {
|
|
return
|
|
}
|
|
f.once.Do(func() {
|
|
if f.release != nil {
|
|
f.release()
|
|
}
|
|
})
|
|
}
|