From bdb134220a5eaba9db92f087692c0e07215178c0 Mon Sep 17 00:00:00 2001 From: l0rem1psum Date: Mon, 18 Mar 2024 06:54:01 +0000 Subject: [PATCH] feat: return unsafe pointer instead of raw C struct --- frame.go | 4 ++-- frame_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frame.go b/frame.go index 17c6edb..a7866c3 100644 --- a/frame.go +++ b/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) } diff --git a/frame_test.go b/frame_test.go index 98c175e..049b5a0 100644 --- a/frame_test.go +++ b/frame_test.go @@ -12,7 +12,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)