-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpv_test.go
72 lines (65 loc) · 2.13 KB
/
mpv_test.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
package mpv
import (
"fmt"
"testing"
)
func TestClientApiVersion(t *testing.T) {
fmt.Println(ClientApiVersion())
}
func TestMpv(t *testing.T) {
mpv := Create()
fmt.Println(mpv.ClientName())
fmt.Println(mpv.Initialize())
mpv.Destroy()
}
func TestMpv_GetProperty(t *testing.T) {
mpv := Create()
fmt.Println(mpv.Initialize())
fmt.Println(mpv.GetPropertyString("idle-actffive"))
fmt.Println(mpv.GetPropertyString("idle-active"))
fmt.Println(mpv.GetPropertyOsdString("idle-active"))
fmt.Println(mpv.GetProperty("idle-active", FORMAT_STRING))
fmt.Println(mpv.GetProperty("volume", FORMAT_STRING))
fmt.Println(mpv.GetProperty("volume", FORMAT_INT64))
fmt.Println(mpv.GetProperty("audio-device-list", FORMAT_STRING))
fmt.Println(mpv.GetPropertyString("audio-device-list"))
mpv.Destroy()
}
func TestMpv_SetProperty(t *testing.T) {
mpv := Create()
fmt.Println(mpv.Initialize())
fmt.Println(mpv.GetProperty("volume", FORMAT_STRING))
fmt.Println(mpv.GetProperty("volume", FORMAT_INT64))
fmt.Println(mpv.SetProperty("volume", FORMAT_INT64, 50))
fmt.Println(mpv.GetProperty("volume", FORMAT_INT64))
mpv.Destroy()
}
func TestMpv_SetProperty2(t *testing.T) {
mpv := Create()
fmt.Println(mpv.Initialize())
fmt.Println(mpv.GetProperty("volume", FORMAT_STRING))
fmt.Println(mpv.GetProperty("volume", FORMAT_INT64))
fmt.Println(mpv.SetProperty("volume", FORMAT_INT64, 50))
fmt.Println(mpv.GetProperty("volume", FORMAT_INT64))
fmt.Println(mpv.SetPropertyString("volume", "61"))
//fmt.Println(mpv.SetProperty("volume", FORMAT_STRING, "61"))
fmt.Println(mpv.GetProperty("volume", FORMAT_INT64))
mpv.Destroy()
}
func TestMpv_GetProperty2(t *testing.T) {
mpv := Create()
fmt.Println(mpv.Initialize())
fmt.Println(FORMAT_NODE_ARRAY, FORMAT_NODE_MAP)
n, _ := mpv.GetProperty("audio-device-list", FORMAT_NODE)
fmt.Println(n.(Node))
fmt.Println(n.(Node).Format)
for _, val := range n.(Node).Value.([]Node) {
fmt.Println(val)
for key, val2 := range val.Value.(map[string]Node) {
fmt.Println(key, val2)
}
}
fmt.Println(mpv.GetProperty("audio-device-list", FORMAT_STRING))
fmt.Println(mpv.GetProperty("audio-device", FORMAT_STRING))
mpv.Destroy()
}