2023-10-24 21:24:55 CST W43D2

This commit is contained in:
aggresss
2023-10-24 21:24:55 +08:00
parent e163918619
commit 4329c27b55
47 changed files with 3577 additions and 165 deletions

View File

@@ -5,6 +5,7 @@ import (
"io"
"os"
"syscall"
"unsafe"
ffmpeg "github.com/qrtc/ffmpeg-dev-go"
)
@@ -16,8 +17,9 @@ const (
func pgmSave(buf *uint8, wrap, xsize, ysize int32, filename string) {
f, _ := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755)
fmt.Fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255)
bufSlice := unsafe.Slice(buf, xsize*ysize)
for i := int32(0); i < ysize; i++ {
f.Write(ffmpeg.ByteSliceWithOffset(buf, i+wrap, xsize))
f.Write(bufSlice[i+wrap : i+wrap+xsize])
}
f.Close()
}