2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <camera_internal.h>
24 #include <camera_private.h>
31 #define LOG_TAG "TIZEN_N_CAMERA"
33 #define LIB_CAMERA_DEVICE_MANAGER PATH_LIBDIR"/libcamera_device_manager.so"
35 typedef struct _cdm_symbol_table {
37 const char *func_name;
42 int camera_start_evas_rendering(camera_h camera)
44 return _camera_start_evas_rendering(camera);
48 int camera_stop_evas_rendering(camera_h camera, bool keep_screen)
50 return _camera_stop_evas_rendering(camera, keep_screen);
54 int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window)
56 return _camera_set_display(camera, MM_DISPLAY_TYPE_OVERLAY_EXT, ecore_wl_window);
61 void camera_create_preview_frame(camera_stream_data_s *stream, int num_buffer_fd,
62 tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
65 unsigned char *buf_pos = NULL;
67 if (!stream || !buffer_bo_handle || !frame) {
68 CAM_LOG_ERROR("invalid param %p,%p,%p", stream, buffer_bo_handle, frame);
73 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
74 frame->format = MM_PIXEL_FORMAT_UYVY;
76 frame->format = stream->format;
78 frame->width = stream->width;
79 frame->height = stream->height;
80 frame->timestamp = stream->timestamp;
81 frame->num_of_planes = stream->num_planes;
83 if (num_buffer_fd == 0) {
86 if (!data_bo_handle || !data_bo_handle->ptr) {
87 CAM_LOG_ERROR("NULL pointer");
91 buf_pos = data_bo_handle->ptr;
93 switch (stream->format) {
94 case MM_PIXEL_FORMAT_ENCODED_H264:
96 case MM_PIXEL_FORMAT_ENCODED_MJPEG:
98 case MM_PIXEL_FORMAT_ENCODED_VP8:
100 case MM_PIXEL_FORMAT_ENCODED_VP9:
101 frame->data.encoded_plane.data = buf_pos;
102 frame->data.encoded_plane.size = stream->data.encoded.length_data;
103 frame->data.encoded_plane.is_delta_frame = (bool)stream->data.encoded.is_delta_frame;
104 total_size = stream->data.encoded.length_data;
107 case MM_PIXEL_FORMAT_INVZ:
108 frame->data.depth_plane.data = buf_pos;
109 frame->data.depth_plane.size = stream->data.depth.length_data;
110 total_size = stream->data.depth.length_data;
113 case MM_PIXEL_FORMAT_RGBA:
115 case MM_PIXEL_FORMAT_ARGB:
116 frame->data.rgb_plane.data = buf_pos;
117 frame->data.rgb_plane.size = stream->data.rgb.length_data;
118 total_size = stream->data.rgb.length_data;
122 switch (stream->num_planes) {
124 frame->data.single_plane.yuv = buf_pos;
125 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
126 total_size = stream->data.yuv420.length_yuv;
129 frame->data.double_plane.y = buf_pos;
130 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
131 buf_pos += stream->data.yuv420sp.length_y;
132 frame->data.double_plane.uv = buf_pos;
133 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
134 total_size = stream->data.yuv420sp.length_y + \
135 stream->data.yuv420sp.length_uv;
138 frame->data.triple_plane.y = buf_pos;
139 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
140 buf_pos += stream->data.yuv420p.length_y;
141 frame->data.triple_plane.u = buf_pos;
142 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
143 buf_pos += stream->data.yuv420p.length_u;
144 frame->data.triple_plane.v = buf_pos;
145 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
146 total_size = stream->data.yuv420p.length_y + \
147 stream->data.yuv420p.length_u + \
148 stream->data.yuv420p.length_v;
158 switch (stream->num_planes) {
161 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
162 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
163 total_size = stream->data.yuv420.length_yuv;
167 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
168 if (stream->num_planes == (unsigned int)num_buffer_fd)
169 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
171 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
172 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
173 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
174 total_size = stream->data.yuv420sp.length_y + \
175 stream->data.yuv420sp.length_uv;
179 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
180 if (stream->num_planes == (unsigned int)num_buffer_fd) {
181 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
182 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
184 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
185 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
187 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
188 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
189 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
190 total_size = stream->data.yuv420p.length_y + \
191 stream->data.yuv420p.length_u + \
192 stream->data.yuv420p.length_v;
200 CAM_LOG_DEBUG("format[%d], res[%dx%d], size[%d], plane num[%d]",
201 frame->format, frame->width, frame->height, total_size, frame->num_of_planes);
205 int camera_create_network(camera_device_e device, camera_h *camera)
207 return _camera_create_private(device, true, camera);
211 int camera_device_manager_initialize(camera_device_manager_h *manager)
214 int ret = CAMERA_ERROR_NONE;
215 void *dl_handle = NULL;
216 camera_device_manager *new_manager = g_new0(camera_device_manager, 1);
217 cdm_symbol_table sym_table[] = {
218 {(void **)&new_manager->initialize, "cdm_initialize"},
219 {(void **)&new_manager->deinitialize, "cdm_deinitialize"},
220 {(void **)&new_manager->get_device_list, "cdm_get_device_list"},
221 {(void **)&new_manager->add_device_connection_changed_cb, "cdm_add_device_connection_changed_cb"},
222 {(void **)&new_manager->remove_device_connection_changed_cb, "cdm_remove_device_connection_changed_cb"},
226 CAM_LOG_ERROR("NULL manager");
227 ret = CAMERA_ERROR_INVALID_PARAMETER;
228 goto _INITIALIZE_FAILED;
231 dl_handle = dlopen(LIB_CAMERA_DEVICE_MANAGER, RTLD_NOW);
233 CAM_LOG_ERROR("dlopen[%s] failed[%s]", LIB_CAMERA_DEVICE_MANAGER, dlerror());
234 ret = CAMERA_ERROR_NOT_SUPPORTED;
235 goto _INITIALIZE_FAILED;
239 for (i = 0 ; i < G_N_ELEMENTS(sym_table) ; i++) {
240 *sym_table[i].func_ptr = dlsym(dl_handle, sym_table[i].func_name);
241 if (*sym_table[i].func_ptr == NULL) {
242 CAM_LOG_ERROR("symbol failed[%s]", sym_table[i].func_name);
243 ret = CAMERA_ERROR_INVALID_OPERATION;
244 goto _INITIALIZE_FAILED;
248 ret = new_manager->initialize();
249 if (ret != CAMERA_ERROR_NONE) {
250 CAM_LOG_ERROR("failed[0x%x]", ret);
251 goto _INITIALIZE_FAILED;
254 new_manager->dl_handle = dl_handle;
255 *manager = (camera_device_manager_h)new_manager;
257 CAM_LOG_INFO("camera device manager[%p]", new_manager);
259 return CAMERA_ERROR_NONE;
269 int camera_device_manager_deinitialize(camera_device_manager_h manager)
271 int ret = CAMERA_ERROR_NONE;
272 camera_device_manager *m = (camera_device_manager *)manager;
275 CAM_LOG_ERROR("NULL manager");
276 return CAMERA_ERROR_INVALID_PARAMETER;
279 ret = m->deinitialize();
280 if (ret != CAMERA_ERROR_NONE) {
281 CAM_LOG_ERROR("failed[0x%x]", ret);
285 dlclose(m->dl_handle);
286 memset(m, 0x0, sizeof(camera_device_manager));
289 CAM_LOG_INFO("finalized");
291 return CAMERA_ERROR_NONE;
295 int camera_device_manager_get_device_list(camera_device_manager_h manager, camera_device_list_s *list)
297 int ret = CAMERA_ERROR_NONE;
299 camera_device_manager *m = (camera_device_manager *)manager;
302 CAM_LOG_ERROR("NULL parameter[%p,%p]", m, list);
303 return CAMERA_ERROR_INVALID_PARAMETER;
306 CAM_LOG_INFO("enter");
308 ret = m->get_device_list(list);
309 if (ret != CAMERA_ERROR_NONE) {
310 CAM_LOG_ERROR("failed[0x%x]", ret);
314 CAM_LOG_INFO("device count[%d]", list->count);
316 for (i = 0 ; i < list->count ; i++) {
317 CAM_LOG_INFO(" [%d] : type[%d], device index[%d], name[%s], id[%s]",
318 i, list->device[i].type, list->device[i].index,
319 list->device[i].name, list->device[i].id);
322 return CAMERA_ERROR_NONE;
326 int camera_device_manager_add_device_connection_changed_cb(camera_device_manager_h manager,
327 camera_device_connection_changed_cb callback, void *user_data, int *cb_id)
329 int ret = CAMERA_ERROR_NONE;
330 camera_device_manager *m = (camera_device_manager *)manager;
332 if (!m || !callback || !cb_id) {
333 CAM_LOG_ERROR("NULL parameter[%p,%p,%p]", m, callback, cb_id);
334 return CAMERA_ERROR_INVALID_PARAMETER;
337 CAM_LOG_INFO("enter");
339 ret = m->add_device_connection_changed_cb(callback, user_data, cb_id);
340 if (ret != CAMERA_ERROR_NONE) {
341 CAM_LOG_ERROR("failed[0x%x]", ret);
345 CAM_LOG_INFO("cb_id[%d] added", *cb_id);
347 return CAMERA_ERROR_NONE;
351 int camera_device_manager_remove_device_connection_changed_cb(camera_device_manager_h manager, int cb_id)
353 int ret = CAMERA_ERROR_NONE;
354 camera_device_manager *m = (camera_device_manager *)manager;
357 CAM_LOG_ERROR("NULL manager");
358 return CAMERA_ERROR_INVALID_PARAMETER;
361 CAM_LOG_INFO("enter - cb_id[%d]", cb_id);
363 ret = m->remove_device_connection_changed_cb(cb_id);
364 if (ret != CAMERA_ERROR_NONE) {
365 CAM_LOG_ERROR("failed[0x%x]", ret);
369 CAM_LOG_INFO("cb_id[%d] removed", cb_id);
371 return CAMERA_ERROR_NONE;
375 int camera_attr_set_flash_brightness(camera_h camera, int level)
377 int ret = CAMERA_ERROR_NONE;
378 camera_cli_s *pc = (camera_cli_s *)camera;
379 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_BRIGHTNESS;
380 camera_msg_param param;
382 if (!pc || !pc->cb_info) {
383 CAM_LOG_ERROR("NULL handle");
384 return CAMERA_ERROR_INVALID_PARAMETER;
387 CAM_LOG_INFO("Enter");
389 CAMERA_MSG_PARAM_SET(param, INT, level);
391 _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
393 CAM_LOG_INFO("ret : 0x%x", ret);
399 int camera_attr_get_flash_brightness(camera_h camera, int *level)
401 int ret = CAMERA_ERROR_NONE;
402 camera_cli_s *pc = (camera_cli_s *)camera;
403 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_BRIGHTNESS;
405 if (!pc || !pc->cb_info || !level) {
406 CAM_LOG_ERROR("NULL pointer %p %p", pc, level);
407 return CAMERA_ERROR_INVALID_PARAMETER;
410 CAM_LOG_INFO("Enter");
412 _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
414 if (ret == CAMERA_ERROR_NONE)
415 *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_FLASH_BRIGHTNESS];
417 CAM_LOG_INFO("ret : 0x%x", ret);
423 int camera_attr_get_flash_brightness_range(camera_h camera, int *min, int *max)
425 int ret = CAMERA_ERROR_NONE;
426 camera_cli_s *pc = (camera_cli_s *)camera;
427 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_BRIGHTNESS_RANGE;
429 if (!pc || !pc->cb_info || !min || !max) {
430 CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
431 return CAMERA_ERROR_INVALID_PARAMETER;
434 CAM_LOG_INFO("Enter");
436 _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
438 if (ret == CAMERA_ERROR_NONE) {
439 *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_FLASH_BRIGHTNESS_RANGE][0];
440 *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_FLASH_BRIGHTNESS_RANGE][1];
443 CAM_LOG_INFO("ret : 0x%x", ret);
449 int camera_attr_set_focus_level(camera_h camera, int level)
451 int ret = CAMERA_ERROR_NONE;
452 camera_cli_s *pc = (camera_cli_s *)camera;
453 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FOCUS_LEVEL;
454 camera_msg_param param;
456 if (!pc || !pc->cb_info) {
457 CAM_LOG_ERROR("NULL handle");
458 return CAMERA_ERROR_INVALID_PARAMETER;
461 CAM_LOG_INFO("Enter");
463 CAMERA_MSG_PARAM_SET(param, INT, level);
465 _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
467 CAM_LOG_INFO("ret : 0x%x", ret);
473 int camera_attr_get_focus_level(camera_h camera, int *level)
475 int ret = CAMERA_ERROR_NONE;
476 camera_cli_s *pc = (camera_cli_s *)camera;
477 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FOCUS_LEVEL;
479 if (!pc || !pc->cb_info || !level) {
480 CAM_LOG_ERROR("NULL pointer %p %p", pc, level);
481 return CAMERA_ERROR_INVALID_PARAMETER;
484 CAM_LOG_INFO("Enter");
486 _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
488 if (ret == CAMERA_ERROR_NONE)
489 *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_FOCUS_LEVEL];
491 CAM_LOG_INFO("ret : 0x%x", ret);
497 int camera_attr_get_focus_level_range(camera_h camera, int *min, int *max)
499 int ret = CAMERA_ERROR_NONE;
500 camera_cli_s *pc = (camera_cli_s *)camera;
501 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FOCUS_LEVEL_RANGE;
503 if (!pc || !pc->cb_info || !min || !max) {
504 CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
505 return CAMERA_ERROR_INVALID_PARAMETER;
508 CAM_LOG_INFO("Enter");
510 _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
512 if (ret == CAMERA_ERROR_NONE) {
513 *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_FOCUS_LEVEL_RANGE][0];
514 *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_FOCUS_LEVEL_RANGE][1];
517 CAM_LOG_INFO("ret : 0x%x", ret);
523 int camera_set_extra_preview_cb(camera_h camera, camera_extra_preview_cb callback, void *user_data)
525 int ret = CAMERA_ERROR_NONE;
526 camera_cli_s *pc = (camera_cli_s *)camera;
527 muse_camera_api_e api = MUSE_CAMERA_API_SET_EXTRA_PREVIEW_CB;
529 if (!pc || !pc->cb_info || !callback) {
530 CAM_LOG_ERROR("NULL pointer %p %p", pc, callback);
531 return CAMERA_ERROR_INVALID_PARAMETER;
534 CAM_LOG_INFO("Enter");
536 _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
538 if (ret == CAMERA_ERROR_NONE) {
539 g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
541 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW] = callback;
542 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW] = user_data;
544 g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
547 CAM_LOG_INFO("ret : 0x%x", ret);
553 int camera_unset_extra_preview_cb(camera_h camera)
555 int ret = CAMERA_ERROR_NONE;
556 camera_cli_s *pc = (camera_cli_s *)camera;
557 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_EXTRA_PREVIEW_CB;
559 if (!pc || !pc->cb_info) {
560 CAM_LOG_ERROR("NULL handle");
561 return CAMERA_ERROR_INVALID_PARAMETER;
564 CAM_LOG_INFO("Enter");
566 _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
568 if (ret == CAMERA_ERROR_NONE) {
569 g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
571 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW] = NULL;
572 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW] = NULL;
574 g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
577 CAM_LOG_INFO("ret : 0x%x", ret);
583 int camera_set_extra_preview_stream_format(camera_h camera, int stream_id, camera_pixel_format_e pixel_format, int width, int height, int fps)
585 int ret = CAMERA_ERROR_NONE;
587 int stream_format[4] = {pixel_format, width, height, fps};
589 camera_cli_s *pc = (camera_cli_s *)camera;
590 muse_camera_api_e api = MUSE_CAMERA_API_SET_EXTRA_PREVIEW_STREAM_FORMAT;
592 if (!pc || !pc->cb_info) {
593 CAM_LOG_ERROR("NULL handle");
594 return CAMERA_ERROR_INVALID_PARAMETER;
597 CAM_LOG_INFO("Enter - stream_id[%d],[%d,%dx%d,%d]",
598 stream_id, pixel_format, width, height, fps);
600 msg = muse_core_msg_new(api,
601 MUSE_TYPE_INT, "stream_id", stream_id,
602 MUSE_TYPE_ARRAY, "stream_format", 4, stream_format,
605 CAM_LOG_ERROR("msg creation failed: api %d", api);
606 return CAMERA_ERROR_OUT_OF_MEMORY;
609 if (pc->cb_info->is_server_connected) {
610 _camera_update_api_waiting(pc->cb_info, api, 1);
612 g_mutex_lock(&pc->cb_info->fd_lock);
613 send_ret = muse_core_msg_send(pc->cb_info->fd, msg);
614 g_mutex_unlock(&pc->cb_info->fd_lock);
618 CAM_LOG_ERROR("message send failed");
619 ret = CAMERA_ERROR_INVALID_OPERATION;
621 ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
624 _camera_update_api_waiting(pc->cb_info, api, -1);
626 muse_core_msg_free(msg);
628 CAM_LOG_INFO("ret : 0x%x", ret);
634 int camera_get_extra_preview_stream_format(camera_h camera, int stream_id, camera_pixel_format_e *pixel_format, int *width, int *height, int *fps)
636 int ret = CAMERA_ERROR_NONE;
637 camera_cli_s *pc = (camera_cli_s *)camera;
638 camera_msg_param param;
639 muse_camera_api_e api = MUSE_CAMERA_API_GET_EXTRA_PREVIEW_STREAM_FORMAT;
641 if (!pc || !pc->cb_info || !pixel_format || !width || !height || !fps) {
642 CAM_LOG_ERROR("NULL pointer %p %p %p %p %p", pc, pixel_format, width, height, fps);
643 return CAMERA_ERROR_INVALID_PARAMETER;
646 CAM_LOG_INFO("Enter - stream_id[%d]", stream_id);
648 CAMERA_MSG_PARAM_SET(param, INT, stream_id);
650 _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
652 if (ret == CAMERA_ERROR_NONE) {
653 *pixel_format = (camera_pixel_format_e)pc->cb_info->get_extra_preview_stream_format[0];
654 *width = pc->cb_info->get_extra_preview_stream_format[1];
655 *height = pc->cb_info->get_extra_preview_stream_format[2];
656 *fps = pc->cb_info->get_extra_preview_stream_format[3];
659 CAM_LOG_INFO("ret : 0x%x", ret);
665 int camera_attr_set_extra_preview_bitrate(camera_h camera, int stream_id, int bitrate)
667 int ret = CAMERA_ERROR_NONE;
668 camera_cli_s *pc = (camera_cli_s *)camera;
669 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXTRA_PREVIEW_BITRATE;
670 camera_msg_param param0;
671 camera_msg_param param1;
673 if (!pc || !pc->cb_info) {
674 CAM_LOG_ERROR("NULL handle");
675 return CAMERA_ERROR_INVALID_PARAMETER;
678 CAM_LOG_INFO("Enter - stream_id[%d], bitrate[%d]", stream_id, bitrate);
680 CAMERA_MSG_PARAM_SET(param0, INT, stream_id);
681 CAMERA_MSG_PARAM_SET(param1, INT, bitrate);
683 _camera_msg_send_param2_int(api, pc->cb_info, &ret,
684 ¶m0, ¶m1, CAMERA_CB_TIMEOUT);
686 CAM_LOG_INFO("ret : 0x%x", ret);
692 int camera_attr_get_extra_preview_bitrate(camera_h camera, int stream_id, int *bitrate)
694 int ret = CAMERA_ERROR_NONE;
695 camera_cli_s *pc = (camera_cli_s *)camera;
696 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_BITRATE;
697 camera_msg_param param;
699 if (!pc || !pc->cb_info || !bitrate) {
700 CAM_LOG_ERROR("NULL pointer %p %p", pc, bitrate);
701 return CAMERA_ERROR_INVALID_PARAMETER;
704 CAM_LOG_INFO("Enter - stream_id[%d]", stream_id);
706 CAMERA_MSG_PARAM_SET(param, INT, stream_id);
708 _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
710 if (ret == CAMERA_ERROR_NONE) {
711 *bitrate = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXTRA_PREVIEW_BITRATE];
712 CAM_LOG_INFO("get bitrate[%d] for stream[%d]", *bitrate, stream_id);
714 CAM_LOG_ERROR("get bitrate failed for stream[%d] : 0x%x", stream_id, ret);