mirror of
https://github.com/go-gst/go-gst.git
synced 2025-09-26 20:11:18 +08:00
switch to github.com/go-gst/go-pointer
This commit is contained in:
@@ -16,6 +16,12 @@ import (
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
)
|
||||
|
||||
// #include <stdio.h>
|
||||
// #include <stdlib.h>
|
||||
//
|
||||
// void __lsan_do_leak_check(void);
|
||||
import "C"
|
||||
|
||||
func run(ctx context.Context) error {
|
||||
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
|
||||
defer cancel()
|
||||
@@ -83,14 +89,10 @@ func run(ctx context.Context) error {
|
||||
|
||||
go mainloop.Run()
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
|
||||
mainloop.Quit()
|
||||
}()
|
||||
|
||||
<-ctx.Done()
|
||||
|
||||
mainloop.Quit()
|
||||
|
||||
pipeline.BlockSetState(gst.StateNull)
|
||||
|
||||
gst.Deinit()
|
||||
@@ -110,6 +112,18 @@ func main() {
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
runtime.GC()
|
||||
|
||||
C.__lsan_do_leak_check()
|
||||
|
||||
prof := pprof.Lookup("go-glib-reffed-objects")
|
||||
|
||||
|
11
go.mod
11
go.mod
@@ -1,11 +1,10 @@
|
||||
module github.com/go-gst/go-gst
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
toolchain go1.23.2
|
||||
|
||||
require github.com/mattn/go-pointer v0.0.1
|
||||
|
||||
require github.com/go-gst/go-glib v1.4.1-0.20241125224403-1748a2b7e9e1
|
||||
require (
|
||||
github.com/go-gst/go-glib v1.4.1-0.20241127164645-1aa7cfba8dcf
|
||||
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c
|
||||
)
|
||||
|
||||
require golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
|
||||
|
8
go.sum
8
go.sum
@@ -1,6 +1,6 @@
|
||||
github.com/go-gst/go-glib v1.4.1-0.20241125224403-1748a2b7e9e1 h1:0foANpP83iNay7XN5lp3Ug3ywP7zQterXoOOtEH0CHA=
|
||||
github.com/go-gst/go-glib v1.4.1-0.20241125224403-1748a2b7e9e1/go.mod h1:GUIpWmkxQ1/eL+FYSjKpLDyTZx6Vgd9nNXt8dA31d5M=
|
||||
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
|
||||
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
|
||||
github.com/go-gst/go-glib v1.4.1-0.20241127164645-1aa7cfba8dcf h1:mffP/eHbVYx9C1dAV7ouqdE48B5EbARTPVAzkqIu09Q=
|
||||
github.com/go-gst/go-glib v1.4.1-0.20241127164645-1aa7cfba8dcf/go.mod h1:ZWT4LXOO2PH8lSNu/dR5O2yoNQJKEgmijNa2d7nByK8=
|
||||
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c h1:x8kKRVDmz5BRlolmDZGcsuZ1l+js6TRL3QWBJjGVctM=
|
||||
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c/go.mod h1:qKw5ZZ0U58W6PU/7F/Lopv+14nKYmdXlOd7VnAZ17Mk=
|
||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
|
||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
func getSinkCbsFromPtr(userData C.gpointer) *SinkCallbacks {
|
||||
|
@@ -21,7 +21,7 @@ import (
|
||||
"errors"
|
||||
"unsafe"
|
||||
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
"github.com/go-gst/go-gst/gst/base"
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
"github.com/go-gst/go-gst/gst/base"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// SourceCallbacks represents callbacks to configure on an AppSource.
|
||||
|
@@ -60,7 +60,7 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
)
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
)
|
||||
|
@@ -13,7 +13,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
//export goElementCallAsync
|
||||
|
@@ -26,7 +26,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// GetMaxBufferMemory returns the maximum amount of memory a buffer can hold.
|
||||
|
@@ -15,7 +15,7 @@ import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// BufferList is a go wrapper around a GstBufferList for grouping Buffers
|
||||
|
@@ -30,7 +30,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// Bus is a Go wrapper around a GstBus. It provides convenience methods for
|
||||
|
@@ -18,7 +18,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// TypeCaps is the static Glib Type for a GstCaps.
|
||||
|
@@ -26,7 +26,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
type ClockTime C.GstClockTime
|
||||
|
@@ -47,7 +47,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// Element is a Go wrapper around a GstElement.
|
||||
|
@@ -81,10 +81,11 @@ import "C"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// PadFuncMap is an type of map for registering callbacks to a pad instance.
|
||||
@@ -1138,7 +1139,13 @@ func (p *PadProbeInfo) GetEvent() *Event {
|
||||
if ev == nil {
|
||||
return nil
|
||||
}
|
||||
return wrapEvent(ev)
|
||||
|
||||
event := wrapEvent(ev)
|
||||
|
||||
event.Ref()
|
||||
runtime.SetFinalizer(event, (*Event).Unref)
|
||||
|
||||
return event
|
||||
}
|
||||
|
||||
// GetQuery returns the query, if any, inside this probe info.
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
func getParent(parent *C.GstObject) *Object {
|
||||
|
@@ -54,7 +54,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// PluginMetadata represents the information to include when registering a new plugin
|
||||
|
@@ -20,7 +20,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
type PromiseResult int
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// Structure is a go implementation of a C GstStructure.
|
||||
@@ -212,8 +212,7 @@ func (s *Structure) ToGValue() (*glib.Value, error) {
|
||||
// marshalStructure is used to extract the GstStructure from a GValue.
|
||||
func marshalStructure(p unsafe.Pointer) (interface{}, error) {
|
||||
c := C.gst_value_get_structure(toGValue(p))
|
||||
obj := (*C.GstStructure)(unsafe.Pointer(c))
|
||||
return structureFromGlibNone(obj), nil
|
||||
return structureFromGlibNone(c), nil
|
||||
}
|
||||
|
||||
func wrapStructure(st *C.GstStructure) *Structure {
|
||||
|
@@ -19,7 +19,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-glib/glib"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// TagList is a go wrapper around a GstTagList. For now, until the rest of the methods are
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
//export goVideoGDestroyNotifyFunc
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
gopointer "github.com/mattn/go-pointer"
|
||||
gopointer "github.com/go-gst/go-pointer"
|
||||
)
|
||||
|
||||
// ConvertSampleCallback represents a callback from a video convert opereration.
|
||||
|
Reference in New Issue
Block a user