tuli
8th April 2015, 07:50
Hi!
I am trying to implement a zoom-able video playing, which is only possible by using QGraphicsVideoItem in a QGraphicssView, I have been told. This would be a basic example:
QGraphicsView * graphicsView = new QGraphicsView;
QMediaPlayer * player = new QMediaPlayer;
QGraphicsScene * scene = new QGraphicsScene;
graphicsView->setScene(scene);
QGraphicsVideoItem *item = new QGraphicsVideoItem;
player->setVideoOutput(item);
graphicsView->scene()->addItem(item);
graphicsView->show();
player->setMedia(QUrl::fromLocalFile("c:/x.mp4"));
player->play();
however, it chokes on a debug assert:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Error!
Program: C:\Qt5\5.4\msvc2013_64\bin\Qt5Cored.dll
Module: 5.4.1
File: global\qglobal.cpp
Line: 2868
ASSERT: "m_surface" in file player\mfvideorenderercontrol.cpp, line 2342
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
I looked into it, but I have no idea why the assert is fired.
Q_ASSERT(m_surface);
As far as i can tell, m_surface is non-NULL. :(
Anyways, the crash also occurs when I just create a QGraphicsVideoItem without adding it to anything.
QMediaPlayer * player = new QMediaPlayer;
QGraphicsVideoItem *item = new QGraphicsVideoItem;
player->setVideoOutput(item);
player->setMedia(QUrl::fromLocalFile("c:/x.mp4"));
player->play();
i can only guess that the crash is related to the QGraphicsVideoItem not offering a proper surface to render the video on? Where do I go wrong?
I am using Qt 5.4 + MSVC 2013 + Win7.
I am trying to implement a zoom-able video playing, which is only possible by using QGraphicsVideoItem in a QGraphicssView, I have been told. This would be a basic example:
QGraphicsView * graphicsView = new QGraphicsView;
QMediaPlayer * player = new QMediaPlayer;
QGraphicsScene * scene = new QGraphicsScene;
graphicsView->setScene(scene);
QGraphicsVideoItem *item = new QGraphicsVideoItem;
player->setVideoOutput(item);
graphicsView->scene()->addItem(item);
graphicsView->show();
player->setMedia(QUrl::fromLocalFile("c:/x.mp4"));
player->play();
however, it chokes on a debug assert:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Error!
Program: C:\Qt5\5.4\msvc2013_64\bin\Qt5Cored.dll
Module: 5.4.1
File: global\qglobal.cpp
Line: 2868
ASSERT: "m_surface" in file player\mfvideorenderercontrol.cpp, line 2342
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
I looked into it, but I have no idea why the assert is fired.
Q_ASSERT(m_surface);
As far as i can tell, m_surface is non-NULL. :(
Anyways, the crash also occurs when I just create a QGraphicsVideoItem without adding it to anything.
QMediaPlayer * player = new QMediaPlayer;
QGraphicsVideoItem *item = new QGraphicsVideoItem;
player->setVideoOutput(item);
player->setMedia(QUrl::fromLocalFile("c:/x.mp4"));
player->play();
i can only guess that the crash is related to the QGraphicsVideoItem not offering a proper surface to render the video on? Where do I go wrong?
I am using Qt 5.4 + MSVC 2013 + Win7.