Commit 2600e619 authored by Thiago Santini's avatar Thiago Santini

Small adjustments

parent 86a71ed7
...@@ -57,7 +57,6 @@ UVCCameraService::UVCCameraService(QObject *parent): ...@@ -57,7 +57,6 @@ UVCCameraService::UVCCameraService(QObject *parent):
m_control = new UVCCameraControl(m_session); m_control = new UVCCameraControl(m_session);
m_videoDevice = new UVCVideoDeviceControl(m_session); m_videoDevice = new UVCVideoDeviceControl(m_session);
m_viewfinderSettings = new UVCCameraViewfinderSettingsControl(m_session); m_viewfinderSettings = new UVCCameraViewfinderSettingsControl(m_session);
// m_imageProcessingControl = new DSCameraImageProcessingControl(m_session);
} }
UVCCameraService::~UVCCameraService() UVCCameraService::~UVCCameraService()
...@@ -66,7 +65,6 @@ UVCCameraService::~UVCCameraService() ...@@ -66,7 +65,6 @@ UVCCameraService::~UVCCameraService()
delete m_viewfinderSettings; delete m_viewfinderSettings;
delete m_videoDevice; delete m_videoDevice;
delete m_videoRenderer; delete m_videoRenderer;
// delete m_imageCapture;
delete m_session; delete m_session;
} }
......
...@@ -11,7 +11,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent) ...@@ -11,7 +11,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent)
UVCCameraSession::~UVCCameraSession() UVCCameraSession::~UVCCameraSession()
{ {
unload();
} }
void UVCCameraSession::setDevice(uvc_device_t *device) void UVCCameraSession::setDevice(uvc_device_t *device)
...@@ -33,7 +33,6 @@ void UVCCameraSession::callback(uvc_frame_t *frame) ...@@ -33,7 +33,6 @@ void UVCCameraSession::callback(uvc_frame_t *frame)
return; return;
if (m_surface) { if (m_surface) {
QVideoFrame qFrame; QVideoFrame qFrame;
switch(frame->frame_format) { switch(frame->frame_format) {
case UVC_FRAME_FORMAT_MJPEG: case UVC_FRAME_FORMAT_MJPEG:
...@@ -58,7 +57,7 @@ void UVCCameraSession::presentFrame(const QVideoFrame &frame, const qreal t) ...@@ -58,7 +57,7 @@ void UVCCameraSession::presentFrame(const QVideoFrame &frame, const qreal t)
if (latency < MAX_LATENCY_MS) if (latency < MAX_LATENCY_MS)
m_surface->present( frame ); m_surface->present( frame );
else else
qDebug() << "Dropping frame (" << latency << "ms old)"; qDebug() << "Dropping frame (" << latency << "ms old )";
} }
bool UVCCameraSession::load() bool UVCCameraSession::load()
...@@ -90,10 +89,12 @@ bool UVCCameraSession::load() ...@@ -90,10 +89,12 @@ bool UVCCameraSession::load()
bool UVCCameraSession::unload() bool UVCCameraSession::unload()
{ {
QMutexLocker sessionLocker(&sessionMutex); QMutexLocker sessionLocker(&sessionMutex);
if (streaming) if (streaming)
stopPreview(); stopPreview();
uvc_close(devh); if (devh)
uvc_close(devh);
devh = NULL; devh = NULL;
m_supportedViewfinderSettings.clear(); m_supportedViewfinderSettings.clear();
...@@ -126,7 +127,7 @@ bool UVCCameraSession::startPreview() ...@@ -126,7 +127,7 @@ bool UVCCameraSession::startPreview()
return false; return false;
} }
res = uvc_stream_start(strmh, cb, (void*) this, 1.5f, 0); res = uvc_stream_start(strmh, cb, (void*) this, 2.0f, 0);
if (res != UVC_SUCCESS) { if (res != UVC_SUCCESS) {
qDebug() << "uvc_stream_start" << uvc_strerror(res); qDebug() << "uvc_stream_start" << uvc_strerror(res);
return false; return false;
......
...@@ -15,9 +15,9 @@ void UVCServicePlugin::release(QMediaService *service) ...@@ -15,9 +15,9 @@ void UVCServicePlugin::release(QMediaService *service)
QByteArray UVCServicePlugin::defaultDevice(const QByteArray &service) const QByteArray UVCServicePlugin::defaultDevice(const QByteArray &service) const
{ {
if (service == Q_MEDIASERVICE_CAMERA) { if (service == Q_MEDIASERVICE_CAMERA) {
// const QList<UVCVideoDeviceControl> &devs = UVCVideoDeviceControl::availableDevices(); const QList<UVCVideoDeviceInfo> &devs = UVCVideoDeviceControl::availableDevices();
// if (!devs.isEmpty()) if (!devs.isEmpty())
// return devs.first().first; return devs.first().first;
} }
return QByteArray(); return QByteArray();
...@@ -48,6 +48,15 @@ QString UVCServicePlugin::deviceDescription(const QByteArray &service, const QBy ...@@ -48,6 +48,15 @@ QString UVCServicePlugin::deviceDescription(const QByteArray &service, const QBy
return QString(); return QString();
} }
QMediaServiceProviderHint::Features UVCServicePlugin::supportedFeatures(
const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_MEDIAPLAYER)
return QMediaServiceProviderHint::StreamPlayback | QMediaServiceProviderHint::VideoSurface;
else
return QMediaServiceProviderHint::Features();
}
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(uvcengine, UVCServicePlugin) Q_EXPORT_PLUGIN2(uvcengine, UVCServicePlugin)
#endif // QT_VERSION < 0x050000 #endif // QT_VERSION < 0x050000
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
class UVCServicePlugin class UVCServicePlugin
: public QMediaServiceProviderPlugin : public QMediaServiceProviderPlugin
, public QMediaServiceSupportedDevicesInterface , public QMediaServiceSupportedDevicesInterface
//, public QMediaServiceDefaultDeviceInterface , public QMediaServiceDefaultDeviceInterface
//, public QMediaServiceFeaturesInterface , public QMediaServiceFeaturesInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface) Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
//Q_INTERFACES(QMediaServiceDefaultDeviceInterface) Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
//Q_INTERFACES(QMediaServiceFeaturesInterface) Q_INTERFACES(QMediaServiceFeaturesInterface)
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "uvcengine.json") Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "uvcengine.json")
...@@ -27,6 +27,8 @@ public: ...@@ -27,6 +27,8 @@ public:
QMediaService *create(const QString &key); QMediaService *create(const QString &key);
void release(QMediaService *service); void release(QMediaService *service);
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
QByteArray defaultDevice(const QByteArray &service) const; QByteArray defaultDevice(const QByteArray &service) const;
QList<QByteArray> devices(const QByteArray &service) const; QList<QByteArray> devices(const QByteArray &service) const;
QString deviceDescription(const QByteArray &service, const QByteArray &device); QString deviceDescription(const QByteArray &service, const QByteArray &device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment