blob: 9ca18068ef5909aac0261ea5a733e36b1855e6e7 [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
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
23namespace android {
24
25class CameraParameters
26{
27public:
28 CameraParameters();
29 CameraParameters(const String8 &params) { unflatten(params); }
30 ~CameraParameters();
31
The Android Open Source Projecta6938ba2009-02-10 15:44:00 -080032 enum {
33 CAMERA_ORIENTATION_UNKNOWN = 0,
34 CAMERA_ORIENTATION_PORTRAIT = 1,
35 CAMERA_ORIENTATION_LANDSCAPE = 2,
36 };
37
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070038 String8 flatten() const;
39 void unflatten(const String8 &params);
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
The Android Open Source Projecta6938ba2009-02-10 15:44:00 -080066 int getOrientation() const;
67 void setOrientation(int orientation);
68
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070069 void dump() const;
70 status_t dump(int fd, const Vector<String16>& args) const;
71
72private:
73 DefaultKeyedVector<String8,String8> mMap;
74};
75
76
77}; // namespace android
78
79#endif