Blame view

camerasurface.cpp 697 Bytes
0dd519e8   Caio Lucena   starting
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #include "camerasurface.h"
  
  QList<QVideoFrame::PixelFormat> CameraSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
  {
      return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32;
  }
  
  bool CameraSurface::present(const QVideoFrame &frame)
  {
      if (frame.isValid()) {
          QVideoFrame cloneFrame(frame);
                      cloneFrame.map(QAbstractVideoBuffer::ReadOnly);
  
          QByteArray ba;
                     ba.append( (char*)cloneFrame.bits(), cloneFrame.bytesPerLine() * cloneFrame.height() );
  
          emit novoFrame( ba, cloneFrame.width(), cloneFrame.height() );
  
          cloneFrame.unmap();
          return true;
      }
      return false;
  }