Unsolved How to set a configuration specific to a certain USB camera?
-
Hi everyone,
currently I'm developing a little tool, which simply takes the images of two webcams and displays them. Development takes place under Win 10, with an option to later port it to Android. The capture and display stuff works. So far so good. Setting frame rate and resolution works. Also access to image processing stuff.
The problem is now, that the QCamera object doesn't give me access to exposure and focus related settings (isAvailable() == false). I tried to figure out, how to implement it myself but I totally got lost in the nearly non existing documentation to service provider, plugins, control interfaces, requestControll(), n'stuff (or I used the wrong search patterns).
Until now I even couldn't figure out, how to get a handle to the camera device itself, to simply send some raw data configuration bytes. Which would be sufficient enough and also platform independent.
After browsing the Qt source code, it seemed, that the hardware specific stuff/access is always hidden in classes private sections inside special classes. Like QCameraPrivat, QMediaObjectPrivate, DSCameraSession and so on.Is there a way, to do some device specific configuration stuff? Without the need to re implement a whole bunch of interfaces to fit inside the QT multimedia stack?
If someone could point me to the right documentation/tutorials or a working example? This would be really really great.
Greetings
Sorut -
Hi and welcome to the forums
Did you try this class ?
http://doc.qt.io/qt-5/qcameraexposurecontrol.html#details -
@mrjj Yes, I tried this way also (via camera->service->requestControl(...). Same result: not available.
-
Hi,
Not all backends provide all the controls. You have to check whether Direct Show provides the ones you want.
Or do you have some API for the camera you are using ?
-
@SGaist Yes, the cameras have an API, which I need to use. Like switching the image transfer mode from RAW to compressed, or do some adjusting during zoom and so on. I know for sure, that the cameras work. They are already used this way with the old main application (written in C#).
After some additional Qt source browsing, I've got the impression that adding additional QMediaControl functionality is impossible without altering the existing driver (read patching the Qt source code).
Under Windows the relevant part is buried inside private member m_session (holding a DSCameraSession *) of DSCameraService. DSCameraService itself is only a wrapper which returns different control objects. ... To be honest, I don't get the advantage of this design decision at all. Why this paranoid hiding/encapsulation without the possibility to add custom control(s)?Probably it is the best way to simply get rid of this and do it all manually without the hassle of the multimedia stack.
-
It's not paranoïa.
AFAIK, the design of QtMultimedia stack is to provide a common wrapper to access the platform specific multimedia API in a uniform manner while, at the same time, it provides you the means to also implement your own plugins if you have something custom like it seems you do.
If your camera provider gives you all the means to access configuration options, video streams and what not, then I'd recommend implementing your own QCamera backend.
-
@SGaist You are right about this. I hoped to prevent the complete re implementation of my one camera driver only to add some configuration switches.
Is there a tutorial/documentation about implementing a qt service provider (which is the camera driver?). The qt documentation itself is ... a little to compact about this topic.
-
Never mind. For now, we decided to ignore the multimedia stack and implement the camera driver more directly. Maybe a qt integration comes later.
Thanks for all your help.
-
No there's not.
I've based the various backend I wrote on the existing ones which basically makes the plugin a "wrapper" to use the various SDK needed.
-
@SGaist That was the idea I started with in the first place. But the device access is hidden inside the privat section of the platform depended implementation. As far as I understood the qt source code.
How do re use this part and still get access to the hardware and be able to do custom configuration?
-
What do you mean by "device access" ?
As for writing a QCamera backend plugin, you don't have to use any private classes.
-
I tried to find a way to use the available backend(s) (platform plugins/service provider) and only add a custom device control. The majority of the camera backend functionality simply works for me and is usable. It is only missing some configuration options.
But I simply couldn't find a way to add such a custom device control without altering the qt source code itself (or I'm greatly missing something). What I meant with "device access hidden in side the private section". -
Ok, indeed, if you want to extend one of the plugin you have to modify Qt's sources, but you can limit that to the plugin itself without have to rebuild all of Qt.