Exemplo n.º 1
0
/** Match codec list with specified capabilities */
MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities)
{
	int i;
	mpf_codec_descriptor_t *descriptor;
	apt_bool_t status = FALSE;
	if(!capabilities) {
		return FALSE;
	}

	for(i=0; i<codec_list->descriptor_arr->nelts; i++) {
		descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t);
		if(descriptor->enabled == FALSE) continue;

		/* match capabilities */
		if(mpf_codec_capabilities_attribs_find(capabilities,descriptor)) {
			/* at least one codec descriptor matches */
			status = TRUE;
		}
		else {
			descriptor->enabled = FALSE;
		}
	}

	return status;
}
Exemplo n.º 2
0
/** Modify codec list according to capabilities specified */
MPF_DECLARE(apt_bool_t) mpf_codec_list_modify(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities)
{
    int i;
    mpf_codec_descriptor_t *descriptor;
    if(!capabilities) {
        return FALSE;
    }

    for(i=0; i<codec_list->descriptor_arr->nelts; i++) {
        descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t);
        /* match capabilities */
        if(!mpf_codec_capabilities_attribs_find(capabilities,descriptor)) {
            descriptor->enabled = FALSE;
        }
    }

    return TRUE;
}
Exemplo n.º 3
0
/** Create codec descriptor by capabilities */
MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool)
{
    mpf_codec_descriptor_t *descriptor;
    mpf_codec_attribs_t *attribs = NULL;
    if(capabilities && peer) {
        attribs = mpf_codec_capabilities_attribs_find(capabilities,peer);
    }

    if(!attribs) {
        return mpf_codec_lpcm_descriptor_create(8000,1,pool);
    }

    descriptor = mpf_codec_descriptor_create(pool);
    *descriptor = *peer;
    if(apt_string_compare(&peer->name,&attribs->name) == FALSE) {
        descriptor->payload_type = RTP_PT_UNKNOWN;
        descriptor->name = attribs->name;
    }
    return descriptor;
}