summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2024-09-02 10:36:57 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2024-09-02 11:30:47 +0900
commit130e9f03e105671991116a30d376bba3e81f83dc (patch)
tree2d9afbed7f9e7de3fd38c9ef5cc8f841b9197fb2
parente213c94a9eaca52ec7431348456968208823f266 (diff)
downloadcamera-v4l2-130e9f03e105671991116a30d376bba3e81f83dc.tar.gz
camera-v4l2-130e9f03e105671991116a30d376bba3e81f83dc.tar.bz2
camera-v4l2-130e9f03e105671991116a30d376bba3e81f83dc.zip
- It's for Tizen Compliance test. The "I420" format was removed in supported format list after libv4l2 dependency is removed and it caused camera CTC failure. - The MJPEG format can be used JPEG format which is included in compliance specification. As a result, camera CTC is passed with this patch. [Version] 1.3.1 [Issue Type] Compatibility Change-Id: I599c69c8902cd7a3888734f5d6ab09a0b8a419d7 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--packaging/hal-backend-camera-v4l2.spec2
-rw-r--r--src/hal_backend_camera_v4l2.c74
2 files changed, 71 insertions, 5 deletions
diff --git a/packaging/hal-backend-camera-v4l2.spec b/packaging/hal-backend-camera-v4l2.spec
index 834440e..d7ef1d3 100644
--- a/packaging/hal-backend-camera-v4l2.spec
+++ b/packaging/hal-backend-camera-v4l2.spec
@@ -2,7 +2,7 @@
Name: hal-backend-camera-v4l2
Summary: Tizen Camera Hal using generic V4L2 interface
-Version: 1.3.0
+Version: 1.3.1
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
diff --git a/src/hal_backend_camera_v4l2.c b/src/hal_backend_camera_v4l2.c
index e1b4b14..fa407e8 100644
--- a/src/hal_backend_camera_v4l2.c
+++ b/src/hal_backend_camera_v4l2.c
@@ -682,11 +682,51 @@ static void __camera_get_fps_list(int device_fd, guint32 pixel_format, int width
}
+static int __camera_copy_capability_format(camera_device_capability_format_s *format_to_copy, camera_device_capability_format_s **format_out)
+{
+ int i = 0;
+ int alloc_size = 0;
+ camera_device_capability_format_s *format_new = NULL;
+ camera_device_capability_resolution_s *resolution_to_copy = NULL;
+
+ if (!format_to_copy || !format_out) {
+ LOGE("NULL param %p, %p", format_to_copy, format_out);
+ return 0;
+ }
+
+ LOGI("copy format[%d]", format_to_copy->pixel_format);
+
+ format_new = g_new0(camera_device_capability_format_s, 1);
+ alloc_size += sizeof(camera_device_capability_format_s);
+
+ for (i = 0 ; i < format_to_copy->resolution_count ; i++) {
+ resolution_to_copy = format_to_copy->resolution[i];
+
+ LOGI("\tcopy resolution[%dx%d] and FPS list", resolution_to_copy->width, resolution_to_copy->height);
+
+ format_new->resolution[i] = g_new0(camera_device_capability_resolution_s, 1);
+ alloc_size += sizeof(camera_device_capability_resolution_s);
+
+ memcpy(format_new->resolution[i], resolution_to_copy, sizeof(camera_device_capability_resolution_s));
+ }
+
+ format_new->pixel_format = format_to_copy->pixel_format;
+ format_new->resolution_count = format_to_copy->resolution_count;
+ format_new->default_resolution_index = format_to_copy->default_resolution_index;
+
+ *format_out = format_new;
+
+ return alloc_size;
+}
+
+
static int __camera_get_device_info(int device_index, int device_fd, char *node_path,
camera_device_info_s *device_info, camera_device_capability_s **device_capability)
{
int format_index = 0;
int format_count = 0;
+ int format_index_jpeg = -1;
+ int format_index_mjpeg = -1;
int resolution_index = 0;
int resolution_count = 0;
int camera_format = 0;
@@ -695,8 +735,8 @@ static int __camera_get_device_info(int device_index, int device_fd, char *node_
camera_device_capability_s *_capability = NULL;
int alloc_size = 0;
- if (device_fd < 0 || !device_info || !node_path) {
- LOGE("invalid param %d %p %p", device_fd, device_info, node_path);
+ if (device_fd < 0 || !device_info || !node_path || !device_capability) {
+ LOGE("invalid param %d %p %p %p", device_fd, device_info, node_path, device_capability);
return CAMERA_ERROR_INVALID_PARAMETER;
}
@@ -835,6 +875,14 @@ static int __camera_get_device_info(int device_index, int device_fd, char *node_
LOGD("\t\tresolution count [%d]", resolution_count);
+ if (camera_format == CAMERA_PIXEL_FORMAT_JPEG) {
+ format_index_jpeg = format_count;
+ LOGD("\t\tfound format JPEG[%d]", format_index_jpeg);
+ } else if (camera_format == CAMERA_PIXEL_FORMAT_MJPEG) {
+ format_index_mjpeg = format_count;
+ LOGD("\t\tfound format MJPEG[%d]", format_index_mjpeg);
+ }
+
format_count++;
} else {
LOGW("\t\tno resolution for format[%d]", camera_format);
@@ -855,10 +903,28 @@ static int __camera_get_device_info(int device_index, int device_fd, char *node_
_capability->device_index = device_index;
_capability->format_count = format_count;
- if (device_capability)
- *device_capability = _capability;
+ *device_capability = _capability;
LOGD("\tformat count [%d]", format_count);
+
+ if (format_index_jpeg == -1 && format_index_mjpeg != -1) {
+ int added_size = 0;
+ camera_device_capability_format_s *format_out = NULL;
+
+ LOGW("\tadd JPEG by copying MJPEG for camera CTC");
+
+ added_size = __camera_copy_capability_format(_capability->format[format_index_mjpeg], &format_out);
+ if (format_out) {
+ format_out->pixel_format = CAMERA_PIXEL_FORMAT_JPEG;
+
+ _capability->format[format_count] = format_out;
+ _capability->format_count++;
+
+ alloc_size += added_size;
+ } else {
+ LOGE("\tcopy MJPEG failed");
+ }
+ }
} else {
LOGW("\tno format for device[%d]", device_index);
g_free(_capability);