-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuffer_private.go
99 lines (89 loc) · 2.64 KB
/
buffer_private.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
// Copyright 2017 The go-mmal Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mmal
/*
#include <interface/mmal/mmal.h>
#include <interface/mmal/mmal_buffer.h>
#include <interface/mmal/core/mmal_buffer_private.h>
*/
import "C"
import (
"unsafe"
)
const DriverBufferSize = 32
type DriverBufferType struct {
c *C.MMAL_DRIVER_BUFFER_T
}
type BufferHeaderPrivateType struct {
c *C.MMAL_BUFFER_HEADER_PRIVATE_T
}
// TODO(zchee): implements. error: type *_Ctype_struct_MMAL_BUFFER_HEADER_PRIVATE_T has no field or method ***(e.g. pf_pre_release)
// func (b BufferHeaderPrivateType) PfPreRelease() BHPreReleaseCB {
// return BHPreReleaseCB(b.c.pf_pre_release)
// }
//
//
// func (b BufferHeaderPrivateType) PreReleaseUserdata() unsafe.Pointer {
// return b.c.pre_release_userdata
// }
//
// func (b BufferHeaderPrivateType) PfRelease() Void (*)(mmalBufferHeaderT) {
// return Void (*)(mmalBufferHeaderT){b.c.pf_release}
// }
//
// func (b BufferHeaderPrivateType) Owner() unsafe.Pointer {
// return b.c.owner
// }
//
// func (b BufferHeaderPrivateType) Refcount() int32 {
// return int32(b.c.refcount)
// }
//
// func (b BufferHeaderPrivateType) Reference() BufferHeader {
// return BufferHeader{b.c.reference}
// }
//
// func (b BufferHeaderPrivateType) PfPayloadFree() Void (*)(void, void *) {
// return Void (*)(void, void *){b.c.pf_payload_free}
// }
//
// func (b BufferHeaderPrivateType) Payload() unsafe.Pointer {
// return b.c.payload
// }
//
// func (b BufferHeaderPrivateType) PayloadContext() unsafe.Pointer {
// return b.c.payload_context
// }
//
// func (b BufferHeaderPrivateType) PayloadSize() Status {
// return Status{b.c.payload_size}
// }
//
// func (b BufferHeaderPrivateType) ComponentData() unsafe.Pointer {
// return b.c.component_data
// }
//
// func (b BufferHeaderPrivateType) PayloadHandle() unsafe.Pointer {
// return b.c.payload_handle
// }
//
// func (b BufferHeaderPrivateType) DriverArea() []uint {
// darea := make([]uint, DriverBufferSize)
// for i, da := range b.c.driver_area {
// darea[i] = da
// }
// return darea
// }
func BufferHeaderSize(header *BufferHeader) uint {
return uint(C.mmal_buffer_header_size(header.c))
}
func BufferHeaderInitialise(mem unsafe.Pointer, length uint) BufferHeader {
return BufferHeader{C.mmal_buffer_header_initialise(mem, C.uint(length))}
}
func BufferHeaderDriverData(header *BufferHeader) DriverBufferType {
return DriverBufferType{C.mmal_buffer_header_driver_data(header.c)}
}
func BufferHeaderReference(header *BufferHeader) BufferHeader {
return BufferHeader{C.mmal_buffer_header_reference(header.c)}
}