Exemplo n.º 1
0
/**
 * Get nbr of codecs
 */
PJ_DECL(int) codecs_get_nbr() {
	pjsua_codec_info c[32];
	unsigned i, count = PJ_ARRAY_SIZE(c);
	pj_status_t status = pjsua_enum_codecs(c, &count);
	if (status == PJ_SUCCESS) {
		return count;
	}
	return 0;
}
Exemplo n.º 2
0
/**
 * Get codec id
 */
PJ_DECL(pj_str_t) codecs_get_id(int codec_id) {
	pjsua_codec_info c[32];
	unsigned i, count = PJ_ARRAY_SIZE(c);

	pjsua_enum_codecs(c, &count);
	if (codec_id < count) {
		return c[codec_id].codec_id;
	}
	return pj_str((char *)"INVALID/8000/1");
}
Exemplo n.º 3
0
void ScreenPhone::loadCodecList()
{
    QStringList codecList;
    pjsua_codec_info codec_info[64];
    unsigned count;
    count = 64;
    pjsua_enum_codecs(codec_info, &count);

    for(unsigned i=0 ; count > i ; i++)
    {
        codecList.append(QString(codec_info[i].codec_id.ptr));
    }

    setCodec_list(codecList);
}
Exemplo n.º 4
0
/*
 * Change codec priorities.
 */
static void ui_manage_codec_prio()
{
    pjsua_codec_info c[32];
    unsigned i, count = PJ_ARRAY_SIZE(c);
    char input[32];
    char *codec, *prio;
    pj_str_t id;
    int new_prio;
    pj_status_t status;

    printf("List of audio codecs:\n");
    pjsua_enum_codecs(c, &count);
    for (i=0; i<count; ++i) {
	printf("  %d\t%.*s\n", c[i].priority, (int)c[i].codec_id.slen,
			       c[i].codec_id.ptr);
    }

#if PJSUA_HAS_VIDEO
    puts("");
    printf("List of video codecs:\n");
    pjsua_vid_enum_codecs(c, &count);
    for (i=0; i<count; ++i) {
	printf("  %d\t%.*s%s%.*s\n", c[i].priority,
				     (int)c[i].codec_id.slen,
				     c[i].codec_id.ptr,
				     c[i].desc.slen? " - ":"",
				     (int)c[i].desc.slen,
				     c[i].desc.ptr);
    }
#endif

    puts("");
    puts("Enter codec id and its new priority (e.g. \"speex/16000 200\", "
	 """\"H263 200\"),");
    puts("or empty to cancel.");

    printf("Codec name (\"*\" for all) and priority: ");
    if (fgets(input, sizeof(input), stdin) == NULL)
	return;
    if (input[0]=='\r' || input[0]=='\n') {
	puts("Done");
	return;
    }

    codec = strtok(input, " \t\r\n");
    prio = strtok(NULL, " \r\n");

    if (!codec || !prio) {
	puts("Invalid input");
	return;
    }

    new_prio = atoi(prio);
    if (new_prio < 0)
	new_prio = 0;
    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST)
	new_prio = PJMEDIA_CODEC_PRIO_HIGHEST;

    status = pjsua_codec_set_priority(pj_cstr(&id, codec),
				      (pj_uint8_t)new_prio);
#if PJSUA_HAS_VIDEO
    if (status != PJ_SUCCESS) {
	status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec),
					      (pj_uint8_t)new_prio);
    }
#endif
    if (status != PJ_SUCCESS)
	pjsua_perror(THIS_FILE, "Error setting codec priority", status);
}
Exemplo n.º 5
0
BOOL SettingsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	TranslateDialog(this->m_hWnd);
#ifndef _GLOBAL_NO_AUTO
	((CButton*)GetDlgItem(IDC_AUTO_ANSWER))->SetCheck(accountSettings.autoAnswer);
#endif
	((CButton*)GetDlgItem(IDC_LOCAL_DTMF))->SetCheck(accountSettings.localDTMF);
#ifndef _GLOBAL_SINGLE_MODE
	((CButton*)GetDlgItem(IDC_SINGLE_MODE))->SetCheck(accountSettings.singleMode);
#endif
#ifndef _GLOBAL_NO_LOG
	((CButton*)GetDlgItem(IDC_ENABLE_LOG))->SetCheck(accountSettings.enableLog);
#endif
#ifndef _GLOBAL_NO_VAD
	((CButton*)GetDlgItem(IDC_DISABLE_VAD))->SetCheck(accountSettings.disableVAD);
#endif
#ifndef _GLOBAL_NO_RINGING_SOUND
	GetDlgItem(IDC_RINGING_SOUND)->SetWindowText(accountSettings.ringingSound);
#endif
	CComboBox *combobox;
	unsigned count;


	pjmedia_aud_dev_info aud_dev_info[64];
	count = 64;
	pjsua_enum_aud_devs(aud_dev_info, &count);

	combobox= (CComboBox*)GetDlgItem(IDC_MICROPHONE);
	combobox->AddString(Translate("Default"));
	combobox->SetCurSel(0);
	for (unsigned i=0;i<count;i++)
	{
		if (aud_dev_info[i].input_count) {
			combobox->AddString(aud_dev_info[i].name);
			if (!accountSettings.audioInputDevice.Compare(aud_dev_info[i].name))
			{
				combobox->SetCurSel(combobox->GetCount()-1);
			}
		}
	}
	combobox= (CComboBox*)GetDlgItem(IDC_SPEAKERS);
	combobox->AddString(Translate("Default"));
	combobox->SetCurSel(0);
	for (unsigned i=0;i<count;i++)
	{
		if (aud_dev_info[i].output_count) {
			combobox->AddString(aud_dev_info[i].name);
			if (!accountSettings.audioOutputDevice.Compare(aud_dev_info[i].name))
			{
				combobox->SetCurSel(combobox->GetCount()-1);
			}
		}
	}

	pjsua_codec_info codec_info[64];
	CListBox *listbox;
	CListBox *listbox2;

	listbox = (CListBox*)GetDlgItem(IDC_AUDIO_CODECS_ALL);
	listbox2 = (CListBox*)GetDlgItem(IDC_AUDIO_CODECS);
	count = 64;
	pjsua_enum_codecs(codec_info, &count);
	for (unsigned i=0;i<count;i++)
	{
#ifdef _GLOBAL_CODECS_AVAILABLE
		if (strstr(_GLOBAL_CODECS_AVAILABLE,PjToStr(&codec_info[i].codec_id)))
		{
#endif
			if (codec_info[i].priority
#ifdef _GLOBAL_CODECS_ENABLED
				&& (accountSettings.audioCodecs!="" || strstr(_GLOBAL_CODECS_ENABLED,PjToStr(&codec_info[i].codec_id)))
#endif
				)
			{
				listbox2->AddString(PjToStr(&codec_info[i].codec_id));
			} else
			{
				listbox->AddString(PjToStr(&codec_info[i].codec_id));
			}	
#ifdef _GLOBAL_CODECS_AVAILABLE
		}
#endif
	}

#ifdef _GLOBAL_VIDEO
	((CButton*)GetDlgItem(IDC_DISABLE_H264))->SetCheck(accountSettings.disableH264);
 	((CButton*)GetDlgItem(IDC_DISABLE_H263))->SetCheck(accountSettings.disableH263);
	if (accountSettings.bitrateH264=="") {
		const pj_str_t codec_id = {"H264", 4};
		pjmedia_vid_codec_param param;
		pjsua_vid_codec_get_param(&codec_id, &param);
		accountSettings.bitrateH264.Format("%d",param.enc_fmt.det.vid.max_bps/1000);
	}
	if (accountSettings.bitrateH263=="") {
		const pj_str_t codec_id = {"H263", 4};
		pjmedia_vid_codec_param param;
		pjsua_vid_codec_get_param(&codec_id, &param);
		accountSettings.bitrateH263.Format("%d",param.enc_fmt.det.vid.max_bps/1000);
	}
	GetDlgItem(IDC_BITRATE_264)->SetWindowText(accountSettings.bitrateH264);
	GetDlgItem(IDC_BITRATE_263)->SetWindowText(accountSettings.bitrateH263);

	combobox= (CComboBox*)GetDlgItem(IDC_VID_CAP_DEV);
	combobox->AddString(Translate("Default"));
	combobox->SetCurSel(0);
	pjmedia_vid_dev_info vid_dev_info[64];
	count = 64;
	pjsua_vid_enum_devs(vid_dev_info, &count);
	for (unsigned i=0;i<count;i++)
	{
		if (vid_dev_info[i].fmt_cnt && (vid_dev_info[i].dir==PJMEDIA_DIR_ENCODING || vid_dev_info[i].dir==PJMEDIA_DIR_ENCODING_DECODING))
		{
			combobox->AddString(vid_dev_info[i].name);
			if (!accountSettings.videoCaptureDevice.Compare(vid_dev_info[i].name))
			{
				combobox->SetCurSel(combobox->GetCount()-1);
			}
		}
	}

	combobox= (CComboBox*)GetDlgItem(IDC_VIDEO_CODEC);
	combobox->AddString(Translate("Default"));
	combobox->SetCurSel(0);
	count = 64;
	pjsua_vid_enum_codecs(codec_info, &count);
	for (unsigned i=0;i<count;i++)
	{
		combobox->AddString(PjToStr(&codec_info[i].codec_id));
		if (!accountSettings.videoCodec.Compare(PjToStr(&codec_info[i].codec_id)))
		{
			combobox->SetCurSel(combobox->GetCount()-1);
		}
	}
#endif

#ifndef _GLOBAL_CUSTOM
	((CButton*)GetDlgItem(IDC_DISABLE_LOCAL))->SetCheck(accountSettings.disableLocalAccount);
	
	int i;
	combobox= (CComboBox*)GetDlgItem(IDC_UPDATES_INTERVAL);
	combobox->AddString(Translate("Daily"));
	combobox->AddString(Translate("Weekly"));
	combobox->AddString(Translate("Monthly"));
	combobox->AddString(Translate("Quarterly"));
	combobox->AddString(Translate("Never"));
	if (accountSettings.updatesInterval=="daily")
	{
		i=0;
	} else if (accountSettings.updatesInterval=="monthly")
	{
		i=2;
	} else if (accountSettings.updatesInterval=="quarterly")
	{
		i=3;
	} else if (accountSettings.updatesInterval=="never")
	{
		i=4;
	} else
	{
		i=1;
	}
	combobox->SetCurSel(i);
#endif

	return TRUE;
}