Display NvBuffer based frame

Hi Guys,

I wish to display the frame received from camera using NvBuffer on the screen. Following is the code I use to receive frame from camera :

while (true)
    {
        // Acquire a Frame.
  
  	UniqueObj<Frame> frame(iFrameConsumer->acquireFrame());
        IFrame *iFrame = interface_cast<IFrame>(frame);
        if (!iFrame)
            break;

        // Get the Frame's Image.
        Image *image = iFrame->getImage();
        EGLStream::NV::IImageNativeBuffer *iImageNativeBuffer
              = interface_cast<EGLStream::NV::IImageNativeBuffer>(image);
        TEST_ERROR_RETURN(!iImageNativeBuffer, "Failed to create an IImageNativeBuffer");

        int fd = iImageNativeBuffer->createNvBuffer(Argus::Size {m_pCamInfo->liveParams.inputVideoInfo.width, m_pCamInfo->liveParams.inputVideoInfo.height},
               NvBufferColorFormat_YUV420, NvBufferLayout_Pitch, &status);
        if (status != STATUS_OK)
               TEST_ERROR_RETURN(status != STATUS_OK, "Failed to create a native buffer");


        NvBufferParams params;
        NvBufferGetParams(fd, &params);

        int fsize = params.pitch[0] * params.height[0] ;

        char *m_datamem  = (char *)mmap(NULL, fsize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, params.offset[0]);
	 

        if (m_datamem == MAP_FAILED)
           printf("mmap failed : %s\n", strerror(errno));


	munmap(m_datamem, fsize);

	NvBufferDestroy(fd);

     }

I wish to display the received frame buffer using a lightweight display module. Please let me know how to do so.

Thanks.

Hi lamegeorge,
We suggest use NvEglRenderer. Please refer to ~/tegra_multimedia_api/samples/09_camera_jpeg_capture