Fix links to ABI>=5 in video code preventing use with old telephones.

Disable video when ABI<5 or ILBC not found.
Automatically open preference activity on linphone first launch.
This commit is contained in:
Guillaume Beraudo 2010-12-02 12:29:51 +01:00
parent a7c66cff38
commit c4cf0434ff
8 changed files with 178 additions and 87 deletions

View file

@ -15,7 +15,7 @@
<EditTextPreference android:title="@string/pref_stun_server" android:key="@string/pref_stun_server_key"></EditTextPreference> <EditTextPreference android:title="@string/pref_stun_server" android:key="@string/pref_stun_server_key"></EditTextPreference>
<PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key"> <PreferenceScreen android:title="@string/pref_codecs" android:key="@string/pref_codecs_key">
<CheckBoxPreference android:key="@string/pref_codec_speex16_key" <CheckBoxPreference android:key="@string/pref_codec_speex16_key"
android:title="@string/pref_codec_speex16" android:defaultValue="true"></CheckBoxPreference> android:title="@string/pref_codec_speex16" android:defaultValue="true" android:enabled="false"></CheckBoxPreference>
<CheckBoxPreference android:key="@string/pref_codec_speex8_key" <CheckBoxPreference android:key="@string/pref_codec_speex8_key"
android:title="@string/pref_codec_speex8" android:defaultValue="true"></CheckBoxPreference> android:title="@string/pref_codec_speex8" android:defaultValue="true"></CheckBoxPreference>
<CheckBoxPreference android:key="@string/pref_codec_ilbc_key" android:title="@string/pref_codec_ilbc" android:enabled="false" android:shouldDisableView="true" android:defaultValue="true" android:summary="@string/pref_ilbc_summary"></CheckBoxPreference> <CheckBoxPreference android:key="@string/pref_codec_ilbc_key" android:title="@string/pref_codec_ilbc" android:enabled="false" android:shouldDisableView="true" android:defaultValue="true" android:summary="@string/pref_ilbc_summary"></CheckBoxPreference>
@ -36,8 +36,8 @@
<CheckBoxPreference android:defaultValue="true" android:title="@string/pref_video_enable_title" android:key="@string/pref_video_enable_key"></CheckBoxPreference> <CheckBoxPreference android:defaultValue="true" android:title="@string/pref_video_enable_title" android:key="@string/pref_video_enable_key" />
<PreferenceScreen android:title="@string/pref_video_settings_title" android:dependency="@string/pref_video_enable_key"><CheckBoxPreference android:key="@string/pref_video_initiate_call_with_video_key" android:defaultValue="false" android:title="@string/pref_video_initiate_call_with_video_title" android:summary="@string/pref_video_initiate_call_with_video" android:dependency="@string/pref_video_enable_key"></CheckBoxPreference> <PreferenceScreen android:title="@string/pref_video_settings_title" android:dependency="@string/pref_video_enable_key" android:shouldDisableView="true"><CheckBoxPreference android:key="@string/pref_video_initiate_call_with_video_key" android:defaultValue="false" android:title="@string/pref_video_initiate_call_with_video_title" android:summary="@string/pref_video_initiate_call_with_video" android:dependency="@string/pref_video_enable_key"></CheckBoxPreference>
<CheckBoxPreference android:key="@string/pref_video_automatically_share_my_video_key" android:title="@string/pref_video_automatically_share_my_video_title" android:defaultValue="false" android:summary="@string/pref_video_automatically_share_my_video" android:dependency="@string/pref_video_enable_key"></CheckBoxPreference> <CheckBoxPreference android:key="@string/pref_video_automatically_share_my_video_key" android:title="@string/pref_video_automatically_share_my_video_title" android:defaultValue="false" android:summary="@string/pref_video_automatically_share_my_video" android:dependency="@string/pref_video_enable_key"></CheckBoxPreference>
</PreferenceScreen> </PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>

View file

@ -101,7 +101,8 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
private SharedPreferences mPref; private SharedPreferences mPref;
private ImageButton mAddVideo; private ImageButton mAddVideo;
static String PREF_CHECK_CONFIG = "pref_check_config"; private static final String PREF_CHECK_CONFIG = "pref_check_config";
private static final String PREF_FIRST_LAUNCH = "pref_first_launch";
private static String CURRENT_ADDRESS = "org.linphone.current-address"; private static String CURRENT_ADDRESS = "org.linphone.current-address";
private static String CURRENT_DISPLAYNAME = "org.linphone.current-displayname"; private static String CURRENT_DISPLAYNAME = "org.linphone.current-displayname";
static int VIDEO_VIEW_ACTIVITY = 100; static int VIDEO_VIEW_ACTIVITY = 100;
@ -256,7 +257,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
} else { } else {
mDisplayNameView.setText(lLinphoneCore.getRemoteAddress().getUserName()); mDisplayNameView.setText(lLinphoneCore.getRemoteAddress().getUserName());
} }
configureMuteButtons(); configureMuteAndSpeakerButtons();
mWakeLock.acquire(); mWakeLock.acquire();
} }
} }
@ -391,33 +392,38 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
try{ try{
LinphoneService.instance().initFromConf(); LinphoneService.instance().initFromConf();
} catch (LinphoneConfigException ec) { } catch (LinphoneConfigException ec) {
Log.w(LinphoneService.TAG,"no valid settings found",ec); if (mPref.getBoolean(PREF_FIRST_LAUNCH, true)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this); Log.w(LinphoneService.TAG,"no valid settings found - first launch",ec);
TextView lDialogTextView = new TextView(this); LinphoneActivity.instance().startprefActivity();
lDialogTextView.setAutoLinkMask(0x0f/*all*/); mPref.edit().putBoolean(PREF_FIRST_LAUNCH, false).commit();
lDialogTextView.setPadding(10, 10, 10, 10); } else {
lDialogTextView.setText(Html.fromHtml(getString(R.string.initial_config_error) )); Log.w(LinphoneService.TAG,"no valid settings found", ec);
builder.setCustomTitle(lDialogTextView) AlertDialog.Builder builder = new AlertDialog.Builder(this);
.setCancelable(false) TextView lDialogTextView = new TextView(this);
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { lDialogTextView.setAutoLinkMask(0x0f/*all*/);
public void onClick(DialogInterface dialog, int id) { lDialogTextView.setPadding(10, 10, 10, 10);
LinphoneActivity.instance().startprefActivity(); lDialogTextView.setText(Html.fromHtml(getString(R.string.initial_config_error)));
} builder.setCustomTitle(lDialogTextView)
}).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() { .setCancelable(false)
public void onClick(DialogInterface dialog, int id) { .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
dialog.cancel(); public void onClick(DialogInterface dialog, int id) {
LinphoneActivity.instance().startprefActivity();
}
}).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
}).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit();
dialog.cancel();
}
});
if (mPref.getBoolean(PREF_CHECK_CONFIG, false) == false) {
builder.create().show();
} }
}).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit();
dialog.cancel();
}
});
if (mPref.getBoolean(PREF_CHECK_CONFIG, false) == false) {
builder.create().show();
} }
} catch (Exception e ) { } catch (Exception e ) {
Log.e(LinphoneService.TAG,"Cannot get initial config", e); Log.e(LinphoneService.TAG,"Cannot get initial config", e);
} }
@ -457,8 +463,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
} else if (state == LinphoneCall.State.CallEnd) { } else if (state == LinphoneCall.State.CallEnd) {
exitCallMode(); exitCallMode();
} else if (state == LinphoneCall.State.StreamsRunning) { } else if (state == LinphoneCall.State.StreamsRunning) {
if (!VideoCallActivity.launched && LinphoneService.instance().getLinphoneCore().getCurrentCall().getCurrentParamsReadOnly().getVideoEnabled()) { if (LinphoneService.instance().getLinphoneCore().getCurrentCall().getCurrentParamsReadOnly().getVideoEnabled()) {
startVideoView(VIDEO_VIEW_ACTIVITY); if (!VideoCallActivity.launched) {
startVideoView(VIDEO_VIEW_ACTIVITY);
}
} }
} }
mCurrentCallState = state; mCurrentCallState = state;
@ -488,7 +496,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
mDisplayNameView.setText(lc.getRemoteAddress().toString()); mDisplayNameView.setText(lc.getRemoteAddress().toString());
} }
} }
configureMuteButtons(); configureMuteAndSpeakerButtons();
if (mSpeaker.isChecked()) { if (mSpeaker.isChecked()) {
routeAudioToSpeaker(); routeAudioToSpeaker();
@ -497,9 +505,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
} }
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
} }
private void configureMuteButtons() { private void configureMuteAndSpeakerButtons() {
mMute.setChecked(LinphoneService.instance().getLinphoneCore().isMicMuted()); mMute.setChecked(LinphoneService.instance().getLinphoneCore().isMicMuted());
if ((Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getMode() == AudioManager.MODE_NORMAL) if ((Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_SPEAKER)
|| Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn()) { || Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn()) {
mSpeaker.setChecked(true); mSpeaker.setChecked(true);
} else { } else {
@ -534,7 +542,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
} }
private void routeAudioToReceiver() { private void routeAudioToReceiver() {
if (Integer.parseInt(Build.VERSION.SDK) <=4 /*<donut*/) { if (Integer.parseInt(Build.VERSION.SDK) <=4 /*<donut*/) {
mAudioManager.setRouting(AudioManager.MODE_NORMAL, mAudioManager.setRouting(AudioManager.MODE_NORMAL,
AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL); AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
} else { } else {
@ -700,7 +707,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
} }
private AndroidCameraRecordManager getVideoManager() { private AndroidCameraRecordManager getVideoManager() {
return AndroidCameraRecordManager.getInstance(AndroidCameraRecordManager.CAMERA_ID_FIXME_USE_PREFERENCE); return AndroidCameraRecordManager.getInstance();
} }
} }

View file

@ -21,42 +21,59 @@ package org.linphone;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
import android.util.Log; import android.util.Log;
public class LinphonePreferencesActivity extends PreferenceActivity { public class LinphonePreferencesActivity extends PreferenceActivity {
@Override private static final int version = Integer.parseInt(Build.VERSION.SDK);
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
boolean enableIlbc=false;
if (LinphoneService.isready()) {
enableIlbc = LinphoneService.instance().getLinphoneCore().findPayloadType("iLBC", 8000)!=null?true:false;;
if (enableIlbc && !getPreferenceManager().getSharedPreferences().contains(getString(R.string.pref_echo_cancellation_key))) {
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_echo_cancellation_key), true).commit();
}
if (!enableIlbc) {
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_codec_ilbc_key), false).commit();
}
} @Override
// Load the preferences from an XML resource protected void onCreate(Bundle savedInstanceState) {
addPreferencesFromResource(R.xml.preferences); super.onCreate(savedInstanceState);
if (enableIlbc) { boolean enableIlbc=false;
getPreferenceScreen().findPreference(getString(R.string.pref_codec_ilbc_key)).setEnabled(enableIlbc); if (LinphoneService.isready()) {
} // if not ilbc, we are on low end cpu.
enableIlbc = LinphoneService.instance().getLinphoneCore().findPayloadType("iLBC", 8000)!=null?true:false;
if (enableIlbc && !getPreferenceManager().getSharedPreferences().contains(getString(R.string.pref_echo_cancellation_key))) {
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_echo_cancellation_key), true).commit();
}
if (!enableIlbc) {
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_codec_ilbc_key), false).commit();
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_codec_speex16_key), false).commit();
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_codec_speex32_key), false).commit();
}
} }
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
if (enableIlbc) {
getPreferenceScreen().findPreference(getString(R.string.pref_codec_ilbc_key)).setEnabled(enableIlbc);
getPreferenceScreen().findPreference(getString(R.string.pref_codec_speex16_key)).setEnabled(enableIlbc);
//getPreferenceScreen().findPreference(getString(R.string.pref_codec_speex32_key)).setEnabled(enableIlbc);
}
// Force disable video
if (version < 5 || !enableIlbc) {
getPreferenceManager().getSharedPreferences().edit().putBoolean(getString(R.string.pref_video_enable_key), false).commit();
CheckBoxPreference videoPref = (CheckBoxPreference) getPreferenceScreen().findPreference(getString(R.string.pref_video_enable_key));
videoPref.setEnabled(false);
videoPref.setChecked(false);
}
}
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
if (isFinishing()) { if (isFinishing()) {
try { try {
LinphoneActivity.instance().initFromConf(); LinphoneActivity.instance().initFromConf();
} catch (LinphoneException e) { } catch (LinphoneException e) {
Log.e(LinphoneService.TAG, "cannot update config",e); Log.e(LinphoneService.TAG, "cannot update config",e);
} }
} }
} }

View file

@ -45,12 +45,12 @@ public class VideoCallActivity extends Activity {
setContentView(R.layout.videocall); setContentView(R.layout.videocall);
mVideoView = (SurfaceView) findViewById(R.id.video_surface); mVideoView = (SurfaceView) findViewById(R.id.video_surface);
LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView); LinphoneService.instance().getLinphoneCore().setVideoWindow(mVideoView);
mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface); mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface);
final int rotation = getWindowManager().getDefaultDisplay().getRotation(); final int rotation = getWindowManager().getDefaultDisplay().getRotation();
recordManager = AndroidCameraRecordManager.getInstance(AndroidCameraRecordManager.CAMERA_ID_FIXME_USE_PREFERENCE); recordManager = AndroidCameraRecordManager.getInstance();
recordManager.setSurfaceView(mVideoCaptureView, rotation); recordManager.setSurfaceView(mVideoCaptureView, rotation);
mVideoCaptureView.setZOrderOnTop(true); mVideoCaptureView.setZOrderOnTop(true);
} }

View file

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package org.linphone.core; package org.linphone.core;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import android.hardware.Camera; import android.hardware.Camera;
@ -39,7 +40,7 @@ public abstract class AndroidCameraRecord {
private PreviewCallback storedPreviewCallback; private PreviewCallback storedPreviewCallback;
private boolean previewStarted; private boolean previewStarted;
protected int orientationCode; protected int orientationCode;
private static final String tag="Linphone"; protected static final String tag="Linphone";
private List <Size> supportedVideoSizes; private List <Size> supportedVideoSizes;
public AndroidCameraRecord(RecorderParams parameters) { public AndroidCameraRecord(RecorderParams parameters) {
@ -47,7 +48,9 @@ public abstract class AndroidCameraRecord {
setRotation(parameters.rotation); setRotation(parameters.rotation);
} }
protected List<Size> getSupportedPreviewSizes(Camera.Parameters parameters) {
return Collections.emptyList();
}
public void startPreview() { // FIXME throws exception? public void startPreview() { // FIXME throws exception?
if (previewStarted) { if (previewStarted) {
@ -73,7 +76,7 @@ public abstract class AndroidCameraRecord {
Camera.Parameters parameters=camera.getParameters(); Camera.Parameters parameters=camera.getParameters();
if (supportedVideoSizes == null) { if (supportedVideoSizes == null) {
supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); supportedVideoSizes = getSupportedPreviewSizes(camera.getParameters());
} }
parameters.set("camera-id", params.cameraId); parameters.set("camera-id", params.cameraId);
@ -83,18 +86,7 @@ public abstract class AndroidCameraRecord {
parameters.setPreviewSize(params.height, params.width); parameters.setPreviewSize(params.height, params.width);
} }
parameters.setPreviewFrameRate(Math.round(params.fps)); parameters.setPreviewFrameRate(Math.round(params.fps));
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
Log.w(tag, "Auto Focus supported by camera device");
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
} else {
Log.w(tag, "Auto Focus not supported by camera device");
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
Log.w(tag, "Infinity Focus supported by camera device");
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
} else {
Log.w(tag, "Infinity Focus not supported by camera device");
}
}
onSettingCameraParameters(parameters); onSettingCameraParameters(parameters);
camera.setParameters(parameters); camera.setParameters(parameters);

View file

@ -30,7 +30,7 @@ import android.util.Log;
* @author Guillaume Beraudo * @author Guillaume Beraudo
* *
*/ */
public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImpl { public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 {
public AndroidCameraRecordBufferedImpl(RecorderParams parameters) { public AndroidCameraRecordBufferedImpl(RecorderParams parameters) {

View file

@ -0,0 +1,64 @@
/*
AndroidCameraRecordImplAPI5.java
Copyright (C) 2010 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
import java.util.List;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.Size;
import android.util.Log;
public class AndroidCameraRecordImplAPI5 extends AndroidCameraRecordImpl {
public AndroidCameraRecordImplAPI5(RecorderParams parameters) {
super(parameters);
}
@Override
protected void onSettingCameraParameters(Parameters parameters) {
super.onSettingCameraParameters(parameters);
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
Log.w(tag, "Auto Focus supported by camera device");
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
} else {
Log.w(tag, "Auto Focus not supported by camera device");
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
Log.w(tag, "Infinity Focus supported by camera device");
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
} else {
Log.w(tag, "Infinity Focus not supported by camera device");
}
}
}
public static List<Size> oneShotSupportedVideoSizes() {
Camera camera = Camera.open();
List<Size> supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes();
camera.release();
return supportedVideoSizes;
}
@Override
protected List<Size> getSupportedPreviewSizes(Parameters parameters) {
return parameters.getSupportedPreviewSizes();
}
}

View file

@ -24,7 +24,6 @@ import java.util.Map;
import org.linphone.core.AndroidCameraRecord.RecorderParams; import org.linphone.core.AndroidCameraRecord.RecorderParams;
import android.hardware.Camera;
import android.hardware.Camera.Size; import android.hardware.Camera.Size;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
@ -41,7 +40,6 @@ import android.view.SurfaceHolder.Callback;
* *
*/ */
public class AndroidCameraRecordManager { public class AndroidCameraRecordManager {
public static final int CAMERA_ID_FIXME_USE_PREFERENCE = 0;
private static final int version = Integer.parseInt(Build.VERSION.SDK); private static final int version = Integer.parseInt(Build.VERSION.SDK);
private static Map<Integer, AndroidCameraRecordManager> instances = new HashMap<Integer, AndroidCameraRecordManager>(); private static Map<Integer, AndroidCameraRecordManager> instances = new HashMap<Integer, AndroidCameraRecordManager>();
@ -52,7 +50,8 @@ public class AndroidCameraRecordManager {
} }
/** /**
* @param cameraId : see max_camera_id * Instance for a given camera
* @param cameraId : starting from 0
* @return * @return
*/ */
public static final synchronized AndroidCameraRecordManager getInstance(int cameraId) { public static final synchronized AndroidCameraRecordManager getInstance(int cameraId) {
@ -69,6 +68,9 @@ public class AndroidCameraRecordManager {
return m; return m;
} }
/**
* @return instance for the default camera
*/
public static final synchronized AndroidCameraRecordManager getInstance() { public static final synchronized AndroidCameraRecordManager getInstance() {
return getInstance(0); return getInstance(0);
} }
@ -148,6 +150,8 @@ public class AndroidCameraRecordManager {
parameters.surfaceView = surfaceView; parameters.surfaceView = surfaceView;
if (version >= 8) { if (version >= 8) {
recorder = new AndroidCameraRecordBufferedImpl(parameters); recorder = new AndroidCameraRecordBufferedImpl(parameters);
} else if (version >= 5) {
recorder = new AndroidCameraRecordImplAPI5(parameters);
} else { } else {
recorder = new AndroidCameraRecordImpl(parameters); recorder = new AndroidCameraRecordImpl(parameters);
} }
@ -164,6 +168,10 @@ public class AndroidCameraRecordManager {
// FIXME select right camera // FIXME select right camera
/**
* Eventually null if API < 5.
*
*/
public List<Size> supportedVideoSizes() { public List<Size> supportedVideoSizes() {
if (supportedVideoSizes != null) { if (supportedVideoSizes != null) {
return supportedVideoSizes; return supportedVideoSizes;
@ -174,9 +182,12 @@ public class AndroidCameraRecordManager {
if (supportedVideoSizes != null) return supportedVideoSizes; if (supportedVideoSizes != null) return supportedVideoSizes;
} }
Camera camera = Camera.open(); if (version >= 5) {
supportedVideoSizes = camera.getParameters().getSupportedPreviewSizes(); supportedVideoSizes = AndroidCameraRecordImplAPI5.oneShotSupportedVideoSizes();
camera.release(); }
// eventually null
return supportedVideoSizes; return supportedVideoSizes;
} }