omxvideocapnplay.c File Reference

#include "omxvideocapnplay.h"

Go to the source code of this file.

Defines

#define COMPONENT_NAME_BASE   "OMX.st.video_src"
#define BASE_ROLE   "video_src"
#define COMPONENT_NAME_BASE_LEN   20

Functions

int setPortParameters ()
void display_help ()
OMX_ERRORTYPE test_OMX_ComponentNameEnum ()
OMX_ERRORTYPE test_OMX_RoleEnum (OMX_STRING component_name)
OMX_ERRORTYPE test_OMX_ComponentEnumByRole (OMX_STRING role_name)
OMX_ERRORTYPE test_OpenClose (OMX_STRING component_name)
int main (int argc, char **argv)
OMX_ERRORTYPE fb_sinkEventHandler (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_EVENTTYPE eEvent, OMX_OUT OMX_U32 Data1, OMX_OUT OMX_U32 Data2, OMX_OUT OMX_PTR pEventData)
OMX_ERRORTYPE fb_sinkEmptyBufferDone (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE colorconvEventHandler (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_EVENTTYPE eEvent, OMX_OUT OMX_U32 Data1, OMX_OUT OMX_U32 Data2, OMX_OUT OMX_PTR pEventData)
OMX_ERRORTYPE colorconvEmptyBufferDone (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE colorconvFillBufferDone (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE videosrcEventHandler (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_EVENTTYPE eEvent, OMX_OUT OMX_U32 Data1, OMX_OUT OMX_U32 Data2, OMX_OUT OMX_PTR pEventData)
OMX_ERRORTYPE videosrcFillBufferDone (OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_BUFFERHEADERTYPE *pBuffer)

Variables

OMX_CALLBACKTYPE videosrccallbacks
OMX_CALLBACKTYPE colorconv_callbacks
OMX_CALLBACKTYPE fbdev_sink_callbacks
appPrivateTypeappPriv
OMX_COLOR_FORMATTYPE COLOR_CONV_OUT_RGB_FORMAT = OMX_COLOR_Format24bitRGB888
OMX_BUFFERHEADERTYPEpOutBuffer1
OMX_BUFFERHEADERTYPEpOutBuffer2
OMX_BUFFERHEADERTYPEpInBufferColorConv1
OMX_BUFFERHEADERTYPEpInBufferColorConv2
OMX_BUFFERHEADERTYPEpOutBufferColorConv1
OMX_BUFFERHEADERTYPEpOutBufferColorConv2
OMX_BUFFERHEADERTYPEpInBufferSink1
OMX_BUFFERHEADERTYPEpInBufferSink2
int buffer_in_size = 4096
OMX_U32 buffer_out_size
OMX_U32 outbuf_colorconv_size
OMX_PARAM_PORTDEFINITIONTYPE paramPort
OMX_PARAM_PORTDEFINITIONTYPE omx_colorconvPortDefinition
OMX_PARAM_COMPONENTROLETYPE paramRole
OMX_VIDEO_PARAM_PORTFORMATTYPE omxVideoParam
OMX_U32 out_width = 176
OMX_U32 out_height = 144
char * output_file
FILE * outfile
int flagIsOutputExpected
int flagDecodedOutputReceived
int flagIsColorConvRequested
int flagIsSinkRequested
int flagIsFormatRequested
int flagSetupTunnel


Detailed Description

Test application that uses a OpenMAX component, a generic video source. The application receives an video stream (.m4v or .264) decoded by a multiple format source component. The decoded output is seen by a yuv viewer.

Copyright (C) 2007 STMicroelectronics Copyright (C) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

$Date$ Revision $Rev$ Author $Author$

Definition in file omxvideocapnplay.c.


Define Documentation

#define BASE_ROLE   "video_src"

Definition at line 35 of file omxvideocapnplay.c.

#define COMPONENT_NAME_BASE   "OMX.st.video_src"

defining global declarations

Definition at line 34 of file omxvideocapnplay.c.

#define COMPONENT_NAME_BASE_LEN   20

Definition at line 36 of file omxvideocapnplay.c.


Function Documentation

OMX_ERRORTYPE colorconvEmptyBufferDone ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_BUFFERHEADERTYPE pBuffer 
)

OMX_ERRORTYPE colorconvEventHandler ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_EVENTTYPE  eEvent,
OMX_OUT OMX_U32  Data1,
OMX_OUT OMX_U32  Data2,
OMX_OUT OMX_PTR  pEventData 
)

OMX_ERRORTYPE colorconvFillBufferDone ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_BUFFERHEADERTYPE pBuffer 
)

if there is no sink component then write buffer content in output file, in non tunneled case else in non tunneled case, call the sink comp handle to process this buffer as its input buffer

Definition at line 1021 of file omxvideocapnplay.c.

References DEB_LEV_ERR, DEBUG, err, appPrivateType::fbdev_sink_handle, flagIsSinkRequested, flagSetupTunnel, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERFLAG_EOS, OMX_EmptyThisBuffer, OMX_ErrorNone, OMX_FillThisBuffer, OMX_TRUE, outfile, and OMX_BUFFERHEADERTYPE::pBuffer.

void display_help (  ) 

help display

Definition at line 200 of file omxvideocapnplay.c.

OMX_ERRORTYPE fb_sinkEmptyBufferDone ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_BUFFERHEADERTYPE pBuffer 
)

OMX_ERRORTYPE fb_sinkEventHandler ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_EVENTTYPE  eEvent,
OMX_OUT OMX_U32  Data1,
OMX_OUT OMX_U32  Data2,
OMX_OUT OMX_PTR  pEventData 
)

int main ( int  argc,
char **  argv 
)

if color converter component is not selected then sink component will not work, even if specified

output file name check

getting video source handle

getting color converter component handle, if specified

getting sink component handle - if reqd'

output buffer size calculation based on input dimension speculation

if tunneling option is given then set up the tunnel between the components

sending command to video source component to go to idle state

in tunnel case, change the color conv and sink comp state to idle

if tunneling option is not given then allocate buffers on video source output port

in non tunneled case, using buffers in color conv input port, allocated by video dec component output port

allocating buffers in the color converter compoennt output port

send command to change color onv and sink comp in executing state

sending command to video source component to go to executing state

state change of all components from executing to idle

sending command to all components to go to loaded state

freeing buffers of color conv and sink component

freeing buffers of video source input ports

closing the output file

Definition at line 362 of file omxvideocapnplay.c.

References BASE_ROLE, buffer_out_size, COLOR_CONV_OUT_RGB_FORMAT, appPrivateType::colorconv_handle, appPrivateType::colorconvEventSem, COMPONENT_NAME_BASE, DEB_LEV_ERR, DEB_LEV_PARAMS, DEB_LEV_SIMPLE_SEQ, DEBUG, DEFAULT_MESSAGES, display_help(), appPrivateType::eofSem, err, appPrivateType::fbdev_sink_handle, appPrivateType::fbdevSinkEventSem, flagDecodedOutputReceived, flagIsColorConvRequested, flagIsFormatRequested, flagIsOutputExpected, flagIsSinkRequested, flagSetupTunnel, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_AllocateBuffer, OMX_COLOR_Format16bitARGB1555, OMX_COLOR_Format16bitBGR565, OMX_COLOR_Format16bitRGB565, OMX_COLOR_Format24bitBGR888, OMX_COLOR_Format24bitRGB888, OMX_COLOR_Format32bitARGB8888, OMX_COLOR_Format32bitBGRA8888, OMX_CommandStateSet, OMX_Deinit(), OMX_ErrorNone, OMX_FillThisBuffer, OMX_FreeBuffer, OMX_FreeHandle(), OMX_GetHandle(), OMX_GetParameter, OMX_IndexParamPortDefinition, OMX_Init(), OMX_MAX_STRINGNAME_SIZE, OMX_SendCommand, OMX_SetupTunnel(), OMX_StateExecuting, OMX_StateIdle, OMX_StateLoaded, OMX_TRUE, OMX_UseBuffer, out_height, out_width, outbuf_colorconv_size, outfile, output_file, OMX_BUFFERHEADERTYPE::pBuffer, setHeader(), setPortParameters(), appPrivateType::sourceEventSem, test_OMX_ComponentEnumByRole(), test_OMX_ComponentNameEnum(), test_OMX_RoleEnum(), test_OpenClose(), tsem_down(), tsem_init(), and appPrivateType::videosrchandle.

int setPortParameters (  ) 

this function sets the color converter and video sink port characteristics based on the video source output port settings

setting the color converter and sink component chararacteristics, if selected - both in tunneled as well as non tunneled case

setting the color conv input port width, height it will be same as the video source output port width, height

setting the color converter output width height it will be same as input dimensions

setting the input color format of color converter component it will be same as output yuv color format of the source component

setting output RGB color format of the color converter component

if video sink component is selected then set its input port settings accroding to the output port settings of the color converter component

Definition at line 102 of file omxvideocapnplay.c.

OMX_ERRORTYPE test_OMX_ComponentEnumByRole ( OMX_STRING  role_name  ) 

OMX_ERRORTYPE test_OMX_ComponentNameEnum (  ) 

OMX_ERRORTYPE test_OMX_RoleEnum ( OMX_STRING  component_name  ) 

OMX_ERRORTYPE test_OpenClose ( OMX_STRING  component_name  ) 

OMX_ERRORTYPE videosrcEventHandler ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_EVENTTYPE  eEvent,
OMX_OUT OMX_U32  Data1,
OMX_OUT OMX_U32  Data2,
OMX_OUT OMX_PTR  pEventData 
)

Callbacks implementation of the video source component

Definition at line 1065 of file omxvideocapnplay.c.

OMX_ERRORTYPE videosrcFillBufferDone ( OMX_OUT OMX_HANDLETYPE  hComponent,
OMX_OUT OMX_PTR  pAppData,
OMX_OUT OMX_BUFFERHEADERTYPE pBuffer 
)

if there is color conv component in processing state then send this buffer, in non tunneled case else in non tunneled case, write the output buffer contents in the specified output file

Definition at line 1119 of file omxvideocapnplay.c.


Variable Documentation

global variables

Definition at line 55 of file omxvideocapnplay.c.

int buffer_in_size = 4096

Definition at line 65 of file omxvideocapnplay.c.

Definition at line 66 of file omxvideocapnplay.c.

OMX_COLOR_FORMATTYPE COLOR_CONV_OUT_RGB_FORMAT = OMX_COLOR_Format24bitRGB888

Definition at line 57 of file omxvideocapnplay.c.

Initial value:

 { .EventHandler = colorconvEventHandler,
    .EmptyBufferDone = colorconvEmptyBufferDone,
    .FillBufferDone = colorconvFillBufferDone
    }

Definition at line 43 of file omxvideocapnplay.c.

Initial value:

 { .EventHandler = fb_sinkEventHandler,
    .EmptyBufferDone = fb_sinkEmptyBufferDone,
    .FillBufferDone = NULL
    }

Definition at line 48 of file omxvideocapnplay.c.

Definition at line 80 of file omxvideocapnplay.c.

Definition at line 83 of file omxvideocapnplay.c.

Referenced by main().

Definition at line 79 of file omxvideocapnplay.c.

Definition at line 82 of file omxvideocapnplay.c.

Definition at line 84 of file omxvideocapnplay.c.

Definition at line 70 of file omxvideocapnplay.c.

Referenced by SetPortParametersVideo().

Definition at line 72 of file omxvideocapnplay.c.

Definition at line 74 of file omxvideocapnplay.c.

Definition at line 73 of file omxvideocapnplay.c.

Definition at line 67 of file omxvideocapnplay.c.

Referenced by main(), and videodecEventHandler().

FILE* outfile

Definition at line 77 of file omxvideocapnplay.c.

char* output_file

Definition at line 76 of file omxvideocapnplay.c.

Definition at line 69 of file omxvideocapnplay.c.

Definition at line 71 of file omxvideocapnplay.c.

used with color converter if selected

Definition at line 62 of file omxvideocapnplay.c.

Definition at line 62 of file omxvideocapnplay.c.

Definition at line 63 of file omxvideocapnplay.c.

Definition at line 63 of file omxvideocapnplay.c.

used with video source

Definition at line 60 of file omxvideocapnplay.c.

Definition at line 60 of file omxvideocapnplay.c.

Definition at line 62 of file omxvideocapnplay.c.

Definition at line 62 of file omxvideocapnplay.c.

Initial value:

 { .EventHandler = videosrcEventHandler,
    .EmptyBufferDone = NULL,
    .FillBufferDone = videosrcFillBufferDone
    }

Definition at line 38 of file omxvideocapnplay.c.


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