Java 类org.webrtc.videoengine.VideoCaptureDeviceInfoAndroid.FrontFacingCameraType 实例源码

项目:CSipSimple    文件:CameraUtils9.java   
@Override
public void Init(VideoCaptureDeviceInfoAndroid deviceInfoAndroid,
        List<AndroidVideoCaptureDevice> listToPopulate)
        throws SecurityException,
        IllegalArgumentException, NoSuchMethodException, ClassNotFoundException,
        IllegalAccessException, InvocationTargetException {

    Camera camera = null;

    // From Android 2.3 and onwards
    for (int i = 0; i < Camera.getNumberOfCameras(); ++i) {
        AndroidVideoCaptureDevice newDevice = deviceInfoAndroid.new AndroidVideoCaptureDevice();

        Camera.CameraInfo info = new Camera.CameraInfo();
        Camera.getCameraInfo(i, info);
        newDevice.index = i;
        newDevice.orientation = info.orientation;
        if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
            newDevice.deviceUniqueName =
                    "Camera " + i + ", Facing back, Orientation " + info.orientation;
        }
        else {
            newDevice.deviceUniqueName =
                    "Camera " + i + ", Facing front, Orientation " + info.orientation;
            newDevice.frontCameraType = FrontFacingCameraType.Android23;
        }

        camera = Camera.open(i);
        Camera.Parameters parameters = camera.getParameters();
        deviceInfoAndroid.AddDeviceInfo(newDevice, parameters);
        camera.release();
        camera = null;
        listToPopulate.add(newDevice);
    }
}