Home | History | Annotate | Download | only in src

Lines Matching refs:my_obj

47 int32_t mm_stream_qbuf(mm_stream_t *my_obj,
49 int32_t mm_stream_set_ext_mode(mm_stream_t * my_obj);
50 int32_t mm_stream_set_fmt(mm_stream_t * my_obj);
51 int32_t mm_stream_get_offset(mm_stream_t *my_obj);
52 int32_t mm_stream_set_cid(mm_stream_t *my_obj,stream_cid_t *in_value);
53 int32_t mm_stream_init_bufs(mm_stream_t * my_obj);
54 int32_t mm_stream_deinit_bufs(mm_stream_t * my_obj);
55 int32_t mm_stream_request_buf(mm_stream_t * my_obj);
56 int32_t mm_stream_unreg_buf(mm_stream_t * my_obj);
57 int32_t mm_stream_release(mm_stream_t *my_obj);
58 int32_t mm_stream_get_crop(mm_stream_t *my_obj,
60 int32_t mm_stream_get_cid(mm_stream_t *my_obj,
62 int32_t mm_stream_set_parm_acquire(mm_stream_t *my_obj,
64 int32_t mm_stream_get_parm_acquire(mm_stream_t *my_obj,
66 int32_t mm_stream_set_parm_config(mm_stream_t *my_obj,
68 int32_t mm_stream_get_parm_config(mm_stream_t *my_obj,
70 int32_t mm_stream_set_parm_start(mm_stream_t *my_obj,
72 int32_t mm_stream_get_parm_start(mm_stream_t *my_obj,
74 int32_t mm_stream_streamon(mm_stream_t *my_obj);
75 int32_t mm_stream_streamoff(mm_stream_t *my_obj);
76 int32_t mm_stream_read_msm_frame(mm_stream_t * my_obj,
78 int32_t mm_stream_config(mm_stream_t *my_obj,
80 int32_t mm_stream_reg_buf(mm_stream_t * my_obj);
81 int32_t mm_stream_buf_done(mm_stream_t * my_obj,
86 int32_t mm_stream_fsm_inited(mm_stream_t * my_obj,
90 int32_t mm_stream_fsm_acquired(mm_stream_t * my_obj,
94 int32_t mm_stream_fsm_cfg(mm_stream_t * my_obj,
98 int32_t mm_stream_fsm_buffed(mm_stream_t * my_obj,
102 int32_t mm_stream_fsm_reg(mm_stream_t * my_obj,
106 int32_t mm_stream_fsm_active_stream_on(mm_stream_t * my_obj,
110 int32_t mm_stream_fsm_active_stream_off(mm_stream_t * my_obj,
115 extern int32_t mm_camera_send_native_ctrl_cmd(mm_camera_obj_t * my_obj,
120 static int get_stream_inst_handle(mm_stream_t *my_obj)
129 rc = ioctl(my_obj->fd, MSM_CAM_V4L2_IOCTL_PRIVATE_G_CTRL, &v4l2_ioctl);
135 my_obj->inst_hdl = inst_handle;
138 __func__, my_obj->inst_hdl, my_obj->my_hdl,
139 my_obj->ext_image_mode, my_obj->fd, my_obj->state, rc);
143 void mm_stream_handle_rcvd_buf(mm_stream_t *my_obj,
150 __func__, my_obj->inst_hdl, my_obj->my_hdl,
151 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
154 if (my_obj->is_bundled) {
165 mm_camera_queue_enq(&(my_obj->ch_obj->cmd_thread.cmd_queue), node);
168 sem_post(&(my_obj->ch_obj->cmd_thread.cmd_sem));
176 if(NULL != my_obj->buf_cb[i].cb) {
191 mm_camera_queue_enq(&(my_obj->cmd_thread.cmd_queue), node);
194 sem_post(&(my_obj->cmd_thread.cmd_sem));
203 mm_stream_t *my_obj = (mm_stream_t*)user_data;
208 if (NULL == my_obj) {
214 __func__, my_obj->inst_hdl, my_obj->my_hdl,
215 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
216 if (MM_STREAM_STATE_ACTIVE_STREAM_ON != my_obj->state) {
220 __func__, my_obj->state);
226 pthread_mutex_lock(&my_obj->buf_lock);
227 rc = mm_stream_read_msm_frame(my_obj, &buf_info);
229 pthread_mutex_unlock(&my_obj->buf_lock);
234 my_obj->buf_status[idx].in_kernel = 0;
237 if (my_obj->is_bundled) {
239 my_obj->buf_status[idx].buf_refcnt++;
243 if(NULL != my_obj->buf_cb[i].cb) {
245 my_obj->buf_status[idx].buf_refcnt++;
249 pthread_mutex_unlock(&my_obj->buf_lock);
251 mm_stream_handle_rcvd_buf(my_obj, &buf_info);
258 mm_stream_t * my_obj = (mm_stream_t*)user_data;
264 if (my_obj == NULL) {
269 __func__, my_obj->inst_hdl, my_obj->my_hdl,
270 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
272 if (MM_STREAM_STATE_ACTIVE_STREAM_OFF != my_obj->state) {
279 if (my_obj->buf_num <= 0) {
284 my_obj->buf[my_obj->local_buf_idx].buf_idx = 0;
285 my_obj->buf[my_obj->local_buf_idx].stream_id = my_obj->my_hdl;
286 my_obj->buf[my_obj->local_buf_idx].frame_idx = buf->frame_idx;
288 memcpy(&my_obj->buf[my_obj->local_buf_idx].ts, &buf->ts, sizeof(buf->ts));
290 memcpy(my_obj->buf[my_obj->local_buf_idx].buffer, buf->buffer, buf->frame_len);
293 my_obj->is_local_buf = 1;
296 mm_channel_qbuf(my_obj->ch_obj, buf);
300 buf_info.frame_idx =my_obj->buf[my_obj->local_buf_idx].frame_idx;
301 buf_info.buf = &my_obj->buf[my_obj->local_buf_idx];
302 buf_info.stream_id = my_obj->my_hdl;
304 my_obj->local_buf_idx++;
305 if (my_obj->local_buf_idx >= my_obj->buf_num) {
306 my_obj->local_buf_idx = 0;
308 mm_stream_handle_rcvd_buf(my_obj, &buf_info);
315 mm_stream_t * my_obj = (mm_stream_t *)user_data;
319 if (NULL == my_obj) {
324 __func__, my_obj->inst_hdl, my_obj->my_hdl,
325 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
337 super_buf.camera_handle = my_obj->ch_obj->cam_obj->my_hdl;
338 super_buf.ch_id = my_obj->ch_obj->my_hdl;
341 pthread_mutex_lock(&my_obj->cb_lock);
343 if(NULL != my_obj->buf_cb[i].cb) {
344 if (my_obj->buf_cb[i].cb_count != 0) {
348 my_obj->buf_cb[i].cb(&super_buf,
349 my_obj->buf_cb[i].user_data);
354 if (my_obj->buf_cb[i].cb_count > 0) {
355 my_obj->buf_cb[i].cb_count--;
356 if (0 == my_obj->buf_cb[i].cb_count) {
357 my_obj->buf_cb[i].cb = NULL;
358 my_obj->buf_cb[i].user_data = NULL;
363 pthread_mutex_unlock(&my_obj->cb_lock);
367 int32_t mm_stream_fsm_fn(mm_stream_t *my_obj,
376 __func__, my_obj->inst_hdl, my_obj->my_hdl,
377 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
378 switch (my_obj->state) {
383 rc = mm_stream_fsm_inited(my_obj, evt, in_val, out_val);
386 rc = mm_stream_fsm_acquired(my_obj, evt, in_val, out_val);
389 rc = mm_stream_fsm_cfg(my_obj, evt, in_val, out_val);
392 rc = mm_stream_fsm_buffed(my_obj, evt, in_val, out_val);
395 rc = mm_stream_fsm_reg(my_obj, evt, in_val, out_val);
398 rc = mm_stream_fsm_active_stream_on(my_obj, evt, in_val, out_val);
401 rc = mm_stream_fsm_active_stream_off(my_obj, evt, in_val, out_val);
404 CDBG("%s: Not a valid state (%d)", __func__, my_obj->state);
411 int32_t mm_stream_fsm_inited(mm_stream_t *my_obj,
421 __func__, my_obj->inst_hdl, my_obj->my_hdl,
422 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
425 if ((NULL == my_obj->ch_obj) || (NULL == my_obj->ch_obj->cam_obj)) {
432 mm_camera_util_get_dev_name(my_obj->ch_obj->cam_obj->my_hdl));
434 my_obj->fd = open(dev_name, O_RDWR | O_NONBLOCK);
435 if (my_obj->fd <= 0) {
436 CDBG_ERROR("%s: open dev returned %d\n", __func__, my_obj
441 __func__, my_obj->fd, my_obj->ext_image_mode, my_obj->sensor_idx);
442 rc = mm_stream_set_ext_mode(my_obj);
444 my_obj->state = MM_STREAM_STATE_ACQUIRED;
448 if(my_obj->fd > 0) {
449 close(my_obj->fd);
450 my_obj->fd = -1;
454 rc = get_stream_inst_handle(my_obj);
456 if(my_obj->fd > 0) {
457 close(my_obj->fd);
458 my_obj->fd = -1;
464 __func__,evt,my_obj->state);
470 int32_t mm_stream_fsm_acquired(mm_stream_t *my_obj,
479 __func__, my_obj->inst_hdl, my_obj->my_hdl,
480 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
487 rc = mm_stream_config(my_obj, config);
490 my_obj->state = MM_STREAM_STATE_CFG;
495 rc = mm_stream_release(my_obj);
497 my_obj->state = MM_STREAM_STATE_NOTUSED;
500 rc = mm_stream_set_parm_acquire(my_obj, in_val);
503 rc = mm_stream_get_parm_acquire(my_obj,out_val);
507 __func__, evt, my_obj->state);
513 int32_t mm_stream_fsm_cfg(mm_stream_t * my_obj,
521 __func__, my_obj->inst_hdl, my_obj->my_hdl,
522 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
529 rc = mm_stream_config(my_obj, config);
532 my_obj->state = MM_STREAM_STATE_CFG;
537 rc = mm_stream_release(my_obj);
538 my_obj->state = MM_STREAM_STATE_NOTUSED;
541 rc = mm_stream_set_parm_config(my_obj, in_val);
544 rc = mm_stream_get_parm_config(my_obj, out_val);
547 rc = mm_stream_init_bufs(my_obj);
550 my_obj->state = MM_STREAM_STATE_BUFFED;
555 __func__, evt, my_obj->state);
561 int32_t mm_stream_fsm_buffed(mm_stream_t * my_obj,
569 __func__, my_obj->inst_hdl, my_obj->my_hdl,
570 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
573 rc = mm_stream_deinit_bufs(my_obj);
576 my_obj->state = MM_STREAM_STATE_CFG;
580 rc = mm_stream_reg_buf(my_obj);
583 my_obj->state = MM_STREAM_STATE_REG;
587 rc = mm_stream_set_parm_config(my_obj, in_val);
590 rc = mm_stream_get_parm_config(my_obj, out_val);
594 __func__, evt, my_obj->state);
600 int32_t mm_stream_fsm_reg(mm_stream_t * my_obj,
608 __func__, my_obj->inst_hdl, my_obj->my_hdl,
609 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
613 rc = mm_stream_unreg_buf(my_obj);
616 my_obj->state = MM_STREAM_STATE_BUFFED;
621 if (NULL != my_obj->buf_cb) {
622 mm_camera_cmd_thread_launch(&my_obj->cmd_thread,
624 (void *)my_obj);
628 if(my_obj->need_stream_on) {
629 rc = mm_stream_streamon(my_obj);
632 if (NULL != my_obj->buf_cb) {
633 mm_camera_cmd_thread_release(&my_obj->cmd_thread);
638 my_obj->state = MM_STREAM_STATE_ACTIVE_STREAM_ON;
644 cb.cb_count = my_obj->num_stream_cb_times; /* reigstration cb times */
648 cb.user_data = (void*)my_obj;
650 rc = mm_channel_reg_stream_cb(my_obj->ch_obj, &cb,
652 my_obj->sensor_idx);
653 my_obj->state = MM_STREAM_STATE_ACTIVE_STREAM_OFF;
658 rc = mm_stream_set_parm_config(my_obj, in_val);
661 rc = mm_stream_get_parm_config(my_obj, out_val);
665 __func__, evt, my_obj->state);
671 int32_t mm_stream_fsm_active_stream_on(mm_stream_t * my_obj,
679 __func__, my_obj->inst_hdl, my_obj->my_hdl,
680 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
683 rc = mm_stream_buf_done(my_obj, (mm_camera_buf_def_t *)in_val);
687 rc = mm_stream_streamoff(my_obj);
688 if (NULL != my_obj->buf_cb) {
689 mm_camera_cmd_thread_release(&my_obj->cmd_thread);
692 my_obj->state = MM_STREAM_STATE_REG;
696 rc = mm_stream_set_parm_start(my_obj, in_val);
699 rc = mm_stream_get_parm_start(my_obj, out_val);
703 __func__, evt, my_obj->state);
709 int32_t mm_stream_fsm_active_stream_off(mm_stream_t * my_obj,
717 __func__, my_obj->inst_hdl, my_obj->my_hdl,
718 my_obj->ext_image_mode, my_obj->fd, my_obj->state, evt);
721 rc = mm_stream_buf_done(my_obj, (mm_camera_buf_def_t *)in_val);
725 if (NULL != my_obj->buf_cb) {
726 rc = mm_camera_cmd_thread_release(&my_obj->cmd_thread);
729 my_obj->state = MM_STREAM_STATE_REG;
733 rc = mm_stream_set_parm_config(my_obj, in_val);
736 rc = mm_stream_get_parm_config(my_obj, out_val);
740 __func__, evt, my_obj->state);
746 int32_t mm_stream_config(mm_stream_t *my_obj,
752 __func__, my_obj->inst_hdl, my_obj->my_hdl,
753 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
754 memcpy(&my_obj->fmt, &config->fmt, sizeof(mm_camera_image_fmt_t));
755 my_obj->hal_requested_num_bufs = config->num_of_bufs;
756 my_obj->need_stream_on = config->need_stream_on;
757 my_obj->num_stream_cb_times = config->num_stream_cb_times;
759 rc = mm_stream_get_offset(my_obj);
765 config->fmt.width = my_obj->fmt.width;
766 config->fmt.height = my_obj->fmt.height;
767 if(my_obj->need_stream_on) {
769 rc = mm_stream_set_fmt(my_obj);
774 int32_t mm_stream_release(mm_stream_t *my_obj)
779 __func__, my_obj->inst_hdl, my_obj->my_hdl,
780 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
783 if(my_obj->fd > 0)
785 close(my_obj->fd);
789 pthread_mutex_destroy(&my_obj->buf_lock);
790 pthread_mutex_destroy(&my_obj->cb_lock);
793 memset(my_obj, 0, sizeof(mm_stream_t));
794 my_obj->fd = -1;
799 int32_t mm_stream_streamon(mm_stream_t *my_obj)
806 __func__, my_obj->inst_hdl, my_obj->my_hdl,
807 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
809 rc = mm_camera_poll_thread_add_poll_fd(&my_obj->ch_obj->poll_thread[0],
810 my_obj->my_hdl,
811 my_obj->fd,
813 (void*)my_obj);
817 rc = ioctl(my_obj->fd, VIDIOC_STREAMON, &buf_type);
822 mm_camera_poll_thread_del_poll_fd(&my_obj->ch_obj->poll_thread[0], my_obj->my_hdl);
828 int32_t mm_stream_streamoff(mm_stream_t *my_obj)
834 __func__, my_obj->inst_hdl, my_obj->my_hdl,
835 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
838 mm_camera_poll_thread_del_poll_fd(&my_obj->ch_obj->poll_thread[0], my_obj->my_hdl);
841 rc = ioctl(my_obj->fd, VIDIOC_STREAMOFF, &buf_type);
906 int32_t mm_stream_read_msm_frame(mm_stream_t * my_obj,
916 __func__, my_obj->inst_hdl, my_obj->my_hdl,
917 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
919 mm_stream_util_get_v4l2_fmt(my_obj->fmt.fmt,
928 rc = ioctl(my_obj->fd, VIDIOC_DQBUF, &vb);
934 buf_info->buf = &my_obj->buf[idx];
936 buf_info->stream_id = my_obj->my_hdl;
938 buf_info->buf->stream_id = my_obj->my_hdl;
960 int32_t mm_stream_get_crop(mm_stream_t *my_obj,
967 __func__, my_obj->inst_hdl, my_obj->my_hdl,
968 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
972 rc = ioctl(my_obj->fd, VIDIOC_G_CROP, &crop_info);
983 int32_t mm_stream_set_parm_acquire(mm_stream_t *my_obj,
991 __func__, my_obj->inst_hdl, my_obj->my_hdl,
992 my_obj->ext_image_mode, my_obj->fd, my_obj->state, parm_type);
997 mm_stream_set_cid(my_obj,value);
1006 int32_t mm_stream_get_parm_acquire(mm_stream_t *my_obj,
1014 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1015 my_obj->ext_image_mode, my_obj->fd, my_obj->state, parm_type);
1020 rc = mm_stream_get_cid(my_obj,value);
1025 rc = mm_stream_get_crop(my_obj, crop);
1035 int32_t mm_stream_set_parm_config(mm_stream_t *my_obj,
1045 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1046 my_obj->ext_image_mode, my_obj->fd, my_obj->state, parm_type);
1054 int32_t mm_stream_get_parm_config(mm_stream_t *my_obj,
1066 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1067 my_obj->ext_image_mode, my_obj->fd, my_obj->state, (int)payload->parm_type);
1070 memcpy(payload->value,(void *)&my_obj->frame_offset,sizeof(mm_camera_frame_len_offset));
1074 rc = mm_stream_get_crop(my_obj, crop);
1084 int32_t mm_stream_set_parm_start(mm_stream_t *my_obj,
1094 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1095 my_obj->ext_image_mode, my_obj->fd, my_obj->state, parm_type);
1103 int32_t mm_stream_get_parm_start(mm_stream_t *my_obj,
1115 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1116 my_obj->ext_image_mode, my_obj->fd, my_obj->state, (int)payload->parm_type);
1119 memcpy(payload->value,(void *)&my_obj->frame_offset,sizeof(mm_camera_frame_len_offset));
1123 rc = mm_stream_get_crop(my_obj, crop);
1132 int32_t mm_stream_set_ext_mode(mm_stream_t * my_obj)
1138 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1139 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1142 s_parm.parm.capture.extendedmode = my_obj->ext_image_mode;
1144 rc = ioctl(my_obj->fd, VIDIOC_S_PARM, &s_parm);
1146 __func__, my_obj->fd, rc,
1151 int32_t mm_stream_qbuf(mm_stream_t *my_obj, mm_camera_buf_def_t *buf)
1158 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1159 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1171 rc = ioctl(my_obj->fd, VIDIOC_QBUF, &buffer);
1177 int32_t mm_stream_request_buf(mm_stream_t * my_obj)
1182 uint8_t buf_num = my_obj->buf_num;
1185 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1186 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1193 pthread_mutex_lock(&my_obj->buf_lock);
1195 if (my_obj->buf_status[i].initial_reg_flag){
1200 pthread_mutex_unlock(&my_obj->buf_lock);
1210 rc = ioctl(my_obj->fd, VIDIOC_REQBUFS, &bufreq);
1213 __func__, my_obj->fd, rc);
1219 int32_t mm_stream_init_bufs(mm_stream_t * my_obj)
1228 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1229 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1232 if (NULL != my_obj->buf) {
1233 mm_stream_deinit_bufs(my_obj);
1236 my_obj->buf_num = my_obj->hal_requested_num_bufs;
1237 if (mm_camera_util_get_pp_mask(my_obj->ch_obj->cam_obj) > 0) {
1239 my_obj->buf_num++;
1242 my_obj->buf =
1243 (mm_camera_buf_def_t*)malloc(sizeof(mm_camera_buf_def_t) * my_obj->buf_num);
1244 my_obj->buf_status =
1245 (mm_stream_buf_status_t*)malloc(sizeof(mm_stream_buf_status_t) * my_obj->buf_num);
1246 reg_flags = (uint8_t *)malloc(sizeof(uint8_t) * my_obj->buf_num);
1248 if (NULL == my_obj->buf ||
1249 NULL == my_obj->buf_status ||
1256 memset(my_obj->buf, 0, sizeof(mm_camera_buf_def_t) * my_obj->buf_num);
1257 memset(my_obj->buf_status, 0, sizeof(mm_stream_buf_status_t) * my_obj->buf_num);
1258 memset(reg_flags, 0, sizeof(uint8_t) * my_obj->buf_num);
1260 mem_vtbl = my_obj->ch_obj->cam_obj->mem_vtbl;
1261 rc = mem_vtbl->get_buf(my_obj->ch_obj->cam_obj->my_hdl,
1262 my_obj->ch_obj->my_hdl,
1263 my_obj->my_hdl,
1265 &my_obj->frame_offset,
1266 my_obj->buf_num,
1268 my_obj->buf);
1275 for (i=0; i < my_obj->buf_num; i++) {
1276 my_obj->buf_status[i].initial_reg_flag = reg_flags[i];
1277 my_obj->buf[i].stream_id = my_obj->my_hdl;
1283 for (i=0; i < my_obj->buf_num; i++) {
1284 if (my_obj->buf[i].fd > 0) {
1285 if(0 >= (rc = mm_camera_map_buf(my_obj->ch_obj->cam_obj,
1286 my_obj->ext_image_mode,
1288 my_obj->buf[i].fd,
1289 my_obj->buf[i].frame_len)))
1304 if (my_obj->buf[j].fd > 0) {
1305 mm_camera_unmap_buf(my_obj->ch_obj->cam_obj,
1306 my_obj->ext_image_mode,
1312 mem_vtbl->put_buf(my_obj->ch_obj->cam_obj->my_hdl,
1313 my_obj->ch_obj->my_hdl,
1314 my_obj->my_hdl,
1316 my_obj->buf_num,
1317 my_obj->buf);
1320 if (NULL != my_obj->buf) {
1321 free(my_obj->buf);
1322 my_obj->buf = NULL;
1324 if (NULL != my_obj->buf_status) {
1325 free(my_obj->buf_status);
1326 my_obj->buf_status = NULL;
1337 int32_t mm_stream_deinit_bufs(mm_stream_t * my_obj)
1343 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1344 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1346 if (NULL == my_obj->buf) {
1352 for (i=0; i<my_obj->buf_num; i++) {
1353 if (my_obj->buf[i].fd > 0) {
1354 rc = mm_camera_unmap_buf(my_obj->ch_obj->cam_obj,
1355 my_obj->ext_image_mode,
1365 mem_vtbl = my_obj->ch_obj->cam_obj->mem_vtbl;
1367 rc = mem_vtbl->put_buf(my_obj->ch_obj->cam_obj->my_hdl,
1368 my_obj->ch_obj->my_hdl,
1369 my_obj->my_hdl,
1371 my_obj->buf_num,
1372 my_obj->buf);
1377 free(my_obj->buf);
1378 my_obj->buf = NULL;
1379 free(my_obj->buf_status);
1380 my_obj->buf_status = NULL;
1385 int32_t mm_stream_reg_buf(mm_stream_t * my_obj)
1391 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1392 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1394 rc = mm_stream_request_buf(my_obj);
1399 pthread_mutex_lock(&my_obj->buf_lock);
1400 for(i = 0; i < my_obj->buf_num; i++){
1401 my_obj->buf[i].buf_idx = i;
1404 if (my_obj->buf_status[i].initial_reg_flag) {
1405 rc = mm_stream_qbuf(my_obj, &my_obj->buf[i]);
1410 my_obj->buf_status[i].buf_refcnt = 0;
1411 my_obj->buf_status[i].in_kernel = 1;
1415 my_obj->buf_status[i].buf_refcnt = 1;
1416 my_obj->buf_status[i].in_kernel = 0;
1420 pthread_mutex_unlock(&my_obj->buf_lock);
1424 int32_t mm_stream_unreg_buf(mm_stream_t * my_obj)
1430 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1431 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1433 pthread_mutex_lock(&my_obj->buf_lock);
1434 if (NULL != my_obj->buf_status) {
1435 for(i = 0; i < my_obj->buf_num; i++){
1436 if (my_obj->buf_status[i].initial_reg_flag){
1442 pthread_mutex_unlock(&my_obj->buf_lock);
1450 rc = ioctl(my_obj->fd, VIDIOC_REQBUFS, &bufreq);
1453 __func__, my_obj->fd, rc);
1458 pthread_mutex_lock(&my_obj->buf_lock);
1459 if (NULL != my_obj->buf_status) {
1460 for(i = 0; i < my_obj->buf_num; i++){
1461 my_obj->buf_status[i].buf_refcnt = 0;
1462 my_obj->buf_status[i].in_kernel = 0;
1465 pthread_mutex_unlock(&my_obj->buf_lock);
1470 int32_t mm_stream_set_fmt(mm_stream_t *my_obj)
1476 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1477 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1479 if(my_obj->fmt.width == 0 || my_obj->fmt.height == 0) {
1481 __func__, my_obj->fmt.width, my_obj->fmt.height, my_obj->fmt.fmt);
1487 fmt.fmt.pix_mp.width = my_obj->fmt.width;
1488 fmt.fmt.pix_mp.height= my_obj->fmt.height;
1491 mm_stream_util_get_v4l2_fmt(my_obj->fmt.fmt,
1493 rc = ioctl(my_obj->fd, VIDIOC_S_FMT, &fmt);
1495 __func__, my_obj->fd, my_obj->ext_image_mode, rc,
1500 int32_t mm_stream_get_offset(mm_stream_t *my_obj)
1506 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1507 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1509 memset(&my_obj->frame_offset,0,sizeof(mm_camera_frame_len_offset));
1511 frame_offset.format = my_obj->fmt.fmt;
1512 frame_offset.rotation = my_obj->fmt.rotation;
1513 frame_offset.width = my_obj->fmt.width;
1514 frame_offset.height = my_obj->fmt.height;
1515 frame_offset.image_mode = my_obj->ext_image_mode;
1516 if (!my_obj->need_stream_on &&
1517 my_obj->ext_image_mode == MSM_V4L2_EXT_CAPTURE_MODE_MAIN) {
1553 rc = mm_camera_send_native_ctrl_cmd(my_obj->ch_obj->cam_obj,
1561 my_obj->fmt.width = frame_offset.width;
1562 my_obj->fmt.height = frame_offset.height;
1563 memcpy(&my_obj->frame_offset,&frame_offset.frame_offset,sizeof(mm_camera_frame_len_offset));
1565 __func__,my_obj->frame_offset.frame_len,my_obj->fmt.width,my_obj->fmt.height,rc);
1570 int32_t mm_stream_set_cid(mm_stream_t *my_obj,stream_cid_t *value)
1576 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1577 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1582 cam_cid_info.cid_entries[0].inst_handle = my_obj->inst_hdl;
1584 rc = mm_camera_send_native_ctrl_cmd(my_obj->ch_obj->cam_obj,
1595 int32_t mm_stream_get_cid(mm_stream_t *my_obj,stream_cid_t *out_value)
1599 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1600 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1606 int32_t mm_stream_buf_done(mm_stream_t * my_obj,
1612 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1613 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1615 if (my_obj->is_local_buf) {
1621 pthread_mutex_lock(&my_obj->buf_lock);
1623 if(my_obj->buf_status[frame->buf_idx].buf_refcnt == 0) {
1626 my_obj->buf_status[frame->buf_idx].buf_refcnt,
1627 my_obj->ext_image_mode);
1630 my_obj->buf_status[frame->buf_idx].buf_refcnt--;
1631 if (0 == my_obj->buf_status[frame->buf_idx].buf_refcnt) {
1632 CDBG("<DEBUG> : Buf done for buffer:%d:%d", my_obj->ext_image_mode, frame->buf_idx);
1633 rc = mm_stream_qbuf(my_obj, frame);
1638 my_obj->buf_status[frame->buf_idx].in_kernel = 1;
1642 my_obj->buf_status[frame->buf_idx].buf_refcnt);
1644 my_obj, frame->buf_idx, my_obj->ext_image_mode);
1647 pthread_mutex_unlock(&my_obj->buf_lock);
1651 int32_t mm_stream_reg_buf_cb(mm_stream_t *my_obj,
1658 __func__, my_obj->inst_hdl, my_obj->my_hdl,
1659 my_obj->ext_image_mode, my_obj->fd, my_obj->state);
1661 pthread_mutex_lock(&my_obj->cb_lock);
1663 if(NULL == my_obj->buf_cb[i].cb) {
1664 memcpy(&my_obj->buf_cb[i], val, sizeof(mm_stream_data_cb_t));
1669 pthread_mutex_unlock(&my_obj->cb_lock);