mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-06 16:46:52 +08:00
feat: return unsafe pointer instead of raw C struct (#54)
This commit is contained in:
4
frame.go
4
frame.go
@@ -214,6 +214,6 @@ func (f *Frame) MoveRef(src *Frame) {
|
||||
C.av_frame_move_ref(f.c, src.c)
|
||||
}
|
||||
|
||||
func (f *Frame) UnsafeTypedPointer() *C.struct_AVFrame {
|
||||
return f.c
|
||||
func (f *Frame) UnsafePointer() unsafe.Pointer {
|
||||
return unsafe.Pointer(f.c)
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ package astiav
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
"unsafe"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -12,7 +13,7 @@ func TestFrame(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, [8]int{384, 192, 192, 0, 0, 0, 0, 0}, f1.Linesize())
|
||||
require.Equal(t, int64(60928), f1.PktDts())
|
||||
require.Equal(t, f1.c, f1.UnsafeTypedPointer())
|
||||
require.Equal(t, unsafe.Pointer(f1.c), f1.UnsafePointer())
|
||||
|
||||
f2 := AllocFrame()
|
||||
require.NotNil(t, f2)
|
||||
|
Reference in New Issue
Block a user