My Project
|
00001 /* 00002 Copyright (c) 2012, Broadcom Europe Ltd 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are met: 00007 * Redistributions of source code must retain the above copyright 00008 notice, this list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright 00010 notice, this list of conditions and the following disclaimer in the 00011 documentation and/or other materials provided with the distribution. 00012 * Neither the name of the copyright holder nor the 00013 names of its contributors may be used to endorse or promote products 00014 derived from this software without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 #ifndef MMAL_UTIL_H 00029 #define MMAL_UTIL_H 00030 00031 #include "interface/mmal/mmal.h" 00032 00040 #define MMAL_OFFSET(TYPE, FIELD) ((size_t)((uint8_t *)&((TYPE*)0)->FIELD - (uint8_t *)0)) 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00051 const char *mmal_status_to_string(MMAL_STATUS_T status); 00052 00059 uint32_t mmal_encoding_stride_to_width(uint32_t encoding, uint32_t stride); 00060 00067 uint32_t mmal_encoding_width_to_stride(uint32_t encoding, uint32_t width); 00068 00074 const char* mmal_port_type_to_string(MMAL_PORT_TYPE_T type); 00075 00089 MMAL_PARAMETER_HEADER_T *mmal_port_parameter_alloc_get(MMAL_PORT_T *port, 00090 uint32_t id, uint32_t size, MMAL_STATUS_T *status); 00091 00097 void mmal_port_parameter_free(MMAL_PARAMETER_HEADER_T *param); 00098 00104 void mmal_buffer_header_copy_header(MMAL_BUFFER_HEADER_T *dest, const MMAL_BUFFER_HEADER_T *src); 00105 00122 MMAL_POOL_T *mmal_port_pool_create(MMAL_PORT_T *port, 00123 unsigned int headers, uint32_t payload_size); 00124 00132 void mmal_port_pool_destroy(MMAL_PORT_T *port, MMAL_POOL_T *pool); 00133 00138 void mmal_log_dump_port(MMAL_PORT_T *port); 00139 00144 void mmal_log_dump_format(MMAL_ES_FORMAT_T *format); 00145 00154 MMAL_PORT_T *mmal_util_get_port(MMAL_COMPONENT_T *comp, MMAL_PORT_TYPE_T type, unsigned index); 00155 00164 char *mmal_4cc_to_string(char *buf, size_t len, uint32_t fourcc); 00165 00166 00167 #ifdef __cplusplus 00168 } 00169 #endif 00170 00173 #endif