1 /* Copyright (c) 2011, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef ANDROID_HARDWARE_QUALCOMM_CAMERA_H
31 #define ANDROID_HARDWARE_QUALCOMM_CAMERA_H
32 
33 #include <hardware/camera2.h>
34 
35 extern "C" {
36 
37   int get_number_of_cameras();
38   int get_camera_info(int camera_id, struct camera_info *info);
39 
40   int camera_device_open(const struct hw_module_t* module, const char* id,
41           struct hw_device_t** device);
42 
43   hw_device_t * open_camera_device(int cameraId);
44 
45   int close_camera_device( hw_device_t *);
46 
47 namespace android {
48   int set_request_queue_src_ops(const struct camera2_device *,
49     const camera2_request_queue_src_ops_t *request_src_ops);
50 
51   int notify_request_queue_not_empty(const struct camera2_device *);
52 
53   int set_frame_queue_dst_ops(const struct camera2_device *,
54     const camera2_frame_queue_dst_ops_t *frame_dst_ops);
55 
56   int get_in_progress_count(const struct camera2_device *);
57 
58   int flush_captures_in_progress(const struct camera2_device *);
59 
60   int construct_default_request(const struct camera2_device *,
61     int request_template,
62     camera_metadata_t **request);
63 
64   int allocate_stream(const struct camera2_device *,
65         uint32_t width,
66         uint32_t height,
67         int      format,
68         const camera2_stream_ops_t *stream_ops,
69         uint32_t *stream_id,
70         uint32_t *format_actual,
71         uint32_t *usage,
72         uint32_t *max_buffers);
73 
74   int register_stream_buffers(
75         const struct camera2_device *,
76         uint32_t stream_id,
77         int num_buffers,
78         buffer_handle_t *buffers);
79 
80   int release_stream(
81         const struct camera2_device *,
82         uint32_t stream_id);
83 
84   int allocate_reprocess_stream(const struct camera2_device *,
85         uint32_t width,
86         uint32_t height,
87         uint32_t format,
88         const camera2_stream_in_ops_t *reprocess_stream_ops,
89         uint32_t *stream_id,
90         uint32_t *consumer_usage,
91         uint32_t *max_buffers);
92 
93   int allocate_reprocess_stream_from_stream(const struct camera2_device *,
94         uint32_t output_stream_id,
95         const camera2_stream_in_ops_t *stream_ops,
96         uint32_t *stream_id);
97 
98   int release_reprocess_stream(
99         const struct camera2_device *,
100         uint32_t stream_id);
101 
102   int trigger_action(const struct camera2_device *,
103         uint32_t trigger_id,
104         int32_t ext1,
105         int32_t ext2);
106 
107   int set_notify_callback(const struct camera2_device *,
108         camera2_notify_callback notify_cb,
109         void *user);
110 
111   int get_metadata_vendor_tag_ops(const struct camera2_device*,
112         vendor_tag_query_ops_t **ops);
113 
114   int dump(const struct camera2_device *, int fd);
115 }; // namespace android
116 
117 } //extern "C"
118 
119 #endif
120