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

Small adjustments

parent 86a71ed7
......@@ -57,7 +57,6 @@ UVCCameraService::UVCCameraService(QObject *parent):
m_control = new UVCCameraControl(m_session);
m_videoDevice = new UVCVideoDeviceControl(m_session);
m_viewfinderSettings = new UVCCameraViewfinderSettingsControl(m_session);
// m_imageProcessingControl = new DSCameraImageProcessingControl(m_session);
}
UVCCameraService::~UVCCameraService()
......@@ -66,7 +65,6 @@ UVCCameraService::~UVCCameraService()
delete m_viewfinderSettings;
delete m_videoDevice;
delete m_videoRenderer;
// delete m_imageCapture;
delete m_session;
}
......
......@@ -11,7 +11,7 @@ UVCCameraSession::UVCCameraSession(QObject *parent)
UVCCameraSession::~UVCCameraSession()
{
unload();
}
void UVCCameraSession::setDevice(uvc_device_t *device)
......@@ -33,7 +33,6 @@ void UVCCameraSession::callback(uvc_frame_t *frame)
return;
if (m_surface) {
QVideoFrame qFrame;
switch(frame->frame_format) {
case UVC_FRAME_FORMAT_MJPEG:
......@@ -58,7 +57,7 @@ void UVCCameraSession::presentFrame(const QVideoFrame &frame, const qreal t)
if (latency < MAX_LATENCY_MS)
m_surface->present( frame );
else
qDebug() << "Dropping frame (" << latency << "ms old)";
qDebug() << "Dropping frame (" << latency << "ms old )";
}
bool UVCCameraSession::load()
......@@ -90,9 +89,11 @@ bool UVCCameraSession::load()
bool UVCCameraSession::unload()
{
QMutexLocker sessionLocker(&sessionMutex);
if (streaming)
stopPreview();
if (devh)
uvc_close(devh);
devh = NULL;
......@@ -126,7 +127,7 @@ bool UVCCameraSession::startPreview()
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) {
qDebug() << "uvc_stream_start" << uvc_strerror(res);
return false;
......
......@@ -15,9 +15,9 @@ void UVCServicePlugin::release(QMediaService *service)
QByteArray UVCServicePlugin::defaultDevice(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
// const QList<UVCVideoDeviceControl> &devs = UVCVideoDeviceControl::availableDevices();
// if (!devs.isEmpty())
// return devs.first().first;
const QList<UVCVideoDeviceInfo> &devs = UVCVideoDeviceControl::availableDevices();
if (!devs.isEmpty())
return devs.first().first;
}
return QByteArray();
......@@ -48,6 +48,15 @@ QString UVCServicePlugin::deviceDescription(const QByteArray &service, const QBy
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
Q_EXPORT_PLUGIN2(uvcengine, UVCServicePlugin)
#endif // QT_VERSION < 0x050000
......@@ -11,13 +11,13 @@
class UVCServicePlugin
: public QMediaServiceProviderPlugin
, public QMediaServiceSupportedDevicesInterface
//, public QMediaServiceDefaultDeviceInterface
//, public QMediaServiceFeaturesInterface
, public QMediaServiceDefaultDeviceInterface
, public QMediaServiceFeaturesInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
//Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
//Q_INTERFACES(QMediaServiceFeaturesInterface)
Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
Q_INTERFACES(QMediaServiceFeaturesInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "uvcengine.json")
......@@ -27,6 +27,8 @@ public:
QMediaService *create(const QString &key);
void release(QMediaService *service);
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
QByteArray defaultDevice(const QByteArray &service) const;
QList<QByteArray> devices(const QByteArray &service) const;
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