From faff95860fec680d5fd0a518e4cd240a99381257 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期三, 25 九月 2019 17:13:37 +0800
Subject: [PATCH] add log

---
 goffmpeg.go |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/goffmpeg.go b/goffmpeg.go
index 1f68e1c..5fca4a9 100644
--- a/goffmpeg.go
+++ b/goffmpeg.go
@@ -75,7 +75,34 @@
 
 // New 2nd new
 func New(conf Config) *GoFFMPEG {
-	f := C.wrap_fn_create()
+
+	var l *C.char
+	f := C.wrap_fn_create(0, 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))
+
+	f := C.wrap_fn_create(1, lf)
 	if f == nil {
 		return nil
 	}

--
Gitblit v1.8.0