diff options
author | Ho-Eun Ryu <ho-eun.ryu@windriver.com> | 2009-12-30 15:30:39 +0900 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 22:03:35 -0700 |
commit | bda0aed55a4fa0b0a610ee40f378ce800fa3e067 (patch) | |
tree | 24bbc83b820b3eef3b7017bfa5ecd5f8799c59f6 | |
parent | 6bda193e1851c89a63c0cda1992de30c1a1c4716 (diff) | |
download | wrs_omxil_core-bda0aed55a4fa0b0a610ee40f378ce800fa3e067.tar.gz |
core: fix debug messages
-rw-r--r-- | core/src/wrs_omxcore.cpp | 72 |
1 files changed, 64 insertions, 8 deletions
diff --git a/core/src/wrs_omxcore.cpp b/core/src/wrs_omxcore.cpp index 5720cf1..9e8a18e 100644 --- a/core/src/wrs_omxcore.cpp +++ b/core/src/wrs_omxcore.cpp @@ -19,7 +19,9 @@ #include <cmodule.h> #include <componentbase.h> -#define LOG_TAG "wrs_omxcore" +//#define LOG_NDEBUG 0 + +#define LOG_TAG "wrs-omxil-core" #include <log.h> static unsigned int g_initialized = 0; @@ -58,7 +60,7 @@ static struct list *construct_components(const char *config_file_name) if (!cmodule) continue; - LOGV("found component library %s\n", library_name); + LOGI("found component library %s\n", library_name); ret = cmodule->Load(MODULE_LAZY); if (ret != OMX_ErrorNone) @@ -74,7 +76,7 @@ static struct list *construct_components(const char *config_file_name) head = __list_add_tail(head, entry); cmodule->Unload(); - LOGV("module %s:%s added to component list\n", + LOGI("module %s:%s added to component list\n", cmodule->GetLibraryName(), cmodule->GetComponentName()); continue; @@ -107,11 +109,15 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void) { int ret; + LOGV("%s(): enter", __FUNCTION__); + pthread_mutex_lock(&g_module_lock); if (!g_initialized) { g_module_list = construct_components("wrs_omxil_components.list"); if (!g_module_list) { pthread_mutex_unlock(&g_module_lock); + LOGE("%s(): exit failure, construct_components failed", + __FUNCTION__); return OMX_ErrorInsufficientResources; } @@ -119,6 +125,7 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void) } pthread_mutex_unlock(&g_module_lock); + LOGV("%s(): exit done", __FUNCTION__); return OMX_ErrorNone; } @@ -126,6 +133,8 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void) { OMX_ERRORTYPE ret = OMX_ErrorNone; + LOGV("%s(): enter", __FUNCTION__); + pthread_mutex_lock(&g_module_lock); if (!g_nr_instances) g_module_list = destruct_components(g_module_list); @@ -133,6 +142,7 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void) ret = OMX_ErrorUndefined; pthread_mutex_unlock(&g_module_lock); + LOGV("%s(): exit done (ret : 0x%08x)", __FUNCTION__, ret); return ret; } @@ -158,6 +168,8 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum( cname = cmodule->GetComponentName(); strncpy(cComponentName, cname, nNameLength); + + LOGV("%s(): found %luth component %s", __FUNCTION__, nIndex, cname); return OMX_ErrorNone; } @@ -170,6 +182,8 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( struct list *entry; OMX_ERRORTYPE ret; + LOGV("%s(): enter, try to get %s", __FUNCTION__, cComponentName); + pthread_mutex_lock(&g_module_lock); list_foreach(g_module_list, entry) { CModule *cmodule; @@ -182,21 +196,33 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( ComponentBase *cbase = NULL; ret = cmodule->Load(MODULE_NOW); - if (ret != OMX_ErrorNone) + if (ret != OMX_ErrorNone) { + LOGE("%s(): exit failure, cmodule->Load failed\n", + __FUNCTION__); goto unlock_list; + } ret = cmodule->InstantiateComponent(&cbase); - if (ret != OMX_ErrorNone) + if (ret != OMX_ErrorNone){ + LOGE("%s(): exit failure, cmodule->Instantiate failed\n", + __FUNCTION__); goto unload_cmodule; + } ret = cbase->GetHandle(pHandle, pAppData, pCallBacks); - if (ret != OMX_ErrorNone) + if (ret != OMX_ErrorNone) { + LOGE("%s(): exit failure, cbase->GetHandle failed\n", + __FUNCTION__); goto delete_cbase; + } cbase->SetCModule(cmodule); g_nr_instances++; pthread_mutex_unlock(&g_module_lock); + + LOGI("get handle of component %s successfully", cComponentName); + LOGV("%s(): exit done\n", __FUNCTION__); return OMX_ErrorNone; delete_cbase: @@ -205,11 +231,14 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( cmodule->Unload(); unlock_list: pthread_mutex_unlock(&g_module_lock); + + LOGE("%s(): exit failure, (ret : 0x%08x)\n", __FUNCTION__, ret); return ret; } } pthread_mutex_unlock(&g_module_lock); + LOGE("%s(): exit failure, %s not found", __FUNCTION__, cComponentName); return OMX_ErrorInvalidComponent; } @@ -219,18 +248,27 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle( ComponentBase *cbase; CModule *cmodule; OMX_ERRORTYPE ret; + char cname[OMX_MAX_STRINGNAME_SIZE]; if (!hComponent) return OMX_ErrorBadParameter; cbase = static_cast<ComponentBase *> (((OMX_COMPONENTTYPE *)hComponent)->pComponentPrivate); - if (!cbase) + if (!cbase) { + LOGE("%s(): exit failure, cannot find cbase pointer\n", + __FUNCTION__); return OMX_ErrorBadParameter; + } + strcpy(&cname[0], cbase->GetName()); + + LOGV("%s(): enter, try to free %s", __FUNCTION__, cbase->GetName()); + ret = cbase->FreeHandle(hComponent); if (ret != OMX_ErrorNone) { - LOGE("failed to cbase->FreeHandle() (ret = 0x%08x)\n", ret); + LOGE("%s(): exit failure, cbase->FreeHandle() failed (ret = 0x%08x)\n", + __FUNCTION__, ret); return ret; } @@ -247,6 +285,8 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle( if (cmodule) cmodule->Unload(); + LOGI("free handle of component %s successfully", cname); + LOGV("%s(): exit done", __FUNCTION__); return OMX_ErrorNone; } @@ -289,6 +329,8 @@ OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( strncpy((OMX_STRING)&compNames[nr_comps][0], cname, OMX_MAX_STRINGNAME_SIZE); copied_nr_comps++; + LOGV("%s(): component %s has %s role", __FUNCTION__, + cname, role); } nr_comps++; } @@ -317,13 +359,27 @@ OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( CModule *cmodule; ComponentBase *cbase; OMX_STRING cname; + OMX_ERRORTYPE ret; cmodule = static_cast<CModule *>(entry->data); cname = cmodule->GetComponentName(); if (!strcmp(compName, cname)) { pthread_mutex_unlock(&g_module_lock); +#if LOG_NDEBUG return cmodule->GetComponentRoles(pNumRoles, roles); +#else + ret = cmodule->GetComponentRoles(pNumRoles, roles); + if (ret != OMX_ErrorNone) { + OMX_U32 i; + + for (i = 0; i < *pNumRoles; i++) { + LOGV("%s(): component %s has %s role", __FUNCTION__, + compName, &roles[i][0]); + } + } + return ret; +#endif } } pthread_mutex_unlock(&g_module_lock); |