Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mmal_il.h 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. Copyright (c) 2012, Broadcom Europe Ltd
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of the copyright holder nor the
  12. names of its contributors may be used to endorse or promote products
  13. derived from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
  18. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef MMAL_IL_H
  26. #define MMAL_IL_H
  27. /** \defgroup MmalILUtility MMAL to OMX IL conversion utilities
  28. * \ingroup MmalUtilities
  29. *
  30. * @{
  31. */
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #include "interface/vmcs_host/khronos/IL/OMX_Core.h"
  36. #include "interface/vmcs_host/khronos/IL/OMX_Component.h"
  37. #include "interface/vmcs_host/khronos/IL/OMX_Video.h"
  38. #include "interface/vmcs_host/khronos/IL/OMX_Audio.h"
  39. #include "interface/vmcs_host/khronos/IL/OMX_Broadcom.h"
  40. /** Convert MMAL status codes into OMX error codes.
  41. *
  42. * @param status MMAL status code.
  43. * @return OMX error code.
  44. */
  45. OMX_ERRORTYPE mmalil_error_to_omx(MMAL_STATUS_T status);
  46. /** Convert OMX error codes into MMAL status codes.
  47. *
  48. * @param error OMX error code.
  49. * @return MMAL status code.
  50. */
  51. MMAL_STATUS_T mmalil_error_to_mmal(OMX_ERRORTYPE error);
  52. /** Convert MMAL buffer header flags into OMX buffer header flags.
  53. *
  54. * @param flags OMX buffer header flags.
  55. * @return MMAL buffer header flags.
  56. */
  57. uint32_t mmalil_buffer_flags_to_mmal(OMX_U32 flags);
  58. /** Convert OMX buffer header flags into MMAL buffer header flags.
  59. *
  60. * @param flags MMAL buffer header flags.
  61. * @return OMX buffer header flags.
  62. */
  63. OMX_U32 mmalil_buffer_flags_to_omx(uint32_t flags);
  64. /** Convert a MMAL buffer header into an OMX buffer header.
  65. * Note that only the fields which have a direct mapping between OMX and MMAL are converted.
  66. *
  67. * @param omx Pointer to the destination OMX buffer header.
  68. * @param mmal Pointer to the source MMAL buffer header.
  69. */
  70. void mmalil_buffer_header_to_omx(OMX_BUFFERHEADERTYPE *omx, MMAL_BUFFER_HEADER_T *mmal);
  71. /** Convert an OMX buffer header into a MMAL buffer header.
  72. *
  73. * @param mmal Pointer to the destination MMAL buffer header.
  74. * @param omx Pointer to the source OMX buffer header.
  75. */
  76. void mmalil_buffer_header_to_mmal(MMAL_BUFFER_HEADER_T *mmal, OMX_BUFFERHEADERTYPE *omx);
  77. OMX_PORTDOMAINTYPE mmalil_es_type_to_omx_domain(MMAL_ES_TYPE_T type);
  78. MMAL_ES_TYPE_T mmalil_omx_domain_to_es_type(OMX_PORTDOMAINTYPE domain);
  79. uint32_t mmalil_omx_audio_coding_to_encoding(OMX_AUDIO_CODINGTYPE coding);
  80. OMX_AUDIO_CODINGTYPE mmalil_encoding_to_omx_audio_coding(uint32_t encoding);
  81. uint32_t mmalil_omx_video_coding_to_encoding(OMX_VIDEO_CODINGTYPE coding);
  82. OMX_VIDEO_CODINGTYPE mmalil_encoding_to_omx_video_coding(uint32_t encoding);
  83. uint32_t mmalil_omx_image_coding_to_encoding(OMX_IMAGE_CODINGTYPE coding);
  84. OMX_IMAGE_CODINGTYPE mmalil_encoding_to_omx_image_coding(uint32_t encoding);
  85. uint32_t mmalil_omx_coding_to_encoding(uint32_t encoding, OMX_PORTDOMAINTYPE domain);
  86. uint32_t mmalil_omx_color_format_to_encoding(OMX_COLOR_FORMATTYPE coding);
  87. OMX_COLOR_FORMATTYPE mmalil_encoding_to_omx_color_format(uint32_t encoding);
  88. uint32_t mmalil_omx_color_space_to_mmal(OMX_COLORSPACETYPE coding);
  89. OMX_COLORSPACETYPE mmalil_color_space_to_omx(uint32_t coding);
  90. uint32_t mmalil_omx_video_profile_to_mmal(OMX_U32 level, OMX_VIDEO_CODINGTYPE coding);
  91. OMX_U32 mmalil_video_profile_to_omx(uint32_t profile);
  92. uint32_t mmalil_omx_video_level_to_mmal(OMX_U32 level, OMX_VIDEO_CODINGTYPE coding);
  93. OMX_U32 mmalil_video_level_to_omx(uint32_t level);
  94. MMAL_VIDEO_RATECONTROL_T mmalil_omx_video_ratecontrol_to_mmal(OMX_VIDEO_CONTROLRATETYPE omx);
  95. OMX_VIDEO_CONTROLRATETYPE mmalil_video_ratecontrol_to_omx(MMAL_VIDEO_RATECONTROL_T mmal);
  96. MMAL_VIDEO_INTRA_REFRESH_T mmalil_omx_video_intrarefresh_to_mmal(OMX_VIDEO_INTRAREFRESHTYPE omx);
  97. /** Union of all the OMX_VIDEO/AUDIO_PARAM types */
  98. typedef union OMX_FORMAT_PARAM_TYPE {
  99. OMX_PARAM_U32TYPE common;
  100. /* Video */
  101. OMX_VIDEO_PARAM_AVCTYPE avc;
  102. OMX_VIDEO_PARAM_H263TYPE h263;
  103. OMX_VIDEO_PARAM_MPEG2TYPE mpeg2;
  104. OMX_VIDEO_PARAM_MPEG4TYPE mpeg4;
  105. OMX_VIDEO_PARAM_WMVTYPE wmv;
  106. OMX_VIDEO_PARAM_RVTYPE rv;
  107. /* Audio */
  108. OMX_AUDIO_PARAM_PCMMODETYPE pcm;
  109. OMX_AUDIO_PARAM_MP3TYPE mp3;
  110. OMX_AUDIO_PARAM_AACPROFILETYPE aac;
  111. OMX_AUDIO_PARAM_VORBISTYPE vorbis;
  112. OMX_AUDIO_PARAM_WMATYPE wma;
  113. OMX_AUDIO_PARAM_RATYPE ra;
  114. OMX_AUDIO_PARAM_SBCTYPE sbc;
  115. OMX_AUDIO_PARAM_ADPCMTYPE adpcm;
  116. OMX_AUDIO_PARAM_G723TYPE g723;
  117. OMX_AUDIO_PARAM_G726TYPE g726;
  118. OMX_AUDIO_PARAM_G729TYPE g729;
  119. OMX_AUDIO_PARAM_AMRTYPE amr;
  120. OMX_AUDIO_PARAM_GSMFRTYPE gsmfr;
  121. OMX_AUDIO_PARAM_GSMHRTYPE gsmhr;
  122. OMX_AUDIO_PARAM_GSMEFRTYPE gsmefr;
  123. OMX_AUDIO_PARAM_TDMAFRTYPE tdmafr;
  124. OMX_AUDIO_PARAM_TDMAEFRTYPE tdmaefr;
  125. OMX_AUDIO_PARAM_PDCFRTYPE pdcfr;
  126. OMX_AUDIO_PARAM_PDCEFRTYPE pdcefr;
  127. OMX_AUDIO_PARAM_PDCHRTYPE pdchr;
  128. OMX_AUDIO_PARAM_QCELP8TYPE qcelp8;
  129. OMX_AUDIO_PARAM_QCELP13TYPE qcelp13;
  130. OMX_AUDIO_PARAM_EVRCTYPE evrc;
  131. OMX_AUDIO_PARAM_SMVTYPE smv;
  132. OMX_AUDIO_PARAM_MIDITYPE midi;
  133. #ifdef OMX_AUDIO_CodingDDP_Supported
  134. OMX_AUDIO_PARAM_DDPTYPE ddp;
  135. #endif
  136. #ifdef OMX_AUDIO_CodingDTS_Supported
  137. OMX_AUDIO_PARAM_DTSTYPE dts;
  138. #endif
  139. } OMX_FORMAT_PARAM_TYPE;
  140. /** Get the OMX_IndexParamAudio index corresponding to a specified audio coding type.
  141. *
  142. * @param coding Audio coding type.
  143. * @param size Pointer used to return the size of the parameter.
  144. *
  145. * @return OMX index or 0 if no match was found.
  146. */
  147. OMX_INDEXTYPE mmalil_omx_audio_param_index(OMX_AUDIO_CODINGTYPE coding, OMX_U32 *size);
  148. /** Get the audio coding corresponding to a specified OMX_IndexParamAudio index.
  149. *
  150. * @param index Audio coding type.
  151. *
  152. * @return Audio coding type.
  153. */
  154. OMX_AUDIO_CODINGTYPE mmalil_omx_audio_param_index_to_coding(OMX_INDEXTYPE index);
  155. /** Setup a default channel mapping based on the number of channels
  156. * @param channel_mapping The output channel mapping
  157. * @param nchannels Number of channels
  158. *
  159. * @return MMAL_SUCCESS if we managed to produce a channel mapping
  160. */
  161. MMAL_STATUS_T mmalil_omx_default_channel_mapping(OMX_AUDIO_CHANNELTYPE *channel_mapping, unsigned int nchannels);
  162. /** Convert an OMX_IndexParamAudio into a MMAL elementary stream format.
  163. *
  164. * @param format Format structure to update.
  165. * @param coding Audio coding type.
  166. * @param param Source OMX_IndexParamAudio structure.
  167. *
  168. * @return The MMAL encoding if a match was found or MMAL_ENCODING_UNKNOWN otherwise.
  169. */
  170. MMAL_FOURCC_T mmalil_omx_audio_param_to_format(MMAL_ES_FORMAT_T *format,
  171. OMX_AUDIO_CODINGTYPE coding, OMX_FORMAT_PARAM_TYPE *param);
  172. /** Convert a MMAL elementary stream format into a OMX_IndexParamAudio structure.
  173. *
  174. * @param param OMX_IndexParamAudio structure to update.
  175. * @param param_index returns the OMX_IndexParamAudio index corresponding to the format.
  176. * @param format Source format structure.
  177. *
  178. * @return The OMX aduio coding type if a match was found or OMX_AUDIO_CodingUnused otherwise.
  179. */
  180. OMX_AUDIO_CODINGTYPE mmalil_format_to_omx_audio_param(OMX_FORMAT_PARAM_TYPE *param,
  181. OMX_INDEXTYPE *param_index, MMAL_ES_FORMAT_T *format);
  182. #ifdef __cplusplus
  183. }
  184. #endif
  185. /** @} */
  186. #endif /* MMAL_IL_H */