From 88c21b872799a1ae9dd7dd7d20f3811d749d9418 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 26 七月 2019 14:04:22 +0800 Subject: [PATCH] add rec --- apipassive.go | 35 +++++++++++++++++++++++------------ 1 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apipassive.go b/apipassive.go index 769c01f..5f866f5 100644 --- a/apipassive.go +++ b/apipassive.go @@ -5,33 +5,44 @@ #include "libcffmpeg.h" */ import "C" -import "unsafe" +import ( + "unsafe" +) // FireRecorder fire recorder -func (h *GoFFMPEG) FireRecorder(id int64) { - C.wrap_fn_fire_recorder(h.ffmpeg, C.long(id)) +func (h *GoFFMPEG) FireRecorder(sid string, id int64) { + csid := C.CString(sid) + defer C.free(unsafe.Pointer(csid)) + C.wrap_fn_fire_recorder(h.ffmpeg, csid, C.long(id)) } // BuildRecorder build recorder -func (h *GoFFMPEG) BuildRecorder(output string, mind, maxd int) { +func (h *GoFFMPEG) BuildRecorder(sid, output string, mind, maxd int) { out := C.CString(output) defer C.free(unsafe.Pointer(out)) + csid := C.CString(sid) + defer C.free(unsafe.Pointer(csid)) - C.wrap_fn_recorder(h.ffmpeg, out, C.int(mind), C.int(maxd)) + C.wrap_fn_recorder(h.ffmpeg, csid, out, C.int(mind), C.int(maxd)) } // GetInfoRecorder info -func (h *GoFFMPEG) GetInfoRecorder() (int, string) { +func (h *GoFFMPEG) GetInfoRecorder() (string, int, string) { var i C.int = -1 var l C.int - - p := C.wrap_fn_info_recorder(h.ffmpeg, &i, &l) - if p == nil { - return -1, "" - } + var sid *C.char + p := C.wrap_fn_info_recorder(h.ffmpeg, &sid, &i, &l) + // if p == nil { + // return -1, "" + // } + path := C.GoString(p) C.free(unsafe.Pointer(p)) - return int(i), C.GoString(p) + goid := C.GoString(sid) + C.free(unsafe.Pointer(sid)) + // fmt.Println("Go get info : ", path, " len: ", l) + + return goid, int(i), path } // BuildDecoder build decoder -- Gitblit v1.8.0