I'm trying to capture camera output frame and process it further in GPU pipeline. For this reason returing frame as a GPU texture is the best option. After inheriting from QVideoFilterRunnable class received by run method QVideoFrame objects has type which is not equal to QAbstractVideoBuffer::GLTextureHandle. It's equal to NoHandle
and I need to do map/unmap and load texture manually by glTexImage
, which is not good for performance. Is there any control options that can be used to return texture name?
Some notes:
Looks good on Android. Returned frame is texture so this works like a charm:
QVideoFrame* input = ...; GLuint texture = input->handle().toUInt(); f->glBindTexture(GL_TEXTURE_2D, texture);
It's possible in general, there is iOS texture cache feature:
CVPixelBufferRef pixelBuffer = ...; CVOpenGLESTextureCacheCreateTextureFromImage(..., pixelBuffer, ..., &textureRef); texture = CVOpenGLESTextureGetName(textureRef);
CVPixelBufferRef
can be created manually (I do need to usemap
still):Use value of
CVPixelBufferRef
pointer to create cache texture:Getting texture name: