QCamera: service not available - dsengine.dll recoverable?
-
Hi there,
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:
http://social.msdn.microsoft.com/Forums/en-US/mediafoundationdevelopment/thread/6106c9f4-0c6f-4886-8835-34ab0e8eb3d5So 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):
http://social.msdn.microsoft.com/Forums/en-US/windowsdirectshowdevelopment/thread/2ab5c212-5824-419d-b5d9-7f5db82f57cdNow 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:
@
#ifndef ISampleGrabberCB_INTERFACE_DEFINED
#define ISampleGrabberCB_INTERFACE_DEFINED
/*
#undef INTERFACE
#define INTERFACE ISampleGrabberCB
DECLARE_INTERFACE_(ISampleGrabberCB, IUnknown)
{
// 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;
};
*/
#undef INTERFACE#endif
#ifndef ISampleGrabber_INTERFACE_DEFINED
#define ISampleGrabber_INTERFACE_DEFINED
/*
#define INTERFACE ISampleGrabber
DECLARE_INTERFACE_(ISampleGrabber,IUnknown)
{
STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) 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;
};
#undef INTERFACE
*/
#endif
@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...
Cheers,
Daniel / mcJackN.B. I also installed while doing try-and-error the old DirectShow DSK following this post:
http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/ed097d2c-3d68-4f48-8448-277eaaf68252But 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...