| 1 | /* |
| 2 | * Copyright (C) 2013 Canonical Ltd |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | * |
| 16 | * Authored by: Thomas Voss <thomas.voss@canonical.com> |
| 17 | */ |
| 18 | |
| 19 | #ifndef CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_H_ |
| 20 | #define CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_H_ |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
| 26 | struct CameraControl; |
| 27 | |
| 28 | typedef enum |
| 29 | { |
| 30 | FLASH_MODE_OFF, |
| 31 | FLASH_MODE_AUTO, |
| 32 | FLASH_MODE_ON, |
| 33 | FLASH_MODE_TORCH |
| 34 | } FlashMode; |
| 35 | |
| 36 | typedef enum |
| 37 | { |
| 38 | WHITE_BALANCE_MODE_AUTO, |
| 39 | WHITE_BALANCE_MODE_DAYLIGHT, |
| 40 | WHITE_BALANCE_MODE_CLOUDY_DAYLIGHT, |
| 41 | WHITE_BALANCE_MODE_FLUORESCENT, |
| 42 | WHITE_BALANCE_MODE_INCANDESCENT |
| 43 | } WhiteBalanceMode; |
| 44 | |
| 45 | typedef enum |
| 46 | { |
| 47 | SCENE_MODE_AUTO, |
| 48 | SCENE_MODE_ACTION, |
| 49 | SCENE_MODE_NIGHT, |
| 50 | SCENE_MODE_PARTY, |
| 51 | SCENE_MODE_SUNSET |
| 52 | } SceneMode; |
| 53 | |
| 54 | typedef enum |
| 55 | { |
| 56 | AUTO_FOCUS_MODE_OFF, |
| 57 | AUTO_FOCUS_MODE_CONTINUOUS_VIDEO, |
| 58 | AUTO_FOCUS_MODE_AUTO, |
| 59 | AUTO_FOCUS_MODE_MACRO, |
| 60 | AUTO_FOCUS_MODE_CONTINUOUS_PICTURE, |
| 61 | AUTO_FOCUS_MODE_INFINITY |
| 62 | } AutoFocusMode; |
| 63 | |
| 64 | typedef enum |
| 65 | { |
| 66 | EFFECT_MODE_NONE, |
| 67 | EFFECT_MODE_MONO, |
| 68 | EFFECT_MODE_NEGATIVE, |
| 69 | EFFECT_MODE_SOLARIZE, |
| 70 | EFFECT_MODE_SEPIA, |
| 71 | EFFECT_MODE_POSTERIZE, |
| 72 | EFFECT_MODE_WHITEBOARD, |
| 73 | EFFECT_MODE_BLACKBOARD, |
| 74 | EFFECT_MODE_AQUA |
| 75 | } EffectMode; |
| 76 | |
| 77 | typedef enum |
| 78 | { |
| 79 | CAMERA_PIXEL_FORMAT_YUV422SP, |
| 80 | CAMERA_PIXEL_FORMAT_YUV420SP, |
| 81 | CAMERA_PIXEL_FORMAT_YUV422I, |
| 82 | CAMERA_PIXEL_FORMAT_YUV420P, |
| 83 | CAMERA_PIXEL_FORMAT_RGB565, |
| 84 | CAMERA_PIXEL_FORMAT_RGBA8888, |
| 85 | CAMERA_PIXEL_FORMAT_BAYER_RGGB |
| 86 | } CameraPixelFormat; |
| 87 | |
| 88 | typedef struct |
| 89 | { |
| 90 | int top; |
| 91 | int left; |
| 92 | int bottom; |
| 93 | int right; |
| 94 | int weight; |
| 95 | } FocusRegion; |
| 96 | |
| 97 | typedef void (*size_callback)(void* ctx, int width, int height); |
| 98 | |
| 99 | // Dumps the camera parameters to stdout. |
| 100 | void android_camera_dump_parameters(struct CameraControl* control); |
| 101 | |
| 102 | // Query camera parameters |
| 103 | int android_camera_get_number_of_devices(); |
| 104 | void android_camera_enumerate_supported_preview_sizes(struct CameraControl* control, size_callback cb, void* ctx); |
| 105 | void android_camera_get_preview_fps_range(struct CameraControl* control, int* min, int* max); |
| 106 | void android_camera_get_preview_fps(struct CameraControl* control, int* fps); |
| 107 | void android_camera_enumerate_supported_picture_sizes(struct CameraControl* control, size_callback cb, void* ctx); |
| 108 | void android_camera_get_preview_size(struct CameraControl* control, int* width, int* height); |
| 109 | void android_camera_get_picture_size(struct CameraControl* control, int* width, int* height); |
| 110 | |
| 111 | void android_camera_get_current_zoom(struct CameraControl* control, int* zoom); |
| 112 | void android_camera_get_max_zoom(struct CameraControl* control, int* max_zoom); |
| 113 | |
| 114 | void android_camera_get_effect_mode(struct CameraControl* control, EffectMode* mode); |
| 115 | void android_camera_get_flash_mode(struct CameraControl* control, FlashMode* mode); |
| 116 | void android_camera_get_white_balance_mode(struct CameraControl* control, WhiteBalanceMode* mode); |
| 117 | void android_camera_get_scene_mode(struct CameraControl* control, SceneMode* mode); |
| 118 | void android_camera_get_auto_focus_mode(struct CameraControl* control, AutoFocusMode* mode); |
| 119 | void android_camera_get_preview_format(struct CameraControl* control, CameraPixelFormat* format); |
| 120 | |
| 121 | // Adjusts camera parameters |
| 122 | void android_camera_set_preview_size(struct CameraControl* control, int width, int height); |
| 123 | void android_camera_set_preview_fps(struct CameraControl* control, int fps); |
| 124 | void android_camera_set_picture_size(struct CameraControl* control, int width, int height); |
| 125 | void android_camera_set_effect_mode(struct CameraControl* control, EffectMode mode); |
| 126 | void android_camera_set_flash_mode(struct CameraControl* control, FlashMode mode); |
| 127 | void android_camera_set_white_balance_mode(struct CameraControl* control, WhiteBalanceMode mode); |
| 128 | void android_camera_set_scene_mode(struct CameraControl* control, SceneMode mode); |
| 129 | void android_camera_set_auto_focus_mode(struct CameraControl* control, AutoFocusMode mode); |
| 130 | void android_camera_set_preview_format(struct CameraControl* control, CameraPixelFormat format); |
| 131 | |
| 132 | void android_camera_set_focus_region(struct CameraControl* control, FocusRegion* region); |
| 133 | void android_camera_reset_focus_region(struct CameraControl* control); |
| 134 | |
| 135 | // Set photo metadata |
| 136 | void android_camera_set_rotation(struct CameraControl* control, int rotation); |
| 137 | |
| 138 | // Video support |
| 139 | void android_camera_enumerate_supported_video_sizes(struct CameraControl* control, size_callback cb, void* ctx); |
| 140 | void android_camera_get_video_size(struct CameraControl* control, int* width, int* height); |
| 141 | void android_camera_set_video_size(struct CameraControl* control, int width, int height); |
| 142 | |
| 143 | #ifdef __cplusplus |
| 144 | } |
| 145 | #endif |
| 146 | |
| 147 | #endif // CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_H_ |