Hello,
I have several questions on the sample 15_multivideo_encoder, please see below:
In ctx.enc->capture_plane.waitForDQThread (-1), why the argument is -1?
In encoder_capture_plane_dq_callback() function, which subfunction perform the dequeue action?
In encoder_capture_plane_dq_callback() function, it seems the encoded stream(NALU) is in NvBuffer *buffer object, right? And what’s the difference between v4l2 buffer and Nvbuffer in this function?
Thank you very much.
I still have several questions for you,
In NvBufferTransform( src_dmabuf_fd, dest_dmabuf_fd, *transform_params), the dest_dmabuf_fd will holds the converted video pixel data, can I use NvV4l2ElementPlane::qBuffer() to queue the dest_dmabuf_fd into the Nvencoder output plane? Or could you tell me how to queue this dest_dmabuf_fd into the encoder output plane?
It seems the encoder output plane only supports mplane format, so does it mean that we can’t use single plane format to capture v4l2 cameras?
Hi DaneLLL,
Thank you very much for your reply.
Another question for you: the process for encoder output plane is that first dequeue the buffer, second fill the dequeued buffer the converted data, third queue the buffer, right?
Hi,
If there is no buffer in queue you would need to queue buffers first. Please refer to the code:
+ // Check if we need dqBuffer first
+ if (bufferIndex < OUTPLANE_BUFNUM &&
+ ctx->enc->output_plane.getNumQueuedBuffers() <
+ ctx->enc->output_plane.getNumBuffers())
+ {
+ // The queue is not full, no need to dqBuffer
+ // Prepare buffer index for the following qBuffer
+ enc_buf.index = bufferIndex;
+ // Create Render buffer
+ if (-1 == NvBufferCreateEx(&fd, &input_params))
+ ERROR_RETURN("Failed to create NvBuffer");
+ outplane_fd[bufferIndex] = fd;
+ bufferIndex++;;
+ }
+ else
+ {
+ // Output plane full or max outstanding number reached
+ ctx->enc->output_plane.dqBuffer(enc_buf, &buffer, NULL, 10);
+ fd = enc_buf.m.planes[0].m.fd;
+ }