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