PDA

View Full Version : A question about using Qt+phonon to develop media player



fox1987
8th April 2010, 02:39
I want to use phonon+qt to develop a media player; I write code just like the following:
The members are:
Phonon::MediaObject *m_MediaObject;
Phonon::VideoWidget *m_VideoWidget;
Phonon::AudioOutput *m_AudioOutput;
QTimer m_Timer;

and in the initial function,I init the variables:
m_MediaObject = new Phonon::MediaObject();
m_VideoWidget = new Phonon::VideoWidget();
Phonon::createPath(m_MediaObject, m_VideoWidget);
m_AudioOutput =new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(m_MediaObject, m_AudioOutput);
m_Timer.setInterval(5000);
connect(&m_Timer,SIGNAL(timeout()),this,SLOT(playNext()));
m_VideoWidget->show();

I define the playNext function
void playNext()
{
m_MediaObject->setCurrentSource(Phonon::MediaSource("1.avi"));
m_MediaObject->play();
}

The function of the program is to play a media for a fixed time ,
and then play next.But when I run this program ,
the memeory of the program is becomming bigger and bigger.
And the loading time of the Media is also getting longger and longger
(I use the signal statechanged to get the time between loading and stopped-----As the
Assistant said that when finished loading ,it will enter the stopped state).
I don't know why?