1

QML でシンプルなビデオ プレーヤーを作成しようとしています。QtSdk をインストールし、QtMobility をコンパイルしてソースからインストールしました。次に、この簡単なビデオ再生コードをメインの qml ファイルに追加します。

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()
            }
        }
    }
}

アプリケーションをコンパイルして実行した後、ビデオが途切れ途切れになり、アプリケーションを終了すると、これがログに記録されます。

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

スムーズに再生してメモリを防ぐ方法はありますか?

4

1 に答える 1

1

解決しました。そのためにOpenGLを使用しました。Windows の非 GL バージョンよりもさらに優れた動作をします。ここにコード:

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);

注: 現在の QtMobility バージョン (1.1) には、Windows で OpenGL レンダリング モードでビデオを再生できないというバグがあります。だから私は勝つためにネイティブのQtレンダリングを使用しました。

于 2011-06-22T08:05:28.770 に答える