From e878e92811a2dbfb6b4d3f7b2c357435f56e28db Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期日, 29 九月 2019 10:27:21 +0800 Subject: [PATCH] add trytime --- goffmpeg.go | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/goffmpeg.go b/goffmpeg.go index 1f68e1c..d23bf80 100644 --- a/goffmpeg.go +++ b/goffmpeg.go @@ -75,7 +75,33 @@ // New 2nd new func New(conf Config) *GoFFMPEG { + f := C.wrap_fn_create() + + 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)) + + f := C.wrap_fn_create2(lf) if f == nil { return nil } -- Gitblit v1.8.0