Unsolved Camera QML element and multiple QMediaService
-
Hi,
One alternative that you can try is to use a wrapper object that provides the QCamera to your VideoOutput.
-
@SGaist
Thanks for reply. Please could you be more concrete? I don't know how to implement it. A hint would help.... -
You have to create a QObject subclass that has a property called mediaObject that will return you camera instance.
-
This post is deleted! -
I'm playing around with the gphoto plugin and this hit me. It seems Qt does not handle the case with multiple QMediaService camera plugins properly.
-
You're right. I tried some hacks but finally I gave up using QML Camera, QMediaService etc. and implemented my own framework for cameras.
-
@oniongarlic said in Camera QML element and multiple QMediaService:
I'm playing around with the gphoto plugin and this hit me. It seems Qt does not handle the case with multiple QMediaService camera plugins properly.
That's a bit too vague. I've written applications using several different custom QtMultimedia backends at the same time and it worked nicely.
-
Well, the issue is with camera selection. If the gphoto plugin, https://github.com/dept2/qtmultimedia-gphoto , and Qts own (gst/v4l2)camera plugin are both available it will load them both, QtMultimedia.availableCameras will contain all cameras available. So far so good.
But assigning a id to the Camera deviceId property only works for cameras from the first loaded plugin, so for example if gphoto plugin is loaded first it is not possible to switch to a v4l2 camera. Plugins seems to be loaded in a-z order so gphoto will be first in case it is installed.
And looking at the code, afaik, it only uses the first QMediaService when the property is changed and does not check other QMediaService camera sources.
-
That's clearer now.
Do you have the same problem if you provide the devices you select through C++ ?
-
I haven't used the camera trough C++ yet.