-
Notifications
You must be signed in to change notification settings - Fork 1
/
mpi.go
102 lines (78 loc) · 2.65 KB
/
mpi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package rkcodec
//#include <rockchip/rk_mpi.h>
//#include "codec.h"
import "C"
import "unsafe"
type Codec struct {
c *C.struct_MppCodec
}
func NewMppCodec() *Codec {
return &Codec{c: C.mpp_ctx_api_alloc()}
}
func (c *Codec) Init(t MppCtxType, coding MppCodingType) MppRet {
return MppRet(C.codec_init(c.c, C.MppCtxType(t), C.MppCodingType(coding)))
}
func (c *Codec) Destroy() MppRet {
return MppRet(C.codec_destroy(c.c))
}
func (c *Codec) Size() uint32 {
return uint32(C.codec_size(c.c))
}
func (c *Codec) Version() uint32 {
return uint32(C.codec_version(c.c))
}
func (c *Codec) Decode(packet MppPacket, frame *MppFrame) MppRet {
return MppRet(C.codec_decode(c.c, *packet.c, frame.c))
}
func (c *Codec) DecodePutPacket(packet MppPacket) MppRet {
return MppRet(C.codec_decode_put_packet(c.c, *packet.c))
}
func (c *Codec) DecodeGetFrame(frame *MppFrame) MppRet {
return MppRet(C.codec_decode_get_frame(c.c, frame.c))
}
func (c *Codec) Encode(frame MppFrame, packet *MppPacket) MppRet {
return MppRet(C.codec_encode(c.c, *frame.c, packet.c))
}
func (c *Codec) EncodePutFrame(frame MppFrame) MppRet {
return MppRet(C.codec_encode_put_frame(c.c, *frame.c))
}
func (c *Codec) EncodeGetPacket(packet *MppPacket) MppRet {
return MppRet(C.codec_encode_get_packet(c.c, packet.c))
}
func (c *Codec) Isp(dst, src MppFrame) MppRet {
return MppRet(C.codec_isp(c.c, *dst.c, *src.c))
}
func (c *Codec) IspPutFrame(frame MppFrame) MppRet {
return MppRet(C.codec_isp_put_frame(c.c, *frame.c))
}
func (c *Codec) IspGetFrame(frame *MppFrame) MppRet {
return MppRet(C.codec_isp_get_frame(c.c, frame.c))
}
func (c *Codec) Poll(t MppPortType, timeout MppPollType) {
C.codec_poll(c.c, C.MppPortType(t), C.MppPollType(timeout))
}
func (c *Codec) Dequeue(t MppPortType, task *MppTask) MppRet {
return MppRet(C.codec_dequeue(c.c, C.MppPortType(t), task.c))
}
func (c *Codec) Enqueue(t MppPortType, task MppTask) MppRet {
return MppRet(C.codec_enqueue(c.c, C.MppPortType(t), *task.c))
}
func (c *Codec) Reset() MppRet {
return MppRet(C.codec_reset(c.c))
}
func (c *Codec) Control(cmd MpiCmd, param any) MppRet {
point := unsafe.Pointer(¶m)
return MppRet(C.codec_control(c.c, C.MpiCmd(cmd), point))
}
// CheckSupportFormat Reutnr 0 for support, -1 for unsupport
func CheckSupportFormat(t MppCtxType, coding MppCodingType) MppRet {
return MppRet(C.mpp_check_support_format(C.MppCtxType(t), C.MppCodingType(coding)))
}
// ShowSupportFormat No return value, It just print format info to standard output
func ShowSupportFormat() {
C.mpp_show_support_format()
}
// ShowColorFormat No return value, It just print format info to standard output
func ShowColorFormat() {
C.mpp_show_color_format()
}