2 * Copyright (C) 2013 The Android Open Source Project
3 * Copyright@ Samsung Electronics Co. LTD
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * \file exynos_blender_obj.h
20 * \brief Class definition for Exynos Blender library
21 * \author Eunseok Choi (es10.choi@samsung.com)
24 * <b>Revision History: </b>
25 * - 2013.09.21 : Eunseok Choi (eunseok.choi@samsung.com) \n
29 #ifndef __EXYNOS_BLENDER_OBJ_H__
30 #define __EXYNOS_BLENDER_OBJ_H__
34 #include <system/graphics.h>
35 #include <cutils/log.h>
36 #include "exynos_blender.h"
38 #define BL_LOGERR(fmt, args...) \
39 ((void)ALOG(LOG_ERROR, LOG_TAG, "%s: " fmt " [%s]", __func__, ##args, strerror(errno)))
40 #define BL_LOGE(fmt, args...) \
41 ((void)ALOG(LOG_ERROR, LOG_TAG, "%s: " fmt, __func__, ##args))
46 #define BL_LOGD(args...) ((void)ALOG(LOG_INFO, LOG_TAG, ##args))
48 #define BL_LOGD(args...)
51 #define UNIMPL { BL_LOGE("Unimplemented Operation %p\n", this); return -1; }
53 #define SRC_BUFTYPE V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
54 #define DST_BUFTYPE V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
58 enum BL_PORT
{ SRC
, DST
, NUM_PORTS
};
61 enum { BL_MAX_NODENAME
= 14 };
93 uint32_t width
, height
;
94 uint32_t crop_x
, crop_y
, crop_width
, crop_height
;
95 uint32_t color_format
;
96 void *addr
[BL_MAX_PLANES
];
99 unsigned long out_plane_size
[BL_MAX_PLANES
];
106 uint32_t color_argb8888
;
139 bool enable
; // set 'true' for user-defined
140 enum v4l2_colorspace space
;
144 unsigned long m_Flags
;
150 char m_cszNode
[BL_MAX_NODENAME
]; // /dev/videoXX
151 static const char *m_cszPortName
[NUM_PORTS
];
153 inline void SetFlag(int f
) { m_Flags
|= (1 << f
); }
154 inline void ResetFlag(void) { m_Flags
= 0; }
156 inline bool IsFlagSet(int f
)
159 return m_Flags
& ((1 << f
) - 1);
161 return m_Flags
& (1 << f
);
164 inline void ClearFlag(int f
)
166 if (f
== F_CTRL_ANY
) {
167 m_Flags
&= ~((1 << f
) - 1);
169 m_Flags
&= ~(1 << f
);
178 memset(&m_Frame
, 0, sizeof(m_Frame
));
179 memset(&m_Ctrl
, 0, sizeof(m_Ctrl
));
182 memset(m_cszNode
, 0, sizeof(m_cszNode
));
184 virtual ~CBlender() {};
186 bool Valid() { return (m_fdBlender
>= 0) && (m_fdBlender
== -m_fdValidate
); }
187 int GetDeviceID() { return m_iDeviceID
; }
189 int SetColorFill(bool enable
, uint32_t color_argb8888
);
190 int SetRotate(BL_ROTATE rot
, bool hflip
, bool vflip
);
191 int SetBlend(BL_OP_TYPE op
, bool premultiplied
);
192 int SetGlobalAlpha(bool enable
, unsigned char g_alpha
);
193 int SetDither(bool enable
);
194 int SetBluescreen(BL_BLUESCREEN mode
, uint32_t bg_color
, uint32_t bs_color
= 0);
195 int SetScale(BL_SCALE mode
, uint32_t src_w
, uint32_t dst_w
, uint32_t src_h
, uint32_t dst_h
);
196 int SetRepeat(BL_REPEAT mode
);
197 int SetClipRect(bool enable
, uint32_t x
, uint32_t y
, uint32_t width
, uint32_t height
);
198 int SetCscSpec(bool enable
, enum v4l2_colorspace space
, bool wide
);
200 int SetAddr(BL_PORT port
, void *addr
[BL_MAX_PLANES
], v4l2_memory type
);
201 int SetImageFormat(BL_PORT port
, unsigned int width
, unsigned int height
,
202 unsigned int crop_x
, unsigned int crop_y
,
203 unsigned int crop_width
, unsigned int crop_height
,
204 unsigned int v4l2_colorformat
);
206 virtual int DoStart() = 0;
207 virtual int DoStop() = 0;
208 virtual int Deactivate(bool deact
) UNIMPL
;
211 #endif // __EXYNOS_BLENER_OBJ_H__