From 265048077b145ccf0834b2807fb6fa14281c63ff Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Fri, 21 Oct 2011 10:11:07 -0500 Subject: DOMX: Skips DCC URI query altogether if DCC data is missing - Should improve camera startup time by avoiding sensor detection. Change-Id: Ifcd28ec7827fd42ff2b22494eda6d72057ae49fa Signed-off-by: Emilian Peev --- .../omx_camera/src/omx_proxy_camera.c | 49 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) mode change 100755 => 100644 omx_proxy_component/omx_camera/src/omx_proxy_camera.c diff --git a/omx_proxy_component/omx_camera/src/omx_proxy_camera.c b/omx_proxy_component/omx_camera/src/omx_proxy_camera.c old mode 100755 new mode 100644 index 7a42902..f72dabe --- a/omx_proxy_component/omx_camera/src/omx_proxy_camera.c +++ b/omx_proxy_component/omx_camera/src/omx_proxy_camera.c @@ -127,6 +127,7 @@ int mmap_fd; MemAllocBlock *MemReqDescTiler; #endif +OMX_BOOL check_DCCdir(OMX_STRING dir_path); OMX_S32 read_DCCdir(OMX_PTR, OMX_STRING *, OMX_U16); OMX_ERRORTYPE DCC_Init(OMX_HANDLETYPE); OMX_ERRORTYPE send_DCCBufPtr(OMX_HANDLETYPE hComponent); @@ -350,7 +351,7 @@ OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent) PROXY_assert(eOsalError == TIMM_OSAL_ERR_NONE, OMX_ErrorInsufficientResources, "Mutex lock failed"); - if (numofInstance == 0) + if ( ( numofInstance == 0 ) && check_DCCdir(DCC_PATH) ) { dcc_eError = DCC_Init(hComponent); if (dcc_eError != OMX_ErrorNone) @@ -538,6 +539,52 @@ OMX_ERRORTYPE send_DCCBufPtr(OMX_HANDLETYPE hComponent) /* ===========================================================================*/ /** + * @name check_DCCdir() + * @brief : Checks if the DCC directory exists and whether it contains + * any useful data. + * @param OMX_STRING: dir_path Path to theDCC directory + * @return return = OMX_TRUE if data is available, otherwise OMX_FALSE + * + */ +/* ===========================================================================*/ +OMX_BOOL check_DCCdir(OMX_STRING dir_path) +{ + OMX_BOOL ret = OMX_FALSE; + struct dirent *dirEntry = NULL; + DIR *dccDir = NULL; + OMX_STRING dot = "."; + + DOMX_ENTER("ENTER"); + + dccDir = opendir(dir_path); + if ( NULL != dccDir ) { + do { + dirEntry = readdir(dccDir); + if ( NULL != dirEntry ) { + if ( dot[0] == dirEntry->d_name[0] ) { + DOMX_DEBUG("Skipping DCC directory: %s", dirEntry->d_name); + continue; + } else { + DOMX_DEBUG("Valid data found in DCC directory: %s", dirEntry->d_name); + ret = OMX_TRUE; + break; + } + } else { + DOMX_DEBUG("NO entries in the DCC Directory"); + } + } while ( dirEntry != NULL ); + closedir(dccDir); + } else { + DOMX_DEBUG("No DCC Directory !"); + } + + DOMX_EXIT("return %d", ret); + + return ret; +} + +/* ===========================================================================*/ +/** * @name read_DCCdir() * @brief : copies all the dcc profiles into the allocated 1D-Tiler buffer * and returns the size of the buffer. -- cgit v1.1