#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <OMX_Core.h>
#include <OMX_Component.h>
#include <OMX_Types.h>
#include "omxcameratest.h"
Go to the source code of this file.
Copyright (C) 2007 Motorola
This code is licensed under LGPL see README for full LGPL notice.
Date Author Comment Fri, 06 Jul 2007 Motorola File created Fri, 15 Feb 2008 Motorola Update: The current implementation for this test app can only support one color format and image size on each port. To convert color formats and image sizes to other choices on some port, that port must be tunneled with a color conversion component. Tue, 06 Apr 2008 STM Update: Adding support for the color converter
This Program 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.
$Date$ Revision $Rev$ Author $Author$
Definition in file omxcameratest.c.
OMX_ERRORTYPE camera_sourceEventHandler | ( | 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 camera component
Definition at line 81 of file omxcameratest.c.
References appPrivateType::cameraSourceEventSem, DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_CommandStateSet, OMX_ErrorNone, OMX_EventCmdComplete, OMX_StateExecuting, OMX_StateIdle, OMX_StateInvalid, OMX_StateLoaded, OMX_StatePause, OMX_StateWaitForResources, and tsem_up().
OMX_ERRORTYPE camera_sourceFillBufferDone | ( | OMX_OUT OMX_HANDLETYPE | hComponent, | |
OMX_OUT OMX_PTR | pAppData, | |||
OMX_OUT OMX_BUFFERHEADERTYPE * | pBuffer | |||
) |
Definition at line 125 of file omxcameratest.c.
References appPrivateType::camerahandle, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEBUG, fCapture, fThumbnail, OMX_BUFFERFLAG_STARTTIME, OMX_CAMPORT_INDEX_CP, OMX_CAMPORT_INDEX_CP_T, OMX_ErrorNone, and OMX_FillThisBuffer.
OMX_ERRORTYPE colorconvEmptyBufferDone | ( | OMX_OUT OMX_HANDLETYPE | hComponent, | |
OMX_OUT OMX_PTR | pAppData, | |||
OMX_OUT OMX_BUFFERHEADERTYPE * | pBuffer | |||
) |
Definition at line 210 of file omxcameratest.c.
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 | |||
) |
callbacks implementation of color converter component
Definition at line 166 of file omxcameratest.c.
OMX_ERRORTYPE colorconvFillBufferDone | ( | OMX_OUT OMX_HANDLETYPE | hComponent, | |
OMX_OUT OMX_PTR | pAppData, | |||
OMX_OUT OMX_BUFFERHEADERTYPE * | pBuffer | |||
) |
Definition at line 224 of file omxcameratest.c.
void display_help | ( | char * | cSelfName | ) |
Definition at line 571 of file omxcameratest.c.
References g_DefaultCaptureFileName, and g_DefaultThumbnailFileName.
OMX_ERRORTYPE fbsinkEmptyBufferDone | ( | OMX_OUT OMX_HANDLETYPE | hComponent, | |
OMX_OUT OMX_PTR | pAppData, | |||
OMX_OUT OMX_BUFFERHEADERTYPE * | pBuffer | |||
) |
Definition at line 283 of file omxcameratest.c.
References DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, DEBUG, and OMX_ErrorNone.
OMX_ERRORTYPE fbsinkEventHandler | ( | 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 fbsink component
Definition at line 239 of file omxcameratest.c.
References DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, DEBUG, appPrivateType::fbsinkEventSem, OMX_CommandStateSet, OMX_ErrorNone, OMX_EventCmdComplete, OMX_StateExecuting, OMX_StateIdle, OMX_StateInvalid, OMX_StateLoaded, OMX_StatePause, OMX_StateWaitForResources, and tsem_up().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 602 of file omxcameratest.c.
References OMX_CONFIG_BOOLEANTYPE::bEnabled, appPrivateType::camerahandle, appPrivateType::cameraSourceEventSem, appPrivateType::colorconvEventSem, appPrivateType::colorconvhandle, DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, display_help(), err, appPrivateType::fbsinkEventSem, appPrivateType::fbsinkhandle, fCapture, fThumbnail, g_DefaultCaptureFileName, g_DefaultThumbnailFileName, OMX_PORTBUFFERCTXT::nBufferCountActual, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERHEADERTYPE::nOffset, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, NUM_CAMERAPORTS, OMX_AllocateBuffer, OMX_CAMPORT_INDEX_CP, OMX_CAMPORT_INDEX_CP_T, OMX_CAMPORT_INDEX_VF, OMX_CommandStateSet, OMX_Deinit(), OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_FALSE, OMX_FillThisBuffer, OMX_FreeBuffer, OMX_FreeHandle(), OMX_GetHandle(), OMX_GetParameter, OMX_GetState, OMX_IndexAutoPauseAfterCapture, OMX_IndexConfigCapturing, OMX_IndexParamPortDefinition, OMX_Init(), OMX_SendCommand, OMX_SetConfig, OMX_SetupTunnel(), OMX_StateExecuting, OMX_StateIdle, OMX_StateLoaded, OMX_StatePause, OMX_TRUE, OMX_PORTBUFFERCTXT::pBufHeaderList, setCameraParameters(), setColorConvParameters(), setFbsinkParameters(), setHeader(), tsem_deinit(), tsem_down(), and tsem_init().
OMX_ERRORTYPE setCameraParameters | ( | OMX_BOOL | bCameraStillImageMode | ) |
Set parameters for camera/fbsink components
Definition at line 311 of file omxcameratest.c.
References OMX_PARAM_SENSORMODETYPE::bOneShot, appPrivateType::camerahandle, DEFAULT_CAMERA_COLOR_FORMAT, DEFAULT_FRAME_HEIGHT, DEFAULT_FRAME_RATE, DEFAULT_FRAME_WIDTH, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eCompressionFormat, err, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_PARAM_SENSORMODETYPE::nFrameRate, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_FRAMESIZETYPE::nHeight, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_FRAMESIZETYPE::nPortIndex, OMX_PARAM_SENSORMODETYPE::nPortIndex, OMX_VIDEO_PORTDEFINITIONTYPE::nSliceHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nStride, OMX_FRAMESIZETYPE::nWidth, OMX_CAMPORT_INDEX_CP, OMX_CAMPORT_INDEX_CP_T, OMX_CAMPORT_INDEX_VF, OMX_ErrorNone, OMX_GetParameter, OMX_IndexParamCommonSensorMode, OMX_IndexParamPortDefinition, OMX_SetParameter, OMX_VIDEO_CodingUnused, setHeader(), OMX_PARAM_SENSORMODETYPE::sFrameSize, and OMX_PARAM_PORTDEFINITIONTYPE::video.
Referenced by main().
OMX_ERRORTYPE setColorConvParameters | ( | ) |
Definition at line 396 of file omxcameratest.c.
References appPrivateType::colorconvhandle, DEB_LEV_ERR, DEBUG, DEFAULT_CAMERA_COLOR_FORMAT, DEFAULT_FBSINK_COLOR_FORMAT, DEFAULT_FRAME_HEIGHT, DEFAULT_FRAME_WIDTH, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eCompressionFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE::eCompressionFormat, err, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_VIDEO_PARAM_PORTFORMATTYPE::nIndex, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_VIDEO_PORTDEFINITIONTYPE::nSliceHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nStride, OMX_ErrorNone, OMX_GetParameter, OMX_IndexParamPortDefinition, OMX_IndexParamVideoPortFormat, OMX_SetParameter, OMX_VIDEO_CodingUnused, setHeader(), OMX_PARAM_PORTDEFINITIONTYPE::video, and OMX_VIDEO_PARAM_PORTFORMATTYPE::xFramerate.
Referenced by main().
OMX_ERRORTYPE setFbsinkParameters | ( | ) |
Definition at line 485 of file omxcameratest.c.
References DEB_LEV_ERR, DEBUG, DEFAULT_FBSINK_COLOR_FORMAT, DEFAULT_FRAME_HEIGHT, DEFAULT_FRAME_WIDTH, OMX_VIDEO_PORTDEFINITIONTYPE::eColorFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE::eColorFormat, OMX_VIDEO_PORTDEFINITIONTYPE::eCompressionFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE::eCompressionFormat, err, appPrivateType::fbsinkhandle, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nFrameWidth, OMX_CONFIG_RECTTYPE::nHeight, OMX_VIDEO_PARAM_PORTFORMATTYPE::nIndex, OMX_CONFIG_RECTTYPE::nLeft, OMX_CONFIG_POINTTYPE::nPortIndex, OMX_CONFIG_RECTTYPE::nPortIndex, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, OMX_VIDEO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_VIDEO_PORTDEFINITIONTYPE::nSliceHeight, OMX_VIDEO_PORTDEFINITIONTYPE::nStride, OMX_CONFIG_RECTTYPE::nTop, OMX_CONFIG_RECTTYPE::nWidth, OMX_CONFIG_POINTTYPE::nX, OMX_CONFIG_POINTTYPE::nY, OMX_ErrorNone, OMX_GetConfig, OMX_GetParameter, OMX_IndexConfigCommonInputCrop, OMX_IndexConfigCommonOutputPosition, OMX_IndexParamPortDefinition, OMX_IndexParamVideoPortFormat, OMX_SetConfig, OMX_SetParameter, OMX_VIDEO_CodingUnused, setHeader(), OMX_PARAM_PORTDEFINITIONTYPE::video, and OMX_VIDEO_PARAM_PORTFORMATTYPE::xFramerate.
Referenced by main().
OMX_ERRORTYPE setHeader | ( | OMX_PTR | header, | |
OMX_U32 | size | |||
) |
Simply fills the first two fields in any OMX structure with the size and the version.
header | pointer to the structure to be filled | |
size | size of the structure. It can be obtained with a call to sizeof of the structure type |
Definition at line 298 of file omxcameratest.c.
References OMX_VERSIONTYPE::nRevision, OMX_VERSIONTYPE::nStep, OMX_VERSIONTYPE::nVersionMajor, OMX_VERSIONTYPE::nVersionMinor, OMX_ErrorNone, OMX_VERSIONTYPE::s, SPECREVISION, SPECSTEP, SPECVERSIONMAJOR, SPECVERSIONMINOR, VERSIONMAJOR, VERSIONMINOR, VERSIONREVISION, and VERSIONSTEP.
appPrivateType* appPriv = NULL |
Definition at line 70 of file omxcameratest.c.
Initial value:
{ .EventHandler = camera_sourceEventHandler, .EmptyBufferDone = NULL, .FillBufferDone = camera_sourceFillBufferDone }
Definition at line 50 of file omxcameratest.c.
Initial value:
{ .EventHandler = colorconvEventHandler, .EmptyBufferDone = colorconvEmptyBufferDone, .FillBufferDone = colorconvFillBufferDone }
Definition at line 57 of file omxcameratest.c.
Initial value:
{ .EventHandler = fbsinkEventHandler, .EmptyBufferDone = fbsinkEmptyBufferDone, .FillBufferDone = NULL }
Definition at line 64 of file omxcameratest.c.
FILE* fCapture = NULL |
Definition at line 74 of file omxcameratest.c.
Referenced by camera_sourceFillBufferDone(), and main().
FILE* fThumbnail = NULL |
Definition at line 76 of file omxcameratest.c.
Referenced by camera_sourceFillBufferDone(), and main().
char g_DefaultCaptureFileName[] = "capture.yuv" |
char g_DefaultThumbnailFileName[] = "thumbnail.yuv" |
OMX_PORTBUFFERCTXT sCameraPortBufferList[(OMX_CAMPORT_INDEX_MAX)] |
Definition at line 72 of file omxcameratest.c.