-
Notifications
You must be signed in to change notification settings - Fork 1
/
task.go
97 lines (77 loc) · 3.04 KB
/
task.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
package rkcodec
//#include <rockchip/mpp_task.h>
import "C"
import "unsafe"
type MppPortType = C.MppPortType
const (
MppPortInput = MppPortType(C.MPP_PORT_INPUT)
MppPortOutput = MppPortType(C.MPP_PORT_OUTPUT)
MppPortButt = MppPortType(C.MPP_PORT_BUTT)
)
type MppTaskWorkMode = C.MppTaskWorkMode
const (
MppTaskAsync = MppTaskWorkMode(C.MPP_TASK_ASYNC)
MppTaskSync = MppTaskWorkMode(C.MPP_TASK_SYNC)
MppTaskWorkModeButt = MppTaskWorkMode(C.MPP_TASK_WORK_MODE_BUTT)
)
type MppPollType = C.MppPollType
const (
MppPollButt = MppPollType(C.MPP_POLL_BUTT)
MppPollBlock = MppPollType(C.MPP_POLL_BLOCK)
MppPollNonBlock = MppPollType(C.MPP_POLL_NON_BLOCK)
MppPollMax = MppPollType(C.MPP_POLL_MAX)
)
const (
MppTimeoutButt = C.MPP_TIMEOUT_BUTT
MppTimeoutBlock = C.MPP_TIMEOUT_BLOCK
MppTimeoutNonBlock = C.MPP_TIMEOUT_NON_BLOCK
MppTimeoutMax = C.MPP_TIMEOUT_MAX
)
func (task *MppTask) MetaSetS32(key MppMetaKey, val int32) MppRet {
return MppRet(C.mpp_task_meta_set_s32(*task.c, C.MppMetaKey(key), cS32(val)))
}
func (task *MppTask) MetaSetS64(key MppMetaKey, val int64) MppRet {
return MppRet(C.mpp_task_meta_set_s64(*task.c, C.MppMetaKey(key), cS64(val)))
}
func (task *MppTask) MetaSetPtr(key MppMetaKey, val unsafe.Pointer) MppRet {
return MppRet(C.mpp_task_meta_set_ptr(*task.c, C.MppMetaKey(key), val))
}
func (task *MppTask) MetaSetFrame(key MppMetaKey, frame *MppFrame) MppRet {
return MppRet(C.mpp_task_meta_set_frame(*task.c, C.MppMetaKey(key), *frame.c))
}
func (task *MppTask) MetaSetPacket(key MppMetaKey, packet *MppPacket) MppRet {
return MppRet(C.mpp_task_meta_set_packet(*task.c, C.MppMetaKey(key), *packet.c))
}
func (task *MppTask) MetaSetBuffer(key MppMetaKey, buffer MppBuffer) MppRet {
return MppRet(C.mpp_task_meta_set_buffer(*task.c, C.MppMetaKey(key), buffer.c))
}
func (task *MppTask) MetaGetS32(key MppMetaKey, defaultVal int32) (int32, MppRet) {
var val cS32
ret := MppRet(C.mpp_task_meta_get_s32(*task.c, C.MppMetaKey(key), &val, cS32(defaultVal)))
return int32(val), ret
}
func (task *MppTask) MetaGetS64(key MppMetaKey, defaultVal int64) (int64, MppRet) {
var val cS64
ret := MppRet(C.mpp_task_meta_get_s64(*task.c, C.MppMetaKey(key), &val, cS64(defaultVal)))
return int64(val), ret
}
func (task *MppTask) MetaGetPtr(key MppMetaKey, defaultVal unsafe.Pointer) (unsafe.Pointer, MppRet) {
var val unsafe.Pointer
ret := MppRet(C.mpp_task_meta_get_ptr(*task.c, C.MppMetaKey(key), &val, defaultVal))
return val, ret
}
func (task *MppTask) MetaGetFrame(key MppMetaKey) (*MppFrame, MppRet) {
var frame MppFrame
ret := MppRet(C.mpp_task_meta_get_frame(*task.c, C.MppMetaKey(key), frame.c))
return &frame, ret
}
func (task *MppTask) MetaGetPacket(key MppMetaKey) (*MppPacket, MppRet) {
var packet MppPacket
ret := MppRet(C.mpp_task_meta_get_packet(*task.c, C.MppMetaKey(key), packet.c))
return &packet, ret
}
func (task *MppTask) MetaGetBuffer(key MppMetaKey) (MppBuffer, MppRet) {
var buffer MppBuffer
ret := MppRet(C.mpp_task_meta_get_buffer(*task.c, C.MppMetaKey(key), &buffer.c))
return buffer, ret
}