[wfdsink] Change the way to wayland surface setting
[platform/core/multimedia/libmm-wfd.git] / src / include / mm_wfd_sink_attrs.h
1 /*
2  * libmm-wfd
3  *
4  * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, ByungWook Jang <bw.jang@samsung.com>,
7  * Manoj Kumar K <manojkumar.k@samsung.com>, Hyunil Park <hyunil46.park@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #ifndef __MM_WFD_ATTRS_H__
24 #define __MM_WFD_ATTRS_H__
25
26 #include <string.h>
27 #include <glib.h>
28 #include <mm_message.h>
29 #include <mm_error.h>
30 #include <mm_types.h>
31 #include <mm_attrs.h>
32 #include <mm_debug.h>
33
34 /* general */
35 #ifndef ARRAY_SIZE
36 #define ARRAY_SIZE(arr)  (sizeof(arr) / sizeof((arr)[0]))
37 #endif
38 #define MMWFD_MAX_INT (2147483647)
39
40 /**
41  * Enumeration for attribute values types.
42  */
43 typedef enum {
44         MM_WFD_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
45         MM_WFD_ATTRS_TYPE_INT,                 /**< Integer type */
46         MM_WFD_ATTRS_TYPE_DOUBLE,              /**< Double type */
47         MM_WFD_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
48         MM_WFD_ATTRS_TYPE_DATA,                /**< Pointer type */
49         MM_WFD_ATTRS_TYPE_ARRAY,               /**< Array type */
50         MM_WFD_ATTRS_TYPE_RANGE,               /**< Range type */
51         MM_WFD_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
52 } MMWfdAttrsType;
53
54 /**
55  * Enumeration for attribute validation type.
56  */
57 typedef enum {
58         MM_WFD_ATTRS_VALID_TYPE_INVALID = -1,       /**< Invalid validation type */
59         MM_WFD_ATTRS_VALID_TYPE_NONE,               /**< Do not check validity */
60         MM_WFD_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
61         MM_WFD_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
62         MM_WFD_ATTRS_VALID_TYPE_DOUBLE_ARRAY,       /**< validity checking type of double array */
63         MM_WFD_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
64 } MMWfdAttrsValidType;
65
66 /**
67  * Enumeration for attribute access flag.
68  */
69 typedef enum {
70         MM_WFD_ATTRS_FLAG_NONE = 0,              /**< None flag is set */
71         MM_WFD_ATTRS_FLAG_READABLE = 1 << 0,     /**< Readable */
72         MM_WFD_ATTRS_FLAG_WRITABLE = 1 << 1,     /**< Writable */
73         MM_WFD_ATTRS_FLAG_MODIFIED = 1 << 2,     /**< Modified */
74
75         MM_WFD_ATTRS_FLAG_RW = MM_WFD_ATTRS_FLAG_READABLE | MM_WFD_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
76 } MMWfdAttrsFlag;
77
78 typedef bool (*mm_wfd_sink_commit_func_t)(MMHandleType handle, int attr_idx, const MMAttrsValue *value);
79
80 /**
81  * Attribute validity structure
82  */
83 typedef struct {
84         MMWfdAttrsType type;
85         MMWfdAttrsValidType validity_type;
86         MMWfdAttrsFlag flag;
87         /**
88           * a union that describes validity of the attribute.
89           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
90           * the attribute can have validity.
91          */
92         union {
93                 /**
94                    * Validity structure for integer array.
95                  */
96                 struct {
97                         int *array;  /**< a pointer of array */
98                         int count;   /**< size of array */
99                         int d_val;
100                 } int_array;
101                 /**
102                    * Validity structure for integer range.
103                  */
104                 struct {
105                         int min;   /**< minimum range */
106                         int max;   /**< maximum range */
107                         int d_val;
108                 } int_range;
109                 /**
110                 * Validity structure for double array.
111                 */
112                 struct {
113                         double    *array;  /**< a pointer of array */
114                         int    count;   /**< size of array */
115                         double d_val;
116                 } double_array;
117                 /**
118                 * Validity structure for double range.
119                 */
120                 struct {
121                         double   min;   /**< minimum range */
122                         double   max;   /**< maximum range */
123                         double d_val;
124                 } double_range;
125         };
126 } MMWfdAttrsInfo;
127
128 MMHandleType _mmwfd_construct_attribute(MMHandleType hwfd);
129 void  _mmwfd_deconstruct_attribute(MMHandleType hwfd);
130 int _mmwfd_set_attribute(MMHandleType hwfd,  char **err_atr_name, const char *attribute_name, va_list args_list);
131 int _mmwfd_get_attributes_info(MMHandleType handle,  const char *attribute_name, MMWfdAttrsInfo *dst_info);
132 int _mmwfd_get_attribute(MMHandleType handle,  char **err_attr_name, const char *attribute_name, va_list args_list);
133 #endif /* __MM_WFD_ATTRS_H__ */