I modified the sample 02_video_dec_cuda ,let dec’s capture_plane use nvmm_buffer I created by NvBufferCreate() ,but I found that dec did not write data to nvmm_buffer. I sent nvmm_buffer to the VIC and renderer, that show a green screen.
I made these changes:
-
dec->capture_plane.setupPlane(),set V4L2_MEMORY_DMABUF
-
create some nvmm_buffer
I did not find the format corresponding to V4L2_PIX_FMT_NV12M
if (-1 == NvBufferCreate(&fd, 1920, 1088,
NvBufferLayout_BlockLinear,
NvBufferColorFormat_NV12))
ERROR_RETURN("Failed to create NvBuffer");
- Enqueue all the empty buffer to dec’s capture_plane in query_and_set_capture()
v4l2_buf.index = i;
v4l2_buf.m.planes = planes;
v4l2_buf.m.planes[0].m.fd = (unsigned long)ctx->g_buff[i].dmabuff_fd;
v4l2_buf.m.planes[0].bytesused = 1; // byteused must be non-zero
ret = dec->capture_plane.qBuffer(v4l2_buf, NULL);
- dequeue and enqueue frame in dec_capture_loop_fcn()
dec->capture_plane.dqBuffer(v4l2_buf, NULL, NULL, 0));
ctx->conv->output_plane.qBuffer(conv_output_buffer, NULL);
//wait vic's capture_plane callback render a frame
pthread_cond_wait(&ctx->queue_cond, &ctx->queue_lock);
ctx->dec->capture_plane.qBuffer(v4l2_buf, NULL);
Is there a problem with my code? Or dec does not support this usage?
thanks.