Reputation: 155
I’m trying to create simple video player with QML. I have QtSdk installed and QtMobility compiled and installed from source. Then I put this simple video playing code to main qml file:
import QtQuick 1.0
import QtMultimediaKit 1.1
Item{
width: 400; height: 300
Video {
id: video
source: "d:/Projects/Serenity - HD DVD Trailer.mp4"
anchors.fill: parent
MouseArea {
anchors.fill: parent
onClicked: {
video.play()
}
}
}
}
After compiling and running application, video plays choppy and on exiting application it puts this in log:
2011-06-07 11:13:44.055 video-player[323:903] *** __NSAutoreleaseNoPool(): Object 0x10225ea60 of class NSCFNumber autoreleased with no pool in place - just leaking
2011-06-07 11:13:45.007 video-player[323:903] *** __NSAutoreleaseNoPool(): Object 0x10264f030 of class __NSCFDate autoreleased with no pool in place - just leaking
2011-06-07 11:13:45.007 video-player[323:903] *** __NSAutoreleaseNoPool(): Object 0x11a409000 of class NSCFTimer autoreleased with no pool in place - just leaking
2011-06-07 11:13:45.008 video-player[323:903] *** __NSAutoreleaseNoPool(): Object 0x11a43e550 of class NSCFArray autoreleased with no pool in place - just leaking
2011-06-07 11:13:45.008 video-player[323:903] *** __NSAutoreleaseNoPool(): Object 0x11a462560 of class __NSFastEnumerationEnumerator autoreleased with no pool in place - just leaking
If any way to make it playing smoothly and to prevent memory?
Upvotes: 1
Views: 849
Reputation: 155
Solved. I`ve used OpenGL for that. Works even better than Windows not-GL version. Here a code:
QDeclarativeView mainwindow;
mainwindow.setSource(QUrl::fromLocalFile("./qml/app.qml"));
QGLFormat format = QGLFormat(QGL::DirectRendering); // you can play with other rendering formats like DoubleBuffer or SimpleBuffer
format.setSampleBuffers(false);
QGLWidget *glWidget = new QGLWidget(format);
glWidget->setAutoFillBackground(false);
mainwindow.setViewport(glWidget);
Note: Current QtMobility version (1.1) has a bug that do not allow playing video in OpenGL rendering mode on Windows. So i used a native Qt rendering for win.
Upvotes: 1