From 762251329bca80422a8e65d0cdb36e86e84883cf Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 27 九月 2019 11:11:45 +0800 Subject: [PATCH] bug fix --- goffmpeg.go | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/goffmpeg.go b/goffmpeg.go index 1f68e1c..c341b73 100644 --- a/goffmpeg.go +++ b/goffmpeg.go @@ -75,7 +75,37 @@ // New 2nd new func New(conf Config) *GoFFMPEG { - f := C.wrap_fn_create() + + var l *C.char + + logit := 0 + f := C.wrap_fn_create(C.int(logit), l) + + if f == nil { + return nil + } + if conf.Scale != 0 && conf.Width != 0 && conf.Height != 0 { + C.wrap_fn_scale(f, C.int(conf.Width), C.int(conf.Height), C.int(conf.Scale)) + } + if conf.GB { + C.wrap_fn_run_gb28181(f) + } + if conf.CPU { + C.wrap_fn_use_cpu(f) + } + + return &GoFFMPEG{ + ffmpeg: f, + } +} + +// NewWithLog log +func NewWithLog(conf Config, logfile string) *GoFFMPEG { + lf := C.CString(logfile) + defer C.free(unsafe.Pointer(lf)) + + logit := 1 + f := C.wrap_fn_create(C.int(logit), lf) if f == nil { return nil } -- Gitblit v1.8.0