说明
由于一定场合,需要需要自动接听视频。这时候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标志位。
具体应该找如何利用这个标志位的