Beispiel #1
0
static int module_init(void)
{
	debug("gsm: GSM v%u.%u.%u\n", GSM_MAJOR, GSM_MINOR, GSM_PATCHLEVEL);

	aucodec_register(baresip_aucodecl(), &ac_gsm);
	return 0;
}
Beispiel #2
0
static int module_init(void)
{
	struct list *aucodecl = baresip_aucodecl();
	size_t i;

	for (i=0; i<ARRAY_SIZE(g726); i++)
		aucodec_register(aucodecl, (struct aucodec *)&g726[i]);

	return 0;
}
Beispiel #3
0
static int module_init(void)
{
	struct conf *conf = conf_cur();
	uint32_t value;
	char *p = fmtp + str_len(fmtp);
	bool b, stereo = true, sprop_stereo = true;
	struct pl pl;
	int n = 0;

	conf_get_bool(conf, "opus_stereo", &stereo);
	conf_get_bool(conf, "opus_sprop_stereo", &sprop_stereo);

	/* always set stereo parameter first */
	n = re_snprintf(p, sizeof(fmtp) - str_len(p),
			"stereo=%d;sprop-stereo=%d", stereo, sprop_stereo);
	if (n <= 0)
		return ENOMEM;

	p += n;

	if (0 == conf_get_u32(conf, "opus_bitrate", &value)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";maxaveragebitrate=%d", value);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	if (0 == conf_get_bool(conf, "opus_cbr", &b)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";cbr=%d", b);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	if (0 == conf_get_bool(conf, "opus_inbandfec", &b)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";useinbandfec=%d", b);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	if (0 == conf_get_bool(conf, "opus_dtx", &b)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";usedtx=%d", b);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	(void)conf_get_bool(conf, "opus_mirror", &opus_mirror);

	if (opus_mirror) {
		opus.fmtp = NULL;
		opus.fmtp_ench = opus_fmtp_enc;
	}

	(void)conf_get_u32(conf, "opus_complexity", &opus_complexity);

	if (opus_complexity > 10)
		opus_complexity = 10;

	if (!conf_get(conf, "opus_application", &pl)) {
		if (!pl_strcasecmp(&pl, "audio"))
			opus_application = OPUS_APPLICATION_AUDIO;
		else if (!pl_strcasecmp(&pl, "voip"))
			opus_application = OPUS_APPLICATION_VOIP;
		else {
			warning("opus: unknown encoder application: %r\n",
					&pl);
			return EINVAL;
		}
	}

	debug("opus: fmtp=\"%s\"\n", fmtp);

	aucodec_register(baresip_aucodecl(), &opus);

	return 0;
}
Beispiel #4
0
static int module_init(void)
{
	aucodec_register(baresip_aucodecl(), (struct aucodec *)&g7221);

	return 0;
}
Beispiel #5
0
static int module_init(void)
{
	struct conf *conf = conf_cur();
	uint32_t value;
	char *p = fmtp + str_len(fmtp);
	bool b, stereo = true, sprop_stereo = true;
	int n = 0;

	conf_get_bool(conf, "opus_stereo", &stereo);
	conf_get_bool(conf, "opus_sprop_stereo", &sprop_stereo);

	/* always set stereo parameter first */
	n = re_snprintf(p, sizeof(fmtp) - str_len(p),
			"stereo=%d;sprop-stereo=%d", stereo, sprop_stereo);
	if (n <= 0)
		return ENOMEM;

	p += n;

	if (0 == conf_get_u32(conf, "opus_bitrate", &value)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";maxaveragebitrate=%d", value);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	if (0 == conf_get_bool(conf, "opus_cbr", &b)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";cbr=%d", b);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	if (0 == conf_get_bool(conf, "opus_inbandfec", &b)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";useinbandfec=%d", b);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	if (0 == conf_get_bool(conf, "opus_dtx", &b)) {

		n = re_snprintf(p, sizeof(fmtp) - str_len(p),
				";usedtx=%d", b);
		if (n <= 0)
			return ENOMEM;

		p += n;
	}

	(void)conf_get_bool(conf, "opus_mirror", &opus_mirror);

	if (opus_mirror) {
		opus.fmtp = NULL;
		opus.fmtp_ench = opus_fmtp_enc;
	}

	debug("opus: fmtp=\"%s\"\n", fmtp);

	aucodec_register(baresip_aucodecl(), &opus);

	return 0;
}