Skinney
9th September 2010, 21:47
Hi!
Currently im encoding a movie to another format, but at the same time i want to play it, so that you don't have to wait for encoding to finish before watching the movie. The way i thought to do it was to make Phonon play a QBuffer, and just update the QBuffer as more data presents itself.
This is the relevant code:
void MainWindow::playVideoPart(QByteArray *part)
{
if (videoWidget == 0)
setupVideoWidget();
if (inputBuffer == 0)
{
inputBuffer = new QBuffer(part);
inputBuffer->open(QBuffer::ReadWrite | QBuffer::Append);
}
else
{
inputBuffer->write(part->trimmed());
}
//if (mediaObject.state() != Phonon::PlayingState)
//{
mediaObject.enqueue(Phonon::MediaSource(inputBuffe r));
mediaObject.play();
//}
}
Unfortuanetly, this only plays the first part of the movie, and stops shortly afterwards... anyone got any idea of how i ca get this working?
Currently im encoding a movie to another format, but at the same time i want to play it, so that you don't have to wait for encoding to finish before watching the movie. The way i thought to do it was to make Phonon play a QBuffer, and just update the QBuffer as more data presents itself.
This is the relevant code:
void MainWindow::playVideoPart(QByteArray *part)
{
if (videoWidget == 0)
setupVideoWidget();
if (inputBuffer == 0)
{
inputBuffer = new QBuffer(part);
inputBuffer->open(QBuffer::ReadWrite | QBuffer::Append);
}
else
{
inputBuffer->write(part->trimmed());
}
//if (mediaObject.state() != Phonon::PlayingState)
//{
mediaObject.enqueue(Phonon::MediaSource(inputBuffe r));
mediaObject.play();
//}
}
Unfortuanetly, this only plays the first part of the movie, and stops shortly afterwards... anyone got any idea of how i ca get this working?