Return `unsafe.Pointer` instead of raw C type
l0rem1psum opened this issue · 1 comments
As discussed in a previous PR #44, the raw C struct of AVFrame
is returned instead of a unsafe.Pointer
.
However, after some fiddling around, I finally discovered the difference of the two approaches.
Currently, the raw C struct returned will have a type of *astiav._Ctype_struct_AVFrame
, and as the name suggests, this type is unexported. Hence, it comes with all the inconveniences of returning an unexported type.
To make it usable, one unavoidably has to do the following:
In conclusion, it's better to just return unsafe.Pointer
and let the caller do the casting.
Thanks for the detailed explanation 👍 The best would be to replace UnsafeTypedPointer
to UnsafePointer
which would indeed return an unsafe.Pointer
. Do you feel like creating a PR for this?