Exemplo n.º 1
0
static tsk_bool_t tdav_codec_g729ab_sdp_att_match(const tmedia_codec_t* codec, const char* att_name, const char* att_value)
{	
	tdav_codec_g729ab_t* g729a = (tdav_codec_g729ab_t*)codec;

	if(tsk_striequals(att_name, "fmtp")){
		tsk_params_L_t* params = tsk_null;
		const char* val_str;
		if((params = tsk_params_fromstring(att_value, ";", tsk_true))){
			if((val_str = tsk_params_get_param_value(params, "annexb"))){
                g729a->encoder.vad_enable &= tsk_strequals(val_str, "yes") ? 1 : 0;
			}
			TSK_OBJECT_SAFE_FREE(params);
		}
	}
	return tsk_true;
}
Exemplo n.º 2
0
tsk_bool_t tdav_codec_mp4ves_sdp_att_match(const tmedia_codec_t* _self, const char* att_name, const char* att_value)
{
	tdav_codec_mp4ves_t *self = (tdav_codec_mp4ves_t *)_self;

	if(!self){
		TSK_DEBUG_ERROR("Invalid parameter");
		return tsk_false;
	}

	if(tsk_striequals(att_name, "fmtp")){
		tsk_params_L_t* params ;
		/* e.g. profile-level-id=1; xx=yy */
		if((params = tsk_params_fromstring(att_value, ";", tsk_true))){
			int val_int;
			if((val_int = tsk_params_get_param_value_as_int(params, "profile-level-id")) != -1){
				TSK_DEBUG_INFO("Proposed profile-level-id=%d", val_int);
				self->profile = val_int; // FIXME: Take the remote profile-level-id even if the bandwidth level doesn't match
			}
			TSK_OBJECT_SAFE_FREE(params);
		}
		
		switch (self->profile ) {
			case Simple_Profile_Level_1:
				TMEDIA_CODEC_VIDEO(self)->out.width = TMEDIA_CODEC_VIDEO(self)->in.width = 176; TMEDIA_CODEC_VIDEO(self)->in.height = TMEDIA_CODEC_VIDEO(self)->out.height = 144;
				break;
			case Simple_Profile_Level_2:
			case Simple_Profile_Level_3:
			default:
				TMEDIA_CODEC_VIDEO(self)->out.width = TMEDIA_CODEC_VIDEO(self)->in.width = 352; TMEDIA_CODEC_VIDEO(self)->in.height = TMEDIA_CODEC_VIDEO(self)->out.height = 288;
				break;
		}
	}
	else if(tsk_striequals(att_name, "imageattr")){
		unsigned in_width, in_height, out_width, out_height;
		if(tmedia_parse_video_imageattr(att_value, TMEDIA_CODEC_VIDEO(self)->pref_size, &in_width, &in_height, &out_width, &out_height) != 0){
			return tsk_false;
		}
		TMEDIA_CODEC_VIDEO(self)->in.width = in_width;
		TMEDIA_CODEC_VIDEO(self)->in.height = in_height;
		TMEDIA_CODEC_VIDEO(self)->out.width = out_width;
		TMEDIA_CODEC_VIDEO(self)->out.height = out_height;
	}

	return tsk_true;
}
Exemplo n.º 3
0
static tsk_bool_t tdav_codec_opus_sdp_att_match(const tmedia_codec_t* codec, const char* att_name, const char* att_value)
{
    tdav_codec_opus_t* opus = (tdav_codec_opus_t*)codec;

    if(!opus) {
        TSK_DEBUG_ERROR("Invalid parameter");
        return tsk_false;
    }

    TSK_DEBUG_INFO("[OPUS] Trying to match [%s:%s]", att_name, att_value);

    if(tsk_striequals(att_name, "fmtp")) {
        int val_int;
        tsk_params_L_t* params;
        /* e.g. FIXME */
        if((params = tsk_params_fromstring(att_value, ";", tsk_true))) {
            tsk_bool_t ret = tsk_false;
            /* === maxplaybackrate ===*/
            if((val_int = tsk_params_get_param_value_as_int(params, "maxplaybackrate")) != -1) {
                if(!_tdav_codec_opus_rate_is_valid(val_int)) {
                    TSK_DEBUG_ERROR("[OPUS] %d not valid as maxplaybackrate value", val_int);
                    goto done;
                }
                TMEDIA_CODEC(opus)->out.rate = TSK_MIN((int32_t)TMEDIA_CODEC(opus)->out.rate, val_int);
                TMEDIA_CODEC_AUDIO(opus)->out.timestamp_multiplier = tmedia_codec_audio_get_timestamp_multiplier(codec->id, codec->out.rate);
            }
            /* === sprop-maxcapturerate ===*/
            if((val_int = tsk_params_get_param_value_as_int(params, "sprop-maxcapturerate")) != -1) {
                if(!_tdav_codec_opus_rate_is_valid(val_int)) {
                    TSK_DEBUG_ERROR("[OPUS] %d not valid as sprop-maxcapturerate value", val_int);
                    goto done;
                }
                TMEDIA_CODEC(opus)->in.rate = TSK_MIN((int32_t)TMEDIA_CODEC(opus)->in.rate, val_int);
                TMEDIA_CODEC_AUDIO(opus)->in.timestamp_multiplier = tmedia_codec_audio_get_timestamp_multiplier(codec->id, codec->in.rate);
            }
            ret = tsk_true;
done:
            TSK_OBJECT_SAFE_FREE(params);
            return ret;
        }
    }

    return tsk_true;
}