The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 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 | |
| 17 | #ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS_H |
| 18 | #define ANDROID_HARDWARE_CAMERA_PARAMETERS_H |
| 19 | |
| 20 | #include <utils/KeyedVector.h> |
| 21 | #include <utils/String8.h> |
| 22 | |
| 23 | namespace android { |
| 24 | |
| 25 | class CameraParameters |
| 26 | { |
| 27 | public: |
| 28 | CameraParameters(); |
| 29 | CameraParameters(const String8 ¶ms) { unflatten(params); } |
| 30 | ~CameraParameters(); |
| 31 | |
| 32 | enum { |
| 33 | CAMERA_ORIENTATION_UNKNOWN = 0, |
| 34 | CAMERA_ORIENTATION_PORTRAIT = 1, |
| 35 | CAMERA_ORIENTATION_LANDSCAPE = 2, |
| 36 | }; |
| 37 | |
| 38 | String8 flatten() const; |
| 39 | void unflatten(const String8 ¶ms); |
| 40 | |
| 41 | void set(const char *key, const char *value); |
| 42 | void set(const char *key, int value); |
| 43 | const char *get(const char *key) const; |
| 44 | int getInt(const char *key) const; |
| 45 | |
| 46 | /* preview-size=176x144 */ |
| 47 | void setPreviewSize(int width, int height); |
| 48 | void getPreviewSize(int *width, int *height) const; |
| 49 | |
| 50 | /* preview-fps=15 */ |
| 51 | void setPreviewFrameRate(int fps); |
| 52 | int getPreviewFrameRate() const; |
| 53 | |
| 54 | /* preview-format=rgb565|yuv422 */ |
| 55 | void setPreviewFormat(const char *format); |
| 56 | const char *getPreviewFormat() const; |
| 57 | |
| 58 | /* picture-size=1024x768 */ |
| 59 | void setPictureSize(int width, int height); |
| 60 | void getPictureSize(int *width, int *height) const; |
| 61 | |
| 62 | /* picture-format=yuv422|jpeg */ |
| 63 | void setPictureFormat(const char *format); |
| 64 | const char *getPictureFormat() const; |
| 65 | |
| 66 | int getOrientation() const; |
| 67 | void setOrientation(int orientation); |
| 68 | |
| 69 | void dump() const; |
| 70 | status_t dump(int fd, const Vector<String16>& args) const; |
| 71 | |
| 72 | private: |
| 73 | DefaultKeyedVector<String8,String8> mMap; |
| 74 | }; |
| 75 | |
| 76 | |
| 77 | }; // namespace android |
| 78 | |
| 79 | #endif |