#endif /* BUFFER_MAX_PLANE_NUM */
#define BUFFER_MAX_PLANE_NUM 4
+#define CAMERA_DEVICE_MAX ((CAMERA_DEVICE_CAMERA9 + 1) * 2)
+#define DEVICE_NAME_MAX_LENGTH 64
+#define DEVICE_ID_MAX_LENGTH 64
typedef struct _camera_stream_data_s {
union {
int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
} camera_stream_data_s;
+
+typedef enum {
+ CAMERA_DEVICE_TYPE_BUILTIN = 0, /**< Built-in camera */
+ CAMERA_DEVICE_TYPE_USB, /**< USB connected camera */
+ CAMERA_DEVICE_TYPE_NETWORK /**< Network camera */
+} camera_device_type_e;
+
+typedef struct _camera_device_s {
+ camera_device_type_e type;
+ camera_device_e index;
+ char name[DEVICE_NAME_MAX_LENGTH];
+ char id[DEVICE_ID_MAX_LENGTH];
+} camera_device_s;
+
+typedef struct _camera_device_list_s {
+ unsigned int count;
+ camera_device_s device[CAMERA_DEVICE_MAX];
+} camera_device_list_s;
+
/**
* @brief Start the evas rendering.
*
tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame);
/**
+ * @brief Creates a new camera handle for controlling a network camera.
+ * @since_tizen 6.0
+ * @remarks A @a camera must be released using camera_destroy().
+ * @param[in] device The network camera to access
+ * @param[out] camera A newly returned handle to the camera
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @post If it succeeds, the camera state will be #CAMERA_STATE_CREATED.
+ *
+ * @see camera_destroy()
+ */
+int camera_create_network(camera_device_e device, camera_h *camera);
+
+/**
+ * @brief Gets a list of available camera devices.
+ * @since_tizen 6.0
+ * @param[out] list A list of available camera devices
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ */
+int camera_get_device_list(camera_device_list_s *list);
+
+/**
* @}
*/
#ifdef __cplusplus
int _camera_stop_evas_rendering(camera_h camera, bool keep_screen);
int _camera_independent_request(int api, int device_type, const char *key, int *value);
int _camera_set_display(camera_h camera, mm_display_type_e type, void *display);
+int _camera_create_private(camera_device_e device, bool is_network, camera_h *camera);
typedef bool (*camera_supported_cb_param1)(int param, void *user_data);
typedef bool (*camera_supported_cb_param2)(int param1, int param2, void *user_data);
Name: capi-media-camera
Summary: A Camera API
-Version: 0.4.41
+Version: 0.4.42
Release: 0
Group: Multimedia/API
License: Apache-2.0
export CFLAGS+=" -fprofile-arcs -ftest-coverage"
export LDFLAGS+=" -lgcov"
%endif
+export CFLAGS+=" -DPATH_LIBDIR=\\\"%{_libdir}\\\""
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
}
-int camera_create(camera_device_e device, camera_h *camera)
+int _camera_create_private(camera_device_e device, bool is_network, camera_h *camera)
{
int sock_fd = -1;
char *send_msg = NULL;
return CAMERA_ERROR_INVALID_PARAMETER;
}
- CAM_LOG_INFO("device %d", device);
+ CAM_LOG_INFO("device %d, is_network %d", device, is_network);
sock_fd = muse_client_new();
if (sock_fd < 0) {
send_msg = muse_core_msg_new(api,
MUSE_TYPE_INT, "module", module_index,
MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
+ MUSE_TYPE_INT, "is_network", (int)is_network,
0);
if (!send_msg) {
}
+int camera_create(camera_device_e device, camera_h *camera)
+{
+ return _camera_create_private(device, false, camera);
+}
+
+
int camera_change_device(camera_h camera, camera_device_e device)
{
int i = 0;
#include <camera_internal.h>
#include <camera_private.h>
#include <dlog.h>
+#include <dlfcn.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "TIZEN_N_CAMERA"
+#define LIB_CAMERA_DEVICE_MANAGER PATH_LIBDIR"/libcamera_device_manager.so"
+
/* log level */
extern int g_mmcam_log_level;
return _camera_start_evas_rendering(camera);
}
+
int camera_stop_evas_rendering(camera_h camera, bool keep_screen)
{
return _camera_stop_evas_rendering(camera, keep_screen);
}
+
int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window)
{
return _camera_set_display(camera, MM_DISPLAY_TYPE_OVERLAY_EXT, ecore_wl_window);
}
//LCOV_EXCL_STOP
+
void camera_create_preview_frame(camera_stream_data_s *stream, int num_buffer_fd,
tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
{
}
CAM_LOG_DEBUG("format[%d], res[%dx%d], size[%d], plane num[%d]",
- frame->format, frame->width, frame->height, total_size, frame->num_of_planes);
+ frame->format, frame->width, frame->height, total_size, frame->num_of_planes);
+}
+
+
+int camera_create_network(camera_device_e device, camera_h *camera)
+{
+ return _camera_create_private(device, true, camera);
+}
+
+
+int camera_get_device_list(camera_device_list_s *list)
+{
+ unsigned int i = 0;
+ int ret = CAMERA_ERROR_NONE;
+ int (*get_device_list)(camera_device_list_s *list);
+ void *dl_handle = NULL;
+
+ CAM_LOG_INFO("enter");
+
+ if (!list) {
+ CAM_LOG_ERROR("NULL parameter");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ dl_handle = dlopen(LIB_CAMERA_DEVICE_MANAGER, RTLD_NOW);
+ if (!dl_handle) {
+ CAM_LOG_ERROR("dlopen[%s] failed[%s]", LIB_CAMERA_DEVICE_MANAGER, dlerror());
+ return CAMERA_ERROR_NOT_SUPPORTED;
+ }
+
+ get_device_list = dlsym(dl_handle, "get_device_list");
+ if (!get_device_list) {
+ dlclose(dl_handle);
+ CAM_LOG_ERROR("failed to get symbol to get device list");
+ return CAMERA_ERROR_NOT_SUPPORTED;
+ }
+
+ ret = get_device_list(list);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ CAM_LOG_INFO("device count[%d]", list->count);
+ for (i = 0 ; i < list->count ; i++)
+ CAM_LOG_INFO(" [%d] : type[%d], device index[%d], name[%s]",
+ i, list->device[i].type, list->device[i].index, list->device[i].name);
+ } else {
+ CAM_LOG_ERROR("failed[0x%x]", ret);
+ }
+
+ dlclose(dl_handle);
- return;
+ return ret;
}
#include <glib.h>
#include <sys/time.h>
#include <dlog.h>
-#include <camera.h>
+#include <camera_internal.h>
#include <Ecore.h>
#include <Elementary.h>
#include <appcore-efl.h>
appdata ad;
GIOChannel *stdin_channel;
-camera_device_e cam_info;
+camera_device_e camera_device;
static GTimer *timer;
static int g_camera_device_changed_cb_id;
break;
case MENU_STATE_MAIN:
g_print("\n\t=======================================\n");
- g_print("\t Video Capture (CAMERA%d)\n", cam_info);
+ g_print("\t Video Capture (CAMERA%d)\n", camera_device);
g_print("\t=======================================\n");
g_print("\t '1' Stillshot test\n");
g_print("\t '2' Multishot test\n");
break;
case 'S': /* Setting > flash state */
g_print("*flash state\n");
- err = camera_get_flash_state(cam_info, (camera_flash_state_e *)&idx);
+ err = camera_get_flash_state(camera_device, (camera_flash_state_e *)&idx);
if (CAMERA_ERROR_NONE == err)
g_print("Current flash state = %s\n", idx ? "ON" : "OFF");
else
static gboolean mode_change(gchar buf)
{
int err = 0;
- camera_device_state_e device_state = CAMERA_DEVICE_STATE_NULL;
- char camera_type = '\0';
- char display_type = '\0';
+ int camera_type = 0;
+ int display_type = 0;
bool check = FALSE;
+ camera_device_state_e device_state = CAMERA_DEVICE_STATE_NULL;
switch (buf) {
case '1':
while (1) {
- g_print("\n\tEnter the Camera Type[0 ~ 9] : ");
+ g_print("\n\tEnter the Camera Type[0:Local, 1:Network] : ");
+ err = scanf("%d", &camera_type);
+ flush_stdin();
+ if (err == EOF) {
+ g_print("\t!!!read input error!!!\n");
+ continue;
+ }
- err = scanf("%c", &camera_type);
+ if (camera_type != 0 && camera_type != 1) {
+ g_print("\t Invalid camera type(%d)\n", camera_type);
+ continue;
+ }
+
+ g_print("\n\tEnter the Camera Device[0 ~ 9] : ");
+ err = scanf("%d", (int *)&camera_device);
flush_stdin();
if (err == EOF) {
g_print("\t!!!read input error!!!\n");
continue;
}
- if (camera_type < '0' || camera_type > '9') {
- g_print("\t Invalid camera type(%c)\n", camera_type);
+ if (camera_device < 0 || camera_device > 9) {
+ g_print("\t Invalid camera device(%d)\n", camera_device);
continue;
}
- hcamcorder->type = cam_info = camera_type - '0';
+ hcamcorder->type = camera_device;
break;
}
return FALSE;
}
- g_print("\n[camcorder_create - type %d]\n", cam_info);
+ g_print("\n[camcorder_create - type %d, device %d]\n", camera_type, camera_device);
gettimeofday(&previous_time, NULL);
g_timer_reset(timer);
- err = camera_create(cam_info, &hcamcorder->camera);
+ if (camera_type)
+ err = camera_create_network(camera_device, &hcamcorder->camera);
+ else
+ err = camera_create(camera_device, &hcamcorder->camera);
g_print("[camera_create() : %12.6lfs]\n", g_timer_elapsed(timer, NULL));
while (!check) {
g_print("\n\tEnter the Display Type [1:Overlay, 2:Evas, 3:None] : ");
-
- err = scanf("%c", &display_type);
+ err = scanf("%d", &display_type);
flush_stdin();
if (err == EOF) {
g_print("\t!!!read input error!!!\n");
}
switch (display_type) {
- case '1':
+ case 1:
camera_set_display(hcamcorder->camera, CAMERA_DISPLAY_TYPE_OVERLAY, GET_DISPLAY(ad.win));
check = TRUE;
break;
- case '2':
+ case 2:
camera_set_display(hcamcorder->camera, CAMERA_DISPLAY_TYPE_EVAS, GET_DISPLAY(ad.eo));
check = TRUE;
break;
- case '3':
+ case 3:
camera_set_display(hcamcorder->camera, CAMERA_DISPLAY_TYPE_NONE, NULL);
check = TRUE;
break;
default:
- g_print("\t Invalid display type(%c)\n", display_type);
+ g_print("\t Invalid display type(%d)\n", display_type);
break;
}
}