2 * Copyright (C) 2011 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * Contains implementation of a class EmulatedFakeCamera that encapsulates
19 * functionality of a fake camera.
23 #define LOG_TAG "EmulatedCamera_FakeCamera"
24 #include <cutils/log.h>
25 #include <cutils/properties.h>
26 #include "EmulatedFakeCamera.h"
27 #include "EmulatedCameraFactory.h"
31 EmulatedFakeCamera::EmulatedFakeCamera(int cameraId,
33 struct hw_module_t* module)
34 : EmulatedCamera(cameraId, module),
35 mFacingBack(facingBack),
36 mFakeCameraDevice(this)
40 EmulatedFakeCamera::~EmulatedFakeCamera()
44 /****************************************************************************
45 * Public API overrides
46 ***************************************************************************/
48 status_t EmulatedFakeCamera::Initialize()
50 status_t res = mFakeCameraDevice.Initialize();
51 if (res != NO_ERROR) {
55 const char* facing = mFacingBack ? EmulatedCamera::FACING_BACK :
56 EmulatedCamera::FACING_FRONT;
58 mParameters.set(EmulatedCamera::FACING_KEY, facing);
59 ALOGD("%s: Fake camera is facing %s", __FUNCTION__, facing);
61 mParameters.set(EmulatedCamera::ORIENTATION_KEY,
62 gEmulatedCameraFactory.getFakeCameraOrientation());
64 res = EmulatedCamera::Initialize();
65 if (res != NO_ERROR) {
70 * Parameters provided by the camera device.
73 /* 352x288 and 320x240 frame dimensions are required by the framework for
74 * video mode preview and video recording. */
75 mParameters.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES,
76 "640x480,352x288,320x240");
77 mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES,
78 "640x480,352x288,320x240");
79 mParameters.setPreviewSize(640, 480);
80 mParameters.setPictureSize(640, 480);
85 EmulatedCameraDevice* EmulatedFakeCamera::getCameraDevice()
87 return &mFakeCameraDevice;
90 }; /* namespace android */