bool UmcScenario::LoadCapabilities(const apr_xml_elem* pElem, apr_pool_t* pool) { const apr_xml_elem* pChildElem; /* Load Child Elements */ m_pCapabilities = (mpf_codec_capabilities_t*) apr_palloc(pool,sizeof(mpf_codec_capabilities_t)); mpf_codec_capabilities_init(m_pCapabilities,1,pool); for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next) { if(strcasecmp(pChildElem->name,"codec") != 0) continue; const char* pName = NULL; const char* pRates = NULL; const apr_xml_attr* pAttr; for(pAttr = pChildElem->attr; pAttr; pAttr = pAttr->next) { if(strcasecmp(pAttr->name,"name") == 0) { pName = pAttr->value; } else if(strcasecmp(pAttr->name,"rates") == 0) { pRates = pAttr->value; } } if(pName) { int rates = ParseRates(pRates,pool); mpf_codec_capabilities_add(m_pCapabilities,rates,pName); } } return true; }
/** Create stream capabilities */ MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e direction, apr_pool_t *pool) { mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t)); capabilities->direction = direction; mpf_codec_capabilities_init(&capabilities->codecs,1,pool); return capabilities; }