In order to solve the green edge caused by buffer alignment,
In addition to adding videoConvter, there is another way is to copy the valid data to another buffer, and then use the renderer to render the buffer.
I am going to try not to add videoConverter, rendering directly after decoding.
I have encountered such a few questions
1,After I set bool map flag to true, mmap will fail
dec->capture_plane.setupPlane(V4L2_MEMORY_MMAP,
min_dec_capture_buffers + 5, true,
false);
[LOG_LEVEL_ERROR] (NvBuffer.cpp:169) <Buffer> Could not map buffer 0, plane 0
[LOG_LEVEL_ERROR] (NvV4l2ElementPlane.cpp:636) <dec0> Capture Plane:Error during setup
2,if I set bool map flag to false,unsigned char *data in NvBufferPlane struct is NULL,How do I get YUV data?
3,Between dec->capture_plane.dqBuffer and dec->capture_plane.qBuffer in dec_capture_loop_fcn, I added the following code
struct v4l2_format format;
ret = dec->capture_plane.getFormat(format);
int dmabuf_fd;
int frame_size = (format.fmt.pix_mp.width * format.fmt.pix_mp.height*3)/2;
uint8_t *data_mem;
ret = NvBufferCreate ( &dmabuf_fd,
format.fmt.pix_mp.width,
format.fmt.pix_mp.height,
NvBufferLayout_Pitch,
NvBufferColorFormat_NV12
);
if (dmabuf_fd)
{
data_mem = (uint8_t *)mmap(0, frame_size, PROT_READ | PROT_WRITE, MAP_SHARED, dmabuf_fd, 0);
}
//Manually set the buffer data to white
memset( data_mem , 0xff , frame_size);
munmap(data_mem, frame_size);
ctx->renderer->render(dmabuf_fd);
NvBufferDestroy(dmabuf_fd);
From the results of the operation, the window is not the white color I want.
Please tell me where the error, thank you.