From 1518fb1f0e59beedfa32663adb3d0bee302f1ad5 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 26 七月 2019 10:42:26 +0800 Subject: [PATCH] bug fix --- apipassive.go | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apipassive.go b/apipassive.go index 61e67cf..769c01f 100644 --- a/apipassive.go +++ b/apipassive.go @@ -26,10 +26,10 @@ var l C.int p := C.wrap_fn_info_recorder(h.ffmpeg, &i, &l) - if i == -1 { + if p == nil { return -1, "" } - defer C.free(unsafe.Pointer(p)) + C.free(unsafe.Pointer(p)) return int(i), C.GoString(p) } @@ -55,3 +55,20 @@ return d, wid, hei } + +//GetAVPacket get AVPacket +func (h *GoFFMPEG) GetAVPacket() ([]byte, int, int) { + var key C.int + var size C.int + + p := C.wrap_fn_get_avpacket(h.ffmpeg, &size, &key) + if size <= 0 { + return nil, 0, -1 + } + defer C.free(unsafe.Pointer(p)) + d := C.GoBytes(p, size) + s := int(size) + k := int(key) + + return d, s, k +} -- Gitblit v1.8.0