Fixed MPP_RET_NULL_PTR

This commit is contained in:
Tryanks
2024-05-27 11:45:06 +08:00
parent 755f717bf6
commit 92b57a3e43
2 changed files with 6 additions and 7 deletions

View File

@@ -375,9 +375,9 @@ const (
)
func MppFrameInit() (*MppFrame, MppRet) {
frame := new(MppFrame)
ret := MppRet(C.mpp_frame_init(frame.c))
return frame, ret
cFrame := C.MppFrame(nil)
ret := MppRet(C.mpp_frame_init(&cFrame))
return &MppFrame{c: cFrame}, ret
}
func (f *MppFrame) Deinit() MppRet {

View File

@@ -14,12 +14,11 @@ void MppPktSeg_setType(MppPktSeg seg, RK_S32 type) {
import "C"
func NewMppPacket() (*MppPacket, MppRet) {
packet := new(MppPacket)
ret := MppRet(C.mpp_packet_new(packet.c))
return packet, ret
cPacket := C.MppPacket(nil)
ret := MppRet(C.mpp_packet_new(cPacket))
return &MppPacket{c: cPacket}, ret
}
// MPP_RET mpp_packet_init(MppPacket *packet, void *data, size_t size);
func (packet *MppPacket) Init(data []byte, size int64) MppRet {
return MppRet(C.mpp_packet_init(packet.c, C.CBytes(data), C.size_t(size)))
}