Hi,

I would like to ask you for help with a problem I got stuck on.

I'm trying to decode video by hardware using Android's Stagefright library. 

All is working OK when I use OMXCodec's flags kClientNeedsFramebuffer which tells OMXCodec to pass decoded frame to RAM. Then I have to pass it to graphic memory and show. But copying frame to RAM is very slow on almost all devices. So, i would like to let OMXCodec to pass frame to graphic memory and I will show it from there.

OMXCodec needs ANativeWindow (from SurfaceView) to create GraphicBuffers for frames. SurfaceView can be only one in application, so I'm giving to it a ANativeWindow from SurfaceView (QtSurface) created by Qt. 

But there is a problem with that surface because it's probably somehow already managed by Qt. This is what I get when I try to create OMXCodec with ANativeWindow from Qt's surface:
@
//on Nexus 4
E/OMXCodec(14819): [OMX.qcom.video.decoder.avc] registering GraphicBuffer with OMX IL component failed: -2147483648

//on Nexus 7
E/BufferQueue(  121): [SurfaceView] setBufferCount: client owns some buffers
E/Surface (31197): IGraphicBufferProducer::setBufferCount(5) returned Invalid argument
E/OMXCodec(31197): native_window_set_buffer_count failed: Invalid argument (22)
@

I've found both errors in https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/OMXCodec.cpp on lines 1832 (Nexus 4) and 1801 (Nexus 7). But nothing about how Qt manages ANativeWindow or GraphicBuffers in Qt's source.

Can anybody help me to solve this problem to share Qt's surface with Stagefright or give some advice how to solve it? 

I believe that it must be possible to use Qt and Stagefright together.

Thank you very much for any help.

Dominik