From 4897afa9cbea920f5586614cb56814db42f5c8d8 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 16 Jul 2018 20:10:32 +0900 Subject: [PATCH] Support new format - INVZ for depth data [Version] 0.10.161 [Profile] Common [Issue Type] Update [Dependency module] libmm-common Change-Id: I806ff17d04dbefdafae28e42fd85518024cacac9 Signed-off-by: Jeongmo Yang --- packaging/libmm-camcorder.spec | 2 +- src/include/mm_camcorder.h | 5 +++-- src/mm_camcorder_gstcommon.c | 39 ++++++++++++++++++++++++++------------- src/mm_camcorder_internal.c | 2 +- src/mm_camcorder_util.c | 6 ++++++ 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index a81c8e8..7c03fa8 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,6 +1,6 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.160 +Version: 0.10.161 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_camcorder.h b/src/include/mm_camcorder.h index 3e32465..ad53612 100644 --- a/src/include/mm_camcorder.h +++ b/src/include/mm_camcorder.h @@ -1681,7 +1681,8 @@ typedef enum { MM_CAM_STREAM_DATA_YUV420SP, /**< YUV420 SemiPlannar type - 2 planes */ MM_CAM_STREAM_DATA_YUV420P, /**< YUV420 Plannar type - 3 planes */ MM_CAM_STREAM_DATA_YUV422P, /**< YUV422 Plannar type - 3 planes */ - MM_CAM_STREAM_DATA_ENCODED /**< Encoded data type - 1 plane */ + MM_CAM_STREAM_DATA_ENCODED, /**< Encoded data type - 1 plane */ + MM_CAM_STREAM_DATA_DEPTH /**< Depth data type - 1 plane */ } MMCamStreamData; @@ -1783,7 +1784,7 @@ typedef struct { struct { unsigned char *data; unsigned int length_data; - } encoded; + } encoded, depth; } data; /**< pointer of captured stream */ MMCamStreamData data_type; /**< data type */ unsigned int length_total; /**< total length of stream buffer (in byte)*/ diff --git a/src/mm_camcorder_gstcommon.c b/src/mm_camcorder_gstcommon.c index 691e9aa..f1e9ce6 100644 --- a/src/mm_camcorder_gstcommon.c +++ b/src/mm_camcorder_gstcommon.c @@ -1810,30 +1810,43 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_preview(GstPad *pad, GstP gst_memory_unmap(metaBlock, &mapinfo); metaBlock = NULL; } + gst_memory_map(dataBlock, &mapinfo, GST_MAP_READWRITE); - if (stream.format == MM_PIXEL_FORMAT_YUYV || - stream.format == MM_PIXEL_FORMAT_UYVY || - stream.format == MM_PIXEL_FORMAT_422P || - stream.format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { + + switch (stream.format) { + case MM_PIXEL_FORMAT_YUYV: + case MM_PIXEL_FORMAT_UYVY: + case MM_PIXEL_FORMAT_422P: + case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY: stream.data_type = MM_CAM_STREAM_DATA_YUV422; stream.data.yuv422.yuv = mapinfo.data; stream.data.yuv422.length_yuv = stream.length_total; stream.stride[0] = stream.width << 1; stream.elevation[0] = stream.height; - } else if (stream.format == MM_PIXEL_FORMAT_ENCODED_H264) { - stream.data_type = MM_CAM_STREAM_DATA_ENCODED; - stream.data.encoded.data = mapinfo.data; - stream.data.encoded.length_data = stream.length_total; - /* - _mmcam_dbg_log("H264[num_planes:%d] [0]p:%p,size:%d", - stream.num_planes, stream.data.encoded.data, stream.data.encoded.length_data); - */ - } else { + break; + case MM_PIXEL_FORMAT_ENCODED_H264: + stream.data_type = MM_CAM_STREAM_DATA_ENCODED; + stream.data.encoded.data = mapinfo.data; + stream.data.encoded.length_data = stream.length_total; + /* + _mmcam_dbg_log("H264[num_planes:%d] [0]p:%p,size:%d", + stream.num_planes, stream.data.encoded.data, stream.data.encoded.length_data); + */ + break; + case MM_PIXEL_FORMAT_INVZ: + stream.data_type = MM_CAM_STREAM_DATA_DEPTH; + stream.data.depth.data = mapinfo.data; + stream.data.depth.length_data = stream.length_total; + stream.stride[0] = stream.width << 1; + stream.elevation[0] = stream.height; + break; + default: stream.data_type = MM_CAM_STREAM_DATA_YUV420; stream.data.yuv420.yuv = mapinfo.data; stream.data.yuv420.length_yuv = stream.length_total; stream.stride[0] = (stream.width * 3) >> 1; stream.elevation[0] = stream.height; + break; } stream.num_planes = 1; diff --git a/src/mm_camcorder_internal.c b/src/mm_camcorder_internal.c index 27aded1..cb094f5 100644 --- a/src/mm_camcorder_internal.c +++ b/src/mm_camcorder_internal.c @@ -947,7 +947,7 @@ int _mmcamcorder_realize(MMHandleType handle) if (hcamcorder->camera_resource == NULL) { ret = mm_resource_manager_mark_for_acquire(hcamcorder->resource_manager, MM_RESOURCE_MANAGER_RES_TYPE_CAMERA, - MM_RESOURCE_MANAGER_RES_VOLUME_FULL, + 1, &hcamcorder->camera_resource); if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) { _mmcam_dbg_err("could not prepare for camera resource"); diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index 8cb41da..49c6ebf 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -1566,6 +1566,9 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co case MM_PIXEL_FORMAT_ENCODED_H264: fourcc = GST_MAKE_FOURCC('H', '2', '6', '4'); break; + case MM_PIXEL_FORMAT_INVZ: + fourcc = GST_MAKE_FOURCC('I', 'N', 'V', 'Z'); + break; default: _mmcam_dbg_log("Not proper pixel type[%d]. Set default - I420", pixtype); if (use_zero_copy_format) @@ -1644,6 +1647,9 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc) case GST_MAKE_FOURCC('H', '2', '6', '4'): pixtype = MM_PIXEL_FORMAT_ENCODED_H264; break; + case GST_MAKE_FOURCC('I', 'N', 'V', 'Z'): + pixtype = MM_PIXEL_FORMAT_INVZ; + break; default: _mmcam_dbg_log("Not supported fourcc type(%c%c%c%c)", fourcc, fourcc>>8, fourcc>>16, fourcc>>24); pixtype = MM_PIXEL_FORMAT_INVALID; -- 2.7.4