I moved to Qt 4.6.2 and tried to run my application. But I still couldn't succeed. Here I am copying my code. Could any one please check If it is running on your system.
#include <QMainWindow>
#include <phonon/VideoPlayer>
#include <phonon/VideoWidget>
#include <phonon/backendcapabilities.h>
#include <QUrl>
#include <phonon>
namespace Ui {
class MainWindow;
}
Q_OBJECT
public:
~MainWindow();
protected:
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
//.CPP file
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug() << Phonon::BackendCapabilities::availableAudioOutputDevices();
Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
Phonon::createPath(mediaObject, videoWidget);
Phonon::AudioOutput *audioOutput =
new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(mediaObject, audioOutput);
mediaObject
->setCurrentSource
(QUrl("file.mkv or .avi"));
connect(mediaObject, SIGNAL(finished()), mediaObject, SLOT(deleteLater()));
mediaObject->play();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow
::changeEvent(QEvent *e
) {
switch (e->type()) {
ui->retranslateUi(this);
break;
default:
break;
}
}
//.pro file
#-------------------------------------------------
#
# Project created by QtCreator 2010-10-10T23:15:17
#
#-------------------------------------------------
QT += opengl phonon multimedia
TARGET = video
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
wince*{
DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout
}
#include <QMainWindow>
#include <phonon/VideoPlayer>
#include <phonon/VideoWidget>
#include <phonon/backendcapabilities.h>
#include <QUrl>
#include <phonon>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
//.CPP file
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug() << Phonon::BackendCapabilities::availableAudioOutputDevices();
Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
Phonon::createPath(mediaObject, videoWidget);
Phonon::AudioOutput *audioOutput =
new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(mediaObject, audioOutput);
mediaObject->setCurrentSource(QUrl("file.mkv or .avi"));
connect(mediaObject, SIGNAL(finished()), mediaObject, SLOT(deleteLater()));
mediaObject->play();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
//.pro file
#-------------------------------------------------
#
# Project created by QtCreator 2010-10-10T23:15:17
#
#-------------------------------------------------
QT += opengl phonon multimedia
TARGET = video
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
wince*{
DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout
}
To copy to clipboard, switch view to plain text mode
Thank You,
baluk
Bookmarks