-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.go
68 lines (50 loc) · 1.27 KB
/
common.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
// 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_common.h>
*/
import "C"
import (
"fmt"
)
func ToString(s interface{}) string {
return fmt.Sprint(s)
}
// TODO(zchee): implements
// func CountOf(x unsafe.Pointer) interface{} { return nil }
func FourCC(a, b, c, d rune) int {
return int(a) | int(b)<<8 | int(c)<<16 | int(d)<<24
}
var Magic = FourCC('m', 'm', 'a', 'l')
type BoolT C.MMAL_BOOL_T
var (
False = 0
True = 1
)
type CoreStatisticsType struct {
c C.MMAL_CORE_STATISTICS_T
}
func (c CoreStatisticsType) BufferCount() uint32 {
return uint32(c.c.buffer_count)
}
func (c CoreStatisticsType) FirstBufferTime() uint32 {
return uint32(c.c.first_buffer_time)
}
func (c CoreStatisticsType) LastBufferTime() uint32 {
return uint32(c.c.last_buffer_time)
}
func (c CoreStatisticsType) MaxDelay() uint32 {
return uint32(c.c.max_delay)
}
type CorePortStatisticsType struct {
c C.MMAL_CORE_PORT_STATISTICS_T
}
func (c CorePortStatisticsType) RX() CoreStatisticsType {
return CoreStatisticsType{c.c.rx}
}
func (c CorePortStatisticsType) TX() CoreStatisticsType {
return CoreStatisticsType{c.c.tx}
}
type Fixed1616 uint32