Vision source API 18/299618/28
authorKwanghoon Son <k.son@samsung.com>
Thu, 5 Oct 2023 10:04:49 +0000 (19:04 +0900)
committerKwanghoon Son <k.son@samsung.com>
Mon, 16 Oct 2023 11:43:38 +0000 (20:43 +0900)
[Issue type] New
[Version] 1.0.0

This APIs introduce vision source api set and verified with real
use-case. The APIs defined this time have to be backward
compatibility as they actually have a place to use them.

1. Custom structures are completely replaced by mediatools.
media_packet and media_format of mediatool do not use custom
structures separately because they support structures and APIs
that are already well utilized.

2. The callback in the start_stream is separated by a distinct function.
In the existing API, there was confusion because the start was in
charge of implicit async call.

Change-Id: Ibd9639e0dc0a8bc9ec38a2a2abac9132bf2b6a78
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
.clang-format
CMakeLists.txt
include/vision_source.h
include/vision_source_interface.h
packaging/vision-source.spec
src/vision_source.c
src/vision_source_private.h
vision_source.ini

index f50fddb065b41114d7c395aded9f3fcd244d9ad4..e8177de116ff011cfe53d31e30fa93581acfcdfe 100644 (file)
@@ -38,22 +38,22 @@ BraceWrapping:
   BeforeElse:      false
 
   # M16
-  AfterEnum:       true
-  AfterStruct:     true
-  AfterUnion:      true
+  AfterEnum:       false
+  AfterStruct:     false
+  AfterUnion:      false
 
   # by inquiry
   AfterClass:      true
   AfterNamespace:  true
   AfterObjCDeclaration: true
-  AfterExternBlock: true
+  AfterExternBlock: false # mediavision want false
   IndentBraces:    false
   SplitEmptyFunction: false
   SplitEmptyRecord: false
   SplitEmptyNamespace: false
 
 # from pptx
-ColumnLimit:     80
+ColumnLimit:     120 # mediavision want 120
 
 # M11
 SpaceAfterCStyleCast: true
@@ -87,7 +87,7 @@ ConstructorInitializerIndentWidth: 8
 ContinuationIndentWidth: 8
 Cpp11BracedListStyle: false
 KeepEmptyLinesAtTheStartOfBlocks: false
-NamespaceIndentation: Inner
+NamespaceIndentation: None # mediavision want None
 PenaltyBreakAssignment: 10
 PenaltyBreakBeforeFirstCallParameter: 30
 PenaltyBreakComment: 10
index e5a01e88760b8dd4831cf93a2d90aa1a84716687..b2d201cfe71946d80ce3d1d814c3049d5b3b6dc2 100644 (file)
@@ -13,7 +13,7 @@ add_compile_definitions(INI_PATH="${SYSCONF_INSTALL_DIR}/vision_source.ini")
 
 target_compile_options(${PROJECT_NAME} PUBLIC ${${PROJECT_NAME}_DEP_CFLAGS})
 target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
-target_link_libraries(${PROJECT_NAME} ${${PROJECT_NAME}_DEP_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} ${${PROJECT_NAME}_DEP_LIBRARIES} dl)
 
 # install packages
 install(
@@ -33,4 +33,4 @@ configure_file(
 )
 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/vision_source.ini DESTINATION ${SYSCONF_INSTALL_DIR})
\ No newline at end of file
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/vision_source.ini DESTINATION ${SYSCONF_INSTALL_DIR})
index 6fa79cb2aa8f342276c6b5876336524511190d64..9abad0fd8a6e298ad0ea1568d13c669cd4073a47 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 - 2023 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <vision_source_interface.h>
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 int vision_source_init(vision_source_h *handle);
 int vision_source_exit(vision_source_h handle);
-int vision_source_open_device(vision_source_h handle, int device_index);
+int vision_source_list_devices(vision_source_h handle, vision_source_device_info_s **dev_list, int *dev_count);
+int vision_source_get_device_cap(vision_source_h handle, int dev_index, media_format_h **fmt_list, int *fmt_count);
+int vision_source_open_device(vision_source_h handle, int dev_index);
 int vision_source_close_device(vision_source_h handle);
-int vision_source_start_stream(vision_source_h handle, stream_cb callback,
-                                                               void *user_data);
+int vision_source_set_stream_format(vision_source_h handle, media_format_h fmt);
+int vision_source_start_stream(vision_source_h handle);
 int vision_source_stop_stream(vision_source_h handle);
-int vision_source_enumerate_devices(
-               vision_source_h handle,
-               vision_source_device_info_list_s *info_list);
-int vision_source_set_stream_format(vision_source_h handle,
-                                                                       vision_source_format_s *format);
-int vision_source_get_capture_frame(vision_source_h handle,
-                                                                       vision_source_buffer_s *buffer);
-int vision_source_release_capture_frame(vision_source_h handle,
-                                                                               int buffer_index);
+int vision_source_get_packet(vision_source_h handle, media_packet_h *pkt);
+int vision_source_set_stream_cb(vision_source_h handle, stream_cb callback, void *user_data);
+int vision_source_set_status_cb(vision_source_h handle, status_cb callback, void *user_data);
+int vision_source_set_error_cb(vision_source_h handle, error_cb callback, void *user_data);
 int vision_source_ioctl(vision_source_h handle, int request, void *arg);
 
 #ifdef __cplusplus
index 0f0ee80a7e1515b4e36955d39b791c1da9fcee4b..90625825b94754a0305962573e8d8be5dba766c0 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 - 2023 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #ifndef __VISION_SOURCE_INTERFACE__
 #define __VISION_SOURCE_INTERFACE__
 
-#include <stdint.h>
 #include <media_packet.h>
 
-#define BUFFER_PLANE_MAX 4
-#define DEVICE_COUNT_MAX 16
-#define RESOLUTION_COUNT_MAX 32
-#define FPS_COUNT_MAX 16
-#define DEVICE_NAME_LENGTH_MAX 16
-#define DEVICE_NODE_PATH_LENGTH_MAX 16
-
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
-typedef struct vision_source_resolution
-{
-       uint32_t width;
-       uint32_t height;
-} vision_source_resolution_s;
-
-typedef enum vision_source_pixel_format
-{
-       VISION_SOURCE_PIXEL_FORMAT_RGB24 = 0x0000,
-       VISION_SOURCE_PIXEL_FORMAT_GREY,
-       VISION_SOURCE_PIXEL_FORMAT_Y10,
-       VISION_SOURCE_PIXEL_FORMAT_NV12,
-       VISION_SOURCE_PIXEL_FORMAT_NV21,
-       VISION_SOURCE_PIXEL_FORMAT_YVU420, //YV12
-       VISION_SOURCE_PIXEL_FORMAT_YUV420, //I420
-       VISION_SOURCE_PIXEL_FORMAT_Z32F, //FP32 depth data(millimeter distance)
-       VISION_SOURCE_PIXEL_FORMAT_Z16U, //U16 depth data(millimeter distance)
-       VISION_SOURCE_PIXEL_FORMAT_MAX
-} vision_source_pixel_format_e;
-
-typedef struct vision_source_pixel_format_list
-{
-       uint32_t count;
-       vision_source_pixel_format_e
-                       pixel_formats[VISION_SOURCE_PIXEL_FORMAT_MAX];
-} vision_source_pixel_format_list_s;
-
-typedef struct vision_source_resolution_list
-{
-       uint32_t count;
-       vision_source_resolution_s resolutions[RESOLUTION_COUNT_MAX];
-} vision_source_resolution_list_s;
-
-typedef struct vision_source_fps_list
-{
-       uint32_t count;
-       int fps[FPS_COUNT_MAX];
-} vision_source_fps_list_s;
-
-typedef struct vision_source_resolution_match_fps
-{
-       vision_source_resolution_s resolution;
-       vision_source_fps_list_s fps_list;
-} vision_source_resolution_match_fps_s;
-
-typedef struct vision_source_resolution_match_fps_list
-{
-       uint32_t count;
-       vision_source_resolution_match_fps_s resolutions[RESOLUTION_COUNT_MAX];
-} vision_source_resolution_match_fps_list_s;
-
-typedef struct vision_source_pixel_match_resolution
-{
-       vision_source_pixel_format_e pixel_format;
-       vision_source_resolution_match_fps_list_s resolution_list;
-} vision_source_pixel_match_resolution_s;
-
-typedef struct vision_source_pixel_match_resolution_list
-{
-       uint32_t count;
-       vision_source_pixel_match_resolution_s
-                       pixels[VISION_SOURCE_PIXEL_FORMAT_MAX];
-} vision_source_pixel_match_resolution_list_s;
+#define DEVICE_NAME_LENGTH_MAX 16
 
-typedef struct vision_source_device_info
-{
+typedef struct vision_source_device_info {
        uint32_t index;
        char name[DEVICE_NAME_LENGTH_MAX];
-       char node_path[DEVICE_NODE_PATH_LENGTH_MAX];
-       vision_source_pixel_match_resolution_list_s pixel_list;
 } vision_source_device_info_s;
 
-typedef struct vision_source_device_info_list
-{
-       uint32_t count;
-       vision_source_device_info_s device_info[DEVICE_COUNT_MAX];
-} vision_source_device_info_list_s;
-
-typedef struct vision_source_plane
-{
-       unsigned char *data;
-       uint32_t align_width;
-       uint32_t align_height;
-       uint32_t size;
-       uint32_t used_size;
-} vision_source_plane_s;
-
-typedef struct vision_source_format
-{
-       vision_source_pixel_format_e pixel_format;
-       vision_source_resolution_s resolution;
-       uint32_t fps;
-       uint32_t quality;
-       uint32_t bitrate;
-} vision_source_format_s;
-
-typedef struct vision_source_buffer
-{
-       int index;
-       vision_source_pixel_format_e pixel_format;
-       vision_source_resolution_s resolution;
-       uint32_t total_size;
-       uint32_t num_planes;
-       vision_source_plane_s planes[BUFFER_PLANE_MAX];
-       uint64_t timestamp;
-       void *priv;
-} vision_source_buffer_s;
-
-typedef enum vision_source_error
-{
+typedef enum vision_source_error {
        VISION_SOURCE_ERROR_NONE = 0,
+       VISION_SOURCE_ERROR_NOT_SUPPORTED,
+       VISION_SOURCE_ERROR_MSG_TOO_LONG,
+       VISION_SOURCE_ERROR_NO_DATA,
+       VISION_SOURCE_ERROR_KEY_NOT_AVAILABLE,
+       VISION_SOURCE_ERROR_OUT_OF_MEMORY,
        VISION_SOURCE_ERROR_INVALID_PARAMETER,
+       VISION_SOURCE_ERROR_INVALID_OPERATION,
+       VISION_SOURCE_ERROR_PERMISSION_DENIED,
+       VISION_SOURCE_ERROR_NOT_SUPPORTED_FORMAT,
        VISION_SOURCE_ERROR_INTERNAL,
-       VISION_SOURCE_ERROR_NOT_IMPLEMENTED,
+       VISION_SOURCE_ERROR_INVALID_DATA,
+       VISION_SOURCE_ERROR_INVALID_PATH,
        VISION_SOURCE_ERROR_UNKNOWN
 } vision_source_error_e;
 
+typedef enum vision_source_status {
+       VISION_SOURCE_STATUS_INITIALIZED = 0,
+       VISION_SOURCE_STATUS_OPENDED,
+       VISION_SOURCE_STATUS_STARTED
+} vision_source_status_e;
+
 typedef void *vision_source_h;
 
 typedef int (*stream_cb)(media_packet_h pkt, void *user_data);
+typedef int (*status_cb)(vision_source_status_e status, void *user_data);
+typedef int (*error_cb)(vision_source_error_e err, void *user_data);
 
-typedef struct vision_source_func
-{
+typedef struct vision_source_func {
        int (*init)(vision_source_h *handle);
        int (*exit)(vision_source_h handle);
-       int (*open_device)(vision_source_h handle, int device_index);
+       int (*list_devices)(vision_source_h handle, vision_source_device_info_s **dev_list, int *dev_count);
+       int (*get_device_cap)(vision_source_h handle, int dev_index, media_format_h **fmt_list, int *fmt_count);
+       int (*open_device)(vision_source_h handle, int dev_index);
        int (*close_device)(vision_source_h handle);
-
-       int (*enumerate_devices)(vision_source_h handle,
-                                                               vision_source_device_info_list_s *info_list);
-       int (*set_stream_format)(vision_source_h handle,
-                                                               vision_source_format_s *format);
-
-       int (*start_stream)(vision_source_h handle, stream_cb callback,
-                                               void *user_data);
+       int (*set_stream_format)(vision_source_h handle, media_format_h fmt);
+       int (*start_stream)(vision_source_h handle);
        int (*stop_stream)(vision_source_h handle);
-
-       int (*get_capture_frame)(vision_source_h handle,
-                                                               vision_source_buffer_s *buffer);
-       int (*release_capture_frame)(vision_source_h handle, int buffer_index);
+       int (*get_packet)(vision_source_h handle, media_packet_h *pkt);
+       int (*set_stream_cb)(vision_source_h handle, stream_cb callback, void *user_data);
+       int (*set_status_cb)(vision_source_h handle, status_cb callback, void *user_data);
+       int (*set_error_cb)(vision_source_h handle, error_cb callback, void *user_data);
        int (*ioctl)(vision_source_h handle, int request, void *arg);
 } vision_source_func_s;
 
index 17cbe65b62f79245569b8667241c5822054ca7e3..816b29a14e5ad7184a0a91b67a9d21787800bdb2 100644 (file)
@@ -1,6 +1,6 @@
 Name:        vision-source
 Summary:     vision source
-Version:     0.2.1
+Version:     1.0.0
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0
index 5bdede618e25dfab1eb0915a04f24da67539e4b5..6d201064a65b38d75e2b8e70e4f70c7fdbf6fc9c 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 - 2023 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -27,8 +27,7 @@
 
 #define MAX_BACKEND_NAME 32
 
-typedef struct vision_source_internal
-{
+typedef struct vision_source_internal {
        void *backend_handle;
        void *dl_handle;
        vision_source_func_s funcs;
@@ -36,8 +35,7 @@ typedef struct vision_source_internal
 
 int _vision_source_dlsym(vision_source_internal_s *handle)
 {
-       void (*attach_backend)(vision_source_func_s *) =
-                       dlsym(handle->dl_handle, "attach_backend");
+       void (*attach_backend)(vision_source_func_s *) = dlsym(handle->dl_handle, "attach_backend");
 
        char *error = dlerror();
        if (error) {
@@ -54,8 +52,7 @@ int _vision_source_dlsym(vision_source_internal_s *handle)
        return VISION_SOURCE_ERROR_NONE;
 }
 
-int _vision_source_attach(const char *backend_name,
-                                                 vision_source_internal_s *handle)
+int _vision_source_attach(const char *backend_name, vision_source_internal_s *handle)
 {
        LOGD("ENTER");
        LOGI("backend %s connected", backend_name);
@@ -134,8 +131,7 @@ int vision_source_exit(vision_source_h handle)
 {
        LOGD("ENTER");
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
        VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.exit);
 
        int ret = source_handle->funcs.exit(source_handle->backend_handle);
@@ -155,91 +151,128 @@ int vision_source_exit(vision_source_h handle)
        return VISION_SOURCE_ERROR_NONE;
 }
 
-int vision_source_open_device(vision_source_h handle, int device_index)
+int vision_source_list_devices(vision_source_h handle, vision_source_device_info_s **dev_list, int *dev_count)
+{
+       VISION_SOURCE_NULL_ARG_CHECK(handle);
+       VISION_SOURCE_NULL_ARG_CHECK(dev_list);
+       VISION_SOURCE_NULL_ARG_CHECK(dev_count);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.list_devices);
+
+       return source_handle->funcs.list_devices(source_handle->backend_handle, dev_list, dev_count);
+}
+
+int vision_source_get_device_cap(vision_source_h handle, int dev_index, media_format_h **fmt_list, int *fmt_count)
+{
+       VISION_SOURCE_NULL_ARG_CHECK(handle);
+       VISION_SOURCE_NULL_ARG_CHECK(fmt_list);
+       VISION_SOURCE_NULL_ARG_CHECK(fmt_count);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.get_device_cap);
+
+       return source_handle->funcs.get_device_cap(source_handle->backend_handle, dev_index, fmt_list, fmt_count);
+}
+
+int vision_source_open_device(vision_source_h handle, int dev_index)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
        VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.open_device);
-       return source_handle->funcs.open_device(source_handle->backend_handle,
-                                                                                       device_index);
+
+       return source_handle->funcs.open_device(source_handle->backend_handle, dev_index);
 }
+
 int vision_source_close_device(vision_source_h handle)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
        VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.close_device);
+
        return source_handle->funcs.close_device(source_handle->backend_handle);
 }
-int vision_source_start_stream(vision_source_h handle, stream_cb callback,
-                                                          void *user_data)
+
+int vision_source_set_stream_format(vision_source_h handle, media_format_h fmt)
+{
+       VISION_SOURCE_NULL_ARG_CHECK(handle);
+       VISION_SOURCE_NULL_ARG_CHECK(fmt);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.set_stream_format);
+
+       return source_handle->funcs.set_stream_format(source_handle->backend_handle, fmt);
+}
+
+int vision_source_start_stream(vision_source_h handle)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
        VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.start_stream);
-       return source_handle->funcs.start_stream(source_handle->backend_handle,
-                                                                                        callback, user_data);
+
+       return source_handle->funcs.start_stream(source_handle->backend_handle);
 }
+
 int vision_source_stop_stream(vision_source_h handle)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
        VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.stop_stream);
+
        return source_handle->funcs.stop_stream(source_handle->backend_handle);
 }
 
-int vision_source_enumerate_devices(vision_source_h handle,
-                                                                       vision_source_device_info_list_s *info_list)
+int vision_source_get_packet(vision_source_h handle, media_packet_h *pkt)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
-       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.enumerate_devices);
-       return source_handle->funcs.enumerate_devices(source_handle->backend_handle,
-                                                                                                 info_list);
+       VISION_SOURCE_NULL_ARG_CHECK(pkt);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.get_packet);
+
+       return source_handle->funcs.get_packet(source_handle->backend_handle, pkt);
 }
 
-int vision_source_set_stream_format(vision_source_h handle,
-                                                                       vision_source_format_s *format)
+int vision_source_set_stream_cb(vision_source_h handle, stream_cb callback, void *user_data)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
-       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.set_stream_format);
-       return source_handle->funcs.set_stream_format(source_handle->backend_handle,
-                                                                                                 format);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.set_stream_cb);
+
+       return source_handle->funcs.set_stream_cb(source_handle->backend_handle, callback, user_data);
 }
-int vision_source_get_capture_frame(vision_source_h handle,
-                                                                       vision_source_buffer_s *buffer)
+
+int vision_source_set_status_cb(vision_source_h handle, status_cb callback, void *user_data)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
-       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.get_capture_frame);
-       return source_handle->funcs.get_capture_frame(source_handle->backend_handle,
-                                                                                                 buffer);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.set_status_cb);
+
+       return source_handle->funcs.set_status_cb(source_handle->backend_handle, callback, user_data);
 }
 
-int vision_source_release_capture_frame(vision_source_h handle,
-                                                                               int buffer_index)
+int vision_source_set_error_cb(vision_source_h handle, error_cb callback, void *user_data)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
-       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.release_capture_frame);
-       return source_handle->funcs.release_capture_frame(
-                       source_handle->backend_handle, buffer_index);
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
+       VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.set_error_cb);
+
+       return source_handle->funcs.set_error_cb(source_handle->backend_handle, callback, user_data);
 }
 
 int vision_source_ioctl(vision_source_h handle, int request, void *arg)
 {
        VISION_SOURCE_NULL_ARG_CHECK(handle);
-       vision_source_internal_s *source_handle =
-                       (vision_source_internal_s *) handle;
+
+       vision_source_internal_s *source_handle = (vision_source_internal_s *) handle;
        VISION_SOURCE_IMPLEMENT_CHECK(source_handle->funcs.ioctl);
-       return source_handle->funcs.ioctl(source_handle->backend_handle, request,
-                                                                         arg);
-}
\ No newline at end of file
+
+       return source_handle->funcs.ioctl(source_handle->backend_handle, request, arg);
+}
index c0b4815ebeaab8a21a4239aa451951753004194a..8039d52bd5f33d7f2203107e1a5641ba4e171783 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2022 - 2023 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
                }                                                      \
        } while (0)
 
-#define VISION_SOURCE_NULL_ARG_CHECK(arg)                                \
-       VISION_SOURCE_CHECK_CONDITION(arg != NULL,                           \
-                                                                 VISION_SOURCE_ERROR_INVALID_PARAMETER, \
+#define VISION_SOURCE_NULL_ARG_CHECK(arg)                                             \
+       VISION_SOURCE_CHECK_CONDITION(arg != NULL, VISION_SOURCE_ERROR_INVALID_PARAMETER, \
                                                                  "VISION_SOURCE_ERROR_INVALID_PARAMETER")
 
-#define VISION_SOURCE_IMPLEMENT_CHECK(arg)                             \
-       VISION_SOURCE_CHECK_CONDITION(arg != NULL,                         \
-                                                                 VISION_SOURCE_ERROR_NOT_IMPLEMENTED, \
-                                                                 "VISION_SOURCE_ERROR_NOT_IMPLEMENTED")
-#endif /* __VISION_SOURCE_INTERFACE__ */
\ No newline at end of file
+#define VISION_SOURCE_IMPLEMENT_CHECK(arg) \
+       VISION_SOURCE_CHECK_CONDITION(arg != NULL, VISION_SOURCE_ERROR_NOT_SUPPORTED, "VISION_SOURCE_ERROR_NOT_SUPPORTED")
+
+#endif /* __VISION_SOURCE_PRIVATE_H__ */
index 9ebb04d1349cdcf69030c443e4dfa9aadbd5c916..422e1737750a7c106c29a1421c251a16d8acba73 100644 (file)
@@ -1,9 +1,2 @@
 [Common]
 name = "v4l2";
-
-[Stream]
-dev_id = 0;
-width = 640;
-height = 480;
-fps = 30;
-pixel_format = 0;
\ No newline at end of file