// From NodeRegistrySharedLibraryInterface void UnregisterAllNodes(PVPlayerNodeRegistryInterface* aRegistry, OsclAny* aContext) { if (NULL != aContext) { Oscl_Vector<PVPlayerNodeInfo, OsclMemAllocator>* nodeList = (Oscl_Vector<PVPlayerNodeInfo, OsclMemAllocator> *)aContext; while (!nodeList->empty()) { PVPlayerNodeInfo tmpnode = nodeList->front(); OSCL_DELETE(tmpnode.iSharedLibrary); aRegistry->UnregisterNode(tmpnode); nodeList->erase(nodeList->begin()); } delete nodeList; } };
void UnregisterAllRecognizers(PVPlayerRecognizerRegistryInterface* aRegistry, OsclAny* aContext) { if (NULL != aContext) { Oscl_Vector<PVMFRecognizerPluginFactory*, OsclMemAllocator>* pluginList = (Oscl_Vector<PVMFRecognizerPluginFactory*, OsclMemAllocator>*)aContext; while (!pluginList->empty()) { PVMFRecognizerPluginFactory* tmpfac = pluginList->front(); aRegistry->UnregisterRecognizer(tmpfac); pluginList->erase(pluginList->begin()); OSCL_DELETE(tmpfac); } delete pluginList; } };
//Read and parse the config file //retval = -1 if the config file doesnt exist int8 ReadAndParseLoggerConfigFile() { int8 retval = 1; if (0 != iLogFile.Open(iLogFileName, Oscl_File::MODE_READ, iFileServer)) { retval = -1; } else { if (!iLogFileRead) { int32 nCharRead = iLogFile.Read(ibuffer, 1, sizeof(ibuffer)); //Parse the buffer for \n chars Oscl_Vector<char*, OsclMemAllocator> LogConfigStrings; const char *end_ptr = ibuffer + oscl_strlen(ibuffer) ; // Point just beyond the end const char *section_start_ptr; const char *line_start_ptr, *line_end_ptr; char* end_temp_ptr; int16 offset = 0; section_start_ptr = skip_whitespace_and_line_term(ibuffer, end_ptr); while (section_start_ptr < end_ptr) { if (!get_next_line(section_start_ptr, end_ptr, line_start_ptr, line_end_ptr)) { break; } section_start_ptr = line_end_ptr + 1; end_temp_ptr = (char*)line_end_ptr; *end_temp_ptr = '\0'; LogConfigStrings.push_back((char*)line_start_ptr); } //Populate the LoggerConfigElements vector { if (!LogConfigStrings.empty()) { Oscl_Vector<char*, OsclMemAllocator>::iterator it; it = LogConfigStrings.begin(); uint32 appenderType; PV_atoi(*it, 'd', oscl_strlen(*it), appenderType); iAppenderType = appenderType; if (LogConfigStrings.size() > 1) { for (it = LogConfigStrings.begin() + 1; it != LogConfigStrings.end(); it++) { char* CommaIndex = (char*)oscl_strstr(*it, ","); if (CommaIndex != NULL) { *CommaIndex = '\0'; LoggerConfigElement obj; uint32 logLevel; PV_atoi(*it, 'd', oscl_strlen(*it), logLevel); obj.iLogLevel = logLevel; obj.iLoggerString = CommaIndex + 1; iLoggerConfigElements.push_back(obj); } } } else { //Add the config element for complete logging fo all the modules LoggerConfigElement obj; obj.iLoggerString = ""; obj.iLogLevel = 8; iLoggerConfigElements.push_back(obj); } } } iLogFile.Close(); iLogFileRead = true; } } return retval; }