camcorder effect support
发布时间:2020-12-15 06:28:11 所属栏目:百科 来源:网络整理
导读:VideoCamera.java private void loadCameraPreferences() { CameraSettings settings = new CameraSettings(this,mParameters,mCameraId,CameraHolder.instance().getCameraInfo()); // Remove the video quality preference setting when the quality is gi
VideoCamera.java private void loadCameraPreferences() { CameraSettings settings = new CameraSettings(this,mParameters,mCameraId,CameraHolder.instance().getCameraInfo()); // Remove the video quality preference setting when the quality is given in the intent. mPreferenceGroup = filterPreferenceScreenByIntent( settings.getPreferenceGroup(R.xml.video_preferences)); } CameraSettings.java public PreferenceGroup getPreferenceGroup(int preferenceRes) { PreferenceInflater inflater = new PreferenceInflater(mContext); PreferenceGroup group = (PreferenceGroup) inflater.inflate(preferenceRes); initPreference(group); return group; } private void initPreference(PreferenceGroup group) { ... ... ListPreference videoFlashMode = group.findPreference(KEY_VIDEOCAMERA_FLASH_MODE); ListPreference videoEffect = group.findPreference(KEY_VIDEO_EFFECT); // Since the screen could be loaded from different resources,we need // to check if the preference is available here ... ... if (videoEffect != null) { initVideoEffect(group,videoEffect); resetIfInvalid(videoEffect); } } private void initVideoEffect(PreferenceGroup group,ListPreference videoEffect) { CharSequence[] values = videoEffect.getEntryValues(); boolean goofyFaceSupported = EffectsRecorder.isEffectSupported(EffectsRecorder.EFFECT_GOOFY_FACE); boolean backdropperSupported = EffectsRecorder.isEffectSupported(EffectsRecorder.EFFECT_BACKDROPPER) && mParameters.isAutoExposureLockSupported() && mParameters.isAutoWhiteBalanceLockSupported(); ArrayList<String> supported = new ArrayList<String>(); for (CharSequence value : values) { String effectSelection = value.toString(); if (!goofyFaceSupported && effectSelection.startsWith("goofy_face")) continue; if (!backdropperSupported && effectSelection.startsWith("backdropper")) continue; supported.add(effectSelection); } filterUnsupportedOptions(group,videoEffect,supported); } EffectsRecorder.java public static boolean isEffectSupported(int effectId) { switch (effectId) { case EFFECT_GOOFY_FACE: return Filter.isAvailable("com.google.android.filterpacks.facedetect.GoofyRenderFilter"); case EFFECT_BACKDROPPER: return Filter.isAvailable("android.filterpacks.videoproc.BackDropperFilter"); default: return false; } } 对于一些实现的库,比如android.filterpacks.videoproc.BackDropperFilter是在system/media下实现的。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |