blob: 30e8c4f4b79c2332c731041f456777bab7bd3575 [file] [log] [blame]
Yin-Chia Yehb978c382019-10-30 00:22:37 -07001/*
2 * Copyright (C) 2019 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_SERVERS_CAMERA3OFFLINESESSION_H
18#define ANDROID_SERVERS_CAMERA3OFFLINESESSION_H
19
20#include <utils/String8.h>
21#include <utils/String16.h>
22
23#include <android/hardware/camera/device/3.6/ICameraOfflineSession.h>
24#include <fmq/MessageQueue.h>
25
26#include "common/CameraOfflineSessionBase.h"
27
28#include "device3/Camera3BufferManager.h"
29#include "device3/DistortionMapper.h"
30#include "utils/TagMonitor.h"
31#include "utils/LatencyHistogram.h"
32#include <camera_metadata_hidden.h>
33
34namespace android {
35
36namespace camera3 {
37
38class Camera3Stream;
39class Camera3OutputStreamInterface;
40class Camera3StreamInterface;
41
42} // namespace camera3
43
44/**
45 * Camera3OfflineSession for offline session defined in HIDL ICameraOfflineSession@3.6 or higher
46 */
47class Camera3OfflineSession :
48 public CameraOfflineSessionBase,
49 virtual public hardware::camera::device::V3_5::ICameraDeviceCallback {
50
51 public:
52
53 // initialize by Camera3Device. Camera3Device must send all info in separate argument.
54 // monitored tags
55 // mUseHalBufManager
56 // mUsePartialResult
57 // mNumPartialResults
58 explicit Camera3OfflineSession(const String8& id);
59
60 virtual ~Camera3OfflineSession();
61
62 status_t initialize(
63 sp<hardware::camera::device::V3_6::ICameraOfflineSession> hidlSession);
64
65 /**
66 * CameraOfflineSessionBase interface
67 */
68 const String8& getId() const override;
69
70 status_t disconnect() override;
71
72 status_t dump(int fd) override;
73
74 status_t abort() override;
75
76 // methods for capture result passing
77 status_t waitForNextFrame(nsecs_t timeout) override;
78 status_t getNextResult(CaptureResult *frame) override;
79
80 // TODO: methods for notification (error/idle/finished etc) passing
81
82 /**
83 * End of CameraOfflineSessionBase interface
84 */
85
86 /**
87 * HIDL ICameraDeviceCallback interface
88 */
89
90 /**
91 * Implementation of android::hardware::camera::device::V3_5::ICameraDeviceCallback
92 */
93
94 hardware::Return<void> processCaptureResult_3_4(
95 const hardware::hidl_vec<
96 hardware::camera::device::V3_4::CaptureResult>& results) override;
97 hardware::Return<void> processCaptureResult(
98 const hardware::hidl_vec<
99 hardware::camera::device::V3_2::CaptureResult>& results) override;
100 hardware::Return<void> notify(
101 const hardware::hidl_vec<
102 hardware::camera::device::V3_2::NotifyMsg>& msgs) override;
103
104 hardware::Return<void> requestStreamBuffers(
105 const hardware::hidl_vec<
106 hardware::camera::device::V3_5::BufferRequest>& bufReqs,
107 requestStreamBuffers_cb _hidl_cb) override;
108
109 hardware::Return<void> returnStreamBuffers(
110 const hardware::hidl_vec<
111 hardware::camera::device::V3_2::StreamBuffer>& buffers) override;
112
113 /**
114 * End of CameraOfflineSessionBase interface
115 */
116
117 private:
118
119 // Camera device ID
120 const String8 mId;
121
122}; // class Camera3OfflineSession
123
124}; // namespace android
125
126#endif