From f93ee1a42e8c47e472332287b7350b66a6b0fa11 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 24 七月 2020 18:28:57 +0800 Subject: [PATCH] 保存触发id之后的视频作为触发视频 --- goffmpeg.go | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/goffmpeg.go b/goffmpeg.go index 5ed9343..bca75d2 100644 --- a/goffmpeg.go +++ b/goffmpeg.go @@ -128,6 +128,14 @@ C.wrap_fn_run(unsafe.Pointer(libcffmpeg), h.ffmpeg, in) } +// Run2 ffmpeg +func (h *GoFFMPEG) Run2(input string, minDuration int) { + in := C.CString(input) + defer C.free(unsafe.Pointer(in)) + + C.wrap_fn_run(unsafe.Pointer(libcffmpeg), h.ffmpeg, in) +} + // FPS fps func (h *GoFFMPEG) FPS() int { return int(C.wrap_fn_fps(unsafe.Pointer(libcffmpeg), h.ffmpeg)) @@ -140,3 +148,16 @@ } C.free(unsafe.Pointer(p)) } + +// GetGBJpg Get GB28181 Jpg +func GetGBJpg(rtspUrl string) []byte { + rtsp := C.CString(rtspUrl) + defer C.free(unsafe.Pointer(rtsp)) + var jpgLen C.int + + pic := C.wrap_fn_get_gb28181_pic(unsafe.Pointer(libcffmpeg), rtsp, &jpgLen) + defer C.free(unsafe.Pointer(pic)) + + retJpg := C.GoBytes(unsafe.Pointer(pic), jpgLen) + return retJpg +} -- Gitblit v1.8.0