-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPanelPlayerNative.cs
More file actions
69 lines (57 loc) · 2.61 KB
/
Copy pathPanelPlayerNative.cs
File metadata and controls
69 lines (57 loc) · 2.61 KB
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
using System;
using System.Runtime.InteropServices;
namespace PanelPlayerExample
{
/// <summary>
/// Native P/Invoke declarations for libpanelplayer.so
/// </summary>
public static class PanelPlayerNative
{
private const string LibraryName = "libpanelplayer.so";
public const int PANELPLAYER_SUCCESS = 0;
public const int PANELPLAYER_ERROR = -1;
public const int PANELPLAYER_INVALID_PARAM = -2;
public const int PANELPLAYER_NOT_INITIALIZED = -3;
public const int PANELPLAYER_ALREADY_INITIALIZED = -4;
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_init(
[MarshalAs(UnmanagedType.LPStr)] string interface_name,
int width,
int height,
int brightness
);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_set_mix(int mix_percentage);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_set_rate(int frame_rate);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_set_duplicate(
[MarshalAs(UnmanagedType.I1)] bool enable
);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_load_extension(
[MarshalAs(UnmanagedType.LPStr)] string extension_path
);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_play_file(
[MarshalAs(UnmanagedType.LPStr)] string file_path
);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_play_frame_bgr(
[MarshalAs(UnmanagedType.LPArray)] byte[] bgr_data,
int width,
int height
);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern int panelplayer_send_brightness(
byte red,
byte green,
byte blue
);
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool panelplayer_is_initialized();
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
public static extern void panelplayer_cleanup();
}
}