QML/Qt6 Mapping QVideoFrame from MediaPlayer on Android [OMX.MTK.VIDEO.DECODER.AVC]
-
I develop an app that needs to play video files. for that i use the qml type MediaPlayer.
On C++ side i grab the videoframes and try to map them to system memory. this works on linux and for avi files on android but not for the native(?) video format on my android device.i use this code :
void OpenGLVideoOutput::newFrame(const QVideoFrame &frame) { //qDebug() << frame << ", " << frame.handleType(); QVideoFrame cloneFrame(frame); if(videoRenderer->ready() && cloneFrame.isValid() && cloneFrame.map(QVideoFrame::MapMode::ReadOnly)) { currentFrame = cloneFrame.toImage(); cloneFrame.unmap(); cvFrame = cv::Mat(currentFrame.height(), currentFrame.width(), CV_8UC4, currentFrame.bits()); videoRenderer->setItemSize(size()); videoRenderer->setNewFrame(cvFrame); videoRenderer->show(showVideoPlane, showDistortionGrid, showDistortionFieldIsoLines, showDistortionField); } }that produce the output :
I OMXClient: IOmx service obtained D MediaCodec: flushMediametrics D SurfaceUtils: connecting to surface 0x746cf8f1d0, reason connectToSurface I MediaCodec: [OMX.MTK.VIDEO.DECODER.AVC] setting surface generation to 25123841 D SurfaceUtils: disconnecting from surface 0x746cf8f1d0, reason connectToSurface(reconnect) D SurfaceUtils: connecting to surface 0x746cf8f1d0, reason connectToSurface(reconnect) D ACodec : virtual setMtkParameters D SurfaceUtils: set up nativeWindow 0x746cf8f1d0 for 1920x1080, color 0x32315679, rotation 0, usage 0x402933 W ACodec : [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 8 failed: -22 D SurfaceUtils: set up nativeWindow 0x746cf8f1d0 for 1920x1088, color 0x32315679, rotation 0, usage 0x402933 W ACodec : [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 12 failed: -22 W libuntitled2_arm64-v8a.so: Error transferring the data to system memory: -38 W libc : Access denied finding property "ro.hardware.chipname" W libuntitled2_arm64-v8a.so: Error transferring the data to system memory: -38 W libuntitled2_arm64-v8a.so: Invalid texture upload for 0x736cfc95f0 layer=0 mip=0 W libuntitled2_arm64-v8a.so: Error transferring the data to system memory: -38receiving frames from integrated camera works as well.
My question is how to load every video file into Mediaplayer Qml type, that is supported by my operating system ?
thx :-)
-
An additional information is that the frames from mediaplayer differ from source to source and also for camera frames this is different.
The specific problem seems to be mapping of Format_SamplerExternalOES, for every call to QVideoFrame::map i got : Error transferring the data to system memory: -38
I have already checked if there is a active opengl context, it is.
I have no idea :-( ...