summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2020-08-06 16:56:12 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2020-08-06 16:57:48 +0900
commit672ccddce9fba7226aedb5220a16005d53ac5016 (patch)
treee72de68316f8a4e18f3089e00a85584a2695ee15
parent0104feb03bd551cfee7208b4a490954dd4a4defe (diff)
downloadcamera-672ccddce9fba7226aedb5220a16005d53ac5016.tar.gz
camera-672ccddce9fba7226aedb5220a16005d53ac5016.tar.bz2
camera-672ccddce9fba7226aedb5220a16005d53ac5016.zip
Add new internal APIs for camera framesubmit/tizen/20200819.022508submit/tizen/20200818.102105
- In fact, they are exported for new recorder API. [Version] 0.4.37 [Issue Type] New feature Change-Id: Ia32edf33fd5cf95a3d011781609d6d4e000e3920 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--include/camera_internal.h59
-rw-r--r--include/camera_private.h46
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c10
4 files changed, 63 insertions, 54 deletions
diff --git a/include/camera_internal.h b/include/camera_internal.h
index 18740ef..a9ac503 100644
--- a/include/camera_internal.h
+++ b/include/camera_internal.h
@@ -18,6 +18,8 @@
#define __TIZEN_MULTIMEDIA_CAMERA_INTERNAL_H__
#include <camera.h>
+#include <mm_types.h>
+#include <tbm_surface_internal.h>
#ifdef __cplusplus
extern "C" {
@@ -34,6 +36,51 @@ extern "C" {
* @{
*/
+#ifdef BUFFER_MAX_PLANE_NUM
+#undef BUFFER_MAX_PLANE_NUM
+#endif /* BUFFER_MAX_PLANE_NUM */
+
+#define BUFFER_MAX_PLANE_NUM 4
+
+typedef struct _camera_stream_data_s {
+ union {
+ struct {
+ unsigned char *yuv;
+ unsigned int length_yuv;
+ } yuv420, yuv422;
+ struct {
+ unsigned char *y;
+ unsigned int length_y;
+ unsigned char *uv;
+ unsigned int length_uv;
+ } yuv420sp;
+ struct {
+ unsigned char *y;
+ unsigned int length_y;
+ unsigned char *u;
+ unsigned int length_u;
+ unsigned char *v;
+ unsigned int length_v;
+ } yuv420p, yuv422p;
+ struct {
+ unsigned char *data;
+ unsigned int length_data;
+ int is_delta_frame;
+ } encoded, depth, rgb;
+ } data; /**< pointer of captured stream */
+ int data_type; /**< data type */
+ unsigned int length_total; /**< total length of stream buffer (in byte)*/
+ unsigned int num_planes; /**< number of planes */
+ MMPixelFormatType format; /**< image format */
+ int width; /**< width of video buffer */
+ int height; /**< height of video buffer */
+ unsigned int timestamp; /**< timestamp of stream buffer (msec)*/
+ void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
+ void *internal_buffer; /**< Internal buffer pointer */
+ int stride[BUFFER_MAX_PLANE_NUM]; /**< Stride of each plane */
+ int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
+} camera_stream_data_s;
+
/**
* @brief Start the evas rendering.
*
@@ -88,6 +135,18 @@ int camera_stop_evas_rendering(camera_h camera, bool keep_screen);
int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window);
/**
+ * @brief Creates preview frame from stream data.
+ * @since_tizen 6.0
+ * @param[in] stream The stream from internal pipeline
+ * @param[in] num_buffer_fd The number of buffer fd
+ * @param[in] buffer_bo_handle The bo handle of buffer
+ * @param[in] data_bo_handle The bo handle of data
+ * @param[out] frame The frame which will be filled
+ */
+void camera_create_preview_frame(camera_stream_data_s *stream, int num_buffer_fd,
+ tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame);
+
+/**
* @}
*/
#ifdef __cplusplus
diff --git a/include/camera_private.h b/include/camera_private.h
index b863bbc..3dfa516 100644
--- a/include/camera_private.h
+++ b/include/camera_private.h
@@ -21,7 +21,7 @@
#ifndef __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
#define __TIZEN_MULTIMEDIA_CAMERA_PRIVATE_H__
#include <glib.h>
-#include <camera.h>
+#include <camera_internal.h>
#include <muse_core.h>
#include <muse_camera.h>
#include <mm_display_interface.h>
@@ -30,11 +30,6 @@
extern "C" {
#endif
-#ifdef BUFFER_MAX_PLANE_NUM
-#undef BUFFER_MAX_PLANE_NUM
-#endif /* BUFFER_MAX_PLANE_NUM */
-
-#define BUFFER_MAX_PLANE_NUM 4
#define CAMERA_CB_TIMEOUT 4
#define CAMERA_CB_NO_TIMEOUT 0
@@ -64,45 +59,6 @@ enum {
CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB
};
-typedef struct _camera_stream_data_s {
- union {
- struct {
- unsigned char *yuv;
- unsigned int length_yuv;
- } yuv420, yuv422;
- struct {
- unsigned char *y;
- unsigned int length_y;
- unsigned char *uv;
- unsigned int length_uv;
- } yuv420sp;
- struct {
- unsigned char *y;
- unsigned int length_y;
- unsigned char *u;
- unsigned int length_u;
- unsigned char *v;
- unsigned int length_v;
- } yuv420p, yuv422p;
- struct {
- unsigned char *data;
- unsigned int length_data;
- int is_delta_frame;
- } encoded, depth, rgb;
- } data; /**< pointer of captured stream */
- int data_type; /**< data type */
- unsigned int length_total; /**< total length of stream buffer (in byte)*/
- unsigned int num_planes; /**< number of planes */
- MMPixelFormatType format; /**< image format */
- int width; /**< width of video buffer */
- int height; /**< height of video buffer */
- unsigned int timestamp; /**< timestamp of stream buffer (msec)*/
- void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
- void *internal_buffer; /**< Internal buffer pointer */
- int stride[BUFFER_MAX_PLANE_NUM]; /**< Stride of each plane */
- int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
-} camera_stream_data_s;
-
typedef struct _camera_msg_handler_info_s {
int type;
void *cb_info;
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index 4bdea7f..63d29cf 100644
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -1,6 +1,6 @@
Name: capi-media-camera
Summary: A Camera API
-Version: 0.4.36
+Version: 0.4.37
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index dd311da..9baa0c0 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -20,14 +20,10 @@
#include <string.h>
#include <mm.h>
#include <mm_types.h>
-#include <camera.h>
-#include <muse_camera.h>
#include <muse_camera_msg.h>
#include <camera_private.h>
-#include <muse_core.h>
#include <muse_client.h>
#include <dlog.h>
-#include <tbm_surface_internal.h>
#include <gio/gio.h>
#ifdef LOG_TAG
@@ -53,8 +49,6 @@ static void _camera_msg_send_param2_int(int api, camera_cb_info_s *cb_info,
static void _camera_msg_return_buffer(int ret_fd, camera_cb_info_s *cb_info);
static bool _camera_import_tbm_fd(tbm_bufmgr bufmgr, int fd, tbm_bo *bo, tbm_bo_handle *bo_handle);
static void _camera_release_imported_bo(tbm_bo *bo);
-static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_fd,
- tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame);
static int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
camera_media_packet_data *mp_data, media_packet_h *packet);
static int _camera_media_packet_data_create(int ret_fd, int *tfd, int num_buffer_fd, tbm_bo bo,
@@ -333,7 +327,7 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
/* call preview callback */
if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
- _camera_preview_frame_create(stream, num_buffer_fd, buffer_bo_handle, &data_bo_handle, &frame);
+ camera_create_preview_frame(stream, num_buffer_fd, buffer_bo_handle, &data_bo_handle, &frame);
((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
@@ -999,7 +993,7 @@ int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mi
return CAMERA_ERROR_NONE;
}
-static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_fd,
+void camera_create_preview_frame(camera_stream_data_s *stream, int num_buffer_fd,
tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
{
int total_size = 0;