blob: c747c1b8b3ad92cbdb622c372b072172737fbb9c [file] [log] [blame]
Yin-Chia Yeh0dea57f2015-12-09 16:46:07 -08001/*
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
17//#define LOG_NDEBUG 0
18#define LOG_TAG "NdkCameraDevice"
19#define ATRACE_TAG ATRACE_TAG_CAMERA
20
21#include <utils/Log.h>
22#include <utils/Trace.h>
23
24#include <NdkCameraDevice.h>
25#include "impl/ACameraDevice.h"
26
27using namespace android;
28
29EXPORT
30camera_status_t ACameraDevice_close(ACameraDevice* device) {
31 ATRACE_CALL();
32 if (device == nullptr) {
33 ALOGE("%s: invalid argument! device is null", __FUNCTION__);
34 return ACAMERA_ERROR_INVALID_PARAMETER;
35 }
36 delete device;
37 return ACAMERA_OK;
38}
39
40EXPORT
41const char* ACameraDevice_getId(const ACameraDevice* device) {
42 ATRACE_CALL();
43 if (device == nullptr) {
44 ALOGE("%s: invalid argument! device is null", __FUNCTION__);
45 return nullptr;
46 }
47 return device->getId();
48}
49
50EXPORT
51camera_status_t ACameraDevice_createCaptureRequest(
52 const ACameraDevice* device,
53 ACameraDevice_request_template templateId,
54 ACaptureRequest** request) {
55 ATRACE_CALL();
56 if (device == nullptr || request == nullptr) {
57 ALOGE("%s: invalid argument! device 0x%p request 0x%p",
58 __FUNCTION__, device, request);
59 return ACAMERA_ERROR_INVALID_PARAMETER;
60 }
61 switch (templateId) {
62 case TEMPLATE_PREVIEW:
63 case TEMPLATE_STILL_CAPTURE:
64 case TEMPLATE_RECORD:
65 case TEMPLATE_VIDEO_SNAPSHOT:
66 case TEMPLATE_ZERO_SHUTTER_LAG:
67 case TEMPLATE_MANUAL:
68 break;
69 default:
70 ALOGE("%s: unknown template ID %d", __FUNCTION__, templateId);
71 return ACAMERA_ERROR_INVALID_PARAMETER;
72 }
73 return device->createCaptureRequest(templateId, request);
74}
75
76struct ACaptureSessionOutputContainer;
77
78struct ACaptureSessionOutput;
79
80EXPORT
81camera_status_t ACaptureSessionOutputContainer_create(/*out*/ACaptureSessionOutputContainer**) {
82 ATRACE_CALL();
83 return ACAMERA_OK;
84}
85
86EXPORT
87void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer*) {
88 ATRACE_CALL();
89 return;
90}
91
92EXPORT
93camera_status_t ACaptureSessionOutput_create(ANativeWindow*, /*out*/ACaptureSessionOutput**) {
94 ATRACE_CALL();
95 return ACAMERA_OK;
96}
97
98EXPORT
99void ACaptureSessionOutput_free(ACaptureSessionOutput*) {
100 ATRACE_CALL();
101 return;
102}
103
104EXPORT
105camera_status_t ACaptureSessionOutputContainer_add(
106 ACaptureSessionOutputContainer*, const ACaptureSessionOutput*) {
107 ATRACE_CALL();
108 return ACAMERA_OK;
109}
110
111EXPORT
112camera_status_t ACaptureSessionOutputContainer_remove(
113 ACaptureSessionOutputContainer*, const ACaptureSessionOutput*) {
114 ATRACE_CALL();
115 return ACAMERA_OK;
116}
117
118EXPORT
119camera_status_t ACameraDevice_createCaptureSession(
120 ACameraDevice*,
121 const ACaptureSessionOutputContainer* outputs,
122 const ACameraCaptureSession_stateCallbacks* callbacks) {
123 ATRACE_CALL();
124 return ACAMERA_OK;
125}