~ubuntu-branches/ubuntu/trusty/linphone/trusty

« back to all changes in this revision

Viewing changes to mediastreamer2/java/src/org/linphone/mediastream/video/capture/hwconf/AndroidCameraConfigurationReader5.java

  • Committer: Package Import Robot
  • Author(s): Luk Claes
  • Date: 2013-09-11 19:08:43 UTC
  • mfrom: (1.1.19) (16.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20130911190843-fkydjxsdvy1fmx24
Tags: 3.6.1-2.1
* Non-maintainer upload.
* Apply Sebastian Ramacher's patch to fix FTBFS (Closes: #720668).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
AndroidCameraConf.java
 
3
Copyright (C) 2010  Belledonne Communications, Grenoble, France
 
4
 
 
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.
 
9
 
 
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.
 
14
 
 
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.
 
18
*/
 
19
package org.linphone.mediastream.video.capture.hwconf;
 
20
 
 
21
import java.util.ArrayList;
 
22
import java.util.List;
 
23
 
 
24
import org.linphone.mediastream.Log;
 
25
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
 
26
 
 
27
import android.hardware.Camera;
 
28
import android.hardware.Camera.Size;
 
29
 
 
30
/**
 
31
 * Android cameras detection, using SDK < 9
 
32
 *
 
33
 */
 
34
class AndroidCameraConfigurationReader5  {
 
35
        static public AndroidCamera[] probeCameras() {
 
36
                List<AndroidCamera> cam = new ArrayList<AndroidCamera>(1);
 
37
                
 
38
                Camera camera = Camera.open();
 
39
                List<Size> r = camera.getParameters().getSupportedPreviewSizes();
 
40
                camera.release();
 
41
                
 
42
                // Defaults
 
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));
 
48
                        } else {
 
49
                                Log.d("Hack Galaxy S : NO front camera");
 
50
                        }
 
51
                        Log.d("Hack Galaxy S : HAS a rear camera with id=1");
 
52
                        cam.add(new AndroidCamera(1, false, 90, r));
 
53
                } else {
 
54
                        cam.add(new AndroidCamera(0, false, 90, r));
 
55
 
 
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));
 
59
                        }
 
60
                }
 
61
                
 
62
                AndroidCamera[] result = new AndroidCamera[cam.size()];
 
63
                result = cam.toArray(result);
 
64
                return result;
 
65
                
 
66
        }
 
67
}