| 26 | } |
| 27 | |
| 28 | void CRecordVideoThread::run() |
| 29 | { |
| 30 | bool check = false; |
| 31 | qDebug(logThread) << "Record video thread start ..."; |
| 32 | CRecordVideo record; |
| 33 | int nRet = record.Start(m_szFile); |
| 34 | if(nRet) { |
| 35 | qCritical(logThread) << "Start record fail:" << nRet; |
| 36 | emit sigStatusChanged(CFrmViewer::RecordVideoStatus::Error); |
| 37 | return; |
| 38 | } |
| 39 | check = connect(&record, SIGNAL(sigStatusChanged(CFrmViewer::RecordVideoStatus)), |
| 40 | this, SIGNAL(sigStatusChanged(CFrmViewer::RecordVideoStatus))); |
| 41 | Q_ASSERT(check); |
| 42 | check = connect(this, SIGNAL(sigUpdate(QImage)), |
| 43 | &record, SLOT(slotUpdate(QImage))); |
| 44 | Q_ASSERT(check); |
| 45 | check = connect(&record, SIGNAL(sigError(int,QString)), |
| 46 | this, SIGNAL(sigError(int,QString))); |
| 47 | Q_ASSERT(check); |
| 48 | emit sigStatusChanged(CFrmViewer::RecordVideoStatus::Recording); |
| 49 | |
| 50 | exec(); |
| 51 | |
| 52 | nRet = record.Stop(); |
| 53 | if(nRet) { |
| 54 | qCritical(logThread) << "Stop record fail:" << nRet; |
| 55 | emit sigStatusChanged(CFrmViewer::RecordVideoStatus::Error); |
| 56 | } |
| 57 | else |
| 58 | emit sigStatusChanged(CFrmViewer::RecordVideoStatus::Stop); |
| 59 | qDebug(logThread) << "Record video thread end"; |
| 60 | } |
| 61 | |
| 62 | CRecordVideo::CRecordVideo(QObject *parent) |
| 63 | : QObject{parent} |