Update package structure 24/177224/2 accepted/tizen/unified/20180427.131014 submit/tizen/20180427.022926
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 26 Apr 2018 07:52:52 +0000 (16:52 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 26 Apr 2018 09:09:24 +0000 (18:09 +0900)
- Add devel package for header files and camera-hal-interface pc file
- Move header files to new devel package
- Add libcamera_hal_interface to mm-hal-interface package

[Version] 0.0.7
[Profile] Common
[Issue Type] Update
[Dependency module] pulseaudio-modules-tizen, gst-plugins-tizen

Change-Id: I19bfa1bc8d553677e8c79b7589ddc8fc33167d46
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
13 files changed:
Makefile.am
camera-hal-interface.pc.in [new file with mode: 0644]
configure.ac
include/camera/camera_hal_interface.h [new file with mode: 0644]
mm-hal-interface.manifest [new file with mode: 0644]
packaging/mm-hal-interface.spec
src/Makefile.am [new file with mode: 0644]
src/camera/Makefile.am [new file with mode: 0644]
src/camera/camera_hal_interface.c [new file with mode: 0644]
testcase/camera/Makefile.am
testcase/camera/camera_hal_interface.c [deleted file]
testcase/camera/camera_hal_interface.h [deleted file]
testcase/camera/camera_hal_tc.cpp

index efb1910fcc22a427e053a3756638876b0ffb3180..f149a4dc3b1b98d5a212a092b29503862bcbab08 100644 (file)
@@ -1,2 +1,7 @@
-SUBDIRS = testcase
+SUBDIRS = src testcase
+
+pcfiles = camera-hal-interface.pc
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(pcfiles)
+EXTRA_DIST = $(pcfiles)
 
diff --git a/camera-hal-interface.pc.in b/camera-hal-interface.pc.in
new file mode 100644 (file)
index 0000000..62243c6
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: camera-hal-interface
+Description: Multimedia Framework Camera HAL Interface library
+Requires: glib-2.0 dlog
+Version: $VERSION
+Libs: -L${libdir} -lcamera_hal_interface
+Cflags: -I${includedir}/
index 3898f002206874e85020a55b4caaf4d8c814b4d4..711a40f19ede90a22b0960d61736f373f1e4e956 100644 (file)
@@ -29,8 +29,11 @@ AC_SUBST(DLOG_LIBS)
 # Checks for library functions.
 AC_CONFIG_FILES([
 Makefile
+src/Makefile
+src/camera/Makefile
 testcase/Makefile
 testcase/camera/Makefile
+camera-hal-interface.pc
 ])
 AC_OUTPUT
 
diff --git a/include/camera/camera_hal_interface.h b/include/camera/camera_hal_interface.h
new file mode 100644 (file)
index 0000000..6ee6c61
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * camera_hal_interface.h
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jeongmo Yang <jm80.yang@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include <tizen-camera.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _camera_hal_interface camera_hal_interface;
+
+int camera_hal_interface_init(camera_hal_interface **h);
+int camera_hal_interface_deinit(camera_hal_interface *h);
+int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list);
+int camera_hal_interface_open_device(camera_hal_interface *h, int device_index);
+int camera_hal_interface_close_device(camera_hal_interface *h);
+int camera_hal_interface_add_message_callback(camera_hal_interface *h, camera_message_cb callback, void *user_data, uint32_t *cb_id);
+int camera_hal_interface_remove_message_callback(camera_hal_interface *h, uint32_t cb_id);
+int camera_hal_interface_set_preview_stream_format(camera_hal_interface *h, camera_format_t *format);
+int camera_hal_interface_get_preview_stream_format(camera_hal_interface *h, camera_format_t *format);
+int camera_hal_interface_start_preview(camera_hal_interface *h, camera_preview_frame_cb callback, void *user_data);
+int camera_hal_interface_release_preview_buffer(camera_hal_interface *h, int buffer_index);
+int camera_hal_interface_stop_preview(camera_hal_interface *h);
+int camera_hal_interface_start_auto_focus(camera_hal_interface *h);
+int camera_hal_interface_stop_auto_focus(camera_hal_interface *h);
+int camera_hal_interface_start_capture(camera_hal_interface *h, camera_capture_cb callback, void *user_data);
+int camera_hal_interface_stop_capture(camera_hal_interface *h);
+int camera_hal_interface_set_video_stream_format(camera_hal_interface *h, camera_format_t *format);
+int camera_hal_interface_get_video_stream_format(camera_hal_interface *h, camera_format_t *format);
+int camera_hal_interface_start_record(camera_hal_interface *h, camera_video_frame_cb callback, void *user_data);
+int camera_hal_interface_release_video_buffer(camera_hal_interface *h, int buffer_index);
+int camera_hal_interface_stop_record(camera_hal_interface *h);
+int camera_hal_interface_set_command(camera_hal_interface *h, int64_t command, void *value);
+int camera_hal_interface_get_command(camera_hal_interface *h, int64_t command, void *value);
+int camera_hal_interface_set_batch_command(camera_hal_interface *h, camera_batch_command_control_t *batch_command, int64_t *error_command);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/mm-hal-interface.manifest b/mm-hal-interface.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
index 3037c4b4bff4b94b1bffd94608d1ae99a854dda6..f6482f3b1708c78f5781ae5be2c135a8a281517d 100644 (file)
@@ -1,24 +1,34 @@
 Name:       mm-hal-interface
 Summary:    Multimedia HAL Interface
-Version:    0.0.6
+Version:    0.0.7
 Release:    0
 Group:      Multimedia/Development
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  gtest-devel
 
 %description
 Multimedia framework hardware abstraction layer interface package.
 
 
+%package devel
+Summary:    Multimedia framework hardware abstraction layer interface development package
+Group:      libdevel
+Version:    %{version}
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Multimedia framework hardware abstraction layer interface development package.
+
+
 %package -n camera-hal-gtests
 Summary:    gtest for camera HAL APIs
 Group:      Development/Tools
 Version:    %{version}
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
-BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(dlog)
-BuildRequires:  gtest-devel
 
 %description -n camera-hal-gtests
 gtest for camera HAL APIs.
@@ -40,13 +50,23 @@ install -m 644 include/camera/*.h %{buildroot}%{_includedir}
 install -m 644 include/radio/*.h %{buildroot}%{_includedir}
 %make_install
 
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
 %post -n camera-hal-gtests -p /sbin/ldconfig
 %postun -n camera-hal-gtests -p /sbin/ldconfig
 
 %files
+%manifest mm-hal-interface.manifest
+%license LICENSE.APLv2
+%defattr(-,root,root,-)
+%{_libdir}/*.so.*
+
+%files devel
 %defattr(-,root,root,-)
 %{_includedir}/*.h
-%license LICENSE.APLv2
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/*.so
 
 %files -n camera-hal-gtests
 %manifest mm-hal-gtests.manifest
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..ac1b359
--- /dev/null
@@ -0,0 +1,2 @@
+SUBDIRS = camera
+
diff --git a/src/camera/Makefile.am b/src/camera/Makefile.am
new file mode 100644 (file)
index 0000000..4545434
--- /dev/null
@@ -0,0 +1,6 @@
+lib_LTLIBRARIES = libcamera_hal_interface.la
+
+libcamera_hal_interface_la_SOURCES = camera_hal_interface.c
+libcamera_hal_interface_la_CFLAGS = $(GLIB_CFLAGS) $(DLOG_CFLAGS) -I$(srcdir)/../../include/camera
+libcamera_hal_interface_la_LIBADD = $(GLIB_LIBS) $(DLOG_LIBS) -ldl
+
diff --git a/src/camera/camera_hal_interface.c b/src/camera/camera_hal_interface.c
new file mode 100644 (file)
index 0000000..4b484eb
--- /dev/null
@@ -0,0 +1,593 @@
+/*
+ * camera_hal_interface.c
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jeongmo Yang <jm80.yang@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <errno.h>
+#include <dlfcn.h>
+#include <glib.h>
+#include <dlog.h>
+#include "camera_hal_interface.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif /* LOG_TAG */
+#define LOG_TAG "CAMERA_HAL_INTF"
+
+#define LIB_TIZEN_CAMERA "libtizen-camera.so"
+
+struct _camera_hal_interface {
+       void *dl_handle;
+       void *hal_handle;
+       camera_interface_t intf;
+};
+
+
+int camera_hal_interface_init(camera_hal_interface **h)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_hal_interface *tmp_h = NULL;
+
+       if (h == NULL) {
+               LOGE("invalid parameter for camera_hal_interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       tmp_h = g_new0(camera_hal_interface, 1);
+       if (tmp_h == NULL) {
+               LOGE("failed to allocate hal interface");
+               return CAMERA_ERROR_OUT_OF_MEMORY;
+       }
+
+       tmp_h->dl_handle = dlopen(LIB_TIZEN_CAMERA, RTLD_NOW);
+       if (tmp_h->dl_handle) {
+               tmp_h->intf.init = dlsym(tmp_h->dl_handle, "camera_init");
+               tmp_h->intf.deinit = dlsym(tmp_h->dl_handle, "camera_deinit");
+               tmp_h->intf.get_device_info_list = dlsym(tmp_h->dl_handle, "camera_get_device_info_list");
+               tmp_h->intf.open_device = dlsym(tmp_h->dl_handle, "camera_open_device");
+               tmp_h->intf.close_device = dlsym(tmp_h->dl_handle, "camera_close_device");
+               tmp_h->intf.add_message_callback = dlsym(tmp_h->dl_handle, "camera_add_message_callback");
+               tmp_h->intf.remove_message_callback = dlsym(tmp_h->dl_handle, "camera_remove_message_callback");
+               tmp_h->intf.set_preview_stream_format = dlsym(tmp_h->dl_handle, "camera_set_preview_stream_format");
+               tmp_h->intf.get_preview_stream_format = dlsym(tmp_h->dl_handle, "camera_get_preview_stream_format");
+               tmp_h->intf.start_preview = dlsym(tmp_h->dl_handle, "camera_start_preview");
+               tmp_h->intf.release_preview_buffer = dlsym(tmp_h->dl_handle, "camera_release_preview_buffer");
+               tmp_h->intf.stop_preview = dlsym(tmp_h->dl_handle, "camera_stop_preview");
+               tmp_h->intf.start_auto_focus = dlsym(tmp_h->dl_handle, "camera_start_auto_focus");
+               tmp_h->intf.stop_auto_focus = dlsym(tmp_h->dl_handle, "camera_stop_auto_focus");
+               tmp_h->intf.start_capture = dlsym(tmp_h->dl_handle, "camera_start_capture");
+               tmp_h->intf.stop_capture = dlsym(tmp_h->dl_handle, "camera_stop_capture");
+               tmp_h->intf.set_video_stream_format = dlsym(tmp_h->dl_handle, "camera_set_video_stream_format");
+               tmp_h->intf.get_video_stream_format = dlsym(tmp_h->dl_handle, "camera_get_video_stream_format");
+               tmp_h->intf.start_record = dlsym(tmp_h->dl_handle, "camera_start_record");
+               tmp_h->intf.release_video_buffer = dlsym(tmp_h->dl_handle, "camera_release_video_buffer");
+               tmp_h->intf.stop_record = dlsym(tmp_h->dl_handle, "camera_stop_record");
+               tmp_h->intf.set_command = dlsym(tmp_h->dl_handle, "camera_set_command");
+               tmp_h->intf.get_command = dlsym(tmp_h->dl_handle, "camera_get_command");
+               tmp_h->intf.set_batch_command = dlsym(tmp_h->dl_handle, "camera_set_batch_command");
+
+               if (tmp_h->intf.init == NULL || tmp_h->intf.deinit == NULL) {
+                       LOGE("could not get mandatory function. %p %p", tmp_h->intf.init, tmp_h->intf.deinit);
+                       ret = CAMERA_ERROR_INTERNAL;
+                       goto _CAMERA_HAL_INTERFACE_GET_FAILED;
+               }
+
+               if (tmp_h->intf.init) {
+                       ret = tmp_h->intf.init(&tmp_h->hal_handle);
+                       if (ret != CAMERA_ERROR_NONE) {
+                               LOGE("camera_init failed 0x%x", ret);
+                               goto _CAMERA_HAL_INTERFACE_GET_FAILED;
+                       }
+               } else {
+                       LOGE("no camera_init function");
+                       ret = CAMERA_ERROR_INTERNAL;
+                       goto _CAMERA_HAL_INTERFACE_GET_FAILED;
+               }
+       } else {
+               LOGE("dlopen failed [%s][errno %d]", LIB_TIZEN_CAMERA, errno);
+               ret = CAMERA_ERROR_DEVICE_NOT_SUPPORTED;
+               goto _CAMERA_HAL_INTERFACE_GET_FAILED;
+       }
+
+       *h = tmp_h;
+
+       return ret;
+
+_CAMERA_HAL_INTERFACE_GET_FAILED:
+       if (tmp_h) {
+               if (tmp_h->dl_handle)
+                       dlclose(tmp_h->dl_handle);
+
+               g_free(tmp_h);
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_deinit(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->dl_handle) {
+               ret = h->intf.deinit(h->hal_handle);
+               if (ret != CAMERA_ERROR_NONE) {
+                       LOGE("camera_deinit failed 0x%x", ret);
+                       return ret;
+               }
+
+               h->hal_handle = NULL;
+
+               dlclose(h->dl_handle);
+               h->dl_handle = NULL;
+       }
+
+       g_free(h);
+
+       return CAMERA_ERROR_NONE;
+}
+
+
+int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.get_device_info_list) {
+               ret = h->intf.get_device_info_list(device_info_list);
+       } else {
+               LOGE("camera_get_device_info_list not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_open_device(camera_hal_interface *h, int device_index)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.open_device) {
+               ret = h->intf.open_device(h->hal_handle, device_index);
+       } else {
+               LOGE("camera_open_device not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_close_device(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.close_device) {
+               ret = h->intf.close_device(h->hal_handle);
+       } else {
+               LOGE("camera_close_device not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_add_message_callback(camera_hal_interface *h, camera_message_cb callback, void *user_data, uint32_t *cb_id)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.add_message_callback) {
+               ret = h->intf.add_message_callback(h->hal_handle, callback, user_data, cb_id);
+       } else {
+               LOGE("camera_add_message_callback not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_remove_message_callback(camera_hal_interface *h, uint32_t cb_id)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.remove_message_callback) {
+               ret = h->intf.remove_message_callback(h->hal_handle, cb_id);
+       } else {
+               LOGE("camera_remove_message_callback not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_set_preview_stream_format(camera_hal_interface *h, camera_format_t *format)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.set_preview_stream_format) {
+               ret = h->intf.set_preview_stream_format(h->hal_handle, format);
+       } else {
+               LOGE("camera_set_preview_stream_format not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_get_preview_stream_format(camera_hal_interface *h, camera_format_t *format)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.get_preview_stream_format) {
+               ret = h->intf.get_preview_stream_format(h->hal_handle, format);
+       } else {
+               LOGE("camera_get_preview_stream_format not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_start_preview(camera_hal_interface *h, camera_preview_frame_cb callback, void *user_data)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.start_preview) {
+               ret = h->intf.start_preview(h->hal_handle, callback, user_data);
+       } else {
+               LOGE("camera_start_preview not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_release_preview_buffer(camera_hal_interface *h, int buffer_index)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.release_preview_buffer) {
+               ret = h->intf.release_preview_buffer(h->hal_handle, buffer_index);
+       } else {
+               LOGE("camera_release_preview_buffer not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_stop_preview(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.stop_preview) {
+               ret = h->intf.stop_preview(h->hal_handle);
+       } else {
+               LOGE("camera_stop_preview not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_start_auto_focus(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.start_auto_focus) {
+               ret = h->intf.start_auto_focus(h->hal_handle);
+       } else {
+               LOGE("camera_start_auto_focus not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_stop_auto_focus(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.stop_auto_focus) {
+               ret = h->intf.stop_auto_focus(h->hal_handle);
+       } else {
+               LOGE("camera_stop_auto_focus not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_start_capture(camera_hal_interface *h, camera_capture_cb callback, void *user_data)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.start_capture) {
+               ret = h->intf.start_capture(h->hal_handle, callback, user_data);
+       } else {
+               LOGE("camera_start_capture not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_stop_capture(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.stop_capture) {
+               ret = h->intf.stop_capture(h->hal_handle);
+       } else {
+               LOGE("camera_stop_capture not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_set_video_stream_format(camera_hal_interface *h, camera_format_t *format)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.set_video_stream_format) {
+               ret = h->intf.set_video_stream_format(h->hal_handle, format);
+       } else {
+               LOGE("camera_set_video_stream_format not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_get_video_stream_format(camera_hal_interface *h, camera_format_t *format)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.get_video_stream_format) {
+               ret = h->intf.get_video_stream_format(h->hal_handle, format);
+       } else {
+               LOGE("camera_get_video_stream_format not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_start_record(camera_hal_interface *h, camera_video_frame_cb callback, void *user_data)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.start_record) {
+               ret = h->intf.start_record(h->hal_handle, callback, user_data);
+       } else {
+               LOGE("camera_start_record not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_release_video_buffer(camera_hal_interface *h, int buffer_index)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.release_video_buffer) {
+               ret = h->intf.release_video_buffer(h->hal_handle, buffer_index);
+       } else {
+               LOGE("camera_release_video_buffer not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_stop_record(camera_hal_interface *h)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.stop_record) {
+               ret = h->intf.stop_record(h->hal_handle);
+       } else {
+               LOGE("camera_stop_record not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_set_command(camera_hal_interface *h, int64_t command, void *value)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.set_command) {
+               ret = h->intf.set_command(h->hal_handle, command, value);
+       } else {
+               LOGE("camera_set_command not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_get_command(camera_hal_interface *h, int64_t command, void *value)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.get_command) {
+               ret = h->intf.get_command(h->hal_handle, command, value);
+       } else {
+               LOGE("camera_get_command not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
+
+
+int camera_hal_interface_set_batch_command(camera_hal_interface *h, camera_batch_command_control_t *batch_command, int64_t *error_command)
+{
+       int ret = CAMERA_ERROR_NONE;
+
+       if (h == NULL) {
+               LOGE("NULL interface");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (h->intf.set_batch_command) {
+               ret = h->intf.set_batch_command(h->hal_handle, batch_command, error_command);
+       } else {
+               LOGE("camera_set_batch_command not implemented");
+               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
+       }
+
+       return ret;
+}
index 13e0782ec25a664dd7eeb1f36d99e6cdffd0e7c7..67def4221ea9c5d6db6c500860360ddae2fcc300 100644 (file)
@@ -1,14 +1,18 @@
 # with gtest
 bin_PROGRAMS = camera_hal_gtests
 
-camera_hal_gtests_SOURCES = camera_hal_tc.cpp camera_hal_interface.c
+camera_hal_gtests_SOURCES = \
+       camera_hal_tc.cpp
 
-camera_hal_gtests_CFLAGS = $(GLIB_CFLAGS) $(DLOG_CFLAGS)
-camera_hal_gtests_CPPFLAGS = $(GLIB_CFLAGS) $(DLOG_CFLAGS) -I$(srcdir)/../../include/camera
+camera_hal_gtests_CPPFLAGS = \
+       $(GLIB_CFLAGS)\
+       $(DLOG_CFLAGS)\
+       -I$(srcdir)/../../include/camera
 
 camera_hal_gtests_LDADD = \
-       -ldl \
-       -lgtest \
-       $(GLIB_LIBS) \
+       -ldl\
+       -lgtest\
+       $(top_builddir)/src/camera/libcamera_hal_interface.la\
+       $(GLIB_LIBS)\
        $(DLOG_LIBS)
 
diff --git a/testcase/camera/camera_hal_interface.c b/testcase/camera/camera_hal_interface.c
deleted file mode 100644 (file)
index cc2f4d7..0000000
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jeongmo Yang <jm80.yang@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <errno.h>
-#include <dlfcn.h>
-#include <glib.h>
-#include <dlog.h>
-#include "camera_hal_interface.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif /* LOG_TAG */
-#define LOG_TAG "CAMERA_HAL_INTF"
-
-#define LIB_TIZEN_CAMERA "libtizen-camera.so"
-
-struct _camera_hal_interface {
-       void *dl_handle;
-       void *hal_handle;
-       camera_interface_t intf;
-};
-
-
-int camera_hal_interface_init(camera_hal_interface **h)
-{
-       int ret = CAMERA_ERROR_NONE;
-       camera_hal_interface *tmp_h = NULL;
-
-       if (h == NULL) {
-               LOGE("invalid parameter for camera_hal_interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       tmp_h = g_new0(camera_hal_interface, 1);
-       if (tmp_h == NULL) {
-               LOGE("failed to allocate hal interface");
-               return CAMERA_ERROR_OUT_OF_MEMORY;
-       }
-
-       tmp_h->dl_handle = dlopen(LIB_TIZEN_CAMERA, RTLD_NOW);
-       if (tmp_h->dl_handle) {
-               tmp_h->intf.init = dlsym(tmp_h->dl_handle, "camera_init");
-               tmp_h->intf.deinit = dlsym(tmp_h->dl_handle, "camera_deinit");
-               tmp_h->intf.get_device_info_list = dlsym(tmp_h->dl_handle, "camera_get_device_info_list");
-               tmp_h->intf.open_device = dlsym(tmp_h->dl_handle, "camera_open_device");
-               tmp_h->intf.close_device = dlsym(tmp_h->dl_handle, "camera_close_device");
-               tmp_h->intf.add_message_callback = dlsym(tmp_h->dl_handle, "camera_add_message_callback");
-               tmp_h->intf.remove_message_callback = dlsym(tmp_h->dl_handle, "camera_remove_message_callback");
-               tmp_h->intf.set_preview_stream_format = dlsym(tmp_h->dl_handle, "camera_set_preview_stream_format");
-               tmp_h->intf.get_preview_stream_format = dlsym(tmp_h->dl_handle, "camera_get_preview_stream_format");
-               tmp_h->intf.start_preview = dlsym(tmp_h->dl_handle, "camera_start_preview");
-               tmp_h->intf.release_preview_buffer = dlsym(tmp_h->dl_handle, "camera_release_preview_buffer");
-               tmp_h->intf.stop_preview = dlsym(tmp_h->dl_handle, "camera_stop_preview");
-               tmp_h->intf.start_auto_focus = dlsym(tmp_h->dl_handle, "camera_start_auto_focus");
-               tmp_h->intf.stop_auto_focus = dlsym(tmp_h->dl_handle, "camera_stop_auto_focus");
-               tmp_h->intf.start_capture = dlsym(tmp_h->dl_handle, "camera_start_capture");
-               tmp_h->intf.stop_capture = dlsym(tmp_h->dl_handle, "camera_stop_capture");
-               tmp_h->intf.set_video_stream_format = dlsym(tmp_h->dl_handle, "camera_set_video_stream_format");
-               tmp_h->intf.get_video_stream_format = dlsym(tmp_h->dl_handle, "camera_get_video_stream_format");
-               tmp_h->intf.start_record = dlsym(tmp_h->dl_handle, "camera_start_record");
-               tmp_h->intf.release_video_buffer = dlsym(tmp_h->dl_handle, "camera_release_video_buffer");
-               tmp_h->intf.stop_record = dlsym(tmp_h->dl_handle, "camera_stop_record");
-               tmp_h->intf.set_command = dlsym(tmp_h->dl_handle, "camera_set_command");
-               tmp_h->intf.get_command = dlsym(tmp_h->dl_handle, "camera_get_command");
-               tmp_h->intf.set_batch_command = dlsym(tmp_h->dl_handle, "camera_set_batch_command");
-
-               if (tmp_h->intf.init == NULL || tmp_h->intf.deinit == NULL) {
-                       LOGE("could not get mandatory funtion. %p %1p", tmp_h->intf.init, tmp_h->intf.deinit);
-                       ret = CAMERA_ERROR_INTERNAL;
-                       goto _CAMERA_HAL_INTERFACE_GET_FAILED;
-               }
-
-               if (tmp_h->intf.init) {
-                       ret = tmp_h->intf.init(&tmp_h->hal_handle);
-                       if (ret != CAMERA_ERROR_NONE) {
-                               LOGE("camera_init failed 0x%x", ret);
-                               goto _CAMERA_HAL_INTERFACE_GET_FAILED;
-                       }
-               } else {
-                       LOGE("no camera_init function");
-                       ret = CAMERA_ERROR_INTERNAL;
-                       goto _CAMERA_HAL_INTERFACE_GET_FAILED;
-               }
-       } else {
-               LOGE("dlopen failed [%s][errno %d]", LIB_TIZEN_CAMERA, errno);
-               ret = CAMERA_ERROR_DEVICE_NOT_SUPPORTED;
-               goto _CAMERA_HAL_INTERFACE_GET_FAILED;
-       }
-
-       *h = tmp_h;
-
-       return ret;
-
-_CAMERA_HAL_INTERFACE_GET_FAILED:
-       if (tmp_h) {
-               if (tmp_h->dl_handle)
-                       dlclose(tmp_h->dl_handle);
-
-               g_free(tmp_h);
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_deinit(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->dl_handle) {
-               ret = h->intf.deinit(h->hal_handle);
-               if (ret != CAMERA_ERROR_NONE) {
-                       LOGE("camera_deinit failed 0x%x", ret);
-                       return ret;
-               }
-
-               h->hal_handle = NULL;
-
-               dlclose(h->dl_handle);
-               h->dl_handle = NULL;
-       }
-
-       g_free(h);
-
-       return CAMERA_ERROR_NONE;
-}
-
-
-int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.get_device_info_list) {
-               ret = h->intf.get_device_info_list(device_info_list);
-       } else {
-               LOGE("camera_get_device_info_list not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_open_device(camera_hal_interface *h, int device_index)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.open_device) {
-               ret = h->intf.open_device(h->hal_handle, device_index);
-       } else {
-               LOGE("camera_open_device not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_close_device(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.close_device) {
-               ret = h->intf.close_device(h->hal_handle);
-       } else {
-               LOGE("camera_close_device not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_add_message_callback(camera_hal_interface *h, camera_message_cb callback, void *user_data, uint32_t *cb_id)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.add_message_callback) {
-               ret = h->intf.add_message_callback(h->hal_handle, callback, user_data, cb_id);
-       } else {
-               LOGE("camera_add_message_callback not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_remove_message_callback(camera_hal_interface *h, uint32_t cb_id)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.remove_message_callback) {
-               ret = h->intf.remove_message_callback(h->hal_handle, cb_id);
-       } else {
-               LOGE("camera_remove_message_callback not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_set_preview_stream_format(camera_hal_interface *h, camera_format_t *format)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.set_preview_stream_format) {
-               ret = h->intf.set_preview_stream_format(h->hal_handle, format);
-       } else {
-               LOGE("camera_set_preview_stream_format not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_get_preview_stream_format(camera_hal_interface *h, camera_format_t *format)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.get_preview_stream_format) {
-               ret = h->intf.get_preview_stream_format(h->hal_handle, format);
-       } else {
-               LOGE("camera_get_preview_stream_format not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_start_preview(camera_hal_interface *h, camera_preview_frame_cb callback, void *user_data)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.start_preview) {
-               ret = h->intf.start_preview(h->hal_handle, callback, user_data);
-       } else {
-               LOGE("camera_start_preview not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_release_preview_buffer(camera_hal_interface *h, int buffer_index)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.release_preview_buffer) {
-               ret = h->intf.release_preview_buffer(h->hal_handle, buffer_index);
-       } else {
-               LOGE("camera_release_preview_buffer not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_stop_preview(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.stop_preview) {
-               ret = h->intf.stop_preview(h->hal_handle);
-       } else {
-               LOGE("camera_stop_preview not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_start_auto_focus(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.start_auto_focus) {
-               ret = h->intf.start_auto_focus(h->hal_handle);
-       } else {
-               LOGE("camera_start_auto_focus not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_stop_auto_focus(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.stop_auto_focus) {
-               ret = h->intf.stop_auto_focus(h->hal_handle);
-       } else {
-               LOGE("camera_stop_auto_focus not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_start_capture(camera_hal_interface *h, camera_capture_cb callback, void *user_data)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.start_capture) {
-               ret = h->intf.start_capture(h->hal_handle, callback, user_data);
-       } else {
-               LOGE("camera_start_capture not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_stop_capture(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.stop_capture) {
-               ret = h->intf.stop_capture(h->hal_handle);
-       } else {
-               LOGE("camera_stop_capture not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_set_video_stream_format(camera_hal_interface *h, camera_format_t *format)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.set_video_stream_format) {
-               ret = h->intf.set_video_stream_format(h->hal_handle, format);
-       } else {
-               LOGE("camera_set_video_stream_format not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_get_video_stream_format(camera_hal_interface *h, camera_format_t *format)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.get_video_stream_format) {
-               ret = h->intf.get_video_stream_format(h->hal_handle, format);
-       } else {
-               LOGE("camera_get_video_stream_format not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_start_record(camera_hal_interface *h, camera_video_frame_cb callback, void *user_data)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.start_record) {
-               ret = h->intf.start_record(h->hal_handle, callback, user_data);
-       } else {
-               LOGE("camera_start_record not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_release_video_buffer(camera_hal_interface *h, int buffer_index)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.release_video_buffer) {
-               ret = h->intf.release_video_buffer(h->hal_handle, buffer_index);
-       } else {
-               LOGE("camera_release_video_buffer not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_stop_record(camera_hal_interface *h)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.stop_record) {
-               ret = h->intf.stop_record(h->hal_handle);
-       } else {
-               LOGE("camera_stop_record not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_set_command(camera_hal_interface *h, int64_t command, void *value)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.set_command) {
-               ret = h->intf.set_command(h->hal_handle, command, value);
-       } else {
-               LOGE("camera_set_command not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_get_command(camera_hal_interface *h, int64_t command, void *value)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.get_command) {
-               ret = h->intf.get_command(h->hal_handle, command, value);
-       } else {
-               LOGE("camera_get_command not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
-
-int camera_hal_interface_set_batch_command(camera_hal_interface *h, camera_batch_command_control_t *batch_command, int64_t *error_command)
-{
-       int ret = CAMERA_ERROR_NONE;
-
-       if (h == NULL) {
-               LOGE("NULL interface");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       if (h->intf.set_batch_command) {
-               ret = h->intf.set_batch_command(h->hal_handle, batch_command, error_command);
-       } else {
-               LOGE("camera_set_batch_command not implemented");
-               ret = CAMERA_ERROR_NOT_IMPLEMENTED;
-       }
-
-       return ret;
-}
-
diff --git a/testcase/camera/camera_hal_interface.h b/testcase/camera/camera_hal_interface.h
deleted file mode 100644 (file)
index bf0e880..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jeongmo Yang <jm80.yang@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <tizen-camera.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _camera_hal_interface camera_hal_interface;
-
-int camera_hal_interface_init(camera_hal_interface **h);
-int camera_hal_interface_deinit(camera_hal_interface *h);
-int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list);
-int camera_hal_interface_open_device(camera_hal_interface *h, int device_index);
-int camera_hal_interface_close_device(camera_hal_interface *h);
-int camera_hal_interface_add_message_callback(camera_hal_interface *h, camera_message_cb callback, void *user_data, uint32_t *cb_id);
-int camera_hal_interface_remove_message_callback(camera_hal_interface *h, uint32_t cb_id);
-int camera_hal_interface_set_preview_stream_format(camera_hal_interface *h, camera_format_t *format);
-int camera_hal_interface_get_preview_stream_format(camera_hal_interface *h, camera_format_t *format);
-int camera_hal_interface_start_preview(camera_hal_interface *h, camera_preview_frame_cb callback, void *user_data);
-int camera_hal_interface_release_preview_buffer(camera_hal_interface *h, int buffer_index);
-int camera_hal_interface_stop_preview(camera_hal_interface *h);
-int camera_hal_interface_start_auto_focus(camera_hal_interface *h);
-int camera_hal_interface_stop_auto_focus(camera_hal_interface *h);
-int camera_hal_interface_start_capture(camera_hal_interface *h, camera_capture_cb callback, void *user_data);
-int camera_hal_interface_stop_capture(camera_hal_interface *h);
-int camera_hal_interface_set_video_stream_format(camera_hal_interface *h, camera_format_t *format);
-int camera_hal_interface_get_video_stream_format(camera_hal_interface *h, camera_format_t *format);
-int camera_hal_interface_start_record(camera_hal_interface *h, camera_video_frame_cb callback, void *user_data);
-int camera_hal_interface_release_video_buffer(camera_hal_interface *h, int buffer_index);
-int camera_hal_interface_stop_record(camera_hal_interface *h);
-int camera_hal_interface_set_command(camera_hal_interface *h, int64_t command, void *value);
-int camera_hal_interface_get_command(camera_hal_interface *h, int64_t command, void *value);
-int camera_hal_interface_set_batch_command(camera_hal_interface *h, camera_batch_command_control_t *batch_command, int64_t *error_command);
-
-#ifdef __cplusplus
-}
-#endif
-
index 15fe0329d6af4138a3f41a237942a87842fdc096..3d3c149ee45091fd9104768a62e589b848605fa0 100644 (file)
@@ -21,7 +21,7 @@
 #include <gtest/gtest.h>
 #include <unistd.h>
 #include <iostream>
-#include "camera_hal_interface.h"
+#include <camera_hal_interface.h>
 
 using namespace std;