int MLProc::getOutputIndex(const MLSymbol name) { // get index int idx = 0; if (procInfo().hasVariableOutputs()) { // idx = name.getNumber(); // variable outputs are indexed by symbols out1, out2, ... const std::string& str = name.getString(); if (str[0] == 'o') { idx = atoi(&str[3]); } else { /* TEMP compiler issues debug() << "MLProc::getOutputIndex: bad name for variable output index " << str << "!\n"; */ } } else { idx = procInfo().getOutputMap().getIndex(name); } if (!idx) { debug() << "MLProc::getOutputIndex: null output index!\n"; } return idx; }
int MLProc::getNumRequiredOutputs() { if (procInfo().hasVariableOutputs()) { return 0; } else { return procInfo().getOutputMap().getSize(); } }
ml::Symbol MLProc::getOutputName(int index) { if (procInfo().hasVariableOutputs()) { return ml::textUtils::addFinalNumber(ml::Symbol("out"), index); } else { return procInfo().getOutputMap().getSymbolAtIndex(index); } return ml::Symbol(); }
bool MLProc::paramExists(const MLSymbol pname) { bool r = false; if (procInfo().hasVariableParams()) { // any param exists. r = true; } else { MLSymbolMap& map = procInfo().getParamMap(); r = (map.getIndex(pname) > 0); } return r; }
int Interpreter::getArgs(const ProcInfo *info, ArgList *argList) { int i; QString label, desc, procInfo(info->procInfo); QStringList sections, words; if (info->argTypes==NULL) return -1; sections = getSections("@p", procInfo); for (i=0; info->argTypes[i]; i++) { if (i<sections.size()) { words = sections[i].split(QRegExp("\\s+")); label = words[0]; desc = sections[i]; desc.remove(QRegExp("^\\s+")); // remove leading whitespace desc.remove(QRegExp("^" + label)); // remove id desc.remove(QRegExp("^\\s+")); // remove leading whitespace argList->push_back(Arg(label, desc)); // if argument is a type hint, we need to skip the 4-byte (32-bit) int, error if we run out of args if (info->argTypes[i]==CRP_TYPE_HINT && (!info->argTypes[++i] || !info->argTypes[++i] || !info->argTypes[++i] || !info->argTypes[++i])) return -1; } else argList->push_back(Arg(QString("arg")+QString::number(i), "")); } return 0; }
void CMediaStreamingClientProfile::onBufferReceived(const iviLink::Channel::tChannelId channel, iviLink::Buffer const& buffer) { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__); if (mChannelID != channel) { LOG4CPLUS_INFO(msLogger, "mChannelID != channel_id"); return; } else { LOG4CPLUS_INFO(msLogger, "mChannelID == channel_id"); } UInt8 *incomingData = buffer.getBuffer(); int read_size = buffer.getSize(); LOG4CPLUS_INFO(msLogger, "Procedure ID = " + convertIntegerToString(incomingData[0])); if(incomingData[0] == SENDSTREAMINGINFO) { LOG4CPLUS_INFO(msLogger, "case SENDSTREAMINGINFO"); std::string info((char*)(incomingData + 1), read_size - 1); LOG4CPLUS_INFO(msLogger, "info = " + info); procInfo(info); } else { LOG4CPLUS_INFO(msLogger, "unknown procedure ID"); } }
void MLProc::setParam(const ml::Symbol pname, const MLProperty& val) { // TODO rather than setting directly here, the enclosing MLDSPContext can store a list of changes // to take effect before the next process() call. This way all the [if (mParamsChanged) doParams();] // code can be moved out of process() methods and mParamsChanged would not be needed! procInfo().setParamProperty(pname, val); mParamsChanged = true; }
int MLProc::getInputIndex(const MLSymbol name) { // get index int idx = 0; if (procInfo().hasVariableInputs()) { idx = name.getFinalNumber(); } else { // will be > 0 for valid names, otherwise 0 idx = procInfo().getInputMap().getIndex(name); } if (!idx) { debug() << "MLProc::getInputIndex: proc " << getName() << " has no input " << name << "\n"; } return idx; }
int MLProc::getOutputIndex(const ml::Symbol name) { // get index int idx = 0; if (procInfo().hasVariableOutputs()) { // variable outputs are indexed by symbols out1, out2, ... idx = ml::textUtils::getFinalNumber(name); } else { idx = procInfo().getOutputMap().getIndex(name); } if (!idx) { debug() << "MLProc::getOutputIndex: null output index!\n"; } return idx; }
MLSymbol MLProc::getOutputName(int index) { if (procInfo().hasVariableOutputs()) { return MLSymbol("out").withFinalNumber(index); } else if (index <= (int)mOutputs.size()) { MLSymbolMap& map = procInfo().getOutputMap(); for (MLSymbolMap::MLSymbolMapIter i = map.begin(); i != map.end(); i++) { if ((*i).second == index) { return ((*i).first); } } } return MLSymbol(); }
void MLProc::dumpParams() { MLSymbolMap& map = procInfo().getParamMap(); debug() << getClassName() << "(" << static_cast<void *>(this) << ")" << " params:--------\n"; for (MLSymbolMap::MLSymbolMapIter i = map.begin(); i != map.end(); i++) { const MLSymbol pName = ((*i).first); MLParamValue val = getParam(pName); debug() << "[" << pName << " : " << val << "] "; } debug() << "\n"; }
void MLProc::dumpParams() { MLSymbolMap& map = procInfo().getParamMap(); int v = map.getSize(); debug() << getClassName() << "(" << static_cast<void *>(this) << ")" << " params:--------\n"; for (int i=0; i<v; ++i) { const ml::Symbol pName = map.getSymbolAtIndex(i); float val = getParam(pName); debug() << "[" << pName << " : " << val << "] "; } debug() << "\n"; }
void MLProc::setParam(const MLSymbol pname, MLParamValue f) { // TODO post changes to be called by container procInfo().setParam(pname, f); mParamsChanged = true; }
MLParamValue MLProc::getParam(const MLSymbol pname) { return procInfo().getParam(pname); }
const MLSignal& MLProc::getSignalParam(const ml::Symbol pname) { return procInfo().getParamProperty(pname).getSignalValue(); }
const ml::Text MLProc::getTextParam(const ml::Symbol pname) { return procInfo().getParamProperty(pname).getTextValue(); }