package goffmpeg /* #include */ import "C" import ( "unsafe" ) // RecorderFunc C function pointer GO type RecorderFunc func(*string, *int) // DecoderFunc C func pointer go type DecoderFunc func(*[]byte, *int, *int) var ( funcRecorder RecorderFunc funcDecoder DecoderFunc ) //export cb_rec_proxy func cb_rec_proxy(path *C.char, index C.int) { if funcRecorder != nil { p := C.GoString(path) i := int(index) funcRecorder(&p, &i) } } //export cb_dec_proxy func cb_dec_proxy(data *C.uchar, w, h C.int) { if funcDecoder != nil { d := C.GoBytes(unsafe.Pointer(data), w*h*3) C.free(unsafe.Pointer(data)) wid := int(w) hei := int(h) funcDecoder(&d, &wid, &hei) } }