omx_camera_source_component.h

Go to the documentation of this file.
00001 
00029 #ifndef _OMX_CAMERA_SOURCE_COMPONENT_H_
00030 #define _OMX_CAMERA_SOURCE_COMPONENT_H_
00031 
00032 
00033 #include <omx_base_source.h>
00034 #include <omx_base_video_port.h>
00035 
00036 #include <linux/videodev2.h>
00037 
00038 
00039 /* Camera Component Port Index */
00040 enum 
00041 {
00042     OMX_CAMPORT_INDEX_VF = 0, /* preview/viewfinder */
00043     OMX_CAMPORT_INDEX_CP,       /* captured video */
00044     OMX_CAMPORT_INDEX_CP_T,   /* thumbnail or snapshot for captured video */
00045     OMX_CAMPORT_INDEX_MAX
00046 };
00047 
00048 
00049 #define NUM_CAMERAPORTS (OMX_CAMPORT_INDEX_MAX)
00050 
00051 #define V4L2DEV_FILENAME  "/dev/video0" 
00052 
00053 
00054 
00055 typedef __u32 V4L2_PICTURE_PIX_FMT;
00056 typedef __u32 V4L2_PICTURE_DEPTHTYPE;
00057 
00058 typedef struct V4L2_COLOR_FORMATTYPE
00059 {
00060     V4L2_PICTURE_PIX_FMT v4l2Pixfmt;
00061     V4L2_PICTURE_DEPTHTYPE v4l2Depth;
00062 } V4L2_COLOR_FORMATTYPE;
00063 
00064 struct buffer
00065 {
00066   OMX_U8* pCapAddrStart; /* Starting address for captured data */
00067   unsigned int length;
00068 };
00069 
00070 /* Queue for V4L mapping buffers.
00071  *  Note: This is the key structure of the camera component. According to V4L,
00072  *  there may be multiple buffers that can be requested for buffer capturing
00073  *  one after another. All these buffers form a cyclic queue.
00074  */
00075 typedef struct OMX_V4L2_MAPBUFFER_QUEUETYPE
00076 {
00077     OMX_U32 nNextCaptureIndex; /* Which index to perform capture request */
00078     OMX_U32 nNextWaitIndex; /* Which index to sync buffer */
00079     OMX_U32 nLastBufIndex; /* The last ready buffer that has not been sent to some port */
00080     OMX_U32 nBufCountTotal; /* Number of total involved buffers, including all buffers that has been started and not been sent to some port */
00081     OMX_U32 nBufCountCaptured; /* Number of captured bufers, including all ready buffers that has not been sent to some port */
00082     struct buffer *buffers; /* V4L2 buffer map information */
00083     OMX_U32 nFrame;
00084     OMX_TICKS *qTimeStampQueue; /* Queue to store time stamps for each buffer */
00085 } OMX_V4L2_MAPBUFFER_QUEUETYPE;
00086 
00087 
00090 DERIVEDCLASS(omx_camera_source_component_PortType, omx_base_video_PortType)
00091 #define omx_camera_source_component_PortType_FIELDS omx_base_video_PortType_FIELDS \
00092  \
00093   OMX_U32 nIndexMapbufQueue;
00094 ENDCLASS(omx_camera_source_component_PortType)
00095 
00096 
00097 
00098 
00100 DERIVEDCLASS(omx_camera_source_component_PrivateType, omx_base_source_PrivateType)
00101 #define omx_camera_source_component_PrivateType_FIELDS omx_base_source_PrivateType_FIELDS \
00102  \
00103   pthread_mutex_t idle_state_mutex; \
00104  \
00105   pthread_cond_t idle_wait_condition; \
00106  \
00107   pthread_cond_t idle_process_condition; \
00108  \
00109   OMX_BOOL bWaitingOnIdle; \
00110  \
00111   OMX_STATETYPE eLastState; \
00112  \
00113   OMX_PARAM_SENSORMODETYPE sSensorMode; \
00114  \
00115   OMX_U32 nFrameIntervalInMilliSec; \
00116  \
00117   OMX_COLOR_FORMATTYPE eOmxColorFormat; \
00118  \
00119   V4L2_COLOR_FORMATTYPE sV4lColorFormat; \
00120  \
00121   int fdCam; \
00122  \
00123   OMX_V4L2_MAPBUFFER_QUEUETYPE sMapbufQueue; \
00124  \
00125   OMX_U32 nLastCaptureTimeInMilliSec; \
00126  \
00127   pthread_mutex_t setconfig_mutex; \
00128  \
00129   OMX_BOOL bCapturing; \
00130  \
00131   OMX_BOOL bCapturingNext; \
00132  \
00133   OMX_BOOL bIsFirstFrame; \
00134  \
00135   OMX_BOOL bAutoPause; \
00136  \
00137   OMX_BOOL bThumbnailStart; \
00138  \
00139   OMX_U32 nCapturedCount; \
00140  \
00141   OMX_TICKS nRefWallTime; \
00142  \
00143   struct v4l2_capability cap; \
00144  \
00145   OMX_U32 oFrameSize; \
00146  \
00147   OMX_BOOL bOutBufferMemoryMapped; \
00148   /* @param cropcap input image cropping */ \
00149   struct v4l2_cropcap cropcap; \
00150   struct v4l2_crop crop; \
00151   /* @param fmt Stream data format */ \
00152   struct v4l2_format fmt;
00153 ENDCLASS(omx_camera_source_component_PrivateType)
00154 
00155 
00156 
00157 /* Component private entry points declaration */
00158 OMX_ERRORTYPE omx_camera_source_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName);
00159 
00160 OMX_ERRORTYPE omx_camera_source_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp);
00161 
00162 #endif

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