From 278634c0d2eeba9e3fcc3b4cd56ddfb3323277d7 Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期二, 10 三月 2020 10:08:20 +0800 Subject: [PATCH] compatible to local files --- goffmpeg.go | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/goffmpeg.go b/goffmpeg.go index 4353113..bca75d2 100644 --- a/goffmpeg.go +++ b/goffmpeg.go @@ -39,6 +39,12 @@ ScaleSpline = 0x400 ) +// SrcFormat format NV +const SrcFormat = 23 + +// DstFormat format +const DstFormat = 3 + var libcffmpeg C.libcffmpeg // InitFFmpeg init ffmepg @@ -122,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)) @@ -134,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