1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update qqt logic video manager

This commit is contained in:
tianduanrui 2020-04-02 13:03:13 +08:00
parent 0ffec43d63
commit a18ffcf2b5
7 changed files with 76 additions and 31 deletions

View File

@ -1,9 +1,9 @@
#include <qqtlogicvideomanager_p.h>
#include <qqtlogicvideomanager.h>
int QQtLogicVideoManagerPrivate::sDmmuRefCount = 0;
int QQtLogicVideoInputPrivate::sDmmuRefCount = 0;
QQtLogicVideoManagerPrivate::QQtLogicVideoManagerPrivate ( QQtLogicVideoManager* q, QObject* parent )
QQtLogicVideoInputPrivate::QQtLogicVideoInputPrivate ( QQtLogicVideoInput* q, QObject* parent )
: q_ptr ( q ), QObject ( parent )
{
memset ( &sinfo, 0, sizeof ( struct sensor_info ) );
@ -42,7 +42,7 @@ QQtLogicVideoManagerPrivate::QQtLogicVideoManagerPrivate ( QQtLogicVideoManager*
sDmmuRefCount++;
}
QQtLogicVideoManagerPrivate::~QQtLogicVideoManagerPrivate()
QQtLogicVideoInputPrivate::~QQtLogicVideoInputPrivate()
{
sDmmuRefCount--;
if ( sDmmuRefCount <= 0 )
@ -51,18 +51,18 @@ QQtLogicVideoManagerPrivate::~QQtLogicVideoManagerPrivate()
}
}
void QQtLogicVideoManagerPrivate::init_dmmu()
void QQtLogicVideoInputPrivate::init_dmmu()
{
dmmu_init();
dmmu_get_page_table_base_phys ( &tlb_base_phys );
}
void QQtLogicVideoManagerPrivate::deinit_dmmu()
void QQtLogicVideoInputPrivate::deinit_dmmu()
{
dmmu_deinit();
}
bool QQtLogicVideoManagerPrivate::open ( QString devName )
bool QQtLogicVideoInputPrivate::open ( QString devName )
{
//待测试
close();
@ -175,7 +175,7 @@ bool QQtLogicVideoManagerPrivate::open ( QString devName )
return true;
}
bool QQtLogicVideoManagerPrivate::close()
bool QQtLogicVideoInputPrivate::close()
{
timer->stop();
@ -210,7 +210,7 @@ bool QQtLogicVideoManagerPrivate::close()
return true;
}
void QQtLogicVideoManagerPrivate::slotSendImageToClient()
void QQtLogicVideoInputPrivate::slotSendImageToClient()
{
if ( fd <= 0 )
return;

View File

@ -23,14 +23,14 @@ extern "C" {
#include <qqtimageconverter.h>
class QQtLogicVideoManager;
class QQtLogicVideoManagerPrivate : public QObject
class QQtLogicVideoInput;
class QQtLogicVideoInputPrivate : public QObject
{
Q_OBJECT
public:
explicit QQtLogicVideoManagerPrivate ( QQtLogicVideoManager* q, QObject* parent = 0 );
virtual ~QQtLogicVideoManagerPrivate();
explicit QQtLogicVideoInputPrivate ( QQtLogicVideoInput* q, QObject* parent = 0 );
virtual ~QQtLogicVideoInputPrivate();
bool open ( QString devName );
bool close();
@ -70,8 +70,8 @@ private:
protected:
private:
Q_DECLARE_PUBLIC ( QQtLogicVideoManager )
QQtLogicVideoManager* q_ptr;
Q_DECLARE_PUBLIC ( QQtLogicVideoInput )
QQtLogicVideoInput* q_ptr;
static int sDmmuRefCount;
};

View File

@ -6,7 +6,7 @@ QQtLogicPreviewWidget::QQtLogicPreviewWidget ( QWidget* parent ) :
ui ( new Ui::QQtLogicPreviewWidget )
{
ui->setupUi ( this );
manager = new QQtLogicVideoManager ( this );
manager = new QQtLogicVideoInput ( this );
connect ( manager, SIGNAL ( readyRead ( const QImage& ) ),
this, SLOT ( slotReadyRead ( const QImage& ) ) );
}

View File

@ -41,7 +41,7 @@ private:
QRect geome;
Qt::WindowFlags flags;
QQtLogicVideoManager* manager;
QQtLogicVideoInput* manager;
QImage mImage;
// QWidget interface
protected:

View File

@ -1,25 +1,45 @@
#include "qqtlogicvideomanager.h"
#include "qqtlogicvideomanager_p.h"
QQtLogicVideoManager::QQtLogicVideoManager ( QObject* parent ) :
d_ptr ( new QQtLogicVideoManagerPrivate ( this, this ) ), QObject ( parent )
QQtLogicVideoInput::QQtLogicVideoInput ( QObject* parent ) :
d_ptr ( new QQtLogicVideoInputPrivate ( this, this ) ), QObject ( parent )
{
}
QQtLogicVideoManager::~QQtLogicVideoManager()
QQtLogicVideoInput::~QQtLogicVideoInput()
{
Q_D ( QQtLogicVideoManager );
Q_D ( QQtLogicVideoInput );
d->deleteLater();
}
bool QQtLogicVideoManager::open ( QString devName )
bool QQtLogicVideoInput::open ( QString devName )
{
Q_D ( QQtLogicVideoManager );
Q_D ( QQtLogicVideoInput );
return d->open ( devName );
}
bool QQtLogicVideoManager::close()
bool QQtLogicVideoInput::close()
{
Q_D ( QQtLogicVideoManager );
Q_D ( QQtLogicVideoInput );
return d->close();
}
QQtLogicVideoManager::QQtLogicVideoManager ( QObject* parent )
: QObject ( parent )
{
mInputManager = new QQtLogicVideoInput ( this );
connect ( mInputManager, SIGNAL ( readyRead ( const QImage& ) ),
this, SIGNAL ( readyRead ( const QImage& ) ) );
}
QQtLogicVideoManager::~QQtLogicVideoManager() {}
bool QQtLogicVideoManager::openInput ( QString devName )
{
return mInputManager->open ( devName );
}
bool QQtLogicVideoManager::closeInput()
{
return mInputManager->close();
}

View File

@ -6,17 +6,17 @@
#include "qqt-local.h"
/**
* @brief The QQtLogicVideoManager class
* @brief The QQtLogicVideoInput class
*
*/
class QQtLogicVideoManagerPrivate;
class QQTSHARED_EXPORT QQtLogicVideoManager : public QObject
class QQtLogicVideoInputPrivate;
class QQTSHARED_EXPORT QQtLogicVideoInput : public QObject
{
Q_OBJECT
public:
explicit QQtLogicVideoManager ( QObject* parent = 0 );
virtual ~QQtLogicVideoManager();
explicit QQtLogicVideoInput ( QObject* parent = 0 );
virtual ~QQtLogicVideoInput();
//开启某个确定的模拟摄像头
bool open ( QString devName = "/dev/cim" );
@ -29,8 +29,32 @@ signals:
protected:
private:
Q_DECLARE_PRIVATE ( QQtLogicVideoManager )
QQtLogicVideoManagerPrivate* d_ptr;
Q_DECLARE_PRIVATE ( QQtLogicVideoInput )
QQtLogicVideoInputPrivate* d_ptr;
};
/**
* @brief The QQtLogicVideoManager class
*/
class QQTSHARED_EXPORT QQtLogicVideoManager : public QObject
{
Q_OBJECT
public:
explicit QQtLogicVideoManager ( QObject* parent = 0 );
virtual ~QQtLogicVideoManager();
public:
//开启某个确定的模拟摄像头
bool openInput ( QString devName = "/dev/cim" );
bool closeInput();
signals:
//获取图像
void readyRead ( const QImage& image );
private:
QQtLogicVideoInput* mInputManager;
};
#endif // QQTLOGICVIDEOMANAGER_H

View File

@ -239,6 +239,7 @@ defineTest(add_defines_QQt){
#LOGIC CAMERA PREVIEW
#depend on dmmu
#need fix, linux embedded armhf32 mips
#DEFINES += __LOGICCAMERAMODULE__
contains(QSYS_PRIVATE, Embedded|Armhf32|Mips32):DEFINES += __LOGICCAMERAMODULE__
}