Squashed commit of the following:

commit 7f46be64521d7cdf4d94409f979143a55acd665a
Author: Avi Zimmerman <avi.zimmerman@gmail.com>
Date:   Thu Jan 7 12:18:37 2021 +0200

    improve plugin interfaces
This commit is contained in:
Avi Zimmerman
2021-01-07 12:19:25 +02:00
parent 681876fd76
commit cbf6279abc
11 changed files with 163 additions and 91 deletions

View File

@@ -19,6 +19,7 @@ import "C"
import (
"path"
"runtime"
"unsafe"
)
// DebugColorFlags are terminal style flags you can use when creating your debugging
@@ -98,14 +99,20 @@ func NewDebugCategory(name string, color DebugColorFlags, description string) *D
func (d *DebugCategory) logDepth(level DebugLevel, message string, depth int, obj *C.GObject) {
function, file, line, _ := runtime.Caller(depth)
cFile := C.CString(path.Base(file))
cFunc := C.CString(runtime.FuncForPC(function).Name())
cMsg := C.CString(message)
defer C.free(unsafe.Pointer(cFile))
defer C.free(unsafe.Pointer(cFunc))
defer C.free(unsafe.Pointer(cMsg))
C.cgoDebugLog(
d.ptr,
C.GstDebugLevel(level),
C.CString(path.Base(file)),
(C.CString(runtime.FuncForPC(function).Name())),
(*C.gchar)(cFile),
(*C.gchar)(cFunc),
C.gint(line),
obj,
C.CString(message),
(*C.gchar)(cMsg),
)
}