Help needed playing video with qwidgets on imx.6 with hardware acceleration
-
Summary:
We have a qwidget embedded application on an IMX.6. Basically, we can invoke gstreamer on the command line and it works. From within the Qt application we can play video within a qwidget window with low resolution or poor performance, or it can create a window not within the qwidget with high resolution and performance, but then Qt events will cause the window to be hidden.The details:
We have an embedded application that we have developed using QWidgets in c++. The user is able to click on "Help" to get a video to pop up and play a short video on what to do. Using the video player examples, our video player worked, but HD videos were very choppy and the CPU usage was very high. We resized the videos with ffmpeg to the same resolution as the window (620x400). We need to use hardware acceleration for this to work.Our hardware platform is the Toradex Apalis iMX6 (supported by qt), and we're using "Boot to Qt Software Stack 5.12.5" for the Toradex Apalis iMX6 (which is part of "Qt for Device Creation"). We have a commercial license.
We tried to get gstreamer to work, and have found pipelines that work on the command line to play videos smoothly. This works:
gst-launch-1.0 filesrc location=/directory_path/file.mp4 ! decodebin ! videoconvert ! imxipuvideosink
So we tried to use gstreamer in our application using several techniques:
https://gstreamer.freedesktop.org/documentation/video/gstvideooverlay.html?gi-language=c#gstvideooverlay-and-qt
When using imxipuvideosink the video displays nicely, but the call to gst_video_overlay_set_window_handle() fails because imxipuvideosink does not implement GstVideoOverlay. Any time there is a paint event, the video window is hidden by the application window. So we cannot get the video to behave with the controls.We also tried this
https://doc.qt.io/qt-5/qmediaplayer.html#setMedia
This behaved the same way as the one above - it was not associated with a Qwidget and we could not control the window.We have tried many sinks, and have spent days and days googling and trying stuff and are out of ideas. Please, share a code sample that will work with our configuration. We are able to get windows play the video smoothly but cannot figure out how to force them to always be on the top. Is there a way to figure out within the application what the window handle is to associate with a widget?
Is there something else that would work other than gstreamer?