#include <bundle.h>
#include <frame_types.h>
+#include <tbm_surface.h>
#ifdef __cplusplus
extern "C" {
int frame_native_buffer_get_bpp(frame_native_buffer_h handle,
uint32_t *bpp);
+/**
+ * @brief Gets the Tizen buffer surface handle of the native buffer.
+ * @since_tizen 5.5
+ *
+ * @param[in] handle The native buffer handle
+ * @param[out] tbm_surface The Tizen buffer surface
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #FRAME_BROKER_ERROR_NONE Successful
+ * @retval #FRAME_BROKER_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int frame_native_buffer_get_tbm_surface(frame_native_buffer_h handle,
+ tbm_surface_h *tbm_surface);
+
#ifdef __cplusplus
}
#endif
API int frame_get_native_buffer(frame_h handle, frame_native_buffer_h *buffer)
{
tbm_surface_info_s *surface_info = NULL;
+ tbm_surface_h tbm_surface = NULL;
frame_type_e type;
int ret;
return FRAME_BROKER_ERROR_INVALID_PARAMETER;
}
- *buffer = (frame_native_buffer_h)surface_info;
+ ret = screen_connector_launcher_service_image_get_tbm_surface(
+ handle->image, &tbm_surface);
+ if (ret != 0) {
+ _E("Failed to get tbm surface. error(%d)", ret);
+ return FRAME_BROKER_ERROR_INVALID_PARAMETER;
+ }
+
+ *buffer = (frame_native_buffer_h)handle->image;
return ret;
}
API int frame_native_buffer_get_raw(frame_native_buffer_h handle,
void **raw)
{
- tbm_surface_info_s *info;
+ screen_connector_launcher_service_image_h image = handle;
+ tbm_surface_info_s *info = NULL;
if (!handle || !raw) {
_E("Invalid parameter");
return FRAME_BROKER_ERROR_INVALID_PARAMETER;
}
- info = (tbm_surface_info_s *)handle;
+ screen_connector_launcher_service_image_get_tbm_surface_info(image,
+ &info);
*raw = info->planes[0].ptr;
return FRAME_BROKER_ERROR_NONE;
API int frame_native_buffer_get_width(frame_native_buffer_h handle,
uint32_t *width)
{
- tbm_surface_info_s *info;
+ screen_connector_launcher_service_image_h image = handle;
+ tbm_surface_info_s *info = NULL;
if (!handle || !width) {
_E("Invalid parameter");
return FRAME_BROKER_ERROR_INVALID_PARAMETER;
}
- info = (tbm_surface_info_s *)handle;
+ screen_connector_launcher_service_image_get_tbm_surface_info(image,
+ &info);
*width = info->width;
return FRAME_BROKER_ERROR_NONE;
API int frame_native_buffer_get_height(frame_native_buffer_h handle,
uint32_t *height)
{
- tbm_surface_info_s *info;
+ screen_connector_launcher_service_image_h image = handle;
+ tbm_surface_info_s *info = NULL;
if (!handle || !height) {
_E("Invalid parameter");
return FRAME_BROKER_ERROR_INVALID_PARAMETER;
}
- info = (tbm_surface_info_s *)handle;
+ screen_connector_launcher_service_image_get_tbm_surface_info(image,
+ &info);
*height = info->height;
return FRAME_BROKER_ERROR_NONE;
API int frame_native_buffer_get_bpp(frame_native_buffer_h handle,
uint32_t *bpp)
{
- tbm_surface_info_s *info;
+ screen_connector_launcher_service_image_h image = handle;
+ tbm_surface_info_s *info = NULL;
if (!handle || !bpp) {
_E("Invalid parameter");
return FRAME_BROKER_ERROR_INVALID_PARAMETER;
}
- info = (tbm_surface_info_s *)handle;
+ screen_connector_launcher_service_image_get_tbm_surface_info(image,
+ &info);
*bpp = info->bpp;
return FRAME_BROKER_ERROR_NONE;
}
+
+API int frame_native_buffer_get_tbm_surface(frame_native_buffer_h handle,
+ tbm_surface_h *tbm_surface)
+{
+ screen_connector_launcher_service_image_h image = handle;
+ tbm_surface_h surface = NULL;
+
+ if (!handle || !tbm_surface) {
+ _E("Invalid parameter");
+ return FRAME_BROKER_ERROR_INVALID_PARAMETER;
+ }
+
+ screen_connector_launcher_service_image_get_tbm_surface(image,
+ &surface);
+ *tbm_surface = surface;
+
+ return FRAME_BROKER_ERROR_NONE;
+}