Lines Matching refs:my_obj
52 int32_t mm_camera_evt_sub(mm_camera_obj_t * my_obj,
54 int32_t mm_camera_enqueue_evt(mm_camera_obj_t *my_obj,
120 mm_camera_obj_t * my_obj = (mm_camera_obj_t *)user_data;
121 if (NULL != my_obj) {
122 pthread_mutex_lock(&my_obj->cb_lock);
124 if(my_obj->evt.evt[i].evt_cb) {
125 my_obj->evt.evt[i].evt_cb(
126 my_obj->my_hdl,
128 my_obj->evt.evt[i].user_data);
131 pthread_mutex_unlock(&my_obj->cb_lock);
154 mm_camera_obj_t *my_obj = (mm_camera_obj_t*)user_data;
155 if (NULL != my_obj) {
158 rc = ioctl(my_obj->ctrl_fd, VIDIOC_DQEVENT, &ev);
165 mm_camera_enqueue_evt(my_obj, &evt);
168 pthread_mutex_lock(&my_obj->evt_lock);
169 my_obj->evt_rcvd.server_event_type = msm_evt->command;
170 my_obj->evt_rcvd.status = msm_evt->status;
171 pthread_cond_signal(&my_obj->evt_cond);
172 pthread_mutex_unlock(&my_obj->evt_lock);
177 mm_camera_enqueue_evt(my_obj, &evt);
194 * @my_obj : ptr to a camera object
201 int32_t mm_camera_enqueue_evt(mm_camera_obj_t *my_obj,
214 cam_queue_enq(&(my_obj->evt_thread.cmd_queue), node);
216 cam_sem_post(&(my_obj->evt_thread.cmd_sem));
231 * @my_obj : ptr to a camera object
237 int32_t mm_camera_open(mm_camera_obj_t *my_obj)
247 if (NULL == my_obj) {
251 mm_camera_util_get_dev_name(my_obj->my_hdl));
258 my_obj->ctrl_fd = open(dev_name, O_RDWR | O_NONBLOCK);
259 CDBG("%s: ctrl_fd = %d, errno == %d", __func__, my_obj->ctrl_fd, errno);
260 if((my_obj->ctrl_fd >= 0) || (errno != EIO && errno != ETIMEDOUT) || (n_try <= 0 )) {
269 if (my_obj->ctrl_fd < 0) {
280 my_obj->ds_fd = mm_camera_socket_create(cam_idx, MM_CAMERA_SOCK_TYPE_UDP);
281 CDBG("%s: ds_fd = %d, errno = %d", __func__, my_obj->ds_fd, errno);
282 if((my_obj->ds_fd >= 0) || (n_try <= 0 )) {
291 if (my_obj->ds_fd < 0) {
297 pthread_mutex_init(&my_obj->msg_lock, NULL);
299 pthread_mutex_init(&my_obj->cb_lock, NULL);
300 pthread_mutex_init(&my_obj->evt_lock, NULL);
301 pthread_cond_init(&my_obj->evt_cond, NULL);
304 mm_camera_cmd_thread_launch(&my_obj->evt_thread,
306 (void *)my_obj);
311 mm_camera_poll_thread_launch(&my_obj->evt_poll_thread,
313 mm_camera_evt_sub(my_obj, TRUE);
321 if (NULL == my_obj) {
325 if (my_obj->ctrl_fd >= 0) {
326 close(my_obj->ctrl_fd);
327 my_obj->ctrl_fd = -1;
329 if (my_obj->ds_fd >= 0) {
330 mm_camera_socket_close(my_obj->ds_fd);
331 my_obj->ds_fd = -1;
347 * @my_obj : ptr to a camera object
354 int32_t mm_camera_close(mm_camera_obj_t *my_obj)
357 mm_camera_evt_sub(my_obj, FALSE);
360 mm_camera_poll_thread_release(&my_obj->evt_poll_thread);
363 mm_camera_cmd_thread_release(&my_obj->evt_thread);
365 if(my_obj->ctrl_fd >= 0) {
366 close(my_obj->ctrl_fd);
367 my_obj->ctrl_fd = -1;
369 if(my_obj->ds_fd >= 0) {
370 mm_camera_socket_close(my_obj->ds_fd);
371 my_obj->ds_fd = -1;
373 pthread_mutex_destroy(&my_obj->msg_lock);
375 pthread_mutex_destroy(&my_obj->cb_lock);
376 pthread_mutex_destroy(&my_obj->evt_lock);
377 pthread_cond_destroy(&my_obj->evt_cond);
379 pthread_mutex_unlock(&my_obj->cam_lock);
391 * @my_obj : ptr to a camera object
398 int32_t mm_camera_close_fd(mm_camera_obj_t *my_obj)
400 if(my_obj->ctrl_fd >= 0) {
401 close(my_obj->ctrl_fd);
402 my_obj->ctrl_fd = -1;
404 if(my_obj->ds_fd >= 0) {
405 mm_camera_socket_close(my_obj->ds_fd);
406 my_obj->ds_fd = -1;
408 pthread_mutex_unlock(&my_obj->cam_lock);
418 * @my_obj : ptr to a camera object
426 int32_t mm_camera_register_event_notify_internal(mm_camera_obj_t *my_obj,
434 pthread_mutex_lock(&my_obj->cb_lock);
435 evt_array = &my_obj->evt;
460 pthread_mutex_unlock(&my_obj->cb_lock);
470 * @my_obj : ptr to a camera object
478 int32_t mm_camera_register_event_notify(mm_camera_obj_t *my_obj,
483 rc = mm_camera_register_event_notify_internal(my_obj,
486 pthread_mutex_unlock(&my_obj->cam_lock);
496 * @my_obj : camera object
504 int32_t mm_camera_qbuf(mm_camera_obj_t *my_obj,
510 ch_obj = mm_camera_util_get_channel_by_handler(my_obj, ch_id);
512 pthread_mutex_unlock(&my_obj->cam_lock);
530 * @my_obj: camera object
536 int32_t mm_camera_query_capability(mm_camera_obj_t *my_obj)
543 rc = ioctl(my_obj->ctrl_fd, VIDIOC_QUERYCAP, &cap);
548 pthread_mutex_unlock(&my_obj->cam_lock);
559 * @my_obj : camera object
569 int32_t mm_camera_set_parms(mm_camera_obj_t *my_obj,
575 rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd, CAM_PRIV_PARM, &value);
577 pthread_mutex_unlock(&my_obj->cam_lock);
587 * @my_obj : camera object
599 int32_t mm_camera_get_parms(mm_camera_obj_t *my_obj,
605 rc = mm_camera_util_g_ctrl(my_obj->ctrl_fd, CAM_PRIV_PARM, &value);
607 pthread_mutex_unlock(&my_obj->cam_lock);
625 int32_t mm_camera_do_auto_focus(mm_camera_obj_t *my_obj)
629 rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd, CAM_PRIV_DO_AUTO_FOCUS, &value);
630 pthread_mutex_unlock(&my_obj->cam_lock);
646 int32_t mm_camera_cancel_auto_focus(mm_camera_obj_t *my_obj)
650 rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd, CAM_PRIV_CANCEL_AUTO_FOCUS, &value);
651 pthread_mutex_unlock(&my_obj->cam_lock);
661 * @my_obj : camera object
668 int32_t mm_camera_prepare_snapshot(mm_camera_obj_t *my_obj,
673 rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd, CAM_PRIV_PREPARE_SNAPSHOT, &value);
674 pthread_mutex_unlock(&my_obj->cam_lock);
684 * @my_obj : camera object
690 int32_t mm_camera_start_zsl_snapshot(mm_camera_obj_t *my_obj)
695 rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd,
706 * @my_obj : camera object
712 int32_t mm_camera_stop_zsl_snapshot(mm_camera_obj_t *my_obj)
716 rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd,
727 * @my_obj : camera object
740 uint32_t mm_camera_add_channel(mm_camera_obj_t *my_obj,
750 if (MM_CHANNEL_STATE_NOTUSED == my_obj->ch[ch_idx].state) {
751 ch_obj = &my_obj->ch[ch_idx];
762 ch_obj->cam_obj = my_obj;
767 pthread_mutex_unlock(&my_obj->cam_lock);
778 * @my_obj : camera object
787 int32_t mm_camera_del_channel(mm_camera_obj_t *my_obj,
792 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
796 pthread_mutex_unlock(&my_obj->cam_lock);
806 pthread_mutex_unlock(&my_obj->cam_lock);
817 * @my_obj : camera object
827 int32_t mm_camera_get_bundle_info(mm_camera_obj_t *my_obj,
833 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
837 pthread_mutex_unlock(&my_obj->cam_lock);
844 pthread_mutex_unlock(&my_obj->cam_lock);
855 * @my_obj : camera object
862 uint32_t mm_camera_add_stream(mm_camera_obj_t *my_obj,
867 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
871 pthread_mutex_unlock(&my_obj->cam_lock);
878 pthread_mutex_unlock(&my_obj->cam_lock);
890 * @my_obj : camera object
899 int32_t mm_camera_del_stream(mm_camera_obj_t *my_obj,
905 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
909 pthread_mutex_unlock(&my_obj->cam_lock);
916 pthread_mutex_unlock(&my_obj->cam_lock);
928 * @my_obj : camera object
935 int32_t mm_camera_start_zsl_snapshot_ch(mm_camera_obj_t *my_obj,
940 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
944 pthread_mutex_unlock(&my_obj->cam_lock);
951 pthread_mutex_unlock(&my_obj->cam_lock);
963 * @my_obj : camera object
970 int32_t mm_camera_stop_zsl_snapshot_ch(mm_camera_obj_t *my_obj,
975 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
979 my_obj->cam_lock);
986 pthread_mutex_unlock(&my_obj->cam_lock);
998 * @my_obj : camera object
1007 int32_t mm_camera_config_stream(mm_camera_obj_t *my_obj,
1014 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1019 pthread_mutex_unlock(&my_obj->cam_lock);
1029 pthread_mutex_unlock(&my_obj->cam_lock);
1041 * @my_obj : camera object
1048 int32_t mm_camera_start_channel(mm_camera_obj_t *my_obj,
1053 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1057 pthread_mutex_unlock(&my_obj->cam_lock);
1064 pthread_mutex_unlock(&my_obj->cam_lock);
1076 * @my_obj : camera object
1083 int32_t mm_camera_stop_channel(mm_camera_obj_t *my_obj,
1088 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1092 pthread_mutex_unlock(&my_obj->cam_lock);
1099 pthread_mutex_unlock(&my_obj->cam_lock);
1111 * @my_obj : camera object
1119 int32_t mm_camera_request_super_buf(mm_camera_obj_t *my_obj,
1126 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1130 pthread_mutex_unlock(&my_obj->cam_lock);
1137 pthread_mutex_unlock(&my_obj->cam_lock);
1150 * @my_obj : camera object
1157 int32_t mm_camera_cancel_super_buf_request(mm_camera_obj_t *my_obj, uint32_t ch_id)
1161 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1165 pthread_mutex_unlock(&my_obj->cam_lock);
1172 pthread_mutex_unlock(&my_obj->cam_lock);
1184 * @my_obj : camera object
1191 int32_t mm_camera_flush_super_buf_queue(mm_camera_obj_t *my_obj, uint32_t ch_id,
1196 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1200 pthread_mutex_unlock(&my_obj->cam_lock);
1207 pthread_mutex_unlock(&my_obj->cam_lock);
1219 * @my_obj : camera object
1227 int32_t mm_camera_config_channel_notify(mm_camera_obj_t *my_obj,
1233 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1237 pthread_mutex_unlock(&my_obj->cam_lock);
1244 pthread_mutex_unlock(&my_obj->cam_lock);
1256 * @my_obj : camera object
1268 int32_t mm_camera_set_stream_parms(mm_camera_obj_t *my_obj,
1276 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1280 pthread_mutex_unlock(&my_obj->cam_lock);
1291 pthread_mutex_unlock(&my_obj->cam_lock);
1303 * @my_obj : camera object
1317 int32_t mm_camera_get_stream_parms(mm_camera_obj_t *my_obj,
1325 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1329 pthread_mutex_unlock(&my_obj->cam_lock);
1340 pthread_mutex_unlock(&my_obj->cam_lock);
1353 * @my_obj : camera object
1365 int32_t mm_camera_do_stream_action(mm_camera_obj_t *my_obj,
1373 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1377 pthread_mutex_unlock(&my_obj->cam_lock);
1388 pthread_mutex_unlock(&my_obj->cam_lock);
1400 * @my_obj : camera object
1420 int32_t mm_camera_map_stream_buf(mm_camera_obj_t *my_obj,
1432 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1436 pthread_mutex_unlock(&my_obj->cam_lock);
1450 pthread_mutex_unlock(&my_obj->cam_lock);
1462 * @my_obj : camera object
1480 int32_t mm_camera_unmap_stream_buf(mm_camera_obj_t *my_obj,
1490 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1494 pthread_mutex_unlock(&my_obj->cam_lock);
1506 pthread_mutex_unlock(&my_obj->cam_lock);
1518 * @my_obj : camera object
1525 int32_t mm_camera_evt_sub(mm_camera_obj_t * my_obj,
1536 rc = ioctl(my_obj->ctrl_fd, VIDIOC_UNSUBSCRIBE_EVENT, &sub);
1542 rc = mm_camera_poll_thread_del_poll_fd(&my_obj->evt_poll_thread,
1543 my_obj->my_hdl,
1546 rc = ioctl(my_obj->ctrl_fd, VIDIOC_SUBSCRIBE_EVENT, &sub);
1552 rc = mm_camera_poll_thread_add_poll_fd(&my_obj->evt_poll_thread,
1553 my_obj->my_hdl,
1554 my_obj->ctrl_fd,
1556 (void*)my_obj,
1568 * @my_obj : camera object
1575 void mm_camera_util_wait_for_event(mm_camera_obj_t *my_obj,
1579 pthread_mutex_lock(&my_obj->evt_lock);
1580 while (!(my_obj->evt_rcvd.server_event_type & evt_mask)) {
1581 pthread_cond_wait(&my_obj->evt_cond, &my_obj->evt_lock);
1583 *status = my_obj->evt_rcvd.status;
1585 memset(&my_obj->evt_rcvd, 0, sizeof(mm_camera_event_t));
1586 pthread_mutex_unlock(&my_obj->evt_lock);
1595 * @my_obj : camera object
1604 int32_t mm_camera_util_sendmsg(mm_camera_obj_t *my_obj,
1613 pthread_mutex_lock(&my_obj->msg_lock);
1614 if(mm_camera_socket_sendmsg(my_obj->ds_fd, msg, buf_size, sendfd) > 0) {
1616 mm_camera_util_wait_for_event(my_obj, CAM_EVENT_TYPE_MAP_UNMAP_DONE, &status);
1621 pthread_mutex_unlock(&my_obj->msg_lock);
1631 * @my_obj : camera object
1643 int32_t mm_camera_map_buf(mm_camera_obj_t *my_obj,
1655 rc = mm_camera_util_sendmsg(my_obj,
1659 pthread_mutex_unlock(&my_obj->cam_lock);
1669 * @my_obj : camera object
1679 int32_t mm_camera_unmap_buf(mm_camera_obj_t *my_obj,
1687 rc = mm_camera_util_sendmsg(my_obj,
1691 pthread_mutex_unlock(&my_obj->cam_lock);
1767 * @my_obj : camera object
1776 int32_t mm_camera_channel_advanced_capture(mm_camera_obj_t *my_obj,
1784 mm_camera_util_get_channel_by_handler(my_obj, ch_id);
1788 pthread_mutex_unlock(&my_obj->cam_lock);
1819 pthread_mutex_unlock(&my_obj->cam_lock);