1 /*
2  * Copyright (C) 2015 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 #ifndef _ACAPTURE_REQUEST_H
17 #define _ACAPTURE_REQUEST_H
18 
19 #include <camera/NdkCaptureRequest.h>
20 #include <set>
21 #include <unordered_map>
22 
23 using namespace android;
24 
25 struct ACameraOutputTarget {
ACameraOutputTargetACameraOutputTarget26     explicit ACameraOutputTarget(ANativeWindow* window) : mWindow(window) {};
27 
28     bool operator == (const ACameraOutputTarget& other) const {
29         return mWindow == other.mWindow;
30     }
31     bool operator != (const ACameraOutputTarget& other) const {
32         return mWindow != other.mWindow;
33     }
34     bool operator < (const ACameraOutputTarget& other) const {
35         return mWindow < other.mWindow;
36     }
37     bool operator > (const ACameraOutputTarget& other) const {
38         return mWindow > other.mWindow;
39     }
40 
41     ANativeWindow* mWindow;
42 };
43 
44 struct ACameraOutputTargets {
45     std::set<ACameraOutputTarget> mOutputs;
46 };
47 
48 struct ACaptureRequest {
setContextACaptureRequest49     camera_status_t setContext(void* ctx) {
50         context = ctx;
51         return ACAMERA_OK;
52     }
53 
getContextACaptureRequest54     camera_status_t getContext(void** ctx) const {
55         *ctx = context;
56         return ACAMERA_OK;
57     }
58 
59     sp<ACameraMetadata> settings;
60     std::unordered_map<std::string, sp<ACameraMetadata>> physicalSettings;
61     ACameraOutputTargets* targets;
62     void*                 context;
63 };
64 
65 #endif // _ACAPTURE_REQUEST_H
66