linphone-自動接聽視頻電話

說明

由於一定場合,需要需要自動接聽視頻。這時候linphone在Settings->VIDEO中勾選Enable Video選項就可以實現自動接聽視頻選項了。

自動接聽視頻電話

在SettingsFragment.java中

findPreference(getString(R.string.pref_video_enable_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
    @Override
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        boolean enable = (Boolean) newValue;
        mPrefs.enableVideo(enable);
        return true;
    }
});

其中, 是設置的。

在linphonecore_jni.cc中設置

extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableVideo(JNIEnv*  env
                                                                            ,jobject  thiz
                                                                            ,jlong lc
                                                                            ,jboolean vcap_enabled
                                                                            ,jboolean display_enabled) {
    linphone_core_enable_video((LinphoneCore*)lc, vcap_enabled,display_enabled);

}

找到linphoncore.c主要設置的函數

void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled) {
    linphone_core_enable_video_capture(lc, vcap_enabled);
    linphone_core_enable_video_display(lc, display_enabled);
}

linphone_core_enable_video

void linphone_core_enable_video_capture(LinphoneCore *lc, bool_t enable) {
#ifndef VIDEO_ENABLED
    if (enable == TRUE) {
        ms_warning("Cannot enable video capture, this version of linphone was built without video support.");
    }
#endif
    lc->video_conf.capture = enable;
    if (linphone_core_ready(lc)) {
        lp_config_set_int(lc->config, "video", "capture", lc->video_conf.capture);
    }
    /* Need to re-apply network bandwidth settings. */
    reapply_network_bandwidth_settings(lc);
}

主要是設置了capture標誌位。

linphone_core_enable_video_display

void linphone_core_enable_video_display(LinphoneCore *lc, bool_t enable) {
#ifndef VIDEO_ENABLED
    if (enable == TRUE) {
        ms_warning("Cannot enable video display, this version of linphone was built without video support.");
    }
#endif
    lc->video_conf.display = enable;
    if (linphone_core_ready(lc)) {
        lp_config_set_int(lc->config, "video", "display", lc->video_conf.display);
    }
    /* Need to re-apply network bandwidth settings. */
    reapply_network_bandwidth_settings(lc);
}

設置display標誌位。

具體應該找如何利用這個標誌位的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章