mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-06 16:36:51 +08:00
1333 lines
45 KiB
Go
1333 lines
45 KiB
Go
// Code generated by girgen for GstAllocators-1. DO NOT EDIT.
|
|
|
|
package gstallocators
|
|
|
|
import (
|
|
"runtime"
|
|
"strings"
|
|
"unsafe"
|
|
|
|
"github.com/diamondburned/gotk4/pkg/gobject/v2"
|
|
"github.com/go-gst/go-gst/pkg/gst"
|
|
)
|
|
|
|
// #cgo pkg-config: gstreamer-allocators-1.0
|
|
// #cgo CFLAGS: -Wno-deprecated-declarations
|
|
// #include <gst/allocators/allocators.h>
|
|
import "C"
|
|
|
|
// GType values.
|
|
var (
|
|
TypePhysMemoryAllocator = gobject.Type(C.gst_phys_memory_allocator_get_type())
|
|
TypeDRMDumbAllocator = gobject.Type(C.gst_drm_dumb_allocator_get_type())
|
|
TypeFdAllocator = gobject.Type(C.gst_fd_allocator_get_type())
|
|
TypeShmAllocator = gobject.Type(C.gst_shm_allocator_get_type())
|
|
TypeDmaBufAllocator = gobject.Type(C.gst_dmabuf_allocator_get_type())
|
|
)
|
|
|
|
func init() {
|
|
gobject.RegisterGValueMarshalers([]gobject.TypeMarshaler{
|
|
gobject.TypeMarshaler{T: TypePhysMemoryAllocator, F: marshalPhysMemoryAllocatorInstance},
|
|
gobject.TypeMarshaler{T: TypeDRMDumbAllocator, F: marshalDRMDumbAllocatorInstance},
|
|
gobject.TypeMarshaler{T: TypeFdAllocator, F: marshalFdAllocatorInstance},
|
|
gobject.TypeMarshaler{T: TypeShmAllocator, F: marshalShmAllocatorInstance},
|
|
gobject.TypeMarshaler{T: TypeDmaBufAllocator, F: marshalDmaBufAllocatorInstance},
|
|
})
|
|
}
|
|
|
|
// FdMemoryFlags wraps GstFdMemoryFlags
|
|
//
|
|
// Various flags to control the operation of the fd backed memory.
|
|
type FdMemoryFlags C.gint
|
|
|
|
const (
|
|
// FdMemoryFlagNone wraps GST_FD_MEMORY_FLAG_NONE
|
|
//
|
|
// no flag
|
|
FdMemoryFlagNone FdMemoryFlags = 0
|
|
// FdMemoryFlagKeepMapped wraps GST_FD_MEMORY_FLAG_KEEP_MAPPED
|
|
//
|
|
// once the memory is mapped,
|
|
// keep it mapped until the memory is destroyed.
|
|
FdMemoryFlagKeepMapped FdMemoryFlags = 1
|
|
// FdMemoryFlagMapPrivate wraps GST_FD_MEMORY_FLAG_MAP_PRIVATE
|
|
//
|
|
// do a private mapping instead of
|
|
// the default shared mapping.
|
|
FdMemoryFlagMapPrivate FdMemoryFlags = 2
|
|
// FdMemoryFlagDontClose wraps GST_FD_MEMORY_FLAG_DONT_CLOSE
|
|
//
|
|
// don't close the file descriptor when
|
|
// the memory is freed. Since: 1.10
|
|
FdMemoryFlagDontClose FdMemoryFlags = 4
|
|
)
|
|
|
|
// Has returns true if f contains other
|
|
func (f FdMemoryFlags) Has(other FdMemoryFlags) bool {
|
|
return (f & other) == other
|
|
}
|
|
|
|
func (f FdMemoryFlags) String() string {
|
|
if f == 0 {
|
|
return "FdMemoryFlags(0)"
|
|
}
|
|
|
|
var parts []string
|
|
if (f & FdMemoryFlagNone) != 0 {
|
|
parts = append(parts, "FdMemoryFlagNone")
|
|
}
|
|
if (f & FdMemoryFlagKeepMapped) != 0 {
|
|
parts = append(parts, "FdMemoryFlagKeepMapped")
|
|
}
|
|
if (f & FdMemoryFlagMapPrivate) != 0 {
|
|
parts = append(parts, "FdMemoryFlagMapPrivate")
|
|
}
|
|
if (f & FdMemoryFlagDontClose) != 0 {
|
|
parts = append(parts, "FdMemoryFlagDontClose")
|
|
}
|
|
return "FdMemoryFlags(" + strings.Join(parts, "|") + ")"
|
|
}
|
|
|
|
// DmabufMemoryGetFd wraps gst_dmabuf_memory_get_fd
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: the memory to get the file descriptor
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret int
|
|
//
|
|
// Return the file descriptor associated with @mem.
|
|
func DmabufMemoryGetFd(mem *gst.Memory) int {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.gint // return, none, casted
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_dmabuf_memory_get_fd(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret int
|
|
|
|
goret = int(cret)
|
|
|
|
return goret
|
|
}
|
|
|
|
// DRMDumbMemoryExportDmabuf wraps gst_drm_dumb_memory_export_dmabuf
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: the memory to export from
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret *gst.Memory
|
|
//
|
|
// Exports a DMABuf from the DRM Bumb buffer object. One can check if this
|
|
// feature is supported using gst_drm_dumb_allocator_has_prime_export();
|
|
func DRMDumbMemoryExportDmabuf(mem *gst.Memory) *gst.Memory {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret *C.GstMemory // return, full, converted
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_drm_dumb_memory_export_dmabuf(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret *gst.Memory
|
|
|
|
goret = gst.UnsafeMemoryFromGlibFull(unsafe.Pointer(cret))
|
|
|
|
return goret
|
|
}
|
|
|
|
// DRMDumbMemoryGetHandle wraps gst_drm_dumb_memory_get_handle
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: the memory to get the handle from
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret uint32
|
|
//
|
|
// Return the DRM buffer object handle associated with @mem.
|
|
func DRMDumbMemoryGetHandle(mem *gst.Memory) uint32 {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.guint32 // return, none, casted
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_drm_dumb_memory_get_handle(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret uint32
|
|
|
|
goret = uint32(cret)
|
|
|
|
return goret
|
|
}
|
|
|
|
// FdMemoryGetFd wraps gst_fd_memory_get_fd
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: #GstMemory
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret int
|
|
//
|
|
// Get the fd from @mem. Call gst_is_fd_memory() to check if @mem has
|
|
// an fd.
|
|
func FdMemoryGetFd(mem *gst.Memory) int {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.gint // return, none, casted
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_fd_memory_get_fd(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret int
|
|
|
|
goret = int(cret)
|
|
|
|
return goret
|
|
}
|
|
|
|
// IsDmabufMemory wraps gst_is_dmabuf_memory
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: the memory to be check
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret bool
|
|
//
|
|
// Check if @mem is dmabuf memory.
|
|
func IsDmabufMemory(mem *gst.Memory) bool {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.gboolean // return
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_is_dmabuf_memory(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret bool
|
|
|
|
if cret != 0 {
|
|
goret = true
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// IsDRMDumbMemory wraps gst_is_drm_dumb_memory
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: the memory to be checked
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret bool
|
|
func IsDRMDumbMemory(mem *gst.Memory) bool {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.gboolean // return
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_is_drm_dumb_memory(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret bool
|
|
|
|
if cret != 0 {
|
|
goret = true
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// IsFdMemory wraps gst_is_fd_memory
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: #GstMemory
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret bool
|
|
//
|
|
// Check if @mem is memory backed by an fd
|
|
func IsFdMemory(mem *gst.Memory) bool {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.gboolean // return
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_is_fd_memory(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret bool
|
|
|
|
if cret != 0 {
|
|
goret = true
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// IsPhysMemory wraps gst_is_phys_memory
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - mem *gst.Memory: a #GstMemory
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret bool
|
|
func IsPhysMemory(mem *gst.Memory) bool {
|
|
var carg1 *C.GstMemory // in, none, converted
|
|
var cret C.gboolean // return
|
|
|
|
carg1 = (*C.GstMemory)(gst.UnsafeMemoryToGlibNone(mem))
|
|
|
|
cret = C.gst_is_phys_memory(carg1)
|
|
runtime.KeepAlive(mem)
|
|
|
|
var goret bool
|
|
|
|
if cret != 0 {
|
|
goret = true
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// PhysMemoryAllocatorInstance is the instance type used by all types implementing GstPhysMemoryAllocator. It is used internally by the bindings. Users should use the interface [PhysMemoryAllocator] instead.
|
|
type PhysMemoryAllocatorInstance struct {
|
|
_ [0]func() // equal guard
|
|
Instance gobject.ObjectInstance
|
|
}
|
|
|
|
var _ PhysMemoryAllocator = (*PhysMemoryAllocatorInstance)(nil)
|
|
|
|
// PhysMemoryAllocator wraps GstPhysMemoryAllocator
|
|
type PhysMemoryAllocator interface {
|
|
upcastToGstPhysMemoryAllocator() *PhysMemoryAllocatorInstance
|
|
}
|
|
|
|
var _ PhysMemoryAllocator = (*PhysMemoryAllocatorInstance)(nil)
|
|
|
|
func unsafeWrapPhysMemoryAllocator(base *gobject.ObjectInstance) *PhysMemoryAllocatorInstance {
|
|
return &PhysMemoryAllocatorInstance{
|
|
Instance: *base,
|
|
}
|
|
}
|
|
|
|
func marshalPhysMemoryAllocatorInstance(p unsafe.Pointer) (any, error) {
|
|
return unsafeWrapPhysMemoryAllocator(gobject.ValueFromNative(p).Object()), nil
|
|
}
|
|
|
|
func (p *PhysMemoryAllocatorInstance) upcastToGstPhysMemoryAllocator() *PhysMemoryAllocatorInstance {
|
|
return p
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorFromGlibNone is used to convert raw GstPhysMemoryAllocator pointers to go while taking a reference and attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorFromGlibNone(c unsafe.Pointer) PhysMemoryAllocator {
|
|
return gobject.UnsafeObjectFromGlibNone(c).(PhysMemoryAllocator)
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorFromGlibFull is used to convert raw GstPhysMemoryAllocator pointers to go while attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorFromGlibFull(c unsafe.Pointer) PhysMemoryAllocator {
|
|
return gobject.UnsafeObjectFromGlibFull(c).(PhysMemoryAllocator)
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorToGlibNone is used to convert the instance to it's C value GstPhysMemoryAllocator. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorToGlibNone(c PhysMemoryAllocator) unsafe.Pointer {
|
|
i := c.upcastToGstPhysMemoryAllocator()
|
|
return gobject.UnsafeObjectToGlibNone(&i.Instance)
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorToGlibFull is used to convert the instance to it's C value GstPhysMemoryAllocator, while removeing the finalizer. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorToGlibFull(c PhysMemoryAllocator) unsafe.Pointer {
|
|
i := c.upcastToGstPhysMemoryAllocator()
|
|
return gobject.UnsafeObjectToGlibFull(&i.Instance)
|
|
}
|
|
|
|
// PhysMemoryAllocatorOverrides is the struct used to override the default implementation of virtual methods.
|
|
// it is generic over the extending instance type.
|
|
type PhysMemoryAllocatorOverrides[Instance PhysMemoryAllocator] struct {
|
|
}
|
|
|
|
// UnsafeApplyPhysMemoryAllocatorOverrides applies the overrides to init the gclass by setting the trampoline functions.
|
|
// This is used by the bindings internally and only exported for visibility to other bindings code.
|
|
func UnsafeApplyPhysMemoryAllocatorOverrides[Instance PhysMemoryAllocator](gclass unsafe.Pointer, overrides PhysMemoryAllocatorOverrides[Instance]) {
|
|
}
|
|
|
|
// DRMDumbAllocatorInstance is the instance type used by all types extending GstDRMDumbAllocator. It is used internally by the bindings. Users should use the interface [DRMDumbAllocator] instead.
|
|
type DRMDumbAllocatorInstance struct {
|
|
_ [0]func() // equal guard
|
|
gst.AllocatorInstance
|
|
}
|
|
|
|
var _ DRMDumbAllocator = (*DRMDumbAllocatorInstance)(nil)
|
|
|
|
// DRMDumbAllocator wraps GstDRMDumbAllocator
|
|
//
|
|
// Private intance object for #GstDRMDumbAllocator.
|
|
type DRMDumbAllocator interface {
|
|
gst.Allocator
|
|
upcastToGstDRMDumbAllocator() *DRMDumbAllocatorInstance
|
|
|
|
// DRMAlloc wraps gst_drm_dumb_allocator_alloc
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - drmFourcc uint32: the DRM format to allocate for
|
|
// - width uint32: padded width for this allocation
|
|
// - height uint32: padded height for this allocation
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - outPitch uint32: the pitch as returned by the driver
|
|
// - goret *gst.Memory
|
|
//
|
|
// Allocated a DRM buffer object for the specific @drm_fourcc, @width and
|
|
// @height. Note that the DRM Dumb allocation interface is agnostic to the
|
|
// pixel format. This @drm_fourcc is converted into a bpp (bit-per-pixel)
|
|
// number and the height is scaled according to the sub-sampling.
|
|
DRMAlloc(uint32, uint32, uint32) (uint32, *gst.Memory)
|
|
// HasPrimeExport wraps gst_drm_dumb_allocator_has_prime_export
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret bool
|
|
//
|
|
// This function allow verifying if the driver support dma-buf exportation.
|
|
HasPrimeExport() bool
|
|
}
|
|
|
|
func unsafeWrapDRMDumbAllocator(base *gobject.ObjectInstance) *DRMDumbAllocatorInstance {
|
|
return &DRMDumbAllocatorInstance{
|
|
AllocatorInstance: gst.AllocatorInstance{
|
|
ObjectInstance: gst.ObjectInstance{
|
|
InitiallyUnownedInstance: gobject.InitiallyUnownedInstance{
|
|
ObjectInstance: *base,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func marshalDRMDumbAllocatorInstance(p unsafe.Pointer) (any, error) {
|
|
return unsafeWrapDRMDumbAllocator(gobject.ValueFromNative(p).Object()), nil
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorFromGlibNone is used to convert raw GstDRMDumbAllocator pointers to go while taking a reference and attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeDRMDumbAllocatorFromGlibNone(c unsafe.Pointer) DRMDumbAllocator {
|
|
return gobject.UnsafeObjectFromGlibNone(c).(DRMDumbAllocator)
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorFromGlibFull is used to convert raw GstDRMDumbAllocator pointers to go while attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeDRMDumbAllocatorFromGlibFull(c unsafe.Pointer) DRMDumbAllocator {
|
|
return gobject.UnsafeObjectFromGlibFull(c).(DRMDumbAllocator)
|
|
}
|
|
|
|
func (d *DRMDumbAllocatorInstance) upcastToGstDRMDumbAllocator() *DRMDumbAllocatorInstance {
|
|
return d
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorToGlibNone is used to convert the instance to it's C value GstDRMDumbAllocator. This is used by the bindings internally.
|
|
func UnsafeDRMDumbAllocatorToGlibNone(c DRMDumbAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibNone(c)
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorToGlibFull is used to convert the instance to it's C value GstDRMDumbAllocator, while removeing the finalizer. This is used by the bindings internally.
|
|
func UnsafeDRMDumbAllocatorToGlibFull(c DRMDumbAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibFull(c)
|
|
}
|
|
|
|
// NewDRMDumbAllocatorWithDevicePath wraps gst_drm_dumb_allocator_new_with_device_path
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - drmDevicePath string: path to the DRM device to open
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret gst.Allocator (nullable)
|
|
//
|
|
// Creates a new #GstDRMDumbAllocator for the specific device path. This
|
|
// function can fail if the path does not exist, is not a DRM device or if
|
|
// the DRM device doesnot support DUMB allocation.
|
|
func NewDRMDumbAllocatorWithDevicePath(drmDevicePath string) gst.Allocator {
|
|
var carg1 *C.gchar // in, none, string
|
|
var cret *C.GstAllocator // return, full, converted, nullable
|
|
|
|
carg1 = (*C.gchar)(unsafe.Pointer(C.CString(drmDevicePath)))
|
|
defer C.free(unsafe.Pointer(carg1))
|
|
|
|
cret = C.gst_drm_dumb_allocator_new_with_device_path(carg1)
|
|
runtime.KeepAlive(drmDevicePath)
|
|
|
|
var goret gst.Allocator
|
|
|
|
if cret != nil {
|
|
goret = gst.UnsafeAllocatorFromGlibFull(unsafe.Pointer(cret))
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// NewDRMDumbAllocatorWithFd wraps gst_drm_dumb_allocator_new_with_fd
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - drmFd int: file descriptor of the DRM device
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret gst.Allocator (nullable)
|
|
//
|
|
// Creates a new #GstDRMDumbAllocator for the specific file desciptor. This
|
|
// function can fail if the file descriptor is not a DRM device or if
|
|
// the DRM device does not support DUMB allocation.
|
|
func NewDRMDumbAllocatorWithFd(drmFd int) gst.Allocator {
|
|
var carg1 C.gint // in, none, casted
|
|
var cret *C.GstAllocator // return, full, converted, nullable
|
|
|
|
carg1 = C.gint(drmFd)
|
|
|
|
cret = C.gst_drm_dumb_allocator_new_with_fd(carg1)
|
|
runtime.KeepAlive(drmFd)
|
|
|
|
var goret gst.Allocator
|
|
|
|
if cret != nil {
|
|
goret = gst.UnsafeAllocatorFromGlibFull(unsafe.Pointer(cret))
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// DRMAlloc wraps gst_drm_dumb_allocator_alloc
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - drmFourcc uint32: the DRM format to allocate for
|
|
// - width uint32: padded width for this allocation
|
|
// - height uint32: padded height for this allocation
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - outPitch uint32: the pitch as returned by the driver
|
|
// - goret *gst.Memory
|
|
//
|
|
// Allocated a DRM buffer object for the specific @drm_fourcc, @width and
|
|
// @height. Note that the DRM Dumb allocation interface is agnostic to the
|
|
// pixel format. This @drm_fourcc is converted into a bpp (bit-per-pixel)
|
|
// number and the height is scaled according to the sub-sampling.
|
|
func (allocator *DRMDumbAllocatorInstance) DRMAlloc(drmFourcc uint32, width uint32, height uint32) (uint32, *gst.Memory) {
|
|
var carg0 *C.GstAllocator // in, none, converted, casted *C.GstDRMDumbAllocator
|
|
var carg1 C.guint32 // in, none, casted
|
|
var carg2 C.guint32 // in, none, casted
|
|
var carg3 C.guint32 // in, none, casted
|
|
var carg4 C.guint32 // out, full, casted
|
|
var cret *C.GstMemory // return, full, converted
|
|
|
|
carg0 = (*C.GstAllocator)(UnsafeDRMDumbAllocatorToGlibNone(allocator))
|
|
carg1 = C.guint32(drmFourcc)
|
|
carg2 = C.guint32(width)
|
|
carg3 = C.guint32(height)
|
|
|
|
cret = C.gst_drm_dumb_allocator_alloc(carg0, carg1, carg2, carg3, &carg4)
|
|
runtime.KeepAlive(allocator)
|
|
runtime.KeepAlive(drmFourcc)
|
|
runtime.KeepAlive(width)
|
|
runtime.KeepAlive(height)
|
|
|
|
var outPitch uint32
|
|
var goret *gst.Memory
|
|
|
|
outPitch = uint32(carg4)
|
|
goret = gst.UnsafeMemoryFromGlibFull(unsafe.Pointer(cret))
|
|
|
|
return outPitch, goret
|
|
}
|
|
|
|
// HasPrimeExport wraps gst_drm_dumb_allocator_has_prime_export
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret bool
|
|
//
|
|
// This function allow verifying if the driver support dma-buf exportation.
|
|
func (allocator *DRMDumbAllocatorInstance) HasPrimeExport() bool {
|
|
var carg0 *C.GstAllocator // in, none, converted, casted *C.GstDRMDumbAllocator
|
|
var cret C.gboolean // return
|
|
|
|
carg0 = (*C.GstAllocator)(UnsafeDRMDumbAllocatorToGlibNone(allocator))
|
|
|
|
cret = C.gst_drm_dumb_allocator_has_prime_export(carg0)
|
|
runtime.KeepAlive(allocator)
|
|
|
|
var goret bool
|
|
|
|
if cret != 0 {
|
|
goret = true
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// DRMDumbAllocatorOverrides is the struct used to override the default implementation of virtual methods.
|
|
// it is generic over the extending instance type.
|
|
type DRMDumbAllocatorOverrides[Instance DRMDumbAllocator] struct {
|
|
// gst.AllocatorOverrides allows you to override virtual methods from the parent class gst.Allocator
|
|
gst.AllocatorOverrides[Instance]
|
|
|
|
}
|
|
|
|
// UnsafeApplyDRMDumbAllocatorOverrides applies the overrides to init the gclass by setting the trampoline functions.
|
|
// This is used by the bindings internally and only exported for visibility to other bindings code.
|
|
func UnsafeApplyDRMDumbAllocatorOverrides[Instance DRMDumbAllocator](gclass unsafe.Pointer, overrides DRMDumbAllocatorOverrides[Instance]) {
|
|
gst.UnsafeApplyAllocatorOverrides(gclass, overrides.AllocatorOverrides)
|
|
}
|
|
|
|
// RegisterDRMDumbAllocatorSubClass is used to register a go subclass of GstDRMDumbAllocator. For this to work safely please implement the
|
|
// virtual methods required by the implementation.
|
|
func RegisterDRMDumbAllocatorSubClass[InstanceT DRMDumbAllocator](
|
|
name string,
|
|
classInit func(class *DRMDumbAllocatorClass),
|
|
constructor func() InstanceT,
|
|
overrides DRMDumbAllocatorOverrides[InstanceT],
|
|
signals map[string]gobject.SignalDefinition,
|
|
interfaceInits ...gobject.SubClassInterfaceInit[InstanceT],
|
|
) gobject.Type {
|
|
return gobject.UnsafeRegisterSubClass(
|
|
name,
|
|
classInit,
|
|
constructor,
|
|
overrides,
|
|
signals,
|
|
TypeDRMDumbAllocator,
|
|
UnsafeDRMDumbAllocatorClassFromGlibBorrow,
|
|
UnsafeApplyDRMDumbAllocatorOverrides,
|
|
func (obj *gobject.ObjectInstance) gobject.Object {
|
|
return unsafeWrapDRMDumbAllocator(obj)
|
|
},
|
|
interfaceInits...,
|
|
)
|
|
}
|
|
|
|
// FdAllocatorInstance is the instance type used by all types extending GstFdAllocator. It is used internally by the bindings. Users should use the interface [FdAllocator] instead.
|
|
type FdAllocatorInstance struct {
|
|
_ [0]func() // equal guard
|
|
gst.AllocatorInstance
|
|
}
|
|
|
|
var _ FdAllocator = (*FdAllocatorInstance)(nil)
|
|
|
|
// FdAllocator wraps GstFdAllocator
|
|
//
|
|
// Base class for allocators with fd-backed memory
|
|
type FdAllocator interface {
|
|
gst.Allocator
|
|
upcastToGstFdAllocator() *FdAllocatorInstance
|
|
}
|
|
|
|
func unsafeWrapFdAllocator(base *gobject.ObjectInstance) *FdAllocatorInstance {
|
|
return &FdAllocatorInstance{
|
|
AllocatorInstance: gst.AllocatorInstance{
|
|
ObjectInstance: gst.ObjectInstance{
|
|
InitiallyUnownedInstance: gobject.InitiallyUnownedInstance{
|
|
ObjectInstance: *base,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func marshalFdAllocatorInstance(p unsafe.Pointer) (any, error) {
|
|
return unsafeWrapFdAllocator(gobject.ValueFromNative(p).Object()), nil
|
|
}
|
|
|
|
// UnsafeFdAllocatorFromGlibNone is used to convert raw GstFdAllocator pointers to go while taking a reference and attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeFdAllocatorFromGlibNone(c unsafe.Pointer) FdAllocator {
|
|
return gobject.UnsafeObjectFromGlibNone(c).(FdAllocator)
|
|
}
|
|
|
|
// UnsafeFdAllocatorFromGlibFull is used to convert raw GstFdAllocator pointers to go while attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeFdAllocatorFromGlibFull(c unsafe.Pointer) FdAllocator {
|
|
return gobject.UnsafeObjectFromGlibFull(c).(FdAllocator)
|
|
}
|
|
|
|
func (f *FdAllocatorInstance) upcastToGstFdAllocator() *FdAllocatorInstance {
|
|
return f
|
|
}
|
|
|
|
// UnsafeFdAllocatorToGlibNone is used to convert the instance to it's C value GstFdAllocator. This is used by the bindings internally.
|
|
func UnsafeFdAllocatorToGlibNone(c FdAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibNone(c)
|
|
}
|
|
|
|
// UnsafeFdAllocatorToGlibFull is used to convert the instance to it's C value GstFdAllocator, while removeing the finalizer. This is used by the bindings internally.
|
|
func UnsafeFdAllocatorToGlibFull(c FdAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibFull(c)
|
|
}
|
|
|
|
// NewFdAllocator wraps gst_fd_allocator_new
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret gst.Allocator
|
|
//
|
|
// Return a new fd allocator.
|
|
func NewFdAllocator() gst.Allocator {
|
|
var cret *C.GstAllocator // return, full, converted
|
|
|
|
cret = C.gst_fd_allocator_new()
|
|
|
|
var goret gst.Allocator
|
|
|
|
goret = gst.UnsafeAllocatorFromGlibFull(unsafe.Pointer(cret))
|
|
|
|
return goret
|
|
}
|
|
|
|
// FdAllocatorAlloc wraps gst_fd_allocator_alloc
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - allocator gst.Allocator: allocator to be used for this memory
|
|
// - fd int: file descriptor
|
|
// - size uint: memory size
|
|
// - flags FdMemoryFlags: extra #GstFdMemoryFlags
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret *gst.Memory (nullable)
|
|
//
|
|
// Return a %GstMemory that wraps a generic file descriptor.
|
|
func FdAllocatorAlloc(allocator gst.Allocator, fd int, size uint, flags FdMemoryFlags) *gst.Memory {
|
|
var carg1 *C.GstAllocator // in, none, converted
|
|
var carg2 C.gint // in, none, casted
|
|
var carg3 C.gsize // in, none, casted
|
|
var carg4 C.GstFdMemoryFlags // in, none, casted
|
|
var cret *C.GstMemory // return, full, converted, nullable
|
|
|
|
carg1 = (*C.GstAllocator)(gst.UnsafeAllocatorToGlibNone(allocator))
|
|
carg2 = C.gint(fd)
|
|
carg3 = C.gsize(size)
|
|
carg4 = C.GstFdMemoryFlags(flags)
|
|
|
|
cret = C.gst_fd_allocator_alloc(carg1, carg2, carg3, carg4)
|
|
runtime.KeepAlive(allocator)
|
|
runtime.KeepAlive(fd)
|
|
runtime.KeepAlive(size)
|
|
runtime.KeepAlive(flags)
|
|
|
|
var goret *gst.Memory
|
|
|
|
if cret != nil {
|
|
goret = gst.UnsafeMemoryFromGlibFull(unsafe.Pointer(cret))
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// FdAllocatorOverrides is the struct used to override the default implementation of virtual methods.
|
|
// it is generic over the extending instance type.
|
|
type FdAllocatorOverrides[Instance FdAllocator] struct {
|
|
// gst.AllocatorOverrides allows you to override virtual methods from the parent class gst.Allocator
|
|
gst.AllocatorOverrides[Instance]
|
|
|
|
}
|
|
|
|
// UnsafeApplyFdAllocatorOverrides applies the overrides to init the gclass by setting the trampoline functions.
|
|
// This is used by the bindings internally and only exported for visibility to other bindings code.
|
|
func UnsafeApplyFdAllocatorOverrides[Instance FdAllocator](gclass unsafe.Pointer, overrides FdAllocatorOverrides[Instance]) {
|
|
gst.UnsafeApplyAllocatorOverrides(gclass, overrides.AllocatorOverrides)
|
|
}
|
|
|
|
// RegisterFdAllocatorSubClass is used to register a go subclass of GstFdAllocator. For this to work safely please implement the
|
|
// virtual methods required by the implementation.
|
|
func RegisterFdAllocatorSubClass[InstanceT FdAllocator](
|
|
name string,
|
|
classInit func(class *FdAllocatorClass),
|
|
constructor func() InstanceT,
|
|
overrides FdAllocatorOverrides[InstanceT],
|
|
signals map[string]gobject.SignalDefinition,
|
|
interfaceInits ...gobject.SubClassInterfaceInit[InstanceT],
|
|
) gobject.Type {
|
|
return gobject.UnsafeRegisterSubClass(
|
|
name,
|
|
classInit,
|
|
constructor,
|
|
overrides,
|
|
signals,
|
|
TypeFdAllocator,
|
|
UnsafeFdAllocatorClassFromGlibBorrow,
|
|
UnsafeApplyFdAllocatorOverrides,
|
|
func (obj *gobject.ObjectInstance) gobject.Object {
|
|
return unsafeWrapFdAllocator(obj)
|
|
},
|
|
interfaceInits...,
|
|
)
|
|
}
|
|
|
|
// ShmAllocatorInstance is the instance type used by all types extending GstShmAllocator. It is used internally by the bindings. Users should use the interface [ShmAllocator] instead.
|
|
type ShmAllocatorInstance struct {
|
|
_ [0]func() // equal guard
|
|
FdAllocatorInstance
|
|
}
|
|
|
|
var _ ShmAllocator = (*ShmAllocatorInstance)(nil)
|
|
|
|
// ShmAllocator wraps GstShmAllocator
|
|
//
|
|
// This is a subclass of #GstFdAllocator that implements the
|
|
// gst_allocator_alloc() method using `memfd_create()` when available, POSIX
|
|
// `shm_open()` otherwise. Platforms not supporting any of those (Windows) will
|
|
// always return %NULL.
|
|
//
|
|
// Note that allocating new shared memories has a significant performance cost,
|
|
// it is thus recommended to keep a pool of pre-allocated #GstMemory, using
|
|
// #GstBufferPool. For that reason, this allocator has the
|
|
// %GST_ALLOCATOR_FLAG_NO_COPY flag set.
|
|
type ShmAllocator interface {
|
|
FdAllocator
|
|
upcastToGstShmAllocator() *ShmAllocatorInstance
|
|
}
|
|
|
|
func unsafeWrapShmAllocator(base *gobject.ObjectInstance) *ShmAllocatorInstance {
|
|
return &ShmAllocatorInstance{
|
|
FdAllocatorInstance: FdAllocatorInstance{
|
|
AllocatorInstance: gst.AllocatorInstance{
|
|
ObjectInstance: gst.ObjectInstance{
|
|
InitiallyUnownedInstance: gobject.InitiallyUnownedInstance{
|
|
ObjectInstance: *base,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func marshalShmAllocatorInstance(p unsafe.Pointer) (any, error) {
|
|
return unsafeWrapShmAllocator(gobject.ValueFromNative(p).Object()), nil
|
|
}
|
|
|
|
// UnsafeShmAllocatorFromGlibNone is used to convert raw GstShmAllocator pointers to go while taking a reference and attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeShmAllocatorFromGlibNone(c unsafe.Pointer) ShmAllocator {
|
|
return gobject.UnsafeObjectFromGlibNone(c).(ShmAllocator)
|
|
}
|
|
|
|
// UnsafeShmAllocatorFromGlibFull is used to convert raw GstShmAllocator pointers to go while attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeShmAllocatorFromGlibFull(c unsafe.Pointer) ShmAllocator {
|
|
return gobject.UnsafeObjectFromGlibFull(c).(ShmAllocator)
|
|
}
|
|
|
|
func (s *ShmAllocatorInstance) upcastToGstShmAllocator() *ShmAllocatorInstance {
|
|
return s
|
|
}
|
|
|
|
// UnsafeShmAllocatorToGlibNone is used to convert the instance to it's C value GstShmAllocator. This is used by the bindings internally.
|
|
func UnsafeShmAllocatorToGlibNone(c ShmAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibNone(c)
|
|
}
|
|
|
|
// UnsafeShmAllocatorToGlibFull is used to convert the instance to it's C value GstShmAllocator, while removeing the finalizer. This is used by the bindings internally.
|
|
func UnsafeShmAllocatorToGlibFull(c ShmAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibFull(c)
|
|
}
|
|
|
|
// ShmAllocatorGet wraps gst_shm_allocator_get
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret gst.Allocator (nullable)
|
|
//
|
|
// Get the #GstShmAllocator singleton previously registered with
|
|
// gst_shm_allocator_init_once().
|
|
func ShmAllocatorGet() gst.Allocator {
|
|
var cret *C.GstAllocator // return, full, converted, nullable
|
|
|
|
cret = C.gst_shm_allocator_get()
|
|
|
|
var goret gst.Allocator
|
|
|
|
if cret != nil {
|
|
goret = gst.UnsafeAllocatorFromGlibFull(unsafe.Pointer(cret))
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// ShmAllocatorInitOnce wraps gst_shm_allocator_init_once
|
|
//
|
|
// Register a #GstShmAllocator using gst_allocator_register() with the name
|
|
// %GST_ALLOCATOR_SHM. This is no-op after the first call.
|
|
func ShmAllocatorInitOnce() {
|
|
|
|
C.gst_shm_allocator_init_once()
|
|
}
|
|
|
|
// ShmAllocatorOverrides is the struct used to override the default implementation of virtual methods.
|
|
// it is generic over the extending instance type.
|
|
type ShmAllocatorOverrides[Instance ShmAllocator] struct {
|
|
// FdAllocatorOverrides allows you to override virtual methods from the parent class FdAllocator
|
|
FdAllocatorOverrides[Instance]
|
|
|
|
}
|
|
|
|
// UnsafeApplyShmAllocatorOverrides applies the overrides to init the gclass by setting the trampoline functions.
|
|
// This is used by the bindings internally and only exported for visibility to other bindings code.
|
|
func UnsafeApplyShmAllocatorOverrides[Instance ShmAllocator](gclass unsafe.Pointer, overrides ShmAllocatorOverrides[Instance]) {
|
|
UnsafeApplyFdAllocatorOverrides(gclass, overrides.FdAllocatorOverrides)
|
|
}
|
|
|
|
// RegisterShmAllocatorSubClass is used to register a go subclass of GstShmAllocator. For this to work safely please implement the
|
|
// virtual methods required by the implementation.
|
|
func RegisterShmAllocatorSubClass[InstanceT ShmAllocator](
|
|
name string,
|
|
classInit func(class *ShmAllocatorClass),
|
|
constructor func() InstanceT,
|
|
overrides ShmAllocatorOverrides[InstanceT],
|
|
signals map[string]gobject.SignalDefinition,
|
|
interfaceInits ...gobject.SubClassInterfaceInit[InstanceT],
|
|
) gobject.Type {
|
|
return gobject.UnsafeRegisterSubClass(
|
|
name,
|
|
classInit,
|
|
constructor,
|
|
overrides,
|
|
signals,
|
|
TypeShmAllocator,
|
|
UnsafeShmAllocatorClassFromGlibBorrow,
|
|
UnsafeApplyShmAllocatorOverrides,
|
|
func (obj *gobject.ObjectInstance) gobject.Object {
|
|
return unsafeWrapShmAllocator(obj)
|
|
},
|
|
interfaceInits...,
|
|
)
|
|
}
|
|
|
|
// DmaBufAllocatorInstance is the instance type used by all types extending GstDmaBufAllocator. It is used internally by the bindings. Users should use the interface [DmaBufAllocator] instead.
|
|
type DmaBufAllocatorInstance struct {
|
|
_ [0]func() // equal guard
|
|
FdAllocatorInstance
|
|
}
|
|
|
|
var _ DmaBufAllocator = (*DmaBufAllocatorInstance)(nil)
|
|
|
|
// DmaBufAllocator wraps GstDmaBufAllocator
|
|
//
|
|
// Base class for allocators with dmabuf-backed memory
|
|
type DmaBufAllocator interface {
|
|
FdAllocator
|
|
upcastToGstDmaBufAllocator() *DmaBufAllocatorInstance
|
|
}
|
|
|
|
func unsafeWrapDmaBufAllocator(base *gobject.ObjectInstance) *DmaBufAllocatorInstance {
|
|
return &DmaBufAllocatorInstance{
|
|
FdAllocatorInstance: FdAllocatorInstance{
|
|
AllocatorInstance: gst.AllocatorInstance{
|
|
ObjectInstance: gst.ObjectInstance{
|
|
InitiallyUnownedInstance: gobject.InitiallyUnownedInstance{
|
|
ObjectInstance: *base,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func marshalDmaBufAllocatorInstance(p unsafe.Pointer) (any, error) {
|
|
return unsafeWrapDmaBufAllocator(gobject.ValueFromNative(p).Object()), nil
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorFromGlibNone is used to convert raw GstDmaBufAllocator pointers to go while taking a reference and attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeDmaBufAllocatorFromGlibNone(c unsafe.Pointer) DmaBufAllocator {
|
|
return gobject.UnsafeObjectFromGlibNone(c).(DmaBufAllocator)
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorFromGlibFull is used to convert raw GstDmaBufAllocator pointers to go while attaching a finalizer. This is used by the bindings internally.
|
|
func UnsafeDmaBufAllocatorFromGlibFull(c unsafe.Pointer) DmaBufAllocator {
|
|
return gobject.UnsafeObjectFromGlibFull(c).(DmaBufAllocator)
|
|
}
|
|
|
|
func (d *DmaBufAllocatorInstance) upcastToGstDmaBufAllocator() *DmaBufAllocatorInstance {
|
|
return d
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorToGlibNone is used to convert the instance to it's C value GstDmaBufAllocator. This is used by the bindings internally.
|
|
func UnsafeDmaBufAllocatorToGlibNone(c DmaBufAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibNone(c)
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorToGlibFull is used to convert the instance to it's C value GstDmaBufAllocator, while removeing the finalizer. This is used by the bindings internally.
|
|
func UnsafeDmaBufAllocatorToGlibFull(c DmaBufAllocator) unsafe.Pointer {
|
|
return gobject.UnsafeObjectToGlibFull(c)
|
|
}
|
|
|
|
// NewDmaBufAllocator wraps gst_dmabuf_allocator_new
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret gst.Allocator
|
|
//
|
|
// Return a new dmabuf allocator.
|
|
func NewDmaBufAllocator() gst.Allocator {
|
|
var cret *C.GstAllocator // return, full, converted
|
|
|
|
cret = C.gst_dmabuf_allocator_new()
|
|
|
|
var goret gst.Allocator
|
|
|
|
goret = gst.UnsafeAllocatorFromGlibFull(unsafe.Pointer(cret))
|
|
|
|
return goret
|
|
}
|
|
|
|
// DmaBufAllocatorAlloc wraps gst_dmabuf_allocator_alloc
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - allocator gst.Allocator: allocator to be used for this memory
|
|
// - fd int: dmabuf file descriptor
|
|
// - size uint: memory size
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret *gst.Memory (nullable)
|
|
//
|
|
// Return a %GstMemory that wraps a dmabuf file descriptor.
|
|
func DmaBufAllocatorAlloc(allocator gst.Allocator, fd int, size uint) *gst.Memory {
|
|
var carg1 *C.GstAllocator // in, none, converted
|
|
var carg2 C.gint // in, none, casted
|
|
var carg3 C.gsize // in, none, casted
|
|
var cret *C.GstMemory // return, full, converted, nullable
|
|
|
|
carg1 = (*C.GstAllocator)(gst.UnsafeAllocatorToGlibNone(allocator))
|
|
carg2 = C.gint(fd)
|
|
carg3 = C.gsize(size)
|
|
|
|
cret = C.gst_dmabuf_allocator_alloc(carg1, carg2, carg3)
|
|
runtime.KeepAlive(allocator)
|
|
runtime.KeepAlive(fd)
|
|
runtime.KeepAlive(size)
|
|
|
|
var goret *gst.Memory
|
|
|
|
if cret != nil {
|
|
goret = gst.UnsafeMemoryFromGlibFull(unsafe.Pointer(cret))
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// DmaBufAllocatorAllocWithFlags wraps gst_dmabuf_allocator_alloc_with_flags
|
|
//
|
|
// The function takes the following parameters:
|
|
//
|
|
// - allocator gst.Allocator: allocator to be used for this memory
|
|
// - fd int: dmabuf file descriptor
|
|
// - size uint: memory size
|
|
// - flags FdMemoryFlags: extra #GstFdMemoryFlags
|
|
//
|
|
// The function returns the following values:
|
|
//
|
|
// - goret *gst.Memory (nullable)
|
|
//
|
|
// Return a %GstMemory that wraps a dmabuf file descriptor.
|
|
func DmaBufAllocatorAllocWithFlags(allocator gst.Allocator, fd int, size uint, flags FdMemoryFlags) *gst.Memory {
|
|
var carg1 *C.GstAllocator // in, none, converted
|
|
var carg2 C.gint // in, none, casted
|
|
var carg3 C.gsize // in, none, casted
|
|
var carg4 C.GstFdMemoryFlags // in, none, casted
|
|
var cret *C.GstMemory // return, full, converted, nullable
|
|
|
|
carg1 = (*C.GstAllocator)(gst.UnsafeAllocatorToGlibNone(allocator))
|
|
carg2 = C.gint(fd)
|
|
carg3 = C.gsize(size)
|
|
carg4 = C.GstFdMemoryFlags(flags)
|
|
|
|
cret = C.gst_dmabuf_allocator_alloc_with_flags(carg1, carg2, carg3, carg4)
|
|
runtime.KeepAlive(allocator)
|
|
runtime.KeepAlive(fd)
|
|
runtime.KeepAlive(size)
|
|
runtime.KeepAlive(flags)
|
|
|
|
var goret *gst.Memory
|
|
|
|
if cret != nil {
|
|
goret = gst.UnsafeMemoryFromGlibFull(unsafe.Pointer(cret))
|
|
}
|
|
|
|
return goret
|
|
}
|
|
|
|
// DmaBufAllocatorOverrides is the struct used to override the default implementation of virtual methods.
|
|
// it is generic over the extending instance type.
|
|
type DmaBufAllocatorOverrides[Instance DmaBufAllocator] struct {
|
|
// FdAllocatorOverrides allows you to override virtual methods from the parent class FdAllocator
|
|
FdAllocatorOverrides[Instance]
|
|
|
|
}
|
|
|
|
// UnsafeApplyDmaBufAllocatorOverrides applies the overrides to init the gclass by setting the trampoline functions.
|
|
// This is used by the bindings internally and only exported for visibility to other bindings code.
|
|
func UnsafeApplyDmaBufAllocatorOverrides[Instance DmaBufAllocator](gclass unsafe.Pointer, overrides DmaBufAllocatorOverrides[Instance]) {
|
|
UnsafeApplyFdAllocatorOverrides(gclass, overrides.FdAllocatorOverrides)
|
|
}
|
|
|
|
// RegisterDmaBufAllocatorSubClass is used to register a go subclass of GstDmaBufAllocator. For this to work safely please implement the
|
|
// virtual methods required by the implementation.
|
|
func RegisterDmaBufAllocatorSubClass[InstanceT DmaBufAllocator](
|
|
name string,
|
|
classInit func(class *DmaBufAllocatorClass),
|
|
constructor func() InstanceT,
|
|
overrides DmaBufAllocatorOverrides[InstanceT],
|
|
signals map[string]gobject.SignalDefinition,
|
|
interfaceInits ...gobject.SubClassInterfaceInit[InstanceT],
|
|
) gobject.Type {
|
|
return gobject.UnsafeRegisterSubClass(
|
|
name,
|
|
classInit,
|
|
constructor,
|
|
overrides,
|
|
signals,
|
|
TypeDmaBufAllocator,
|
|
UnsafeDmaBufAllocatorClassFromGlibBorrow,
|
|
UnsafeApplyDmaBufAllocatorOverrides,
|
|
func (obj *gobject.ObjectInstance) gobject.Object {
|
|
return unsafeWrapDmaBufAllocator(obj)
|
|
},
|
|
interfaceInits...,
|
|
)
|
|
}
|
|
|
|
// DRMDumbAllocatorClass wraps GstDRMDumbAllocatorClass
|
|
//
|
|
// DRMDumbAllocatorClass is the type struct for [DRMDumbAllocator]
|
|
type DRMDumbAllocatorClass struct {
|
|
*drmDumbAllocatorClass
|
|
}
|
|
|
|
// drmDumbAllocatorClass is the struct that's finalized
|
|
type drmDumbAllocatorClass struct {
|
|
native *C.GstDRMDumbAllocatorClass
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorClassFromGlibBorrow is used to convert raw C.GstDRMDumbAllocatorClass pointers to go. This is used by the bindings internally.
|
|
func UnsafeDRMDumbAllocatorClassFromGlibBorrow(p unsafe.Pointer) *DRMDumbAllocatorClass {
|
|
return &DRMDumbAllocatorClass{&drmDumbAllocatorClass{(*C.GstDRMDumbAllocatorClass)(p)}}
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorClassFree unrefs/frees the underlying resource. This is used by the bindings internally.
|
|
//
|
|
// After this is called, no other method on [DRMDumbAllocatorClass] is expected to work anymore.
|
|
func UnsafeDRMDumbAllocatorClassFree(d *DRMDumbAllocatorClass) {
|
|
C.free(unsafe.Pointer(d.native))
|
|
}
|
|
|
|
// UnsafeDRMDumbAllocatorClassToGlibNone returns the underlying C pointer. This is used by the bindings internally.
|
|
func UnsafeDRMDumbAllocatorClassToGlibNone(d *DRMDumbAllocatorClass) unsafe.Pointer {
|
|
return unsafe.Pointer(d.native)
|
|
}
|
|
|
|
// ParentClass returns the type struct of the parent class of this type struct.
|
|
// This essentially casts the underlying c pointer.
|
|
func (d *DRMDumbAllocatorClass) ParentClass() *gst.AllocatorClass {
|
|
parent := gst.UnsafeAllocatorClassFromGlibBorrow(UnsafeDRMDumbAllocatorClassToGlibNone(d))
|
|
// attach a cleanup to keep the instance alive as long as the parent is referenced
|
|
runtime.AddCleanup(parent, func(_ *DRMDumbAllocatorClass) {}, d)
|
|
return parent
|
|
}
|
|
|
|
// DmaBufAllocatorClass wraps GstDmaBufAllocatorClass
|
|
//
|
|
// DmaBufAllocatorClass is the type struct for [DmaBufAllocator]
|
|
type DmaBufAllocatorClass struct {
|
|
*dmaBufAllocatorClass
|
|
}
|
|
|
|
// dmaBufAllocatorClass is the struct that's finalized
|
|
type dmaBufAllocatorClass struct {
|
|
native *C.GstDmaBufAllocatorClass
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorClassFromGlibBorrow is used to convert raw C.GstDmaBufAllocatorClass pointers to go. This is used by the bindings internally.
|
|
func UnsafeDmaBufAllocatorClassFromGlibBorrow(p unsafe.Pointer) *DmaBufAllocatorClass {
|
|
return &DmaBufAllocatorClass{&dmaBufAllocatorClass{(*C.GstDmaBufAllocatorClass)(p)}}
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorClassFree unrefs/frees the underlying resource. This is used by the bindings internally.
|
|
//
|
|
// After this is called, no other method on [DmaBufAllocatorClass] is expected to work anymore.
|
|
func UnsafeDmaBufAllocatorClassFree(d *DmaBufAllocatorClass) {
|
|
C.free(unsafe.Pointer(d.native))
|
|
}
|
|
|
|
// UnsafeDmaBufAllocatorClassToGlibNone returns the underlying C pointer. This is used by the bindings internally.
|
|
func UnsafeDmaBufAllocatorClassToGlibNone(d *DmaBufAllocatorClass) unsafe.Pointer {
|
|
return unsafe.Pointer(d.native)
|
|
}
|
|
|
|
// ParentClass returns the type struct of the parent class of this type struct.
|
|
// This essentially casts the underlying c pointer.
|
|
func (d *DmaBufAllocatorClass) ParentClass() *FdAllocatorClass {
|
|
parent := UnsafeFdAllocatorClassFromGlibBorrow(UnsafeDmaBufAllocatorClassToGlibNone(d))
|
|
// attach a cleanup to keep the instance alive as long as the parent is referenced
|
|
runtime.AddCleanup(parent, func(_ *DmaBufAllocatorClass) {}, d)
|
|
return parent
|
|
}
|
|
|
|
// FdAllocatorClass wraps GstFdAllocatorClass
|
|
//
|
|
// FdAllocatorClass is the type struct for [FdAllocator]
|
|
type FdAllocatorClass struct {
|
|
*fdAllocatorClass
|
|
}
|
|
|
|
// fdAllocatorClass is the struct that's finalized
|
|
type fdAllocatorClass struct {
|
|
native *C.GstFdAllocatorClass
|
|
}
|
|
|
|
// UnsafeFdAllocatorClassFromGlibBorrow is used to convert raw C.GstFdAllocatorClass pointers to go. This is used by the bindings internally.
|
|
func UnsafeFdAllocatorClassFromGlibBorrow(p unsafe.Pointer) *FdAllocatorClass {
|
|
return &FdAllocatorClass{&fdAllocatorClass{(*C.GstFdAllocatorClass)(p)}}
|
|
}
|
|
|
|
// UnsafeFdAllocatorClassFree unrefs/frees the underlying resource. This is used by the bindings internally.
|
|
//
|
|
// After this is called, no other method on [FdAllocatorClass] is expected to work anymore.
|
|
func UnsafeFdAllocatorClassFree(f *FdAllocatorClass) {
|
|
C.free(unsafe.Pointer(f.native))
|
|
}
|
|
|
|
// UnsafeFdAllocatorClassToGlibNone returns the underlying C pointer. This is used by the bindings internally.
|
|
func UnsafeFdAllocatorClassToGlibNone(f *FdAllocatorClass) unsafe.Pointer {
|
|
return unsafe.Pointer(f.native)
|
|
}
|
|
|
|
// ParentClass returns the type struct of the parent class of this type struct.
|
|
// This essentially casts the underlying c pointer.
|
|
func (f *FdAllocatorClass) ParentClass() *gst.AllocatorClass {
|
|
parent := gst.UnsafeAllocatorClassFromGlibBorrow(UnsafeFdAllocatorClassToGlibNone(f))
|
|
// attach a cleanup to keep the instance alive as long as the parent is referenced
|
|
runtime.AddCleanup(parent, func(_ *FdAllocatorClass) {}, f)
|
|
return parent
|
|
}
|
|
|
|
// PhysMemoryAllocatorInterface wraps GstPhysMemoryAllocatorInterface
|
|
//
|
|
// Marker interface for allocators with physical address backed memory
|
|
type PhysMemoryAllocatorInterface struct {
|
|
*physMemoryAllocatorInterface
|
|
}
|
|
|
|
// physMemoryAllocatorInterface is the struct that's finalized
|
|
type physMemoryAllocatorInterface struct {
|
|
native *C.GstPhysMemoryAllocatorInterface
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorInterfaceFromGlibBorrow is used to convert raw C.GstPhysMemoryAllocatorInterface pointers to go. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorInterfaceFromGlibBorrow(p unsafe.Pointer) *PhysMemoryAllocatorInterface {
|
|
return &PhysMemoryAllocatorInterface{&physMemoryAllocatorInterface{(*C.GstPhysMemoryAllocatorInterface)(p)}}
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorInterfaceFromGlibNone is used to convert raw C.GstPhysMemoryAllocatorInterface pointers to go without transferring ownership. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorInterfaceFromGlibNone(p unsafe.Pointer) *PhysMemoryAllocatorInterface {
|
|
// FIXME: this has no ref function, what should we do here?
|
|
wrapped := UnsafePhysMemoryAllocatorInterfaceFromGlibBorrow(p)
|
|
runtime.SetFinalizer(
|
|
wrapped.physMemoryAllocatorInterface,
|
|
func (intern *physMemoryAllocatorInterface) {
|
|
C.free(unsafe.Pointer(intern.native))
|
|
},
|
|
)
|
|
return wrapped
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorInterfaceFromGlibFull is used to convert raw C.GstPhysMemoryAllocatorInterface pointers to go while taking ownership. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorInterfaceFromGlibFull(p unsafe.Pointer) *PhysMemoryAllocatorInterface {
|
|
wrapped := UnsafePhysMemoryAllocatorInterfaceFromGlibBorrow(p)
|
|
runtime.SetFinalizer(
|
|
wrapped.physMemoryAllocatorInterface,
|
|
func (intern *physMemoryAllocatorInterface) {
|
|
C.free(unsafe.Pointer(intern.native))
|
|
},
|
|
)
|
|
return wrapped
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorInterfaceFree unrefs/frees the underlying resource. This is used by the bindings internally.
|
|
//
|
|
// After this is called, no other method on [PhysMemoryAllocatorInterface] is expected to work anymore.
|
|
func UnsafePhysMemoryAllocatorInterfaceFree(p *PhysMemoryAllocatorInterface) {
|
|
C.free(unsafe.Pointer(p.native))
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorInterfaceToGlibNone returns the underlying C pointer. This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorInterfaceToGlibNone(p *PhysMemoryAllocatorInterface) unsafe.Pointer {
|
|
return unsafe.Pointer(p.native)
|
|
}
|
|
|
|
// UnsafePhysMemoryAllocatorInterfaceToGlibFull returns the underlying C pointer and gives up ownership.
|
|
// This is used by the bindings internally.
|
|
func UnsafePhysMemoryAllocatorInterfaceToGlibFull(p *PhysMemoryAllocatorInterface) unsafe.Pointer {
|
|
runtime.SetFinalizer(p.physMemoryAllocatorInterface, nil)
|
|
_p := unsafe.Pointer(p.native)
|
|
p.native = nil // PhysMemoryAllocatorInterface is invalid from here on
|
|
return _p
|
|
}
|
|
|
|
// ShmAllocatorClass wraps GstShmAllocatorClass
|
|
//
|
|
// ShmAllocatorClass is the type struct for [ShmAllocator]
|
|
type ShmAllocatorClass struct {
|
|
*shmAllocatorClass
|
|
}
|
|
|
|
// shmAllocatorClass is the struct that's finalized
|
|
type shmAllocatorClass struct {
|
|
native *C.GstShmAllocatorClass
|
|
}
|
|
|
|
// UnsafeShmAllocatorClassFromGlibBorrow is used to convert raw C.GstShmAllocatorClass pointers to go. This is used by the bindings internally.
|
|
func UnsafeShmAllocatorClassFromGlibBorrow(p unsafe.Pointer) *ShmAllocatorClass {
|
|
return &ShmAllocatorClass{&shmAllocatorClass{(*C.GstShmAllocatorClass)(p)}}
|
|
}
|
|
|
|
// UnsafeShmAllocatorClassFree unrefs/frees the underlying resource. This is used by the bindings internally.
|
|
//
|
|
// After this is called, no other method on [ShmAllocatorClass] is expected to work anymore.
|
|
func UnsafeShmAllocatorClassFree(s *ShmAllocatorClass) {
|
|
C.free(unsafe.Pointer(s.native))
|
|
}
|
|
|
|
// UnsafeShmAllocatorClassToGlibNone returns the underlying C pointer. This is used by the bindings internally.
|
|
func UnsafeShmAllocatorClassToGlibNone(s *ShmAllocatorClass) unsafe.Pointer {
|
|
return unsafe.Pointer(s.native)
|
|
}
|
|
|
|
// ParentClass returns the type struct of the parent class of this type struct.
|
|
// This essentially casts the underlying c pointer.
|
|
func (s *ShmAllocatorClass) ParentClass() *FdAllocatorClass {
|
|
parent := UnsafeFdAllocatorClassFromGlibBorrow(UnsafeShmAllocatorClassToGlibNone(s))
|
|
// attach a cleanup to keep the instance alive as long as the parent is referenced
|
|
runtime.AddCleanup(parent, func(_ *ShmAllocatorClass) {}, s)
|
|
return parent
|
|
}
|
|
|