1/*
2Copyright (c) 2012, Broadcom Europe Ltd
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the copyright holder nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef MMAL_VC_MSGS_H
29#define MMAL_VC_MSGS_H
30
31/** @file mmal_vc_msgs.h
32 *
33 * Private message definitions, defining the message API between
34 * the host and VideoCore.
35 */
36#include "interface/vcos/vcos.h"
37#include "interface/mmal/mmal.h"
38#include "mmal_vc_api.h"
39
40#define MMAL_CONTROL_FOURCC() VCHIQ_MAKE_FOURCC('m','m','a','l')
41
42/* Major version indicates binary backwards compatibility */
43#define WORKER_VER_MAJOR 16
44#define WORKER_VER_MINIMUM 10
45/* Minor version is not used normally.
46 */
47#define WORKER_VER_MINOR 1
48#ifndef WORKER_VER_MINIMUM
49#endif
50
51#define VIDEOCORE_PREFIX "vc"
52
53#define MMAL_MAX_PORTS 8 /**< Max ports per component */
54
55#define MMAL_WORKER_MAX_MSG_LEN 512
56#define MMAL_VC_CORE_STATS_NAME_MAX 32 /**< Length of the name in the core stats message */
57
58/** A MMAL_CONTROL_SERVICE_T gets space for a single message. This
59 * is the space allocated for these messages.
60 */
61#define MMAL_WORKER_MSG_LEN 28
62
63/** Maximum size of the format extradata.
64 * FIXME: should probably be made bigger and maybe be passed separately from the info.
65 */
66#define MMAL_FORMAT_EXTRADATA_MAX_SIZE 128
67
68/** Size of space reserved in a buffer message for short messages.
69 */
70#define MMAL_VC_SHORT_DATA 128
71
72/** Message ids sent to worker thread.
73 */
74
75/* Please update the array in mmal_vc_msgnames.c if this is updated.
76 */
77typedef enum {
78 MMAL_WORKER_QUIT = 1,
79 MMAL_WORKER_SERVICE_CLOSED,
80 MMAL_WORKER_GET_VERSION,
81 MMAL_WORKER_COMPONENT_CREATE,
82 MMAL_WORKER_COMPONENT_DESTROY,
83 MMAL_WORKER_COMPONENT_ENABLE,
84 MMAL_WORKER_COMPONENT_DISABLE,
85 MMAL_WORKER_PORT_INFO_GET,
86 MMAL_WORKER_PORT_INFO_SET,
87 MMAL_WORKER_PORT_ACTION,
88 MMAL_WORKER_BUFFER_FROM_HOST,
89 MMAL_WORKER_BUFFER_TO_HOST,
90 MMAL_WORKER_GET_STATS,
91 MMAL_WORKER_PORT_PARAMETER_SET,
92 MMAL_WORKER_PORT_PARAMETER_GET,
93 MMAL_WORKER_EVENT_TO_HOST,
94 MMAL_WORKER_GET_CORE_STATS_FOR_PORT,
95 MMAL_WORKER_OPAQUE_ALLOCATOR,
96 /* VC debug mode only - due to security, denial of service implications */
97 MMAL_WORKER_CONSUME_MEM,
98 MMAL_WORKER_LMK,
99 MMAL_WORKER_OPAQUE_ALLOCATOR_DESC,
100 MMAL_WORKER_DRM_GET_LHS32,
101 MMAL_WORKER_DRM_GET_TIME,
102 MMAL_WORKER_BUFFER_FROM_HOST_ZEROLEN,
103 MMAL_WORKER_PORT_FLUSH,
104 MMAL_WORKER_HOST_LOG,
105 MMAL_WORKER_COMPACT,
106 MMAL_WORKER_MSG_LAST
107} MMAL_WORKER_CMD_T;
108
109/** Every message has one of these at the start.
110 */
111typedef struct
112{
113 uint32_t magic;
114 uint32_t msgid;
115 uint32_t control_service; /** Handle to the control service (unused) */
116
117 union {
118 uint32_t waiter; /** User-land wait structure, passed back */
119 } u;
120
121 MMAL_STATUS_T status; /** Result code, passed back */
122 /* Make sure this structure is 64 bit aligned */
123 uint32_t dummy;
124} mmal_worker_msg_header;
125
126/* Make sure mmal_worker_msg_header will preserve 64 bits alignment */
127vcos_static_assert(!(sizeof(mmal_worker_msg_header) & 0x7));
128
129/* Message structures sent to worker thread.
130 */
131
132/** Tell the worker a service has closed. It should start to delete
133 * the associated components.
134 */
135typedef struct
136{
137 mmal_worker_msg_header header;
138} mmal_worker_service_closed;
139vcos_static_assert(sizeof(mmal_worker_service_closed) <= MMAL_WORKER_MSG_LEN);
140
141/** Send from VC to host to report our version */
142typedef struct
143{
144 mmal_worker_msg_header header;
145 uint32_t flags;
146 uint32_t major;
147 uint32_t minor;
148 uint32_t minimum;
149} mmal_worker_version;
150
151/** Request component creation */
152typedef struct
153{
154 mmal_worker_msg_header header;
155 uint32_t client_component; /** Client component */
156 char name[128];
157 uint32_t pid; /**< For debug */
158} mmal_worker_component_create;
159
160/** Reply to component-creation message. Reports back
161 * the number of ports.
162 */
163typedef struct
164{
165 mmal_worker_msg_header header;
166 MMAL_STATUS_T status;
167 uint32_t component_handle; /** Handle on VideoCore for component */
168 uint32_t input_num; /**< Number of input ports */
169 uint32_t output_num; /**< Number of output ports */
170 uint32_t clock_num; /**< Number of clock ports */
171} mmal_worker_component_create_reply;
172vcos_static_assert(sizeof(mmal_worker_component_create_reply) <= MMAL_WORKER_MAX_MSG_LEN);
173
174/** Destroys a component
175 */
176typedef struct
177{
178 mmal_worker_msg_header header;
179 uint32_t component_handle; /**< which component */
180} mmal_worker_component_destroy;
181
182/** Enables a component
183 */
184typedef struct
185{
186 mmal_worker_msg_header header;
187 uint32_t component_handle; /**< which component */
188} mmal_worker_component_enable;
189
190/** Disable a component
191 */
192typedef struct
193{
194 mmal_worker_msg_header header;
195 uint32_t component_handle; /**< Which component */
196} mmal_worker_component_disable;
197
198/** Component port info. Used to get port info.
199 */
200typedef struct
201{
202 mmal_worker_msg_header header;
203 uint32_t component_handle; /**< Which component */
204 MMAL_PORT_TYPE_T port_type; /**< Type of port */
205 uint32_t index; /**< Which port of given type to get */
206} mmal_worker_port_info_get;
207vcos_static_assert(sizeof(mmal_worker_port_info_get) <= MMAL_WORKER_MAX_MSG_LEN);
208
209typedef struct
210{
211 MMAL_ES_TYPE_T type; /**< Type of the elementary stream */
212
213 MMAL_FOURCC_T encoding; /**< FourCC specifying the encoding of the elementary stream.
214 * See the \ref MmalEncodings "pre-defined encodings" for some
215 * examples.
216 */
217 MMAL_FOURCC_T encoding_variant;/**< FourCC specifying the specific encoding variant of
218 * the elementary stream. See the \ref MmalEncodingVariants
219 * "pre-defined encoding variants" for some examples.
220 */
221
222 uint32_t es; /**< Type specific information for the elementary stream */
223
224 uint32_t bitrate; /**< Bitrate in bits per second */
225 uint32_t flags; /**< Flags describing properties of the elementary stream.
226 * See \ref elementarystreamflags "Elementary stream flags".
227 */
228
229 uint32_t extradata_size; /**< Size of the codec specific data */
230 uint32_t extradata; /**< Codec specific data */
231
232} MMAL_VC_ES_FORMAT_T;
233
234typedef struct
235{
236 uint32_t priv; /**< Private member used by the framework */
237 uint32_t name; /**< Port name. Used for debugging purposes (Read Only) */
238
239 MMAL_PORT_TYPE_T type; /**< Type of the port (Read Only) */
240 uint16_t index; /**< Index of the port in its type list (Read Only) */
241 uint16_t index_all; /**< Index of the port in the list of all ports (Read Only) */
242
243 uint32_t is_enabled; /**< Indicates whether the port is enabled or not (Read Only) */
244 uint32_t format; /**< Format of the elementary stream */
245
246 uint32_t buffer_num_min; /**< Minimum number of buffers the port requires (Read Only).
247 This is set by the component. */
248 uint32_t buffer_size_min; /**< Minimum size of buffers the port requires (Read Only).
249 This is set by the component. */
250 uint32_t buffer_alignment_min; /**< Minimum alignment requirement for the buffers (Read Only).
251 A value of zero means no special alignment requirements.
252 This is set by the component. */
253 uint32_t buffer_num_recommended; /**< Number of buffers the port recommends for optimal performance (Read Only).
254 A value of zero means no special recommendation.
255 This is set by the component. */
256 uint32_t buffer_size_recommended; /**< Size of buffers the port recommends for optimal performance (Read Only).
257 A value of zero means no special recommendation.
258 This is set by the component. */
259 uint32_t buffer_num; /**< Actual number of buffers the port will use.
260 This is set by the client. */
261 uint32_t buffer_size; /**< Actual maximum size of the buffers that will be sent
262 to the port. This is set by the client. */
263
264 uint32_t component; /**< Component this port belongs to (Read Only) */
265 uint32_t userdata; /**< Field reserved for use by the client */
266
267 uint32_t capabilities; /**< Flags describing the capabilities of a port (Read Only).
268 * Bitwise combination of \ref portcapabilities "Port capabilities"
269 * values.
270 */
271
272} MMAL_VC_PORT_T;
273
274/** Component port info. Used to set port info.
275 */
276typedef struct
277{
278 mmal_worker_msg_header header;
279 uint32_t component_handle; /**< Which component */
280 MMAL_PORT_TYPE_T port_type; /**< Type of port */
281 uint32_t index; /**< Which port of given type to get */
282 MMAL_VC_PORT_T port;
283 MMAL_VC_ES_FORMAT_T format;
284 MMAL_ES_SPECIFIC_FORMAT_T es;
285 uint8_t extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE];
286} mmal_worker_port_info_set;
287vcos_static_assert(sizeof(mmal_worker_port_info_set) <= MMAL_WORKER_MAX_MSG_LEN);
288
289/** Report port info back in response to a get / set. */
290typedef struct
291{
292 mmal_worker_msg_header header;
293 MMAL_STATUS_T status; /**< Result of query */
294 uint32_t component_handle; /**< Which component */
295 MMAL_PORT_TYPE_T port_type; /**< Type of port */
296 uint32_t index; /**< Which port of given type to get */
297 int32_t found; /**< Did we find anything? */
298 uint32_t port_handle; /**< Handle to use for this port */
299 MMAL_VC_PORT_T port;
300 MMAL_VC_ES_FORMAT_T format;
301 MMAL_ES_SPECIFIC_FORMAT_T es;
302 uint8_t extradata[MMAL_FORMAT_EXTRADATA_MAX_SIZE];
303} mmal_worker_port_info;
304vcos_static_assert(sizeof(mmal_worker_port_info) <= MMAL_WORKER_MAX_MSG_LEN);
305
306typedef struct
307{
308 mmal_worker_msg_header header;
309 MMAL_STATUS_T status;
310} mmal_worker_reply;
311
312typedef struct
313{
314 mmal_worker_msg_header header;
315 MMAL_STATUS_T status;
316 uint8_t secret[32];
317} mmal_worker_drm_get_lhs32_reply;
318vcos_static_assert(sizeof(mmal_worker_drm_get_lhs32_reply) <= MMAL_WORKER_MAX_MSG_LEN);
319
320typedef struct
321{
322 mmal_worker_msg_header header;
323 MMAL_STATUS_T status;
324 uint32_t time;
325} mmal_worker_drm_get_time_reply;
326vcos_static_assert(sizeof(mmal_worker_drm_get_time_reply) <= MMAL_WORKER_MAX_MSG_LEN);
327
328/** List of actions for a port */
329enum MMAL_WORKER_PORT_ACTIONS
330{
331 MMAL_WORKER_PORT_ACTION_UNKNOWN = 0, /**< Unknown action */
332 MMAL_WORKER_PORT_ACTION_ENABLE, /**< Enable a port */
333 MMAL_WORKER_PORT_ACTION_DISABLE, /**< Disable a port */
334 MMAL_WORKER_PORT_ACTION_FLUSH, /**< Flush a port */
335 MMAL_WORKER_PORT_ACTION_CONNECT, /**< Connect 2 ports together */
336 MMAL_WORKER_PORT_ACTION_DISCONNECT, /**< Disconnect 2 ports connected together */
337 MMAL_WORKER_PORT_ACTION_SET_REQUIREMENTS, /**< Set buffer requirements */
338 MMAL_WORKER_PORT_ACTION_MAX = 0x7fffffff /**< Make the enum 32bits */
339};
340
341/** Trigger an action on a port.
342 */
343typedef struct
344{
345 mmal_worker_msg_header header;
346 uint32_t component_handle;
347 uint32_t port_handle;
348 enum MMAL_WORKER_PORT_ACTIONS action;
349
350 /** Action parameter */
351 union {
352 struct {
353 MMAL_VC_PORT_T port;
354 } enable;
355 struct {
356 uint32_t component_handle;
357 uint32_t port_handle;
358 } connect;
359 } param;
360
361} mmal_worker_port_action;
362vcos_static_assert(sizeof(mmal_worker_port_action) <= MMAL_WORKER_MAX_MSG_LEN);
363
364#define MMAL_WORKER_PORT_PARAMETER_SPACE 96
365
366#define MMAL_WORKER_PORT_PARAMETER_SET_MAX \
367 (MMAL_WORKER_PORT_PARAMETER_SPACE*sizeof(uint32_t)+sizeof(MMAL_PARAMETER_HEADER_T))
368
369#define MMAL_WORKER_PORT_PARAMETER_GET_MAX MMAL_WORKER_PORT_PARAMETER_SET_MAX
370
371/** Component port parameter set. Doesn't include space for the parameter data.
372 */
373typedef struct
374{
375 mmal_worker_msg_header header;
376 uint32_t component_handle; /**< Which component */
377 uint32_t port_handle; /**< Which port */
378 MMAL_PARAMETER_HEADER_T param; /**< Parameter ID and size */
379 uint32_t space[MMAL_WORKER_PORT_PARAMETER_SPACE];
380} mmal_worker_port_param_set;
381vcos_static_assert(sizeof(mmal_worker_port_param_set) <= MMAL_WORKER_MAX_MSG_LEN);
382
383/** Component port parameter get.
384 */
385typedef struct
386{
387 mmal_worker_msg_header header;
388 uint32_t component_handle; /**< Which component */
389 uint32_t port_handle; /**< Which port */
390 MMAL_PARAMETER_HEADER_T param; /**< Parameter ID and size */
391 uint32_t space[MMAL_WORKER_PORT_PARAMETER_SPACE];
392} mmal_worker_port_param_get;
393vcos_static_assert(sizeof(mmal_worker_port_param_get) <= MMAL_WORKER_MAX_MSG_LEN);
394
395typedef struct
396{
397 mmal_worker_msg_header header;
398 uint32_t component_handle; /**< Which component */
399 uint32_t port_handle; /**< Which port */
400 MMAL_PARAMETER_HEADER_T param; /**< Parameter ID and size */
401} mmal_worker_port_param_get_old;
402
403/** Component port parameter get reply. Doesn't include space for the parameter data.
404 */
405typedef struct
406{
407 mmal_worker_msg_header header;
408 MMAL_STATUS_T status; /**< Status of mmal_port_parameter_get call */
409 MMAL_PARAMETER_HEADER_T param; /**< Parameter ID and size */
410 uint32_t space[MMAL_WORKER_PORT_PARAMETER_SPACE];
411} mmal_worker_port_param_get_reply;
412vcos_static_assert(sizeof(mmal_worker_port_param_get_reply) <= MMAL_WORKER_MAX_MSG_LEN);
413
414/** Buffer header driver area structure. In the private area
415 * of a buffer header there is a driver area where we can
416 * put values. This structure defines the layout of that.
417 */
418struct MMAL_DRIVER_BUFFER_T
419{
420 uint32_t magic;
421 uint32_t component_handle; /**< The component this buffer is from */
422 uint32_t port_handle; /**< Index into array of ports for this component */
423
424 /** Client side uses this to get back to its context structure. */
425 uint32_t client_context;
426};
427
428typedef struct MMAL_VC_BUFFER_HEADER_T
429{
430 uint32_t next; /**< Used to link several buffer headers together */
431
432 uint32_t priv; /**< Data private to the framework */
433
434 uint32_t cmd; /**< Defines what the buffer header contains. This is a FourCC
435 with 0 as a special value meaning stream data */
436
437 uint32_t data; /**< Pointer to the start of the payload buffer (should not be
438 changed by component) */
439 uint32_t alloc_size; /**< Allocated size in bytes of payload buffer */
440 uint32_t length; /**< Number of bytes currently used in the payload buffer (starting
441 from offset) */
442 uint32_t offset; /**< Offset in bytes to the start of valid data in the payload buffer */
443
444 uint32_t flags; /**< Flags describing properties of a buffer header (see
445 \ref bufferheaderflags "Buffer header flags") */
446
447 int64_t pts; /**< Presentation timestamp in microseconds. \ref MMAL_TIME_UNKNOWN
448 is used when the pts is unknown. */
449 int64_t dts; /**< Decode timestamp in microseconds (dts = pts, except in the case
450 of video streams with B frames). \ref MMAL_TIME_UNKNOWN
451 is used when the dts is unknown. */
452
453 /** Type specific data that's associated with a payload buffer */
454 uint32_t type;
455
456 uint32_t user_data; /**< Field reserved for use by the client */
457
458} MMAL_VC_BUFFER_HEADER_T;
459
460/** Receive a buffer from the host.
461 *
462 * @sa mmal_port_send_buffer()
463 */
464
465typedef struct mmal_worker_buffer_from_host
466{
467 mmal_worker_msg_header header;
468
469 /** Our control data, copied from the buffer header "driver area"
470 * @sa mmal_buffer_header_driver_data().
471 */
472 struct MMAL_DRIVER_BUFFER_T drvbuf;
473
474 /** Referenced buffer control data.
475 * This is set if the buffer is referencing another
476 * buffer as is the case with passthrough ports where
477 * buffers on the output port reference buffers on the
478 * input port. */
479 struct MMAL_DRIVER_BUFFER_T drvbuf_ref;
480
481 /** the buffer header itself */
482 MMAL_VC_BUFFER_HEADER_T buffer_header;
483 MMAL_BUFFER_HEADER_TYPE_SPECIFIC_T buffer_header_type_specific;
484
485 MMAL_BOOL_T is_zero_copy;
486 MMAL_BOOL_T has_reference;
487
488 /** If the data is short enough, then send it in the control message rather
489 * than using a separate VCHIQ bulk transfer.
490 */
491 uint32_t payload_in_message;
492 uint8_t short_data[MMAL_VC_SHORT_DATA];
493
494} mmal_worker_buffer_from_host;
495vcos_static_assert(sizeof(mmal_worker_buffer_from_host) <= MMAL_WORKER_MAX_MSG_LEN);
496
497/** Maximum number of event data bytes that can be passed in the message.
498 * More than this and the data is passed in a bulk message.
499 */
500#define MMAL_WORKER_EVENT_SPACE 256
501
502/** Send an event buffer from the host.
503 *
504 * @sa mmal_port_send_event()
505 */
506
507typedef struct mmal_worker_event_to_host
508{
509 mmal_worker_msg_header header;
510
511 uint32_t client_component;
512 uint32_t port_type;
513 uint32_t port_num;
514
515 uint32_t cmd;
516 uint32_t length;
517 uint8_t data[MMAL_WORKER_EVENT_SPACE];
518 MMAL_BUFFER_HEADER_T *delayed_buffer; /* Only used to remember buffer for bulk rx */ // FIXME
519} mmal_worker_event_to_host;
520vcos_static_assert(sizeof(mmal_worker_event_to_host) <= MMAL_WORKER_MAX_MSG_LEN);
521
522typedef struct mmal_worker_event_format_changed
523{
524 uint32_t buffer_size_min; /**< Minimum size of buffers the port requires */
525 uint32_t buffer_num_min; /**< Minimum number of buffers the port requires */
526 uint32_t buffer_size_recommended; /**< Size of buffers the port recommends for optimal performance.
527 A value of zero means no special recommendation. */
528 uint32_t buffer_num_recommended; /**< Number of buffers the port recommends for optimal
529 performance. A value of zero means no special recommendation. */
530
531 uint32_t format; /**< New elementary stream format */
532} mmal_worker_event_format_changed;
533
534typedef struct
535{
536 mmal_worker_msg_header header;
537 MMAL_VC_STATS_T stats;
538 uint32_t reset;
539} mmal_worker_stats;
540vcos_static_assert(sizeof(mmal_worker_stats) <= MMAL_WORKER_MAX_MSG_LEN);
541
542typedef enum {
543 MMAL_WORKER_OPAQUE_MEM_ALLOC,
544 MMAL_WORKER_OPAQUE_MEM_RELEASE,
545 MMAL_WORKER_OPAQUE_MEM_ACQUIRE,
546 MMAL_WORKER_OPAQUE_MEM_MAX = 0x7fffffff,
547} MMAL_WORKER_OPAQUE_MEM_OP;
548
549typedef struct
550{
551 mmal_worker_msg_header header;
552 MMAL_WORKER_OPAQUE_MEM_OP op;
553 uint32_t handle;
554 MMAL_STATUS_T status;
555 char description[32];
556} mmal_worker_opaque_allocator;
557
558/*
559 * Per-port core statistics
560 */
561typedef struct
562{
563 mmal_worker_msg_header header;
564 uint32_t component_index;
565 uint32_t port_index;
566 MMAL_PORT_TYPE_T type;
567 MMAL_CORE_STATS_DIR dir;
568 MMAL_BOOL_T reset;
569} mmal_worker_get_core_stats_for_port;
570
571typedef struct
572{
573 mmal_worker_msg_header header;
574 MMAL_STATUS_T status;
575 MMAL_STATS_RESULT_T result;
576 MMAL_CORE_STATISTICS_T stats;
577 char component_name[MMAL_VC_CORE_STATS_NAME_MAX];
578} mmal_worker_get_core_stats_for_port_reply;
579
580typedef struct
581{
582 mmal_worker_msg_header header;
583 MMAL_STATUS_T status;
584 /* The amount of memory to reserve */
585 uint32_t size;
586 /* Handle to newly allocated memory or MEM_HANDLE_INVALD on failure */
587 uint32_t handle;
588} mmal_worker_consume_mem;
589vcos_static_assert(sizeof(mmal_worker_consume_mem) <= MMAL_WORKER_MAX_MSG_LEN);
590
591typedef struct
592{
593 mmal_worker_msg_header header;
594 MMAL_STATUS_T status;
595 uint32_t mode;
596 uint32_t duration;
597} mmal_worker_compact;
598vcos_static_assert(sizeof(mmal_worker_compact) <= MMAL_WORKER_MAX_MSG_LEN);
599
600typedef struct
601{
602 mmal_worker_msg_header header;
603 /* Message text to add to the circular buffer */
604 char msg[MMAL_WORKER_MAX_MSG_LEN - sizeof(mmal_worker_msg_header)];
605} mmal_worker_host_log;
606vcos_static_assert(sizeof(mmal_worker_host_log) <= MMAL_WORKER_MAX_MSG_LEN);
607
608typedef struct
609{
610 mmal_worker_msg_header header;
611 /* The memory allocation size to pass to lmk, as if in a response to an
612 * allocation for this amount of memory. */
613 uint32_t alloc_size;
614} mmal_worker_lmk;
615vcos_static_assert(sizeof(mmal_worker_lmk) <= MMAL_WORKER_MAX_MSG_LEN);
616
617static inline void mmal_vc_buffer_header_to_msg(mmal_worker_buffer_from_host *msg,
618 MMAL_BUFFER_HEADER_T *header)
619{
620 msg->buffer_header.cmd = header->cmd;
621 msg->buffer_header.offset = header->offset;
622 msg->buffer_header.length = header->length;
623 msg->buffer_header.flags = header->flags;
624 msg->buffer_header.pts = header->pts;
625 msg->buffer_header.dts = header->dts;
626 msg->buffer_header.alloc_size = header->alloc_size;
627 msg->buffer_header.data = (uintptr_t)header->data;
628 msg->buffer_header_type_specific = *header->type;
629}
630
631static inline void mmal_vc_msg_to_buffer_header(MMAL_BUFFER_HEADER_T *header,
632 mmal_worker_buffer_from_host *msg)
633{
634 header->cmd = msg->buffer_header.cmd;
635 header->offset = msg->buffer_header.offset;
636 header->length = msg->buffer_header.length;
637 header->flags = msg->buffer_header.flags;
638 header->pts = msg->buffer_header.pts;
639 header->dts = msg->buffer_header.dts;
640 *header->type = msg->buffer_header_type_specific;
641}
642
643static inline void mmal_vc_copy_es_format_from_vc(MMAL_VC_ES_FORMAT_T *src, MMAL_ES_FORMAT_T *dest)
644{
645 // IPC MMAL_VC_ES_FORMAT_T is not necessarily the same as MMAL_ES_FORMAT_T,
646 // so copy fields individually.
647 dest->type = src->type;
648 dest->encoding = src->encoding;
649 dest->encoding_variant = src->encoding_variant;
650 dest->bitrate = src->bitrate;
651 dest->flags = src->flags;
652 dest->extradata_size = src->extradata_size;
653}
654
655#endif
656
657