1 | /* |
2 | * 1394-Based Digital Camera Control Library |
3 | * |
4 | * Format_7 functions |
5 | * |
6 | * Written by Damien Douxchamps <ddouxchamps@users.sf.net> |
7 | * |
8 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Lesser General Public |
10 | * License as published by the Free Software Foundation; either |
11 | * version 2.1 of the License, or (at your option) any later version. |
12 | * |
13 | * This library is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ |
22 | |
23 | #include <dc1394/log.h> |
24 | #include <dc1394/video.h> |
25 | |
26 | #ifndef __DC1394_FORMAT7_H__ |
27 | #define __DC1394_FORMAT7_H__ |
28 | |
29 | /*! \file dc1394/format7.h |
30 | \brief Functions to control Format_7 (aka scalable format, ROI) |
31 | |
32 | More details soon |
33 | */ |
34 | |
35 | /** |
36 | * A struct containing information about a mode of Format_7, the scalable image format. |
37 | */ |
38 | typedef struct __dc1394format7mode_t |
39 | { |
40 | dc1394bool_t present; |
41 | |
42 | uint32_t size_x; |
43 | uint32_t size_y; |
44 | uint32_t max_size_x; |
45 | uint32_t max_size_y; |
46 | |
47 | uint32_t pos_x; |
48 | uint32_t pos_y; |
49 | |
50 | uint32_t unit_size_x; |
51 | uint32_t unit_size_y; |
52 | uint32_t unit_pos_x; |
53 | uint32_t unit_pos_y; |
54 | |
55 | dc1394color_codings_t color_codings; |
56 | dc1394color_coding_t color_coding; |
57 | |
58 | uint32_t pixnum; |
59 | |
60 | uint32_t packet_size; /* in bytes */ |
61 | uint32_t unit_packet_size; |
62 | uint32_t max_packet_size; |
63 | |
64 | uint64_t total_bytes; |
65 | |
66 | dc1394color_filter_t color_filter; |
67 | |
68 | } dc1394format7mode_t; |
69 | |
70 | /** |
71 | * A struct containing the list of Format_7 modes. |
72 | * FIXME: this may become very big if format_7 pages are used in IIDC 1.32. It would be better to use a "num" and an allocated list. |
73 | */ |
74 | typedef struct __dc1394format7modeset_t |
75 | { |
76 | dc1394format7mode_t mode[DC1394_VIDEO_MODE_FORMAT7_NUM]; |
77 | } dc1394format7modeset_t; |
78 | |
79 | /* Parameter flags for dc1394_setup_format7_capture() */ |
80 | #define DC1394_QUERY_FROM_CAMERA -1 |
81 | #define DC1394_USE_MAX_AVAIL -2 |
82 | #define DC1394_USE_RECOMMENDED -3 |
83 | |
84 | #ifdef __cplusplus |
85 | extern "C" { |
86 | #endif |
87 | |
88 | /*************************************************************************** |
89 | Format_7 (scalable image format) |
90 | ***************************************************************************/ |
91 | |
92 | /* image size */ |
93 | |
94 | /** |
95 | * Gets the maximal image size for a given mode. |
96 | */ |
97 | dc1394error_t dc1394_format7_get_max_image_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *h_size,uint32_t *v_size); |
98 | |
99 | /** |
100 | * Gets the unit sizes for a given mode. The image size can only be a multiple of the unit size, and cannot be smaller than it. |
101 | */ |
102 | dc1394error_t dc1394_format7_get_unit_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *h_unit, uint32_t *v_unit); |
103 | |
104 | /** |
105 | * Gets the current image size. |
106 | */ |
107 | dc1394error_t dc1394_format7_get_image_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *width, uint32_t *height); |
108 | |
109 | /** |
110 | * Sets the current image size |
111 | */ |
112 | dc1394error_t dc1394_format7_set_image_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t width, uint32_t height); |
113 | |
114 | /* image position */ |
115 | |
116 | /** |
117 | * Gets the current image position |
118 | */ |
119 | dc1394error_t dc1394_format7_get_image_position(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *left, uint32_t *top); |
120 | |
121 | /** |
122 | * Sets the current image position |
123 | */ |
124 | dc1394error_t dc1394_format7_set_image_position(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t left, uint32_t top); |
125 | |
126 | /** |
127 | * Gets the unit positions for a given mode. The image position can only be a multiple of the unit position (zero is acceptable). |
128 | */ |
129 | dc1394error_t dc1394_format7_get_unit_position(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *h_unit_pos, uint32_t *v_unit_pos); |
130 | |
131 | /* color coding */ |
132 | |
133 | /** |
134 | * Gets the current color coding |
135 | */ |
136 | dc1394error_t dc1394_format7_get_color_coding(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding); |
137 | |
138 | /** |
139 | * Gets the list of color codings available for this mode |
140 | */ |
141 | dc1394error_t dc1394_format7_get_color_codings(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_codings_t *codings); |
142 | |
143 | /** |
144 | * Sets the current color coding |
145 | */ |
146 | dc1394error_t dc1394_format7_set_color_coding(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t color_coding); |
147 | |
148 | /** |
149 | * Gets the current color filter |
150 | */ |
151 | dc1394error_t dc1394_format7_get_color_filter(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_filter_t *color_filter); |
152 | |
153 | /* packet */ |
154 | |
155 | /** |
156 | * Get the parameters of the packet size: its maximal size and its unit size. The packet size is always a multiple of the unit bytes and cannot be zero. |
157 | */ |
158 | dc1394error_t dc1394_format7_get_packet_parameters(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *unit_bytes, uint32_t *max_bytes); |
159 | |
160 | /** |
161 | * Gets the current packet size |
162 | */ |
163 | dc1394error_t dc1394_format7_get_packet_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *packet_size); |
164 | |
165 | /** |
166 | * Sets the current packet size |
167 | */ |
168 | dc1394error_t dc1394_format7_set_packet_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t packet_size); |
169 | |
170 | /** |
171 | * Gets the recommended packet size. Ignore if zero. |
172 | */ |
173 | dc1394error_t dc1394_format7_get_recommended_packet_size(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *packet_size); |
174 | |
175 | /** |
176 | * Gets the number of packets per frame. |
177 | */ |
178 | dc1394error_t dc1394_format7_get_packets_per_frame(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *ppf); |
179 | |
180 | /* other */ |
181 | |
182 | /** |
183 | * Gets the data depth (e.g. 12, 13, 14 bits/pixel) |
184 | */ |
185 | dc1394error_t dc1394_format7_get_data_depth(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *data_depth); |
186 | |
187 | /** |
188 | * Gets the frame interval in float format |
189 | */ |
190 | dc1394error_t dc1394_format7_get_frame_interval(dc1394camera_t *camera, dc1394video_mode_t video_mode, float *interval); |
191 | |
192 | /** |
193 | * Gets the number of pixels per image frame |
194 | */ |
195 | dc1394error_t dc1394_format7_get_pixel_number(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint32_t *pixnum); |
196 | |
197 | /** |
198 | * Get the total number of bytes per frame. This includes padding (to reach an entire number of packets) |
199 | */ |
200 | dc1394error_t dc1394_format7_get_total_bytes(dc1394camera_t *camera, dc1394video_mode_t video_mode, uint64_t *total_bytes); |
201 | |
202 | /* These functions get the properties of (one or all) format7 mode(s) */ |
203 | |
204 | /** |
205 | * Gets the properties of all Format_7 modes supported by the camera. |
206 | */ |
207 | dc1394error_t dc1394_format7_get_modeset(dc1394camera_t *camera, dc1394format7modeset_t *info); |
208 | |
209 | /** |
210 | * Gets the properties of a Format_7 mode |
211 | */ |
212 | dc1394error_t dc1394_format7_get_mode_info(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394format7mode_t *f7_mode); |
213 | |
214 | /** |
215 | * Joint function that fully sets a certain ROI taking all parameters into account. |
216 | * Note that this function does not SWITCH to the video mode passed as argument, it mearly sets it |
217 | */ |
218 | dc1394error_t dc1394_format7_set_roi(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t color_coding, |
219 | int32_t packet_size, int32_t left, int32_t top, int32_t width, int32_t height); |
220 | |
221 | /** |
222 | * Joint function that fully gets a certain ROI taking all parameters into account. |
223 | */ |
224 | dc1394error_t dc1394_format7_get_roi(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding, |
225 | uint32_t *packet_size, uint32_t *left, uint32_t *top, uint32_t *width, uint32_t *height); |
226 | |
227 | #ifdef __cplusplus |
228 | } |
229 | #endif |
230 | |
231 | #endif |
232 | |