f8eb83e23ac16858031691473c21c14f7f7de788
[platform/core/api/mediavision.git] / include / mv_common.h
1 /**
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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 __TIZEN_MEDIAVISION_COMMON_H__
18 #define __TIZEN_MEDIAVISION_COMMON_H__
19
20 #include <media_packet.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 /**
27  * @file  mv_common.h
28  * @brief This file contains the Media Vision Common API.
29  */
30
31 /**
32  * @addtogroup CAPI_MEDIA_VISION_COMMON_MODULE
33  * @{
34  */
35
36 /**
37  * @brief Point in 2D space.
38  *
39  * @since_tizen 2.4
40  */
41 typedef struct
42 {
43     int x; /**< X-axis coordinate of the point in 2D space */
44     int y; /**< Y-axis coordinate of the point in 2D space */
45 } mv_point_s;
46
47 /**
48  * @brief Location of the object bounded by quadrangle defined by four 2D points.
49  *
50  * @since_tizen 2.4
51  */
52 typedef struct
53 {
54     mv_point_s points[4];    /**< Four points that define object bounding
55                                   quadrangle */
56 } mv_quadrangle_s;
57
58 /**
59  * @brief Location of the object bounded by rectangle defined by
60  *        coordinates of top left corner, width and height.
61  *
62  * @since_tizen 2.4
63  */
64 typedef struct
65 {
66     mv_point_s point;     /**< Top left corner of rectangle coordinates */
67     int width;            /**< Width of the bounding rectangle */
68     int height;           /**< Height of the bounding rectangle */
69 } mv_rectangle_s;
70
71 /**
72  * @brief Enumeration for Media Vision error.
73  *
74  * @since_tizen 2.4
75  */
76 typedef enum
77 {
78     MEDIA_VISION_ERROR_NONE
79             = TIZEN_ERROR_NONE,                /**< Successful */
80     MEDIA_VISION_ERROR_NOT_SUPPORTED
81             = TIZEN_ERROR_NOT_SUPPORTED,       /**< Not supported */
82     MEDIA_VISION_ERROR_MSG_TOO_LONG
83             = TIZEN_ERROR_MSG_TOO_LONG,        /**< Message too long */
84     MEDIA_VISION_ERROR_NO_DATA
85             = TIZEN_ERROR_NO_DATA,             /**< No data */
86     MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE
87             = TIZEN_ERROR_KEY_NOT_AVAILABLE,   /**< Key not available */
88     MEDIA_VISION_ERROR_OUT_OF_MEMORY
89             = TIZEN_ERROR_OUT_OF_MEMORY,       /**< Out of memory */
90     MEDIA_VISION_ERROR_INVALID_PARAMETER
91             = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid parameter */
92     MEDIA_VISION_ERROR_INVALID_OPERATION
93             = TIZEN_ERROR_INVALID_OPERATION,   /**< Invalid operation */
94     MEDIA_VISION_ERROR_PERMISSION_DENIED
95             = TIZEN_ERROR_NOT_PERMITTED,       /**< Not permitted */
96     MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT
97             = TIZEN_ERROR_MEDIA_VISION | 0x01, /**< Not supported format */
98     MEDIA_VISION_ERROR_INTERNAL
99             = TIZEN_ERROR_MEDIA_VISION | 0x02, /**< Internal error */
100     MEDIA_VISION_ERROR_INVALID_DATA
101             = TIZEN_ERROR_MEDIA_VISION | 0x03, /**< Invalid data */
102     MEDIA_VISION_ERROR_INVALID_PATH
103             = TIZEN_ERROR_MEDIA_VISION | 0x04, /**< Invalid path (Since 3.0) */
104 } mv_error_e;
105
106 /**
107  * @brief Enumeration for Media Vision @ref mv_engine_config_h handle attribute
108  *        type.
109  *
110  * @since_tizen 2.4
111  */
112 typedef enum
113 {
114     MV_ENGINE_CONFIG_ATTR_TYPE_DOUBLE,     /**< Double attribute type */
115     MV_ENGINE_CONFIG_ATTR_TYPE_INTEGER,    /**< Integer attribute type */
116     MV_ENGINE_CONFIG_ATTR_TYPE_BOOLEAN,    /**< Boolean attribute type */
117     MV_ENGINE_CONFIG_ATTR_TYPE_STRING      /**< String attribute type */
118 } mv_config_attribute_type_e;
119
120 /**
121  * @brief Enumeration for Media Vision colorspace.
122  *
123  * @since_tizen 2.4
124  */
125 typedef enum
126 {
127     MEDIA_VISION_COLORSPACE_INVALID, /**< The colorspace type is invalid */
128     MEDIA_VISION_COLORSPACE_Y800,    /**< The colorspace type is Y800 */
129     MEDIA_VISION_COLORSPACE_I420,    /**< The colorspace type is I420 */
130     MEDIA_VISION_COLORSPACE_NV12,    /**< The colorspace type is NV12 */
131     MEDIA_VISION_COLORSPACE_YV12,    /**< The colorspace type is YV12 */
132     MEDIA_VISION_COLORSPACE_NV21,    /**< The colorspace type is NV21 */
133     MEDIA_VISION_COLORSPACE_YUYV,    /**< The colorspace type is YUYV */
134     MEDIA_VISION_COLORSPACE_UYVY,    /**< The colorspace type is UYVY */
135     MEDIA_VISION_COLORSPACE_422P,    /**< The colorspace type is 422P */
136     MEDIA_VISION_COLORSPACE_RGB565,  /**< The colorspace type is RGB565 */
137     MEDIA_VISION_COLORSPACE_RGB888,  /**< The colorspace type is RGB888 */
138     MEDIA_VISION_COLORSPACE_RGBA,    /**< The colorspace type is RGBA */
139 } mv_colorspace_e;
140
141 /**
142  * @brief The handle to the Media Vision API engine algorithms configuration.
143  * @details Configuration is a dictionary consists of key and value pairs to
144  *          collect engine-specific settings and allow Media Vision module to
145  *          access them internally. Engine configuration provides developer by
146  *          the possibility to make computer vision algorithms work better
147  *          in particular conditions of API usage. To create engine
148  *          configuration handle @ref mv_create_engine_config() function has to
149  *          be used. When configuration is not needed any more, it is required to
150  *          destroy it and release resources by @ref mv_destroy_engine_config()
151  *          function.
152  *
153  * @since_tizen 2.4
154  *
155  * @see mv_create_engine_config()
156  * @see mv_destroy_engine_config()
157  */
158 typedef void *mv_engine_config_h;
159
160 /**
161  * @brief The handle to the source.
162  *
163  * @since_tizen 2.4
164  */
165 typedef void *mv_source_h;
166
167 /**
168  * @brief Creates a source handle.
169  *
170  * @since_tizen 2.4
171  * @remarks You must release @a source by using @ref mv_destroy_source().
172  * @param [out] source    A new handle to the source
173  * @return @c 0 on success, otherwise a negative error value
174  * @retval #MEDIA_VISION_ERROR_NONE Successful
175  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
176  * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
177  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
178  *
179  * @see mv_destroy_source()
180  */
181 int mv_create_source(
182         mv_source_h *source);
183
184 /**
185  * @brief Destroys the source handle and releases all its resources.
186  *
187  * @since_tizen 2.4
188  * @param [in] source    The handle to the source to be destroyed
189  * @return @c 0 on success, otherwise a negative error value
190  * @retval #MEDIA_VISION_ERROR_NONE Successful
191  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
192  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
193  *
194  * @see mv_create_source()
195  */
196 int mv_destroy_source(
197         mv_source_h source);
198
199 /**
200  * @brief Fills the media source based on the media packet.
201  *
202  * @since_tizen 2.4
203  * @param [in,out] source          The handle to the source
204  * @param [in]     media_packet    The handle to the media packet from which
205  *                                 will be filled the source
206  * @return @c 0 on success, otherwise a negative error value
207  * @retval #MEDIA_VISION_ERROR_NONE Successful
208  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
209  * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
210  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
211  * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
212  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
213  *
214  * @pre Create a source handle by calling @ref mv_create_source()
215  *
216  * @see mv_create_source()
217  * @see mv_destroy_source()
218  */
219 int mv_source_fill_by_media_packet(
220         mv_source_h source,
221         media_packet_h media_packet);
222
223 /**
224  * @brief Fills the media source based on the buffer and metadata.
225  *
226  * @since_tizen 2.4
227  * @param [in,out] source             The handle to the source
228  * @param [in]     data_buffer        The buffer of image data
229  * @param [in]     buffer_size        The buffer size
230  * @param [in]     image_width        The width of image data
231  * @param [in]     image_height       The height of image data
232  * @param [in]     image_colorspace   The image colorspace
233  * @return @c 0 on success, otherwise a negative error value
234  * @retval #MEDIA_VISION_ERROR_NONE Successful
235  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
236  * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
237  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
238  *
239  * @pre Create a source handle by calling @ref mv_create_source()
240  *
241  * @see mv_source_clear()
242  */
243 int mv_source_fill_by_buffer(
244         mv_source_h source,
245         unsigned char *data_buffer,
246         unsigned int buffer_size,
247         unsigned int image_width,
248         unsigned int image_height,
249         mv_colorspace_e image_colorspace);
250
251 /**
252  * @brief Clears the buffer of the media source.
253  *
254  * @since_tizen 2.4
255  * @param [in,out] source    The handle to the source
256  * @return @c 0 on success, otherwise a negative error value
257  * @retval #MEDIA_VISION_ERROR_NONE Successful
258  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
259  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
260  *
261  * @see mv_source_fill_by_buffer()
262  */
263 int mv_source_clear(
264         mv_source_h source);
265
266 /**
267  * @brief Gets buffer of the media source.
268  *
269  * @since_tizen 2.4
270  * @remarks Note that the retrieved buffer will be destroyed when
271  *          @ref mv_destroy_source() or @ref mv_source_clear() function
272  *          is called for the @a source.
273  *
274  * @param [in]    source        The handle to the source
275  * @param [out]   data_buffer   The buffer of the source
276  * @param [out]   buffer_size   The size of buffer
277  * @return @c 0 on success, otherwise a negative error value
278  * @retval #MEDIA_VISION_ERROR_NONE Successful
279  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
280  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
281  *
282  * @see mv_source_get_width()
283  * @see mv_source_get_height()
284  * @see mv_source_get_colorspace()
285  */
286 int mv_source_get_buffer(
287         mv_source_h source,
288         unsigned char **data_buffer,
289         unsigned int *buffer_size);
290
291 /**
292  * @brief Gets height of the media source.
293  *
294  * @since_tizen 2.4
295  * @param [in]    source         The handle to the source
296  * @param [out]   image_height   The height of an image in the source
297  * @return @c 0 on success, otherwise a negative error value
298  * @retval #MEDIA_VISION_ERROR_NONE Successful
299  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
300  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
301  *
302  * @see mv_source_get_width()
303  * @see mv_source_get_colorspace()
304  * @see mv_source_get_buffer()
305  */
306 int mv_source_get_height(
307         mv_source_h source,
308         unsigned int *image_height);
309
310 /**
311  * @brief Gets width of the media source.
312  *
313  * @since_tizen 2.4
314  * @param [in]    source        The handle to the source
315  * @param [out]   image_width   The width of an image in the source
316  * @return @c 0 on success, otherwise a negative error value
317  * @retval #MEDIA_VISION_ERROR_NONE Successful
318  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
319  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
320  *
321  * @see mv_source_get_height()
322  * @see mv_source_get_colorspace()
323  * @see mv_source_get_buffer()
324  */
325 int mv_source_get_width(
326         mv_source_h source,
327         unsigned int *image_width);
328
329 /**
330  * @brief Gets colorspace of the media source.
331  *
332  * @since_tizen 2.4
333  * @param [in]    source             The handle to the source
334  * @param [out]   image_colorspace   The colorspace of an image in the source
335  * @return @c 0 on success, otherwise a negative error value
336  * @retval #MEDIA_VISION_ERROR_NONE Successful
337  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
338  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
339  *
340  * @see mv_source_get_width()
341  * @see mv_source_get_height()
342  * @see mv_source_get_buffer()
343  */
344 int mv_source_get_colorspace(
345         mv_source_h source,
346         mv_colorspace_e *image_colorspace);
347
348 /**
349  * @brief Creates the handle to the configuration of engine.
350  *
351  * @since_tizen 2.4
352  * @remarks Available engine configuration attributes can be get by using
353  *          @ref mv_engine_config_foreach_supported_attribute().
354  *          The attributes can be changed by @ref mv_engine_config_h
355  *          related setters. Default values are used if the attributes
356  *          are not changed.
357  * @param [out] engine_cfg    The handle to the engine to be created
358  * @return @c 0 on success, otherwise a negative error value
359  * @retval #MEDIA_VISION_ERROR_NONE Successful
360  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
361  * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
362  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
363  *
364  * @see mv_engine_config_h
365  * @see mv_destroy_engine_config()
366  * @see mv_engine_config_set_double_attribute()
367  * @see mv_engine_config_set_int_attribute()
368  * @see mv_engine_config_set_bool_attribute()
369  * @see mv_engine_config_set_string_attribute()
370  * @see mv_engine_config_get_double_attribute()
371  * @see mv_engine_config_get_int_attribute()
372  * @see mv_engine_config_get_bool_attribute()
373  * @see mv_engine_config_get_string_attribute()
374  */
375 int mv_create_engine_config(
376         mv_engine_config_h *engine_cfg);
377
378 /**
379  * @brief Destroys the engine configuration handle and releases all its
380  *        resources.
381  *
382  * @since_tizen 2.4
383  * @param [in] engine_cfg    The handle to the engine configuration
384  *                           to be destroyed
385  * @return @c 0 on success, otherwise a negative error value
386  * @retval #MEDIA_VISION_ERROR_NONE Successful
387  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
388  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
389  *
390  * @see mv_engine_config_h
391  * @see mv_create_engine_config()
392  */
393 int mv_destroy_engine_config(
394         mv_engine_config_h engine_cfg);
395
396 /**
397  * @brief Sets the double attribute to the configuration.
398  *
399  * @since_tizen 2.4
400  * @param [in] engine_cfg        Engine configuration for which @a value has
401  *                               to be set
402  * @param [in] name              String key of the attribute will be used for
403  *                               storing the @a value into configuration
404  *                               dictionary
405  * @param [in] value             The double value of the attribute
406  * @return @c 0 on success, otherwise a negative error value
407  * @retval #MEDIA_VISION_ERROR_NONE Successful
408  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
409  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
410  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
411  *
412  * @see mv_engine_config_get_double_attribute()
413  * @see mv_engine_config_set_int_attribute()
414  * @see mv_engine_config_set_bool_attribute()
415  * @see mv_engine_config_set_string_attribute()
416  */
417 int mv_engine_config_set_double_attribute(
418         mv_engine_config_h engine_cfg,
419         const char *name,
420         double value);
421
422 /**
423  * @brief Sets the integer attribute to the configuration.
424  *
425  * @since_tizen 2.4
426  * @param [in] engine_cfg        Engine configuration for which @a value has
427  *                               to be set
428  * @param [in] name              String key of the attribute will be used for
429  *                               storing the @a value into configuration
430  *                               dictionary
431  * @param [in] value             The integer value of the attribute
432  * @return @c 0 on success, otherwise a negative error value
433  * @retval #MEDIA_VISION_ERROR_NONE Successful
434  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
435  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
436  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
437  *
438  * @see mv_engine_config_get_int_attribute()
439  * @see mv_engine_config_set_double_attribute()
440  * @see mv_engine_config_set_bool_attribute()
441  * @see mv_engine_config_set_string_attribute()
442  * @see mv_barcode_detect_attr_target_e
443  * @see mv_barcode_generate_attr_text_e
444  */
445 int mv_engine_config_set_int_attribute(
446         mv_engine_config_h engine_cfg,
447         const char *name,
448         int value);
449
450 /**
451  * @brief Sets the boolean attribute to the configuration.
452  *
453  * @since_tizen 2.4
454  * @param [in] engine_cfg        Engine configuration for which @a value has
455  *                               to be set
456  * @param [in] name              String key of the attribute will be used for
457  *                               storing the @a value into configuration
458  *                               dictionary
459  * @param [in] value             The boolean value of the attribute
460  * @return @c 0 on success, otherwise a negative error value
461  * @retval #MEDIA_VISION_ERROR_NONE Successful
462  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
463  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
464  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
465  *
466  * @see mv_engine_config_get_bool_attribute()
467  * @see mv_engine_config_set_double_attribute()
468  * @see mv_engine_config_set_int_attribute()
469  * @see mv_engine_config_set_string_attribute()
470  */
471 int mv_engine_config_set_bool_attribute(
472         mv_engine_config_h engine_cfg,
473         const char *name,
474         bool value);
475
476 /**
477  * @brief Sets the string attribute to the configuration.
478  *
479  * @since_tizen 2.4
480  * @param [in] engine_cfg        Engine configuration for which @a value has
481  *                               to be set
482  * @param [in] name              String key of the attribute will be used for
483  *                               storing the @a value into configuration
484  *                               dictionary
485  * @param [in] value             The string value of the attribute
486  * @return @c 0 on success, otherwise a negative error value
487  * @retval #MEDIA_VISION_ERROR_NONE Successful
488  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
489  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
490  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
491  *
492  * @see mv_engine_config_get_string_attribute()
493  * @see mv_engine_config_set_double_attribute()
494  * @see mv_engine_config_set_int_attribute()
495  * @see mv_engine_config_set_bool_attribute()
496  */
497 int mv_engine_config_set_string_attribute(
498         mv_engine_config_h engine_cfg,
499         const char *name,
500         const char *value);
501
502 /**
503  * @brief Gets the double attribute from the configuration dictionary.
504  *
505  * @since_tizen 2.4
506  * @param [in] engine_cfg        Engine configuration from which @a value
507  *                               has to be gotten
508  * @param [in] name              String key of the attribute will be used for
509  *                               getting the @a value from the
510  *                               configuration dictionary
511  * @param [out] value            The attribute to be filled with double value
512  *                               from dictionary
513  * @return @c 0 on success, otherwise a negative error value
514  * @retval #MEDIA_VISION_ERROR_NONE Successful
515  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
516  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
517  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
518  *
519  * @see mv_engine_config_set_double_attribute()
520  * @see mv_engine_config_get_int_attribute()
521  * @see mv_engine_config_get_bool_attribute()
522  * @see mv_engine_config_get_string_attribute()
523  */
524 int mv_engine_config_get_double_attribute(
525         mv_engine_config_h engine_cfg,
526         const char *name,
527         double *value);
528
529 /**
530  * @brief Gets the integer attribute from the configuration dictionary.
531  *
532  * @since_tizen 2.4
533  * @param [in] engine_cfg        Engine configuration from which @a value
534  *                               has to be gotten
535  * @param [in] name              String key of the attribute will be used for
536  *                               getting the @a value from the
537  *                               configuration dictionary
538  * @param [out] value            The attribute to be filled with integer value
539  *                               from dictionary
540  * @return @c 0 on success, otherwise a negative error value
541  * @retval #MEDIA_VISION_ERROR_NONE Successful
542  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
543  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
544  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
545  *
546  * @see mv_engine_config_set_int_attribute()
547  * @see mv_engine_config_get_double_attribute()
548  * @see mv_engine_config_get_bool_attribute()
549  * @see mv_engine_config_get_string_attribute()
550  * @see mv_barcode_detect_attr_target_e
551  * @see mv_barcode_generate_attr_text_e
552  */
553 int mv_engine_config_get_int_attribute(
554         mv_engine_config_h engine_cfg,
555         const char *name,
556         int *value);
557
558 /**
559  * @brief Gets the boolean attribute from the configuration dictionary.
560  *
561  * @since_tizen 2.4
562  * @param [in] engine_cfg        Engine configuration from which @a value
563  *                               has to be gotten
564  * @param [in] name              String key of the attribute will be used for
565  *                               getting the @a value from the
566  *                               configuration dictionary
567  * @param [out] value            The attribute to be filled with boolean value
568  *                               from dictionary
569  * @return @c 0 on success, otherwise a negative error value
570  * @retval #MEDIA_VISION_ERROR_NONE Successful
571  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
572  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
573  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
574  *
575  * @see mv_engine_config_set_bool_attribute()
576  * @see mv_engine_config_get_double_attribute()
577  * @see mv_engine_config_get_int_attribute()
578  * @see mv_engine_config_get_string_attribute()
579  */
580 int mv_engine_config_get_bool_attribute(
581         mv_engine_config_h engine_cfg,
582         const char *name,
583         bool *value);
584
585 /**
586  * @brief Gets the string attribute from the configuration dictionary.
587  *
588  * @since_tizen 2.4
589  * @remarks Function allocates memory required for output @a value, so
590  *          it has to be removed by the user himself.
591  * @param [in] engine_cfg        Engine configuration from which @a value
592  *                               has to be gotten
593  * @param [in] name              String key of the attribute will be used for
594  *                               getting the @a value from the
595  *                               configuration dictionary
596  * @param [out] value            The attribute to be filled with string value
597  *                               from dictionary
598  * @return @c 0 on success, otherwise a negative error value
599  * @retval #MEDIA_VISION_ERROR_NONE Successful
600  * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
601  * @retval #MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE Attribute key isn't available
602  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
603  *
604  * @see mv_engine_config_set_string_attribute()
605  * @see mv_engine_config_get_double_attribute()
606  * @see mv_engine_config_get_int_attribute()
607  * @see mv_engine_config_get_bool_attribute()
608  */
609 int mv_engine_config_get_string_attribute(
610         mv_engine_config_h engine_cfg,
611         const char *name,
612         char **value);
613
614 /**
615  * @brief Called to get information (type and name) once for each supported
616  *        attribute.
617  *
618  * @since_tizen 2.4
619  * @param [in] attribute_type    The supported attribute type
620  * @param [in] attribute_name    The supported attribute name
621  * @param [in] user_data         The user data passed from the
622  *                               @ref mv_engine_config_foreach_supported_attribute()
623  *                               function
624  * @return @c true to continue with the next iteration of the loop, \n
625  *         otherwise @c false to break out of the loop
626  *
627  * @pre mv_engine_config_foreach_supported_attribute() will invoke this callback
628  * @see mv_engine_config_foreach_supported_attribute()
629  */
630 typedef bool (*mv_supported_attribute_cb)(
631         mv_config_attribute_type_e attribute_type,
632         const char *attribute_name,
633         void *user_data);
634
635 /**
636  * @brief Traverses the list of supported attribute names and types.
637  * @details Using this function names of supported attributes can be obtained.
638  *          Names of the attributes can be used with @ref mv_engine_config_h
639  *          related getters and setters to get/set appropriate attribute values.
640  *
641  * @since_tizen 2.4
642  * @remarks If @a callback is called zero times after
643  *          @ref mv_engine_config_foreach_supported_attribute() call, then
644  *          engine configuration is not supported and setting of attributes will
645  *          cause no effect. In this case for all Media Vision functions which
646  *          require @ref mv_engine_config_h handle as in parameter this
647  *          parameter can be set NULL.
648  * @remarks If @a callback is called at least once, then attribute names and
649  *          types obtained in the @ref mv_supported_attribute_cb callback can be
650  *          changed after mv_engine_config_h handle creation (with
651  *          @ref mv_create_engine_config() function) by corresponding setters.
652  *          Although, if attributes aren't changed by setters, then default
653  *          values will be used.\n
654  *          Changing of attribute values will affect internal functionality
655  *          provided by concrete library underlying Media Vision API.
656  * @param [in] callback     The iteration callback function
657  * @param [in] user_data    The user data to be passed to the callback function
658  * @return @c 0 on success, otherwise a negative error value
659  * @retval #MEDIA_VISION_ERROR_NONE Successful
660  * @retval #MEDIA_VISION_ERROR_NO_DATA Can't determine list of supported attributes
661  * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
662  *
663  * @see mv_engine_config_set_double_attribute()
664  * @see mv_engine_config_set_int_attribute()
665  * @see mv_engine_config_set_bool_attribute()
666  * @see mv_engine_config_set_string_attribute()
667  * @see mv_engine_config_get_double_attribute()
668  * @see mv_engine_config_get_int_attribute()
669  * @see mv_engine_config_get_bool_attribute()
670  * @see mv_engine_config_get_string_attribute()
671  */
672 int mv_engine_config_foreach_supported_attribute(
673         mv_supported_attribute_cb callback,
674         void *user_data);
675
676 /**
677  * @}
678  */
679
680 #ifdef __cplusplus
681 }
682 #endif /* __cplusplus */
683
684 #endif /* __TIZEN_MEDIAVISION_COMMON_H__ */