package goffmpeg /* #include #include "libcffmpeg.h" */ import "C" import "unsafe" /////////////// for decoder // Decode decode jpeg file // return val: -1 open error; -2, find stream error; -3, converter create error func Decode(input string, gb bool) ([]byte, int, int) { in := C.CString(input) defer C.free(unsafe.Pointer(in)) withGB := 0 if gb { withGB = 1 } var width C.int var height C.int p := C.wrap_fn_decode(in, C.int(withGB), &width, &height) defer C.free(p) if width > 0 && height > 0 { data := C.GoBytes(p, width*height*3) wid := int(width) hei := int(height) return data, wid, hei } return nil, int(width), int(height) }