mirror of
https://github.com/status-im/qzxing.git
synced 2025-02-17 21:37:43 +00:00
fix of VideoSink use for Android: map/unmap every frame. @kiibimees #199
This commit is contained in:
parent
c48a7a9006
commit
1f819ed0f0
@ -44,10 +44,6 @@ void QZXingFilter::setVideoSink(QObject *videoSink){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QZXingFilter::processFrame(const QVideoFrame &frame) {
|
void QZXingFilter::processFrame(const QVideoFrame &frame) {
|
||||||
if(isDecoding() || !processThread.isFinished()) return;
|
|
||||||
|
|
||||||
decoding = true;
|
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
m_videoSink->setRhi(nullptr); // https://bugreports.qt.io/browse/QTBUG-97789
|
m_videoSink->setRhi(nullptr); // https://bugreports.qt.io/browse/QTBUG-97789
|
||||||
QVideoFrame f(frame);
|
QVideoFrame f(frame);
|
||||||
@ -56,15 +52,17 @@ void QZXingFilter::processFrame(const QVideoFrame &frame) {
|
|||||||
const QVideoFrame &f = frame;
|
const QVideoFrame &f = frame;
|
||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
|
|
||||||
|
if(isDecoding() || !processThread.isFinished()) return;
|
||||||
|
|
||||||
|
decoding = true;
|
||||||
|
|
||||||
QImage image = f.toImage();
|
QImage image = f.toImage();
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
f.unmap();
|
f.unmap();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_ANDROID
|
|
||||||
processThread = QtConcurrent::run([=](){
|
processThread = QtConcurrent::run([=](){
|
||||||
#endif
|
|
||||||
if(image.isNull())
|
if(image.isNull())
|
||||||
{
|
{
|
||||||
qDebug() << "QZXingFilter error: Cant create image file to process.";
|
qDebug() << "QZXingFilter error: Cant create image file to process.";
|
||||||
@ -86,8 +84,5 @@ void QZXingFilter::processFrame(const QVideoFrame &frame) {
|
|||||||
// qDebug() << "saving image" << i << "at:" << path << frameToProcess.save(path);
|
// qDebug() << "saving image" << i << "at:" << path << frameToProcess.save(path);
|
||||||
|
|
||||||
decoder.decodeImage(frameToProcess, frameToProcess.width(), frameToProcess.height());
|
decoder.decodeImage(frameToProcess, frameToProcess.width(), frameToProcess.height());
|
||||||
#ifndef Q_OS_ANDROID
|
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user