examples/multimedia/videographicsitem/videoitem.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   102 }
   102 }
   103 
   103 
   104 bool VideoItem::start(const QVideoSurfaceFormat &format)
   104 bool VideoItem::start(const QVideoSurfaceFormat &format)
   105 {
   105 {
   106     if (isFormatSupported(format)) {
   106     if (isFormatSupported(format)) {
   107         imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
   107         imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
   108         imageSize = format.frameSize();
   108         imageSize = format.frameSize();
   109         framePainted = true;
   109         framePainted = true;
   110 
   110 
   111         QAbstractVideoSurface::start(format);
   111         QAbstractVideoSurface::start(format);
   112 
   112 
   127 }
   127 }
   128 
   128 
   129 bool VideoItem::present(const QVideoFrame &frame)
   129 bool VideoItem::present(const QVideoFrame &frame)
   130 {
   130 {
   131     if (!framePainted) {
   131     if (!framePainted) {
   132         if (!isStarted())
   132         if (!QAbstractVideoSurface::isActive())
   133             setError(StoppedError);
   133             setError(StoppedError);
   134 
   134 
   135         return false;
   135         return false;
   136     } else {
   136     } else {
   137         currentFrame = frame;
   137         currentFrame = frame;