mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-05 16:06:55 +08:00
Changes some cast to C.gsize to ensure size_t compatibility
This commit is contained in:
2
go.sum
2
go.sum
@@ -1,4 +1,6 @@
|
|||||||
github.com/gotk3/gotk3 v0.4.0 h1:TIuhyQitGeRTxOQIV3AJlYtEWWJpC74JHwAIsxlH8MU=
|
github.com/gotk3/gotk3 v0.4.0 h1:TIuhyQitGeRTxOQIV3AJlYtEWWJpC74JHwAIsxlH8MU=
|
||||||
github.com/gotk3/gotk3 v0.4.0/go.mod h1:Eew3QBwAOBTrfFFDmsDE5wZWbcagBL1NUslj1GhRveo=
|
github.com/gotk3/gotk3 v0.4.0/go.mod h1:Eew3QBwAOBTrfFFDmsDE5wZWbcagBL1NUslj1GhRveo=
|
||||||
|
github.com/gotk3/gotk3 v0.5.1 h1:zIZM2K4gmkGz1idEFVUPTQfAK/pnWoLKrlIjLOc4kzo=
|
||||||
|
github.com/gotk3/gotk3 v0.5.1/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
|
||||||
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
|
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/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#ifndef __GST_GO_H__
|
#ifndef __GST_GO_H__
|
||||||
#define __GST_GO_H__
|
#define __GST_GO_H__
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -77,7 +77,7 @@ func NewBufferFromBytes(b []byte) *Buffer {
|
|||||||
str := string(b)
|
str := string(b)
|
||||||
p := unsafe.Pointer(C.CString(str))
|
p := unsafe.Pointer(C.CString(str))
|
||||||
// memory is freed by gstreamer after building the new buffer
|
// memory is freed by gstreamer after building the new buffer
|
||||||
buf := C.gst_buffer_new_wrapped((C.gpointer)(p), C.gulong(len(str)))
|
buf := C.gst_buffer_new_wrapped((C.gpointer)(p), C.gsize(len(str)))
|
||||||
return wrapBuffer(buf)
|
return wrapBuffer(buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ func (b *Buffer) CopyRegion(flags BufferCopyFlags, offset, size int64) *Buffer {
|
|||||||
// Extract extracts size bytes starting from offset in this buffer. The data extracted may be lower
|
// Extract extracts size bytes starting from offset in this buffer. The data extracted may be lower
|
||||||
// than the actual size if the buffer did not contain enough data.
|
// than the actual size if the buffer did not contain enough data.
|
||||||
func (b *Buffer) Extract(offset, size int64) []byte {
|
func (b *Buffer) Extract(offset, size int64) []byte {
|
||||||
dest := C.malloc(C.sizeof_char * C.ulong(size))
|
dest := C.malloc(C.sizeof_char * C.gsize(size))
|
||||||
defer C.free(dest)
|
defer C.free(dest)
|
||||||
C.gst_buffer_extract(b.Instance(), C.gsize(offset), (C.gpointer)(unsafe.Pointer(dest)), C.gsize(size))
|
C.gst_buffer_extract(b.Instance(), C.gsize(offset), (C.gpointer)(unsafe.Pointer(dest)), C.gsize(size))
|
||||||
return C.GoBytes(dest, C.int(size))
|
return C.GoBytes(dest, C.int(size))
|
||||||
|
@@ -25,7 +25,7 @@ func NewMiniObject(flags MiniObjectFlags, gtype glib.Type) *MiniObject {
|
|||||||
C.gst_mini_object_init(
|
C.gst_mini_object_init(
|
||||||
C.toGstMiniObject(unsafe.Pointer(&cMiniObj)),
|
C.toGstMiniObject(unsafe.Pointer(&cMiniObj)),
|
||||||
C.uint(flags),
|
C.uint(flags),
|
||||||
C.ulong(gtype),
|
C.gsize(gtype),
|
||||||
nil, nil, nil,
|
nil, nil, nil,
|
||||||
)
|
)
|
||||||
return wrapMiniObject(&cMiniObj)
|
return wrapMiniObject(&cMiniObj)
|
||||||
|
@@ -43,7 +43,7 @@ func (o *Object) Name() string {
|
|||||||
// Interfaces returns the interfaces associated with this object.
|
// Interfaces returns the interfaces associated with this object.
|
||||||
func (o *Object) Interfaces() []string {
|
func (o *Object) Interfaces() []string {
|
||||||
var size C.guint
|
var size C.guint
|
||||||
ifaces := C.g_type_interfaces(C.ulong(o.TypeFromInstance()), &size)
|
ifaces := C.g_type_interfaces(C.gsize(o.TypeFromInstance()), &size)
|
||||||
if int(size) == 0 {
|
if int(size) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user