mirror of
https://github.com/qrtc/ffmpeg-dev-go.git
synced 2025-10-04 15:23:13 +08:00
2023-10-24 21:24:55 CST W43D2
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user