Hi all,

I am trying to embed a Movie player in the QWidget. Player is written in C++ and I am facing problems while controling the flow, here is the code i have written,

void MyFilmyWidget::start ()
{

// Start up the player
// Its better to pass the (w,h) to constructor we will use this size next,
myplayer = new NicePlayer(2,variable1,width(),height());

// Let's parse the headers
myplayer->parseheaders();

//Initializing the decoders
myplayer->initdecoders();

// handle the movie, now player will play the movie!!
myplayer->handleMovie();


}

Now if I call " emit myfilmywidget.start();" it works fine. But I don't know how to implement stop ? Because once myplayer->handleMovie() is called it plays the full movie and then controle comes back to the Qt. Do I have to use threads to solve this problem? I mean to say once I enter emit() I have to instantiate a QThread which envelopes all this code in the run() method some thing like this,

void MyFilmyWidget::start ()
{
thinThread= new MyThinThread;
thinThread.run();
}

class MyThinThread : public QThread
{
public:
void run();
};

void MyThinThread ::run()
{
//same code here!!
myplayer = new NicePlayer(2,variable1,width(),height());

}

and in the stop () method
void MyFilmyWidget::stop()
{
thinThread->/*sleep till resume is called*/

}
Is this right way??
Do you guys can suggest a way using which I can obtain finer controle over the player


Thanks in advance,
Boss