Skip to content

Commit

Permalink
feat: return unsafe pointer instead of raw C struct
Browse files Browse the repository at this point in the history
  • Loading branch information
l0rem1psum committed Mar 18, 2024
1 parent 7543fa0 commit bdb1342
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion frame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Check failure on line 15 in frame_test.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

undefined: unsafe

Check failure on line 15 in frame_test.go

View workflow job for this annotation

GitHub Actions / test (macos-latest)

undefined: unsafe

Check failure on line 15 in frame_test.go

View workflow job for this annotation

GitHub Actions / test (windows-latest)

undefined: unsafe

f2 := AllocFrame()
require.NotNil(t, f2)
Expand Down

0 comments on commit bdb1342

Please sign in to comment.