#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <mm.h>
-#include <mm_types.h>
#include <camera_internal.h>
#include <camera_private.h>
//LCOV_EXCL_STOP
-void camera_create_preview_frame(MMCamcorderVideoStreamDataType *stream, int num_buffer_fd,
- tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
+void camera_create_preview_frame(void *stream, int num_buffer_fd,
+ void *buffer_bo_handle, void *data_bo_handle, camera_preview_data_s *frame)
{
int total_size = 0;
unsigned char *buf_pos = NULL;
+ MMCamcorderVideoStreamDataType *_stream = (MMCamcorderVideoStreamDataType *)stream;
+ tbm_bo_handle *_buffer_bo_handle = (tbm_bo_handle *)buffer_bo_handle;
+ tbm_bo_handle *_data_bo_handle = (tbm_bo_handle *)data_bo_handle;
- if (!stream || !buffer_bo_handle || !frame) {
- CAM_LOG_ERROR("invalid param %p,%p,%p", stream, buffer_bo_handle, frame);
+ if (!_stream || !_buffer_bo_handle || !frame) {
+ CAM_LOG_ERROR("invalid param %p,%p,%p", _stream, _buffer_bo_handle, frame);
return;
}
/* set frame info */
- if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
+ if (_stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
frame->format = MM_PIXEL_FORMAT_UYVY;
else
- frame->format = stream->format;
+ frame->format = _stream->format;
- frame->width = stream->width;
- frame->height = stream->height;
- frame->timestamp = stream->timestamp;
- frame->num_of_planes = stream->num_planes;
+ frame->width = _stream->width;
+ frame->height = _stream->height;
+ frame->timestamp = _stream->timestamp;
+ frame->num_of_planes = _stream->num_planes;
if (num_buffer_fd == 0) {
//LCOV_EXCL_START
/* non-zero copy */
- if (!data_bo_handle || !data_bo_handle->ptr) {
+ if (!_data_bo_handle || !_data_bo_handle->ptr) {
CAM_LOG_ERROR("NULL pointer");
return;
}
- buf_pos = data_bo_handle->ptr;
+ buf_pos = _data_bo_handle->ptr;
- switch (stream->format) {
+ switch (_stream->format) {
case MM_PIXEL_FORMAT_ENCODED_H264:
/* fall through */
case MM_PIXEL_FORMAT_ENCODED_MJPEG:
/* fall through */
case MM_PIXEL_FORMAT_ENCODED_VP9:
frame->data.encoded_plane.data = buf_pos;
- frame->data.encoded_plane.size = stream->data.encoded.length_data;
- frame->data.encoded_plane.is_delta_frame = (bool)stream->data.encoded.is_delta_frame;
- total_size = stream->data.encoded.length_data;
+ frame->data.encoded_plane.size = _stream->data.encoded.length_data;
+ frame->data.encoded_plane.is_delta_frame = (bool)_stream->data.encoded.is_delta_frame;
+ total_size = _stream->data.encoded.length_data;
break;
case MM_PIXEL_FORMAT_INVZ:
frame->data.depth_plane.data = buf_pos;
- frame->data.depth_plane.size = stream->data.depth.length_data;
- total_size = stream->data.depth.length_data;
+ frame->data.depth_plane.size = _stream->data.depth.length_data;
+ total_size = _stream->data.depth.length_data;
break;
case MM_PIXEL_FORMAT_RGBA:
/* fall through */
case MM_PIXEL_FORMAT_ARGB:
frame->data.rgb_plane.data = buf_pos;
- frame->data.rgb_plane.size = stream->data.rgb.length_data;
- total_size = stream->data.rgb.length_data;
+ frame->data.rgb_plane.size = _stream->data.rgb.length_data;
+ total_size = _stream->data.rgb.length_data;
break;
default:
- switch (stream->num_planes) {
+ switch (_stream->num_planes) {
case 1:
frame->data.single_plane.yuv = buf_pos;
- frame->data.single_plane.size = stream->data.yuv420.length_yuv;
- total_size = stream->data.yuv420.length_yuv;
+ frame->data.single_plane.size = _stream->data.yuv420.length_yuv;
+ total_size = _stream->data.yuv420.length_yuv;
break;
case 2:
frame->data.double_plane.y = buf_pos;
- frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
- buf_pos += stream->data.yuv420sp.length_y;
+ frame->data.double_plane.y_size = _stream->data.yuv420sp.length_y;
+ buf_pos += _stream->data.yuv420sp.length_y;
frame->data.double_plane.uv = buf_pos;
- frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
- total_size = stream->data.yuv420sp.length_y + \
- stream->data.yuv420sp.length_uv;
+ frame->data.double_plane.uv_size = _stream->data.yuv420sp.length_uv;
+ total_size = _stream->data.yuv420sp.length_y + \
+ _stream->data.yuv420sp.length_uv;
break;
case 3:
frame->data.triple_plane.y = buf_pos;
- frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
- buf_pos += stream->data.yuv420p.length_y;
+ frame->data.triple_plane.y_size = _stream->data.yuv420p.length_y;
+ buf_pos += _stream->data.yuv420p.length_y;
frame->data.triple_plane.u = buf_pos;
- frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
- buf_pos += stream->data.yuv420p.length_u;
+ frame->data.triple_plane.u_size = _stream->data.yuv420p.length_u;
+ buf_pos += _stream->data.yuv420p.length_u;
frame->data.triple_plane.v = buf_pos;
- frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
- total_size = stream->data.yuv420p.length_y + \
- stream->data.yuv420p.length_u + \
- stream->data.yuv420p.length_v;
+ frame->data.triple_plane.v_size = _stream->data.yuv420p.length_v;
+ total_size = _stream->data.yuv420p.length_y + \
+ _stream->data.yuv420p.length_u + \
+ _stream->data.yuv420p.length_v;
break;
default:
break;
//LCOV_EXCL_STOP
} else {
/* zero copy */
- switch (stream->num_planes) {
+ switch (_stream->num_planes) {
//LCOV_EXCL_START
case 1:
- if (stream->data_type == MM_CAM_STREAM_DATA_ENCODED) {
- frame->data.encoded_plane.data = buffer_bo_handle[0].ptr;
- frame->data.encoded_plane.size = stream->data.encoded.length_data;
- frame->data.encoded_plane.is_delta_frame = (bool)stream->data.encoded.is_delta_frame;
- total_size = stream->data.encoded.length_data;
+ if (_stream->data_type == MM_CAM_STREAM_DATA_ENCODED) {
+ frame->data.encoded_plane.data = _buffer_bo_handle[0].ptr;
+ frame->data.encoded_plane.size = _stream->data.encoded.length_data;
+ frame->data.encoded_plane.is_delta_frame = (bool)_stream->data.encoded.is_delta_frame;
+ total_size = _stream->data.encoded.length_data;
} else {
- frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
- frame->data.single_plane.size = stream->data.yuv420.length_yuv;
- total_size = stream->data.yuv420.length_yuv;
+ frame->data.single_plane.yuv = _buffer_bo_handle[0].ptr;
+ frame->data.single_plane.size = _stream->data.yuv420.length_yuv;
+ total_size = _stream->data.yuv420.length_yuv;
}
break;
//LCOV_EXCL_STOP
case 2:
- frame->data.double_plane.y = buffer_bo_handle[0].ptr;
- if (stream->num_planes == (unsigned int)num_buffer_fd)
- frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
+ frame->data.double_plane.y = _buffer_bo_handle[0].ptr;
+ if (_stream->num_planes == (unsigned int)num_buffer_fd)
+ frame->data.double_plane.uv = _buffer_bo_handle[1].ptr;
else
- frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
- frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
- frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
- total_size = stream->data.yuv420sp.length_y + \
- stream->data.yuv420sp.length_uv;
+ frame->data.double_plane.uv = _buffer_bo_handle[0].ptr + _stream->data.yuv420sp.length_y;
+ frame->data.double_plane.y_size = _stream->data.yuv420sp.length_y;
+ frame->data.double_plane.uv_size = _stream->data.yuv420sp.length_uv;
+ total_size = _stream->data.yuv420sp.length_y + \
+ _stream->data.yuv420sp.length_uv;
break;
case 3:
//LCOV_EXCL_START
- frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
- if (stream->num_planes == (unsigned int)num_buffer_fd) {
- frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
- frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
+ frame->data.triple_plane.y = _buffer_bo_handle[0].ptr;
+ if (_stream->num_planes == (unsigned int)num_buffer_fd) {
+ frame->data.triple_plane.u = _buffer_bo_handle[1].ptr;
+ frame->data.triple_plane.v = _buffer_bo_handle[2].ptr;
} else {
- frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
- frame->data.triple_plane.v = frame->data.triple_plane.u + stream->data.yuv420p.length_u;
+ frame->data.triple_plane.u = _buffer_bo_handle[0].ptr + _stream->data.yuv420p.length_y;
+ frame->data.triple_plane.v = frame->data.triple_plane.u + _stream->data.yuv420p.length_u;
}
- frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
- frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
- frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
- total_size = stream->data.yuv420p.length_y + \
- stream->data.yuv420p.length_u + \
- stream->data.yuv420p.length_v;
+ frame->data.triple_plane.y_size = _stream->data.yuv420p.length_y;
+ frame->data.triple_plane.u_size = _stream->data.yuv420p.length_u;
+ frame->data.triple_plane.v_size = _stream->data.yuv420p.length_v;
+ total_size = _stream->data.yuv420p.length_y + \
+ _stream->data.yuv420p.length_u + \
+ _stream->data.yuv420p.length_v;
break;
//LCOV_EXCL_STOP
default: