3
Copyright (C) 2010 Belledonne Communications, Grenoble, France
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
package org.linphone.mediastream.video.capture.hwconf;
21
import java.util.ArrayList;
22
import java.util.List;
24
import org.linphone.mediastream.Log;
25
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
27
import android.hardware.Camera;
28
import android.hardware.Camera.Size;
31
* Android cameras detection, using SDK < 9
34
class AndroidCameraConfigurationReader5 {
35
static public AndroidCamera[] probeCameras() {
36
List<AndroidCamera> cam = new ArrayList<AndroidCamera>(1);
38
Camera camera = Camera.open();
39
List<Size> r = camera.getParameters().getSupportedPreviewSizes();
43
if (Hacks.isGalaxySOrTab()) {
44
Log.d( "Hack Galaxy S : has one or more cameras");
45
if (Hacks.isGalaxySOrTabWithFrontCamera()) {
46
Log.d("Hack Galaxy S : HAS a front camera with id=2");
47
cam.add(new AndroidCamera(2, true, 90, r));
49
Log.d("Hack Galaxy S : NO front camera");
51
Log.d("Hack Galaxy S : HAS a rear camera with id=1");
52
cam.add(new AndroidCamera(1, false, 90, r));
54
cam.add(new AndroidCamera(0, false, 90, r));
56
if (Hacks.hasTwoCamerasRear0Front1()) {
57
Log.d("Hack SPHD700 has 2 cameras a rear with id=0 and a front with id=1");
58
cam.add(new AndroidCamera(1, true, 90, r));
62
AndroidCamera[] result = new AndroidCamera[cam.size()];
63
result = cam.toArray(result);