omx_fbdev_sink_component.c File Reference

#include <errno.h>
#include <omxcore.h>
#include <omx_fbdev_sink_component.h>

Go to the source code of this file.

Defines

#define HEIGHT_OFFSET   10

Functions

long GetTime ()
OMX_ERRORTYPE omx_fbdev_sink_component_Constructor (OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
OMX_ERRORTYPE omx_fbdev_sink_component_Destructor (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_S32 calcStride2 (omx_fbdev_sink_component_PrivateType *omx_fbdev_sink_component_Private)
OMX_ERRORTYPE omx_fbdev_sink_component_Init (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_fbdev_sink_component_Deinit (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_S32 calcStride (OMX_U32 width, OMX_COLOR_FORMATTYPE omx_pxlfmt)
OMX_COLOR_FORMATTYPE find_omx_pxlfmt (struct fb_var_screeninfo *vscr_info)
void omx_img_copy (OMX_U8 *src_ptr, OMX_S32 src_stride, OMX_U32 src_width, OMX_U32 src_height, OMX_S32 src_offset_x, OMX_S32 src_offset_y, OMX_U8 *dest_ptr, OMX_S32 dest_stride, OMX_U32 dest_width, OMX_U32 dest_height, OMX_S32 dest_offset_x, OMX_S32 dest_offset_y, OMX_S32 cpy_width, OMX_U32 cpy_height, OMX_COLOR_FORMATTYPE colorformat, OMX_COLOR_FORMATTYPE fbpxlfmt)
void omx_fbdev_sink_component_BufferMgmtCallback (OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *pInputBuffer)
OMX_ERRORTYPE omx_fbdev_sink_component_SetConfig (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE omx_fbdev_sink_component_GetConfig (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_INOUT OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE omx_fbdev_sink_component_SetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_IN OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_fbdev_sink_component_GetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_fbdev_sink_component_MessageHandler (OMX_COMPONENTTYPE *openmaxStandComp, internalRequestMessageType *message)


Define Documentation

#define HEIGHT_OFFSET   10

height offset - reqd tadjust the display position - at the centre of upper half of screen

Definition at line 35 of file omx_fbdev_sink_component.c.

Referenced by omx_fbdev_sink_component_BufferMgmtCallback(), and omx_fbdev_sink_component_Init().


Function Documentation

OMX_S32 calcStride ( OMX_U32  width,
OMX_COLOR_FORMATTYPE  omx_pxlfmt 
)

This function takes two inputs -

Parameters:
width is the input picture width
omx_pxlfmt is the input openmax standard pixel format It calculates the byte per pixel needed to display the picture with the input omx_pxlfmt The output stride for display is thus omx_fbdev_sink_component_Private->product of input width and byte per pixel

Definition at line 291 of file omx_fbdev_sink_component.c.

Referenced by omx_fbdev_sink_component_Constructor(), omx_fbdev_sink_component_SetParameter(), omx_ffmpeg_colorconv_component_BufferMgmtCallback(), omx_ffmpeg_colorconv_component_Constructor(), omx_ffmpeg_colorconv_component_SetParameter(), and omx_img_copy().

OMX_S32 calcStride2 ( omx_fbdev_sink_component_PrivateType *  omx_fbdev_sink_component_Private  ) 

Definition at line 178 of file omx_fbdev_sink_component.c.

Referenced by omx_fbdev_sink_component_Init().

OMX_COLOR_FORMATTYPE find_omx_pxlfmt ( struct fb_var_screeninfo *  vscr_info  ) 

Returns the OpenMAX color format type corresponding to an fbdev fb_var_screeninfo structure

Parameters:
vscr_info contains the frame buffer display settings We extract the rgba configuration of the frame buffer from this structure and thereby apply the appropriate OpenMAX standard color format equivalent to this configuration the r,g,b,a content length is needed to get the bit per pixel values r,g,b,a content offsets determine their respective positions

check if gray scale - if so then, switch according to bit per pixel criteria

now check the rgba components and set the corresponding color formats

Definition at line 373 of file omx_fbdev_sink_component.c.

References OMX_COLOR_Format12bitRGB444, OMX_COLOR_Format16bitARGB1555, OMX_COLOR_Format16bitARGB4444, OMX_COLOR_Format16bitBGR565, OMX_COLOR_Format16bitRGB565, OMX_COLOR_Format18bitARGB1665, OMX_COLOR_Format18bitRGB666, OMX_COLOR_Format19bitARGB1666, OMX_COLOR_Format24bitARGB1887, OMX_COLOR_Format24bitBGR888, OMX_COLOR_Format24bitRGB888, OMX_COLOR_Format25bitARGB1888, OMX_COLOR_Format32bitARGB8888, OMX_COLOR_Format32bitBGRA8888, OMX_COLOR_Format8bitRGB332, OMX_COLOR_FormatL16, OMX_COLOR_FormatL2, OMX_COLOR_FormatL24, OMX_COLOR_FormatL32, OMX_COLOR_FormatL4, OMX_COLOR_FormatL8, OMX_COLOR_FormatMonochrome, and OMX_COLOR_FormatUnused.

Referenced by omx_fbdev_sink_component_Init().

long GetTime (  ) 

Returns a time value in milliseconds based on a clock starting at some arbitrary base. Given a call to GetTime that returns a value of n a subsequent call to GetTime made m milliseconds later should return a value of (approximately) (n+m). This method is used, for instance, to compute the duration of call.

Definition at line 48 of file omx_fbdev_sink_component.c.

Referenced by omx_fbdev_sink_component_BufferMgmtCallback().

void omx_fbdev_sink_component_BufferMgmtCallback ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_BUFFERHEADERTYPE pInputBuffer 
)

buffer management callback function takes one input buffer and displays its contents

FIXME: Configuration values should be clamped to prevent memory trampling and potential segfaults. It might be best to store clamped AND unclamped values on a per-port basis so that OMX_GetConfig can still return the unclamped ones.

getting current time

Copy image data into in_buffer

Definition at line 955 of file omx_fbdev_sink_component.c.

References GetTime(), HEIGHT_OFFSET, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BASE_SINK_INPUTPORT_INDEX, omx_img_copy(), OMX_MirrorBoth, OMX_MirrorVertical, OMX_BUFFERHEADERTYPE::pBuffer, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_fbdev_sink_component_Constructor().

OMX_ERRORTYPE omx_fbdev_sink_component_Constructor ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_STRING  cComponentName 
)

The Constructor

Parameters:
cComponentName is the name of the constructed component

we could create our own port structures here fixme maybe the base class could use a "port factory" function pointer?

Allocate Ports and call port constructor.

Domain specific section for the allocated port.

Set configs

set the function pointers

Definition at line 57 of file omx_fbdev_sink_component.c.

References base_video_port_Constructor(), calcStride(), DEB_LEV_ERR, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEBUG, err, OMX_COMPONENTTYPE::GetParameter, MAX_NUM_OF_fbdev_sink_component_INSTANCES, omx_base_sink_Constructor(), OMX_BASE_SINK_INPUTPORT_INDEX, OMX_COLOR_Format24bitRGB888, OMX_ErrorInsufficientResources, OMX_ErrorNone, omx_fbdev_sink_component_BufferMgmtCallback(), omx_fbdev_sink_component_Destructor(), omx_fbdev_sink_component_GetParameter(), omx_fbdev_sink_component_MessageHandler(), omx_fbdev_sink_component_SetParameter(), OMX_MirrorNone, OMX_TRUE, OMX_COMPONENTTYPE::pComponentPrivate, setHeader(), and OMX_COMPONENTTYPE::SetParameter.

Referenced by omx_component_library_Setup().

OMX_ERRORTYPE omx_fbdev_sink_component_Deinit ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The deinitialization function It deallocates the frame buffer memory, and closes frame buffer

Definition at line 273 of file omx_fbdev_sink_component.c.

References OMX_ErrorHardware, OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_fbdev_sink_component_MessageHandler().

OMX_ERRORTYPE omx_fbdev_sink_component_Destructor ( OMX_COMPONENTTYPE openmaxStandComp  ) 

OMX_ERRORTYPE omx_fbdev_sink_component_GetConfig ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nIndex,
OMX_INOUT OMX_PTR  pComponentConfigStructure 
)

OMX_ERRORTYPE omx_fbdev_sink_component_GetParameter ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nParamIndex,
OMX_INOUT OMX_PTR  ComponentParameterStructure 
)

OMX_ERRORTYPE omx_fbdev_sink_component_Init ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The initialization function This function opens the frame buffer device and allocates memory for display also it finds the frame buffer supported display formats

frame buffer display configuration get

From the frame buffer display rgb formats, find the corresponding standard OMX format It is needed to convert the input rgb content onto frame buffer supported rgb content

the allocated memory has more vertical reolution than needed because we want to show the output displayed not at the corner of screen, but at the centre of upper part of screen

memory map frame buf memory

Definition at line 195 of file omx_fbdev_sink_component.c.

References calcStride2(), DEB_LEV_ERR, DEB_LEV_PARAMS, DEB_LEV_SIMPLE_SEQ, DEBUG, FBDEV_FILENAME, find_omx_pxlfmt(), HEIGHT_OFFSET, OMX_BASE_SINK_INPUTPORT_INDEX, OMX_COLOR_FormatUnused, OMX_ErrorHardware, OMX_ErrorNone, OMX_ErrorUnsupportedSetting, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_fbdev_sink_component_MessageHandler().

OMX_ERRORTYPE omx_fbdev_sink_component_MessageHandler ( OMX_COMPONENTTYPE openmaxStandComp,
internalRequestMessageType message 
)

OMX_ERRORTYPE omx_fbdev_sink_component_SetConfig ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nIndex,
OMX_IN OMX_PTR  pComponentConfigStructure 
)

OMX_ERRORTYPE omx_fbdev_sink_component_SetParameter ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nParamIndex,
OMX_IN OMX_PTR  ComponentParameterStructure 
)

void omx_img_copy ( OMX_U8 src_ptr,
OMX_S32  src_stride,
OMX_U32  src_width,
OMX_U32  src_height,
OMX_S32  src_offset_x,
OMX_S32  src_offset_y,
OMX_U8 dest_ptr,
OMX_S32  dest_stride,
OMX_U32  dest_width,
OMX_U32  dest_height,
OMX_S32  dest_offset_x,
OMX_S32  dest_offset_y,
OMX_S32  cpy_width,
OMX_U32  cpy_height,
OMX_COLOR_FORMATTYPE  colorformat,
OMX_COLOR_FORMATTYPE  fbpxlfmt 
)

This function copies source image to destination image of required dimension and color formats

Parameters:
src_ptr is the source image strting pointer
src_stride is the source image stride (src_width * byte_per_pixel)
src_width is source image width & src_height is source image height
src_offset_x & src_offset_y are x,y offset values (if any) from starting pointer
dest_ptr is the destination image strting pointer
dest_stride is the destination image stride (dest_width * byte_per_pixel)
dest_width is destination image width & dest_height is destination image height
dest_offset_x dest_offset_y are x,y offset values (if any) from starting pointer
cpy_width cpy_height is the source image copy width and height - it determines the portion of source image to be copied from source to destination image
colorformat is the source image color format

CAUTION: We don't do any checking of boundaries! (FIXME - see omx_ffmpeg_colorconv_component_BufferMgmtCallback) Input frame is planar, not interleaved Feel free to add more formats if implementing them

Watch out for odd or non-multiple-of-4 (4:1:1) luma resolutions (I don't check)

Planar vs. PackedPlanar will have to be handled differently if/when slicing is implemented

OpenMAX IL spec says chroma channels are subsampled by 4x horizontally AND vertically in YUV 4:1:1. Conventional wisdom (wiki) tells us that it is only subsampled horizontally. Following OpenMAX spec anyway. Technically I guess this would be YUV 4:1:0.

Planar vs. PackedPlanar will have to be handled differently if/when slicing is implemented

Planar vs. PackedPlanar will have to be handled differently if/when slicing is implemented

Pointers to the start of each plane to make things easier

Figure out total offsets

If input stride is negative, reverse source row order

Pointers to use with memcpy

Pointers to destination planes to make things easier

Figure out total offsets

If output stride is negative, reverse destination row order

Pointers to use with memcpy

fbpxlfmt is the output (frame buffer supported) image color format here fbpxlfmt is OMX_COLOR_Format32bitARGB8888 always because the frame buffer has configuration of rgba 8/0 8/0 8/0 8/0 with pixel depth 8 if other configuration frame buffer is employed then appropriate conversion policy should be written

Definition at line 501 of file omx_fbdev_sink_component.c.

References calcStride(), DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_COLOR_Format16bitARGB1555, OMX_COLOR_Format16bitBGR565, OMX_COLOR_Format16bitRGB565, OMX_COLOR_Format24bitBGR888, OMX_COLOR_Format24bitRGB888, OMX_COLOR_Format32bitARGB8888, OMX_COLOR_Format32bitBGRA8888, OMX_COLOR_Format8bitRGB332, OMX_COLOR_FormatYUV411PackedPlanar, OMX_COLOR_FormatYUV411Planar, OMX_COLOR_FormatYUV420PackedPlanar, OMX_COLOR_FormatYUV420Planar, OMX_COLOR_FormatYUV422PackedPlanar, and OMX_COLOR_FormatYUV422Planar.

Referenced by omx_fbdev_sink_component_BufferMgmtCallback(), and omx_ffmpeg_colorconv_component_BufferMgmtCallback().


Generated for OpenMAX Bellagio rel. 0.3.5-svn by  doxygen 1.5.1
SourceForge.net Logo