Hi,
I am trying to get the gpu pointer from the output file generated by gstreamer (1008 bytes struct).
This is what I’m doing:
- I run the following command to generate the files:
gst-launch-1.0 filesrc location=file.mp4 ! decodebin ! videorate max-rate=4 ! multifilesink location="/tmp/frame%d.buffer"
- I read the buffer (1008 bytes) from file and extract the file descriptor:
FILE* fp = fopen("/tmp/frame0.buffer", "rb");
void* buff = malloc(1008);
fread(buff, 1008, 1, fp);
ExtractFdFromNvBuffer(buff, &dmabuf_fd);
- I extracted the parameters and printed the values:
NvBufferParams par;
NvBufferGetParams(dmabuf_fd, &par);
I can see that the par.width, par.height matches the source video resolution (file.mp4).
- I tried to get EGLImage from FD but it fails:
EGLImageKHR egl_image = NvEGLImageFromFd(NULL, dmabuf_fd);
But I get the following error:
NvEGLImageFromFd: Failed to create EGLImage from dma-buf fd (1066)
(dmabuf_fd = 1066 in this example)
I also tried this, but I got the same error:
static EGLDisplay egl_display = EGL_NO_DISPLAY;
if (egl_display == EGL_NO_DISPLAY)
{
egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (egl_display == EGL_NO_DISPLAY)
{
exit(-1);
}
}
EGLImageKHR egl_image = NvEGLImageFromFd(egl_display, dmabuf_fd);
What am I doing wrong?