My Project
Modules | Defines | Functions
Utility functions

Modules

 utility
 Port connection utility
 Graph Utility
 MMAL to OMX IL conversion utilities
 Rational Utility Functions

Defines

#define MMAL_OFFSET(TYPE, FIELD)   ((size_t)((uint8_t *)&((TYPE*)0)->FIELD - (uint8_t *)0))

Functions

const char * mmal_status_to_string (MMAL_STATUS_T status)
uint32_t mmal_encoding_stride_to_width (uint32_t encoding, uint32_t stride)
uint32_t mmal_encoding_width_to_stride (uint32_t encoding, uint32_t width)
const char * mmal_port_type_to_string (MMAL_PORT_TYPE_T type)
MMAL_PARAMETER_HEADER_Tmmal_port_parameter_alloc_get (MMAL_PORT_T *port, uint32_t id, uint32_t size, MMAL_STATUS_T *status)
void mmal_port_parameter_free (MMAL_PARAMETER_HEADER_T *param)
void mmal_buffer_header_copy_header (MMAL_BUFFER_HEADER_T *dest, const MMAL_BUFFER_HEADER_T *src)
MMAL_POOL_Tmmal_port_pool_create (MMAL_PORT_T *port, unsigned int headers, uint32_t payload_size)
void mmal_port_pool_destroy (MMAL_PORT_T *port, MMAL_POOL_T *pool)
void mmal_log_dump_port (MMAL_PORT_T *port)
void mmal_log_dump_format (MMAL_ES_FORMAT_T *format)
MMAL_PORT_Tmmal_util_get_port (MMAL_COMPONENT_T *comp, MMAL_PORT_TYPE_T type, unsigned index)
char * mmal_4cc_to_string (char *buf, size_t len, uint32_t fourcc)

Detailed Description

The utility functions provide helpers for common functionality that is not part of the core MMAL API.


Define Documentation

#define MMAL_OFFSET (   TYPE,
  FIELD 
)    ((size_t)((uint8_t *)&((TYPE*)0)->FIELD - (uint8_t *)0))

Offset in bytes of FIELD in TYPE.


Function Documentation

char* mmal_4cc_to_string ( char *  buf,
size_t  len,
uint32_t  fourcc 
)

Convert a 4cc into a string.

Parameters:
bufDestination for result
lenSize of result buffer
fourcc4cc to be converted
Returns:
converted string (buf)

Copy buffer header metadata from source to destination.

Parameters:
destThe destination buffer header.
srcThe source buffer header.

Copy buffer header metadata from source to dest

uint32_t mmal_encoding_stride_to_width ( uint32_t  encoding,
uint32_t  stride 
)

Convert stride to pixel width for a given pixel encoding.

Parameters:
encodingThe pixel encoding (such as one of the pre-defined encodings)
strideThe stride in bytes.
Returns:
The width in pixels.
uint32_t mmal_encoding_width_to_stride ( uint32_t  encoding,
uint32_t  width 
)

Convert pixel width to stride for a given pixel encoding

Parameters:
encodingThe pixel encoding (such as one of the pre-defined encodings)
widthThe width in pixels.
Returns:
The stride in bytes.

Log the content of a MMAL_ES_FORMAT_T structure.

Parameters:
formatPointer to the format to dump.
void mmal_log_dump_port ( MMAL_PORT_T port)

Log the content of a MMAL_PORT_T structure.

Parameters:
portPointer to the port to dump.
MMAL_PARAMETER_HEADER_T* mmal_port_parameter_alloc_get ( MMAL_PORT_T port,
uint32_t  id,
uint32_t  size,
MMAL_STATUS_T status 
)

Get a parameter from a port allocating the required amount of memory for the parameter (i.e. for variable length parameters like URI or arrays). The size field will be set on output to the actual size of the parameter allocated and retrieved.

The pointer returned must be released by a call to mmal_port_parameter_free().

Parameters:
portport to send request to
idparameter id
sizeinitial size hint for allocation (can be 0)
statusstatus of the parameter get operation (can be 0)
Returns:
pointer to the header of the parameter or NULL on failure.

Free a parameter structure previously allocated via mmal_port_parameter_alloc_get().

Parameters:
parampointer to header of the parameter
MMAL_POOL_T* mmal_port_pool_create ( MMAL_PORT_T port,
unsigned int  headers,
uint32_t  payload_size 
)

Create a pool of MMAL_BUFFER_HEADER_T associated with a specific port. This allows a client to allocate memory for the payload buffers based on the preferences of a port. This for instance will allow the port to allocate memory which can be shared between the host processor and videocore. After allocation, all allocated buffer headers will have been added to the queue.

It is valid to create a pool with no buffer headers, or with zero size payload buffers. The mmal_pool_resize() function can be used to increase or decrease the number of buffer headers, or the size of the payload buffers, after creation of the pool.

Parameters:
portPort responsible for creating the pool.
headersNumber of buffers which will be allocated with the pool.
payload_sizeSize of the payload buffer which will be allocated in each of the buffer headers.
Returns:
Pointer to the newly created pool or NULL on failure.

Create a pool of MMAL_BUFFER_HEADER_T

void mmal_port_pool_destroy ( MMAL_PORT_T port,
MMAL_POOL_T pool 
)

Destroy a pool of MMAL_BUFFER_HEADER_T associated with a specific port. This will also deallocate all of the memory which was allocated when creating or resizing the pool.

Parameters:
portPointer to the port responsible for creating the pool.
poolPointer to the pool to be destroyed.

Destroy a pool of MMAL_BUFFER_HEADER_T

Convert a port type to a string.

Parameters:
typeThe MMAL port type.
Returns:
A NULL-terminated string describing the port type.
const char* mmal_status_to_string ( MMAL_STATUS_T  status)

Convert a status to a statically-allocated string.

Parameters:
statusThe MMAL status code.
Returns:
A C string describing the status code.
MMAL_PORT_T* mmal_util_get_port ( MMAL_COMPONENT_T comp,
MMAL_PORT_TYPE_T  type,
unsigned  index 
)

Return the nth port.

Parameters:
compcomponent to query
indexport index
typeport type
Returns:
port or NULL if not found
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines