status_t Harness::allocatePortBuffers(
        const sp<MemoryDealer> &dealer,
        IOMX::node_id node, OMX_U32 portIndex,
        Vector<Buffer> *buffers) {
    buffers->clear();

    OMX_PARAM_PORTDEFINITIONTYPE def;
    status_t err = getPortDefinition(node, portIndex, &def);
    EXPECT_SUCCESS(err, "getPortDefinition");

    for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
        Buffer buffer;
        buffer.mMemory = dealer->allocate(def.nBufferSize);
        buffer.mFlags = 0;
        CHECK(buffer.mMemory != NULL);

        err = mOMX->allocateBufferWithBackup(
                node, portIndex, buffer.mMemory, &buffer.mID);
        EXPECT_SUCCESS(err, "allocateBuffer");

        buffers->push(buffer);
    }

    return OK;
}
int SWProcess::getDefaultPort()
{
   IPropertyTree * portAttrNode =  getPortDefinition();
   if (!portAttrNode) return 0;
   int defaultValue = portAttrNode->getPropInt("@default");

   if (!defaultValue) return 0;

   return defaultValue;
}
bool SWProcess::portIsRequired()
{
   IPropertyTree * portAttrNode =  getPortDefinition();
   if (!portAttrNode) return false;

   const char* portUseAttr = portAttrNode->queryProp("@use");
   if (portUseAttr && stricmp(portUseAttr, "required"))
      return false;

   return true;
}