static void clean_display_buffer(struct mtk_vcodec_ctx *ctx) { struct vb2_buffer *framptr; do { framptr = get_display_buffer(ctx); } while (framptr); }
void frame_end(void) { g_display_flip = !g_display_flip; sceDisplaySetFrameBuf(get_display_buffer(), 512, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_NEXTFRAME); sceDisplayWaitVblank(); }
static int start_loop(void) { int ret, display_index; struct v4l2_buffer buf; static int captFrmCnt = 0; unsigned char *displaybuffer = NULL; int i; char *ptrPlanar = NULL; void *src, *dest; ptrPlanar = (char *)calloc(1, nWidthFinal * nHeightFinal * 2); while (!quit) { fd_set fds; struct timeval tv; int r; FD_ZERO(&fds); FD_SET(fdCapture, &fds); /* Timeout */ tv.tv_sec = 2; tv.tv_usec = 0; r = select(fdCapture + 1, &fds, NULL, NULL, &tv); if (-1 == r) { if (EINTR == errno) continue; printf("StartCameraCapture:select\n"); return -1; } if (0 == r) continue; CLEAR(buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; /* determine ready buffer */ if (-1 == ioctl(fdCapture, VIDIOC_DQBUF, &buf)) { if (EAGAIN == errno) continue; printf("StartCameraCaputre:ioctl:VIDIOC_DQBUF\n"); return -1; } if (en_capture_to_file) { if (captFrmCnt == num_frame_to_capture) { printf("Writing frame %d to file %s, size = %d\n",num_frame_to_capture, FILE_CAPTURE, file_size); fwrite(buffers[buf.index].start, 1, file_size, fp_capture); printf("Writing file %s complete\n", FILE_CAPTURE); fclose(fp_capture); } } if (captFrmCnt <= 1) { if (!captFrmCnt) { printf("5. Test enque first buffer\n"); ret = start_display(fd_vid1, buf.index, 0); } else { printf("5. Test enque second buffer\n"); ret = start_display(fd_vid1, buf.index, 1); } if (ret < 0) { printf("\tError: Starting display failed:VID1\n"); return ret; } captFrmCnt++; continue; } ret = put_display_buffer(fd_vid1, buf.index); if (ret < 0) { printf("Error in putting the display buffer\n"); return ret; } /******************* V4L2 display ********************/ display_index = get_display_buffer(fd_vid1); if (display_index < 0) { printf("Error in getting the display buffer:VID1\n"); return ret; } /***************** END V4L2 display ******************/ if (printfn) printf("time:%lu frame:%u\n", (unsigned long)time(NULL), captFrmCnt++); buf.index = display_index; /* requeue the buffer */ if (-1 == ioctl(fdCapture, VIDIOC_QBUF, &buf)) printf("StartCameraCaputre:ioctl:VIDIOC_QBUF\n"); if (stress_test) { start_loopCnt--; if (start_loopCnt == 0) { start_loopCnt = 50; break; } } } return ret; }