summaryrefslogtreecommitdiff
path: root/camerasrc/src/include/gstcamerasrccontrol.h
blob: c4ce913fe58079e94155e98b53e7b1a008d881c5 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/*
 * camerasrc
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 */

#ifndef __GST_CAMERASRC_CONTROL_H__
#define __GST_CAMERASRC_CONTROL_H__

#include <gst/gst.h>
#include <gst/interfaces/cameracontrol.h>
#include "gstcamerasrc.h"

G_BEGIN_DECLS

#define GST_TYPE_CAMERASRC_CONTROL_CHANNEL (gst_camerasrc_control_channel_get_type ())
#define GST_CAMERASRC_CONTROL_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CAMERASRC_CONTROL_CHANNEL, GstCamerasrcControlChannel))
#define GST_CAMERASRC_CONTROL_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CAMERASRC_CONTROL_CHANNEL, GstCamerasrcControlChannelClass))
#define GST_IS_CAMERASRC_CONTROL_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CAMERASRC_CONTROL_CHANNEL))
#define GST_IS_CAMERASRC_CONTROL_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CAMERASRC_CONTROL_CHANNEL))

typedef struct _GstCamerasrcControlChannel {
GstCameraControlChannel parent;
guint32 id;
} GstCamerasrcControlChannel;

typedef struct _GstCamerasrcControlChannelClass {
GstCameraControlChannelClass parent;
} GstCamerasrcControlChannelClass;

GType gst_camerasrc_control_channel_get_type( void );

const GList*gst_camerasrc_control_list_channels( GstCameraSrc* camera_src );

gboolean    gst_camerasrc_control_set_value          ( GstCameraSrc* camera_src, GstCameraControlChannel* control_channel, gint value );
gboolean    gst_camerasrc_control_get_value          ( GstCameraSrc* camera_src, GstCameraControlChannel* control_channel, gint* value );
gboolean    gst_camerasrc_control_set_exposure       ( GstCameraSrc* camera_src, gint type, gint value1, gint value2 );
gboolean    gst_camerasrc_control_get_exposure       ( GstCameraSrc* camera_src, gint type, gint* value1, gint* value2 );
gboolean    gst_camerasrc_control_set_capture_mode   ( GstCameraSrc* camera_src, gint type, gint value );
gboolean    gst_camerasrc_control_get_capture_mode   ( GstCameraSrc* camera_src, gint type, gint* value );
gboolean    gst_camerasrc_control_set_strobe         ( GstCameraSrc* camera_src, gint type, gint value );
gboolean    gst_camerasrc_control_get_strobe         ( GstCameraSrc* camera_src, gint type, gint *value );
gboolean    gst_camerasrc_control_set_detect         ( GstCameraSrc* camera_src, gint type, gint value );
gboolean    gst_camerasrc_control_get_detect         ( GstCameraSrc* camera_src, gint type, gint* value );
gboolean    gst_camerasrc_control_set_zoom           ( GstCameraSrc* camera_src, gint type, gint value );
gboolean    gst_camerasrc_control_get_zoom           ( GstCameraSrc* camera_src, gint type, gint* value );
gboolean    gst_camerasrc_control_set_focus          ( GstCameraSrc* camera_src, gint mode, gint range );
gboolean    gst_camerasrc_control_get_focus          ( GstCameraSrc* camera_src, gint* mode, gint* range );
gboolean    gst_camerasrc_control_start_auto_focus   ( GstCameraSrc* camera_src );
gboolean    gst_camerasrc_control_stop_auto_focus    ( GstCameraSrc* camera_src );
gboolean    gst_camerasrc_control_set_focus_level    ( GstCameraSrc* camera_src, gint manual_level );
gboolean    gst_camerasrc_control_get_focus_level    ( GstCameraSrc* camera_src, gint* manual_level );
gboolean    gst_camerasrc_control_set_auto_focus_area( GstCameraSrc* camera_src, GstCameraControlRectType rect );
gboolean    gst_camerasrc_control_get_auto_focus_area( GstCameraSrc* camera_src, GstCameraControlRectType* rect );
gboolean    gst_camerasrc_control_set_wdr            ( GstCameraSrc* camera_src, gint value );
gboolean    gst_camerasrc_control_get_wdr            ( GstCameraSrc* camera_src, gint* value );
gboolean    gst_camerasrc_control_set_ahs            ( GstCameraSrc* camera_src, gint value );
gboolean    gst_camerasrc_control_get_ahs            ( GstCameraSrc* camera_src, gint* value );
gboolean    gst_camerasrc_control_set_part_color     ( GstCameraSrc* camera_src, gint type, gint value );
gboolean    gst_camerasrc_control_get_part_color     ( GstCameraSrc* camera_src, gint type, gint* value );
gboolean    gst_camerasrc_control_get_exif_info      ( GstCameraSrc* camera_src, GstCameraControlExifInfo* info );
gboolean    gst_camerasrc_control_get_basic_dev_info ( GstCameraSrc* camera_src, gint dev_id, GstCameraControlCapsInfoType* info );
gboolean    gst_camerasrc_control_get_misc_dev_info  ( GstCameraSrc* camera_src, gint dev_id, GstCameraControlCtrlListInfoType* info );
gboolean    gst_camerasrc_control_get_extra_dev_info ( GstCameraSrc* camera_src, gint dev_id, GstCameraControlExtraInfoType* info );
void        gst_camerasrc_control_set_capture_command( GstCameraSrc* camera_src, GstCameraControlCaptureCommand cmd );

#define GST_IMPLEMENT_CAMERASRC_CONTROL_METHODS(Type, interface_as_function) \
 \
static const GList* \
interface_as_function ## _control_list_channels( GstCameraControl* control ) \
{ \
	Type* this = (Type*) control; \
	return gst_camerasrc_control_list_channels( this ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_value( GstCameraControl* control, \
                                             GstCameraControlChannel* control_channel, gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_value( this, control_channel, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_value( GstCameraControl* control, \
                                             GstCameraControlChannel* control_channel, gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_value( this, control_channel, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_exposure( GstCameraControl* control, \
                                                gint type, gint value1, gint value2 ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_exposure( this, type, value1, value2 ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_exposure( GstCameraControl* control, \
                                                gint type, gint* value1, gint* value2 ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_exposure( this, type, value1, value2 ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_capture_mode( GstCameraControl* control, \
                                                    gint type, gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_capture_mode( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_capture_mode( GstCameraControl* control, \
                                                    gint type, gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_capture_mode( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_strobe( GstCameraControl* control, \
                                              gint type, gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_strobe( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_strobe( GstCameraControl* control, \
                                              gint type, gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_strobe( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_detect( GstCameraControl* control, \
                                              gint type, gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_detect( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_detect( GstCameraControl* control, \
                                              gint type, gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_detect( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_zoom( GstCameraControl* control, \
                                            gint type, gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_zoom( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_zoom( GstCameraControl* control, \
                                            gint type, gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_zoom( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_focus( GstCameraControl* control, \
                                             gint focus_mode, gint focus_range ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_focus( this, focus_mode, focus_range ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_focus( GstCameraControl* control, \
                                             gint* focus_mode, gint* focus_range ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_focus( this, focus_mode, focus_range ); \
} \
 \
static gboolean \
interface_as_function ## _control_start_auto_focus( GstCameraControl* control) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_start_auto_focus( this ); \
} \
 \
static gboolean \
interface_as_function ## _control_stop_auto_focus( GstCameraControl* control) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_stop_auto_focus( this ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_focus_level( GstCameraControl* control, \
                                                   gint focus_level ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_focus_level( this, focus_level ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_focus_level( GstCameraControl* control, \
                                                   gint* focus_level ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_focus_level( this, focus_level ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_auto_focus_area( GstCameraControl* control, \
                                                       GstCameraControlRectType rect ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_auto_focus_area( this, rect ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_auto_focus_area( GstCameraControl* control, \
                                                       GstCameraControlRectType* rect ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_auto_focus_area( this, rect ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_wdr( GstCameraControl* control, \
                                           gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_wdr( this, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_wdr( GstCameraControl* control, \
                                           gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_wdr( this, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_ahs( GstCameraControl* control, \
                                           gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_ahs( this, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_ahs( GstCameraControl* control, \
                                           gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_ahs( this, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_set_part_color( GstCameraControl* control, \
                                                  gint type, gint value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_set_part_color( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_part_color( GstCameraControl* control, \
                                                  gint type, gint* value ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_part_color( this, type, value ); \
} \
 \
static gboolean \
interface_as_function ## _control_get_exif_info( GstCameraControl* control, \
                                                 GstCameraControlExifInfo* info ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_exif_info( this, info); \
} \
 \
static gboolean \
interface_as_function ## _control_get_basic_dev_info( GstCameraControl* control, \
                                                      gint dev_id, \
                                                      GstCameraControlCapsInfoType* info ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_basic_dev_info( this, dev_id, info); \
} \
 \
static gboolean \
interface_as_function ## _control_get_misc_dev_info( GstCameraControl* control, \
                                                     gint dev_id, \
                                                     GstCameraControlCtrlListInfoType* info ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_misc_dev_info( this, dev_id, info); \
} \
 \
static gboolean \
interface_as_function ## _control_get_extra_dev_info( GstCameraControl* control, \
                                                      gint dev_id, \
                                                      GstCameraControlExtraInfoType* info ) \
{ \
	Type* this = (Type*)control; \
	return gst_camerasrc_control_get_extra_dev_info( this, dev_id, info); \
} \
 \
static void \
interface_as_function ## _control_set_capture_command( GstCameraControl* control, \
                                                       GstCameraControlCaptureCommand cmd ) \
{ \
	Type* this = (Type*)control; \
	gst_camerasrc_control_set_capture_command( this, cmd ); \
	return; \
} \
 \
void \
interface_as_function ## _control_interface_init( GstCameraControlClass *klass ) \
{ \
	GST_CAMERA_CONTROL_TYPE( klass ) = GST_CAMERA_CONTROL_HARDWARE; \
 \
	/* default virtual functions */ \
	klass->list_channels = interface_as_function ## _control_list_channels; \
	klass->set_value = interface_as_function ## _control_set_value; \
	klass->get_value = interface_as_function ## _control_get_value; \
	klass->set_exposure = interface_as_function ## _control_set_exposure; \
	klass->get_exposure = interface_as_function ## _control_get_exposure; \
	klass->set_capture_mode = interface_as_function ## _control_set_capture_mode; \
	klass->get_capture_mode = interface_as_function ## _control_get_capture_mode; \
	klass->set_strobe = interface_as_function ## _control_set_strobe; \
	klass->get_strobe = interface_as_function ## _control_get_strobe; \
	klass->set_detect = interface_as_function ## _control_set_detect; \
	klass->get_detect = interface_as_function ## _control_get_detect; \
	klass->set_zoom = interface_as_function ## _control_set_zoom; \
	klass->get_zoom = interface_as_function ## _control_get_zoom; \
	klass->set_focus = interface_as_function ## _control_set_focus; \
	klass->get_focus = interface_as_function ## _control_get_focus; \
	klass->start_auto_focus = interface_as_function ## _control_start_auto_focus; \
	klass->stop_auto_focus = interface_as_function ## _control_stop_auto_focus; \
	klass->set_focus_level = interface_as_function ## _control_set_focus_level; \
	klass->get_focus_level = interface_as_function ## _control_get_focus_level; \
	klass->set_auto_focus_area = interface_as_function ## _control_set_auto_focus_area; \
	klass->get_auto_focus_area = interface_as_function ## _control_get_auto_focus_area; \
	klass->set_wdr = interface_as_function ## _control_set_wdr; \
	klass->get_wdr = interface_as_function ## _control_get_wdr; \
	klass->set_ahs = interface_as_function ## _control_set_ahs; \
	klass->get_ahs = interface_as_function ## _control_get_ahs; \
	klass->set_part_color = interface_as_function ## _control_set_part_color; \
	klass->get_part_color = interface_as_function ## _control_get_part_color; \
	klass->get_exif_info = interface_as_function ## _control_get_exif_info; \
	klass->get_basic_dev_info = interface_as_function ## _control_get_basic_dev_info; \
	klass->get_misc_dev_info = interface_as_function ## _control_get_misc_dev_info; \
	klass->get_extra_dev_info = interface_as_function ## _control_get_extra_dev_info; \
	klass->set_capture_command = interface_as_function ## _control_set_capture_command; \
 \
}

#endif /* __GST_CAMERASRC_CONTROL_H__ */