From f4f467c5a908ddca5d28b61497b8e40c8668fff8 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期二, 07 五月 2019 13:56:15 +0800 Subject: [PATCH] 将c风格改为go风格 --- apipassive.go | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apipassive.go b/apipassive.go index 5bcd8e7..61e67cf 100644 --- a/apipassive.go +++ b/apipassive.go @@ -21,18 +21,17 @@ } // GetInfoRecorder info -func (h *GoFFMPEG) GetInfoRecorder(index *int, path *string) { +func (h *GoFFMPEG) GetInfoRecorder() (int, string) { var i C.int = -1 var l C.int p := C.wrap_fn_info_recorder(h.ffmpeg, &i, &l) if i == -1 { - return + return -1, "" } defer C.free(unsafe.Pointer(p)) - *index = int(i) - *path = C.GoString(p) + return int(i), C.GoString(p) } // BuildDecoder build decoder @@ -41,16 +40,18 @@ } // GetPicDecoder get pic from decoder -func (h *GoFFMPEG) GetPicDecoder(data *[]byte, wid, hei *int) { +func (h *GoFFMPEG) GetPicDecoder() ([]byte, int, int) { var width C.int var height C.int p := C.wrap_fn_decoder_pic(h.ffmpeg, &width, &height) if width == 0 && height == 0 { - return + return nil, 0, 0 } defer C.free(unsafe.Pointer(p)) - *data = C.GoBytes(p, width*height*3) - *wid = int(width) - *hei = int(height) + d := C.GoBytes(p, width*height*3) + wid := int(width) + hei := int(height) + + return d, wid, hei } -- Gitblit v1.8.0