summaryrefslogtreecommitdiff
path: root/camera/libhdrplusclient/include/HdrPlusClientListener.h
blob: 30b817e3c1afb365e79a2eb4eeed4ceb5887d48b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * Copyright 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HDR_PLUS_CLIENT_LISTENER_H
#define HDR_PLUS_CLIENT_LISTENER_H

#include "hardware/camera3.h"
#include "HdrPlusTypes.h"

namespace android {


class HdrPlusClient;

/*
 * HdrPlusClientListener defines callbacks that will be invoked by HdrPlusClient for events like
 * returning capture results.
 */
class HdrPlusClientListener {
public:
    virtual ~HdrPlusClientListener() {};

    /*
     * Invoked when an HDR+ client is opened successfully via
     * EaselManagerClient::openHdrPlusClientAsync.
     */
    virtual void onOpened(std::unique_ptr<HdrPlusClient> client) = 0;

    /*
     * Invoked when opening an HDR+ client failed via EaselManagerClient::openHdrPlusClientAsync.
     *
     * err is
     *  -EEXIST:    if an HDR+ client is already opened.
     *  -ENODEV:    if opening an HDR+ failed due to a serious error.
     */
    virtual void onOpenFailed(status_t err) = 0;

    /*
     * Invoked when HDR+ client is in a fatal error state. After receiving this error, calls to HDR+
     * client will not succeed and HDR+ client should be closed.
     */
    virtual void onFatalError() = 0;

    /*
     * Invoked when a CaptureResult, containing a subset or all output buffers for a CaptureRequest,
     * is received. This may be invoked multiple times for one CaptureRequest but each CaptureResult
     * will contain distinct output buffers that have not been received yet.
     */
    virtual void onCaptureResult(pbcamera::CaptureResult *result,
            const camera_metadata_t &resultMetadata) = 0;

    /*
     * Invoked when a failed CaptureResult, containing a subset or all output buffers for a
     * CaptureRequest, is received. Output buffers in a failed capture result may contain garbage
     * data. This may be invoked multiple times for one CaptureRequest but each CaptureResult
     * will contain distinct output buffers that have not been received yet.
     */
    virtual void onFailedCaptureResult(pbcamera::CaptureResult *failedResult) = 0;

    /*
     * Invoked when HDR+ processing has started for a request. requestId is the ID of the request.
     * apSensorTimestampNs is the AP sensor timestamp of the base frame, in nanoseconds.
     */
    virtual void onShutter(uint32_t requestId, int64_t apSensorTimestampNs) = 0;

    /*
     * Invoked when Easel is ready to take another HDR+ request.
     */
    virtual void onNextCaptureReady(uint32_t requestId) = 0;

    /*
     * Invoked when the postview for a request is ready.
     */
    virtual void onPostview(uint32_t requestId, std::unique_ptr<std::vector<uint8_t>> postview,
            uint32_t width, uint32_t height, uint32_t stride, int32_t format) = 0;
};

} // namespace android

#endif // HDR_PLUS_CLIENT_LISTENER_H