func NewDisplay(title string, width, height int) (*Display, error) { d := Display{frame: make(chan *C.AVFrame)} d.width = C.int(width) d.height = C.int(height) d.screen = C.SDL_SetVideoMode(d.width, d.height, 0, 0) d.overlay = C.SDL_CreateYUVOverlay(d.width, d.height, C.SDL_IYUV_OVERLAY, d.screen) t := C.CString(title) C.SDL_WM_SetCaption(t, (*C.char)(null)) C.free(unsafe.Pointer(t)) return &d, nil }
// This function creates a video output overlay // Calling the returned surface an overlay is something of a misnomer because // the contents of the display surface underneath the area where the overlay // is shown is undefined - it may be overwritten with the converted YUV data. func CreateYUVOverlay(width, height int, format uint32, display *C.SDL_Surface) *C.SDL_Overlay { return C.SDL_CreateYUVOverlay(C.int(width), C.int(height), C.Uint32(format), display) }