func (d *Display) routine() { rect := C.SDL_Rect{x: 0, y: 0, w: C.Uint16(d.width), h: C.Uint16(d.height)} for d.rendering { frame := <-d.frame C.SDL_LockYUVOverlay(d.overlay) pixels := (*[1 << 30]*C.Uint8)(unsafe.Pointer(d.overlay.pixels)) pitches := (*[1 << 30]C.Uint8)(unsafe.Pointer(d.overlay.pitches)) pixels[0] = (*C.Uint8)(frame.data[0]) pixels[1] = (*C.Uint8)(frame.data[1]) pixels[2] = (*C.Uint8)(frame.data[2]) pitches[0] = (C.Uint8)(frame.linesize[0]) pitches[1] = (C.Uint8)(frame.linesize[1]) pitches[2] = (C.Uint8)(frame.linesize[2]) C.SDL_UnlockYUVOverlay(d.overlay) C.SDL_DisplayYUVOverlay(d.overlay, &rect) } }
func UnlockYUVOverlay(overlay *C.SDL_Overlay) { C.SDL_UnlockYUVOverlay(overlay) }