1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #ifndef MMAL_VCHIQ_H
17 #define MMAL_VCHIQ_H
18
19 #include "mmal-msg-format.h"
20
21 #define MAX_PORT_COUNT 4
22
23
24 #define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128
25
26 struct vchiq_mmal_instance;
27
28 enum vchiq_mmal_es_type {
29 MMAL_ES_TYPE_UNKNOWN,
30 MMAL_ES_TYPE_CONTROL,
31 MMAL_ES_TYPE_AUDIO,
32 MMAL_ES_TYPE_VIDEO,
33 MMAL_ES_TYPE_SUBPICTURE
34 };
35
36 struct vchiq_mmal_port_buffer {
37 unsigned int num;
38 u32 size;
39 u32 alignment;
40 };
41
42 struct vchiq_mmal_port;
43
44 typedef void (*vchiq_mmal_buffer_cb)(
45 struct vchiq_mmal_instance *instance,
46 struct vchiq_mmal_port *port,
47 int status, struct mmal_buffer *buffer,
48 unsigned long length, u32 mmal_flags, s64 dts, s64 pts);
49
50 struct vchiq_mmal_port {
51 u32 enabled:1;
52 u32 handle;
53 u32 type;
54 u32 index;
55
56
57 struct vchiq_mmal_component *component;
58
59 struct vchiq_mmal_port *connected;
60
61
62 struct vchiq_mmal_port_buffer minimum_buffer;
63 struct vchiq_mmal_port_buffer recommended_buffer;
64 struct vchiq_mmal_port_buffer current_buffer;
65
66
67 struct mmal_es_format_local format;
68
69 union mmal_es_specific_format es;
70
71
72 struct list_head buffers;
73
74 spinlock_t slock;
75
76
77 atomic_t buffers_with_vpu;
78
79 vchiq_mmal_buffer_cb buffer_cb;
80
81 void *cb_ctx;
82 };
83
84 struct vchiq_mmal_component {
85 u32 enabled:1;
86 u32 handle;
87 u32 inputs;
88 u32 outputs;
89 u32 clocks;
90 struct vchiq_mmal_port control;
91 struct vchiq_mmal_port input[MAX_PORT_COUNT];
92 struct vchiq_mmal_port output[MAX_PORT_COUNT];
93 struct vchiq_mmal_port clock[MAX_PORT_COUNT];
94 };
95
96 int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance);
97 int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance);
98
99
100
101
102 int vchiq_mmal_component_init(
103 struct vchiq_mmal_instance *instance,
104 const char *name,
105 struct vchiq_mmal_component **component_out);
106
107 int vchiq_mmal_component_finalise(
108 struct vchiq_mmal_instance *instance,
109 struct vchiq_mmal_component *component);
110
111 int vchiq_mmal_component_enable(
112 struct vchiq_mmal_instance *instance,
113 struct vchiq_mmal_component *component);
114
115 int vchiq_mmal_component_disable(
116 struct vchiq_mmal_instance *instance,
117 struct vchiq_mmal_component *component);
118
119
120
121
122
123
124 int vchiq_mmal_port_enable(
125 struct vchiq_mmal_instance *instance,
126 struct vchiq_mmal_port *port,
127 vchiq_mmal_buffer_cb buffer_cb);
128
129
130
131
132
133 int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance,
134 struct vchiq_mmal_port *port);
135
136 int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance,
137 struct vchiq_mmal_port *port,
138 u32 parameter,
139 void *value,
140 u32 value_size);
141
142 int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance,
143 struct vchiq_mmal_port *port,
144 u32 parameter,
145 void *value,
146 u32 *value_size);
147
148 int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance,
149 struct vchiq_mmal_port *port);
150
151 int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
152 struct vchiq_mmal_port *src,
153 struct vchiq_mmal_port *dst);
154
155 int vchiq_mmal_version(struct vchiq_mmal_instance *instance,
156 u32 *major_out,
157 u32 *minor_out);
158
159 int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance,
160 struct vchiq_mmal_port *port,
161 struct mmal_buffer *buf);
162
163 int mmal_vchi_buffer_init(struct vchiq_mmal_instance *instance,
164 struct mmal_buffer *buf);
165 int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf);
166 #endif