QCamera: service not available - dsengine.dll recoverable?
I try to use a web-cam in my widgets-application in QT-5.0.2 on Windows 7.
Unfortunately, when using the availableDevices() method, I get no devices and in the debug output: "service not available".
I figured that the camera wants to use the directshow engine in plugins/mediaservice, which is no longer built.
1st question: is this the only and/or recommended way to use a QCamera?
Now I tried to build this plugin on my own, which failed. I followed several workarounds including recovering the old qedit.h file from an old direct show sdk, the workaround to define some symbols as proposed in http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/ed097d2c-3d68-4f48-8448-277eaaf68252 by kenc34 are already included in the file dscamerasession.h.
2nd question: are the plugin dlls always compatible or are they tied to a certain build? I saw, they contain no version information (via resources i.e. file properties). Can I just pick any dsengine.dll from an earlier build?
And 3rd question:
I saw bug: https://bugreports.qt-project.org/browse/QTBUG-28047 "QtMultimedia directshow plugin is missing" and https://bugreports.qt-project.org/browse/QTBUG-29175 "Implement camera support in the WMF plugin". But there are no targets/timelines. Does this render the QCamera unusable or is there any workaround I didn't see?
Thanks very much for any hints
Daniel / mcJack
To share my resume, I shall add my experiences:
As our project is still running on some XP-machines, migrating to WMF is not the best idea, see also:
So recovering the directshow plugin is a good idea anyway:
First i recovered the vanished file in the windows sdk (where the direct show sdk was moved). I got it from a forum thread (they also explain, when it vanished):
Now I was able to compile the plugin in <QT-SOURCE>\qtmultimedia\src\plugins\directshow via nmake.
The two errors about double definition of ISampleGrabber and ISampleGrabberCB I could remove by commenting out the sections in question:
directshowglobal.h from line 196:
#define INTERFACE ISampleGrabberCB
// STDMETHOD(QueryInterface) (THIS_ const GUID *, void **) PURE;
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
STDMETHOD_(HRESULT, SampleCB) (THIS_ double, LPMEDIASAMPLE) PURE;
STDMETHOD_(HRESULT, BufferCB) (THIS_ double, BYTE *, long) PURE;
#define INTERFACE ISampleGrabber
STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
STDMETHOD(SetOneShot)(THIS_ BOOL) PURE;
STDMETHOD(SetMediaType)(THIS_ const AM_MEDIA_TYPE*) PURE;
STDMETHOD(GetConnectedMediaType)(THIS_ AM_MEDIA_TYPE*) PURE;
STDMETHOD(SetBufferSamples)(THIS_ BOOL) PURE;
STDMETHOD(GetCurrentBuffer)(THIS_ long*,long*) PURE;
STDMETHOD(GetCurrentSample)(THIS_ IMediaSample**) PURE;
STDMETHOD(SetCallback)(THIS_ ISampleGrabberCB *,long) PURE;
A quick test with the dsengine.dll found in <QT-SOURCE>\qtbase\plugins\mediaservice worked as expected, even though I only tested the QViewFinderWidget and saving the image afterwards.
Maybe it helps somebody as well...
Daniel / mcJack
N.B. I also installed while doing try-and-error the old DirectShow DSK following this post:
But neither the old qedit.h file nor the dxtrans.h replacement were included in that SDK, so I don't think it has something to do with the solution...