[Libav-user] Is there a way to not copy data to/from buffers?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Libav-user] Is there a way to not copy data to/from buffers?

Zygmunt Ptak

Actually there are two question, but first some explenation:

I have to use AVIOContext to read data from stream, and I have to show decoded video from stream as fast it is possible. I'm using h264_cuvid to get hardware acceleration and video frames are rendered in OpenGL.

I have two problems:

1. I have to use function set in AVIOContext:
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size)

But in that case I have to copy data. Is there a way to just set pointer with filled data?
Or some other way how to speedup that part of the code?
I'm storing data in queue.

2. I have to copy data from AVFrame into GPU, for example:
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RED, GL_UNSIGNED_BYTE, m_frame->data[0]);

Is there a way to ommit that part, cuvid should have already that data in GPU, would be nice to somehow get texture id directly and show it.


Libav-user mailing list
[hidden email]