case V4L2_PIX_FMT_H264:
*pixel_format = CAMERA_PIXEL_FORMAT_H264;
break;
+ case V4L2_PIX_FMT_MJPEG:
+ *pixel_format = CAMERA_PIXEL_FORMAT_MJPEG;
+ break;
default:
LOGE("unknown fourcc "FOURCC_FORMAT, FOURCC_CONVERT(fourcc));
return CAMERA_ERROR_INTERNAL;
*fourcc = V4L2_PIX_FMT_H264;
*plane_num = 1;
break;
+ case CAMERA_PIXEL_FORMAT_MJPEG:
+ *fourcc = V4L2_PIX_FMT_MJPEG;
+ *plane_num = 1;
+ break;
default:
LOGE("unknown format %d", pixel_format);
return CAMERA_ERROR_INTERNAL;
}
+static void __camera_get_fps_list(int device_fd, guint32 pixel_format, int width, int height, camera_fps_list_s *fps_list)
+{
+ struct v4l2_frmivalenum ival;
+
+ if (device_fd < 0 || !fps_list) {
+ LOGE("invalid param %d %p", device_fd, fps_list);
+ return;
+ }
+
+ ival.index = 0;
+ ival.pixel_format = pixel_format;
+ ival.width = width;
+ ival.height = height;
+
+ if (v4l2_ioctl(device_fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) < 0) {
+ LOGE("VIDIOC_ENUM_FRAMEINTERVALS failed[%d]", errno);
+ return;
+ }
+
+ if (ival.type != V4L2_FRMIVAL_TYPE_DISCRETE) {
+ LOGE("NOT V4L2_FRMIVAL_TYPE_DISCRETE -> [%u]", ival.type);
+ return;
+ }
+
+ do {
+ LOGI("\t\t\t\tFramerate[%u/%u]", ival.discrete.denominator, ival.discrete.numerator);
+ fps_list->fps[ival.index++] = ival.discrete.denominator;
+ } while (v4l2_ioctl(device_fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) >= 0);
+
+ fps_list->count = ival.index;
+}
+
+
static int __camera_get_device_info(int device_index, int device_fd, camera_device_info_s *device_info, char *node_path)
{
int i = 0;
LOGD("\t\tsize[%d] %ux%u", j,
v4l2_frame.discrete.width,
v4l2_frame.discrete.height);
+
+ __camera_get_fps_list(device_fd,
+ v4l2_frame.pixel_format,
+ v4l2_frame.discrete.width,
+ v4l2_frame.discrete.height,
+ &device_info->preview_fps_list[j]);
+ memcpy(&device_info->video_fps_list[j], &device_info->preview_fps_list[j], sizeof(camera_fps_list_s));
break;
case V4L2_FRMSIZE_TYPE_CONTINUOUS:
LOGW("\t\tsize[%d] %ux%u - %ux%u", j,